2020-09-02 03:25:11 -07:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
|
|
|
|
|
|
|
export const customerOperations = [
|
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'customer',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
2020-09-02 03:32:12 -07:00
|
|
|
name: 'Create/Update',
|
|
|
|
value: 'upsert',
|
|
|
|
description: 'Create/Update a customer.',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
description: 'Delete a customer.',
|
|
|
|
},
|
|
|
|
],
|
2020-09-02 03:32:12 -07:00
|
|
|
default: 'upsert',
|
2020-09-02 03:25:11 -07:00
|
|
|
description: 'The operation to perform.',
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|
|
|
|
|
|
|
|
export const customerFields = [
|
|
|
|
|
2020-09-02 03:32:12 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* customer:delete */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-09-02 03:25:11 -07:00
|
|
|
{
|
|
|
|
displayName: 'ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
2020-09-02 03:32:12 -07:00
|
|
|
required: true,
|
2020-09-02 03:25:11 -07:00
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'customer',
|
|
|
|
],
|
|
|
|
operation: [
|
2020-09-02 03:32:12 -07:00
|
|
|
'delete',
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
},
|
2020-09-02 03:32:12 -07:00
|
|
|
description: 'The unique identifier for the customer.',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
|
2020-09-02 03:32:12 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* customer:upsert */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-09-02 03:25:11 -07:00
|
|
|
{
|
|
|
|
displayName: 'ID',
|
|
|
|
name: 'id',
|
2020-09-02 03:32:12 -07:00
|
|
|
type: 'string',
|
2020-09-02 03:25:11 -07:00
|
|
|
required: true,
|
2020-09-02 03:32:12 -07:00
|
|
|
default: '',
|
2020-09-02 03:25:11 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'customer',
|
|
|
|
],
|
|
|
|
operation: [
|
2020-09-02 03:32:12 -07:00
|
|
|
'upsert',
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
description: 'The unique identifier for the customer.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'JSON Parameters',
|
|
|
|
name: 'jsonParameters',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'customer',
|
|
|
|
],
|
|
|
|
operation: [
|
2020-09-02 03:32:12 -07:00
|
|
|
'upsert',
|
2020-09-02 03:25:11 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: ' Additional Fields',
|
|
|
|
name: 'additionalFieldsJson',
|
|
|
|
type: 'json',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'customer',
|
|
|
|
],
|
|
|
|
operation: [
|
2020-09-02 03:32:12 -07:00
|
|
|
'upsert',
|
2020-09-02 03:25:11 -07:00
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-08-26 10:42:38 -07:00
|
|
|
description: 'Object of values to set as described <a href="https://github.com/agilecrm/rest-api#1-companys---companies-api">here</a>.',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'customer',
|
|
|
|
],
|
|
|
|
operation: [
|
2020-09-02 03:32:12 -07:00
|
|
|
'upsert',
|
2020-09-02 03:25:11 -07:00
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Custom Properties',
|
|
|
|
name: 'customProperties',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
description: 'Custom Properties',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Property',
|
|
|
|
name: 'customProperty',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Key',
|
|
|
|
name: 'key',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
2020-09-02 03:32:12 -07:00
|
|
|
description: 'Property name.',
|
|
|
|
placeholder: 'Plan',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
2020-09-02 03:32:12 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
2020-09-02 03:25:11 -07:00
|
|
|
default: '',
|
2020-09-02 03:32:12 -07:00
|
|
|
description: 'Property value.',
|
|
|
|
placeholder: 'Basic',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Email',
|
|
|
|
name: 'email',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'The email address of the user.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Created at',
|
|
|
|
name: 'createdAt',
|
|
|
|
type: 'dateTime',
|
|
|
|
default: '',
|
|
|
|
description: 'The UNIX timestamp from when the user was created.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|