2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2021-04-03 02:07:21 -07:00
2021-12-03 00:44:16 -08:00
export const documentOperations : INodeProperties [ ] = [
2021-04-03 02:07:21 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
2022-05-06 14:01:25 -07:00
description : 'Create a document' ,
2022-07-10 13:50:51 -07:00
action : 'Create a document' ,
2021-04-03 02:07:21 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
2022-05-06 14:01:25 -07:00
description : 'Delete a document' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a document' ,
2021-04-03 02:07:21 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
2022-05-06 14:01:25 -07:00
description : 'Retrieve a document' ,
2022-07-10 13:50:51 -07:00
action : 'Get a document' ,
2021-04-03 02:07:21 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-04-03 02:07:21 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Retrieve many documents' ,
2022-09-08 08:10:13 -07:00
action : 'Get many documents' ,
2021-04-03 02:07:21 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
2022-05-06 14:01:25 -07:00
description : 'Update a document' ,
2022-07-10 13:50:51 -07:00
action : 'Update a document' ,
2021-04-03 02:07:21 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2021-04-03 02:07:21 -07:00
2021-12-03 00:44:16 -08:00
export const documentFields : INodeProperties [ ] = [
2021-04-03 02:07:21 -07:00
// ----------------------------------
// document: getAll
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'DocType Name or ID' ,
2021-04-03 02:07:21 -07:00
name : 'docType' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getDocTypes' ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'DocType whose documents to retrieve. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-03 02:07:21 -07:00
placeholder : 'Customer' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'getAll' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'getAll' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
2022-05-20 14:47:24 -07:00
typeOptions : {
minValue : 1 ,
} ,
2021-04-03 02:07:21 -07:00
default : 10 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'getAll' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
options : [
{
2022-06-20 07:54:01 -07:00
displayName : 'Field Names or IDs' ,
2021-04-03 02:07:21 -07:00
name : 'fields' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getDocFilters' ,
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'docType' ] ,
2021-04-03 02:07:21 -07:00
} ,
2022-04-22 09:29:51 -07:00
default : [ ] ,
2022-08-01 13:47:55 -07:00
description :
'Comma-separated list of fields to return. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-03 02:07:21 -07:00
placeholder : 'name,country' ,
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'fixedCollection' ,
2021-12-03 00:44:16 -08:00
default : { } ,
2021-04-03 02:07:21 -07:00
placeholder : 'Add Filter' ,
description : 'Custom Properties' ,
typeOptions : {
multipleValues : true ,
} ,
options : [
{
displayName : 'Property' ,
name : 'customProperty' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2021-04-03 02:07:21 -07:00
name : 'field' ,
type : 'options' ,
2022-08-01 13:47:55 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-04-03 02:07:21 -07:00
typeOptions : {
loadOptionsMethod : 'getDocFields' ,
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'docType' ] ,
2021-04-03 02:07:21 -07:00
} ,
default : '' ,
} ,
{
displayName : 'Operator' ,
name : 'operator' ,
type : 'options' ,
default : 'is' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'EQUALS, or GREATER' ,
value : 'equalsGreater' ,
2021-04-03 02:07:21 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
name : 'EQUALS, or LESS' ,
value : 'equalsLess' ,
} ,
{
name : 'IS' ,
value : 'is' ,
2021-04-03 02:07:21 -07:00
} ,
{
name : 'IS GREATER' ,
value : 'greater' ,
} ,
{
name : 'IS LESS' ,
value : 'less' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'IS NOT' ,
value : 'isNot' ,
2021-04-03 02:07:21 -07:00
} ,
] ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the operator condition' ,
2021-04-03 02:07:21 -07:00
} ,
] ,
} ,
] ,
} ,
] ,
} ,
// ----------------------------------
// document: create
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'DocType Name or ID' ,
2021-04-03 02:07:21 -07:00
name : 'docType' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDocTypes' ,
} ,
required : true ,
2022-08-01 13:47:55 -07:00
description :
'DocType you would like to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-03 02:07:21 -07:00
placeholder : 'Customer' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'create' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
} ,
{
displayName : 'Properties' ,
name : 'properties' ,
type : 'fixedCollection' ,
placeholder : 'Add Property' ,
required : true ,
default : { } ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'create' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
options : [
{
displayName : 'Property' ,
name : 'customProperty' ,
placeholder : 'Add Property' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2021-04-03 02:07:21 -07:00
name : 'field' ,
type : 'options' ,
2022-08-01 13:47:55 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-04-03 02:07:21 -07:00
typeOptions : {
loadOptionsMethod : 'getDocFields' ,
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'docType' ] ,
2021-04-03 02:07:21 -07:00
} ,
default : [ ] ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
// ----------------------------------
// document: get
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'DocType Name or ID' ,
2021-04-03 02:07:21 -07:00
name : 'docType' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getDocTypes' ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'The type of document you would like to get. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'get' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
required : true ,
} ,
{
displayName : 'Document Name' ,
name : 'documentName' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The name (ID) of document you would like to get' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'get' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
required : true ,
} ,
// ----------------------------------
// document: delete
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'DocType Name or ID' ,
2021-04-03 02:07:21 -07:00
name : 'docType' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getDocTypes' ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'The type of document you would like to delete. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'delete' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
required : true ,
} ,
{
displayName : 'Document Name' ,
name : 'documentName' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The name (ID) of document you would like to get' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'delete' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
required : true ,
} ,
// ----------------------------------
// document: update
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'DocType Name or ID' ,
2021-04-03 02:07:21 -07:00
name : 'docType' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getDocTypes' ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'The type of document you would like to update. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'update' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
required : true ,
} ,
{
displayName : 'Document Name' ,
name : 'documentName' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The name (ID) of document you would like to get' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'update' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
required : true ,
} ,
{
displayName : 'Properties' ,
name : 'properties' ,
type : 'fixedCollection' ,
placeholder : 'Add Property' ,
2022-05-06 14:01:25 -07:00
description : 'Properties of request body' ,
2021-04-03 02:07:21 -07:00
default : { } ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'document' ] ,
operation : [ 'update' ] ,
2021-04-03 02:07:21 -07:00
} ,
} ,
options : [
{
displayName : 'Property' ,
name : 'customProperty' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2021-04-03 02:07:21 -07:00
name : 'field' ,
type : 'options' ,
2022-08-01 13:47:55 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-04-03 02:07:21 -07:00
typeOptions : {
loadOptionsMethod : 'getDocFields' ,
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'docType' ] ,
2021-04-03 02:07:21 -07:00
} ,
default : '' ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;