2021-04-17 00:25:51 -07:00
|
|
|
import {
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const itemOperations: INodeProperties[] = [
|
2021-04-17 00:25:51 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
default: 'get',
|
|
|
|
description: 'Operation to perform',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2021-04-17 00:25:51 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const itemFields: INodeProperties[] = [
|
2021-04-17 00:25:51 -07:00
|
|
|
// ----------------------------------
|
|
|
|
// item: create
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Site ID',
|
|
|
|
name: 'siteId',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getSites',
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the site containing the collection whose items to add to',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Collection ID',
|
|
|
|
name: 'collectionId',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getCollections',
|
|
|
|
loadOptionsDependsOn: [
|
|
|
|
'siteId',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the collection to add an item to',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Live',
|
|
|
|
name: 'live',
|
|
|
|
type: 'boolean',
|
|
|
|
required: true,
|
|
|
|
default: false,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Whether the item should be published on the live site',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Fields',
|
|
|
|
name: 'fieldsUi',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Field',
|
|
|
|
name: 'fieldValues',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Field ID',
|
|
|
|
name: 'fieldId',
|
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getFields',
|
|
|
|
loadOptionsDependsOn: [
|
|
|
|
'collectionId',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Field to set for the item to create',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Field Value',
|
|
|
|
name: 'fieldValue',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Value to set for the item to create',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// item: get
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Site ID',
|
|
|
|
name: 'siteId',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getSites',
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'delete',
|
|
|
|
'get',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the site containing the collection whose items to operate on',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Collection ID',
|
|
|
|
name: 'collectionId',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getCollections',
|
|
|
|
loadOptionsDependsOn: [
|
|
|
|
'siteId',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'delete',
|
|
|
|
'get',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the collection whose items to operate on',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Item ID',
|
|
|
|
name: 'itemId',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'delete',
|
|
|
|
'get',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the item to operate on',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
// ----------------------------------
|
|
|
|
// item: update
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Site ID',
|
|
|
|
name: 'siteId',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getSites',
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the site containing the collection whose items to update',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Collection ID',
|
|
|
|
name: 'collectionId',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getCollections',
|
|
|
|
loadOptionsDependsOn: [
|
|
|
|
'siteId',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the collection whose items to update',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Item ID',
|
|
|
|
name: 'itemId',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the item to update',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Live',
|
|
|
|
name: 'live',
|
|
|
|
type: 'boolean',
|
|
|
|
required: true,
|
|
|
|
default: false,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Whether the item should be published on the live site',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Fields',
|
|
|
|
name: 'fieldsUi',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Field',
|
|
|
|
name: 'fieldValues',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Field ID',
|
|
|
|
name: 'fieldId',
|
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getFields',
|
|
|
|
loadOptionsDependsOn: [
|
|
|
|
'collectionId',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Field to set for the item to update',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Field Value',
|
|
|
|
name: 'fieldValue',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Value to set for the item to update',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// ----------------------------------
|
|
|
|
// item:getAll
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Site ID',
|
|
|
|
name: 'siteId',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getSites',
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the site containing the collection whose items to retrieve',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Collection ID',
|
|
|
|
name: 'collectionId',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getCollections',
|
|
|
|
loadOptionsDependsOn: [
|
|
|
|
'siteId',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the collection whose items to retrieve',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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-17 00:25:51 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'item',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
returnAll: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 100,
|
|
|
|
},
|
|
|
|
default: 100,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Max number of results to return',
|
2021-04-17 00:25:51 -07:00
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|