2021-04-03 02:07:21 -07:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
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 : {
resource : [
'document' ,
] ,
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
2022-05-06 14:01:25 -07:00
description : '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' ,
2021-04-03 02:07:21 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
2022-05-06 14:01:25 -07:00
description : 'Retrieve a document' ,
2021-04-03 02:07:21 -07:00
} ,
{
name : 'Get All' ,
value : 'getAll' ,
2022-05-06 14:01:25 -07:00
description : 'Retrieve all 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' ,
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-06-03 10:23:49 -07:00
description : 'DocType whose documents to retrieve. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2021-04-03 02:07:21 -07:00
placeholder : 'Customer' ,
displayOptions : {
show : {
resource : [
'document' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
} ,
{
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 : {
resource : [
'document' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
} ,
{
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 : {
resource : [
'document' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'document' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
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' ,
loadOptionsDependsOn : [
'docType' ,
] ,
} ,
2022-04-22 09:29:51 -07:00
default : [ ] ,
2022-06-20 07:54:01 -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/nodes/expressions.html#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-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2021-04-03 02:07:21 -07:00
typeOptions : {
loadOptionsMethod : 'getDocFields' ,
loadOptionsDependsOn : [
'docType' ,
] ,
} ,
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-06-03 10:23:49 -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/nodes/expressions.html#expressions">expression</a>.' ,
2021-04-03 02:07:21 -07:00
placeholder : 'Customer' ,
displayOptions : {
show : {
resource : [
'document' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
} ,
{
displayName : 'Properties' ,
name : 'properties' ,
type : 'fixedCollection' ,
placeholder : 'Add Property' ,
required : true ,
default : { } ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
resource : [
'document' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
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-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2021-04-03 02:07:21 -07:00
typeOptions : {
loadOptionsMethod : 'getDocFields' ,
loadOptionsDependsOn : [
'docType' ,
] ,
} ,
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-06-03 10:23:49 -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/nodes/expressions.html#expressions">expression</a>.' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
resource : [
'document' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
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 : {
resource : [
'document' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
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-06-03 10:23:49 -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/nodes/expressions.html#expressions">expression</a>.' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
resource : [
'document' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
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 : {
resource : [
'document' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
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-06-03 10:23:49 -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/nodes/expressions.html#expressions">expression</a>.' ,
2021-04-03 02:07:21 -07:00
displayOptions : {
show : {
resource : [
'document' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
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 : {
resource : [
'document' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
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 : {
resource : [
'document' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
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-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2021-04-03 02:07:21 -07:00
typeOptions : {
loadOptionsMethod : 'getDocFields' ,
loadOptionsDependsOn : [
'docType' ,
] ,
} ,
default : '' ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;