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: [
|
|
|
|
'collections',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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: [
|
|
|
|
'collections',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
required: true,
|
|
|
|
description: 'Name of the collection to operate on.'
|
|
|
|
},
|
|
|
|
|
|
|
|
// Collections: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: [
|
|
|
|
'collections',
|
|
|
|
],
|
|
|
|
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-05 06:49:47 -07:00
|
|
|
// Collections:entry:getAll
|
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: [
|
|
|
|
'collections',
|
|
|
|
],
|
|
|
|
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
|
|
|
},
|
|
|
|
{
|
2020-04-05 06:49:47 -07:00
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
2020-04-04 07:04:25 -07:00
|
|
|
type: 'number',
|
|
|
|
default: '',
|
2020-04-05 06:49:47 -07:00
|
|
|
description: 'Limit number of returned entries.',
|
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
|
|
|
{
|
|
|
|
displayName: 'Simple',
|
|
|
|
name: 'simple',
|
|
|
|
type: 'boolean',
|
|
|
|
required: true,
|
|
|
|
default: true,
|
|
|
|
description: 'Return only result entries.',
|
|
|
|
},
|
|
|
|
{
|
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
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// Collections:entry:update
|
|
|
|
{
|
|
|
|
displayName: 'Entry ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'collections',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
description: 'The entry ID.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Data',
|
|
|
|
name: 'data',
|
|
|
|
type: 'json',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'collections',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
description: 'The data to update.',
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|