2020-04-04 07:04:25 -07:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
|
|
|
|
|
|
|
export const collectionOperations = [
|
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'collection',
|
2020-04-04 07:04:25 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create an entry',
|
2020-04-05 06:49:47 -07:00
|
|
|
value: 'create',
|
2020-04-04 07:04:25 -07:00
|
|
|
description: 'Create a collection entry',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get all entries',
|
2020-04-05 06:49:47 -07:00
|
|
|
value: 'getAll',
|
2020-04-04 07:04:25 -07:00
|
|
|
description: 'Get all collection entries',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update an entry',
|
|
|
|
value: 'update',
|
|
|
|
description: 'Update a collection entries',
|
|
|
|
},
|
|
|
|
],
|
2020-04-05 06:49:47 -07:00
|
|
|
default: 'getAll',
|
2020-04-04 07:04:25 -07:00
|
|
|
description: 'The operation to perform.',
|
2020-04-05 06:49:47 -07:00
|
|
|
},
|
2020-04-04 07:04:25 -07:00
|
|
|
] as INodeProperties[];
|
|
|
|
|
|
|
|
export const collectionFields = [
|
2020-04-05 06:49:47 -07:00
|
|
|
{
|
|
|
|
displayName: 'Collection',
|
|
|
|
name: 'collection',
|
|
|
|
type: 'options',
|
|
|
|
default: '',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getCollections',
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'collection',
|
2020-04-05 06:49:47 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
required: true,
|
|
|
|
description: 'Name of the collection to operate on.'
|
|
|
|
},
|
|
|
|
|
2020-04-06 01:03:49 -07:00
|
|
|
// Collection:entry:create
|
2020-04-04 07:04:25 -07:00
|
|
|
{
|
|
|
|
displayName: 'Data',
|
|
|
|
name: 'data',
|
|
|
|
type: 'json',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'collection',
|
2020-04-04 07:04:25 -07:00
|
|
|
],
|
|
|
|
operation: [
|
2020-04-05 06:49:47 -07:00
|
|
|
'create',
|
2020-04-04 07:04:25 -07:00
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
2020-04-05 06:49:47 -07:00
|
|
|
description: 'The data to create.',
|
2020-04-04 07:04:25 -07:00
|
|
|
},
|
|
|
|
|
2020-04-06 01:03:49 -07:00
|
|
|
// Collection:entry:getAll
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
'collection',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: false,
|
|
|
|
description: 'If all results should be returned or only up to a given limit.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
'collection',
|
|
|
|
],
|
|
|
|
returnAll: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 500,
|
|
|
|
},
|
|
|
|
default: 100,
|
|
|
|
description: 'How many results to return.',
|
|
|
|
},
|
2020-04-04 07:04:25 -07:00
|
|
|
{
|
2020-04-05 06:49:47 -07:00
|
|
|
displayName: 'Options',
|
|
|
|
name: 'options',
|
2020-04-04 07:04:25 -07:00
|
|
|
type: 'collection',
|
2020-04-05 06:49:47 -07:00
|
|
|
placeholder: 'Add Option',
|
2020-04-04 07:04:25 -07:00
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'collection',
|
2020-04-04 07:04:25 -07:00
|
|
|
],
|
|
|
|
operation: [
|
2020-04-05 06:49:47 -07:00
|
|
|
'getAll',
|
2020-04-04 07:04:25 -07:00
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Fields',
|
|
|
|
name: 'fields',
|
|
|
|
type: 'json',
|
|
|
|
default: '',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
description: 'Fields to get.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Filter',
|
|
|
|
name: 'filter',
|
|
|
|
type: 'json',
|
|
|
|
default: '',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
description: 'Filter result by fields.',
|
|
|
|
},
|
|
|
|
{
|
2020-04-05 06:49:47 -07:00
|
|
|
displayName: 'Language',
|
|
|
|
name: 'language',
|
|
|
|
type: 'string',
|
2020-04-04 07:04:25 -07:00
|
|
|
default: '',
|
2020-04-05 06:49:47 -07:00
|
|
|
description: 'Return normalized language fields.',
|
2020-04-04 07:04:25 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Populate',
|
|
|
|
name: 'populate',
|
|
|
|
type: 'boolean',
|
|
|
|
required: true,
|
|
|
|
default: true,
|
|
|
|
description: 'Resolve linked collection items.',
|
|
|
|
},
|
2020-04-05 06:49:47 -07:00
|
|
|
{
|
|
|
|
displayName: 'RAW Data',
|
|
|
|
name: 'rawData',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: `Returns the data exactly in the way it got received from the API.`,
|
|
|
|
},
|
2020-04-04 07:04:25 -07:00
|
|
|
{
|
2020-04-05 06:49:47 -07:00
|
|
|
displayName: 'Skip',
|
|
|
|
name: 'skip',
|
|
|
|
type: 'number',
|
2020-04-04 07:04:25 -07:00
|
|
|
default: '',
|
2020-04-05 06:49:47 -07:00
|
|
|
description: 'Skip number of entries.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Sort',
|
|
|
|
name: 'sort',
|
|
|
|
type: 'json',
|
|
|
|
default: '',
|
|
|
|
description: 'Sort result by fields.',
|
2020-04-04 07:04:25 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
2020-04-06 01:03:49 -07:00
|
|
|
// Collection:entry:update
|
2020-04-04 07:04:25 -07:00
|
|
|
{
|
|
|
|
displayName: 'Entry ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'collection',
|
2020-04-04 07:04:25 -07:00
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
description: 'The entry ID.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Data',
|
|
|
|
name: 'data',
|
|
|
|
type: 'json',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-04-06 01:03:49 -07:00
|
|
|
'collection',
|
2020-04-04 07:04:25 -07:00
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
description: 'The data to update.',
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|