2020-09-02 03:25:11 -07:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const customerOperations: INodeProperties[] = [
|
2020-09-02 03:25:11 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2020-09-02 03:25:11 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'customer',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Create or Update',
|
2020-09-02 03:32:12 -07:00
|
|
|
value: 'upsert',
|
2022-05-20 14:47:24 -07:00
|
|
|
description: 'Create a new customer, or update the current one if it already exists (upsert)',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Delete a customer',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
],
|
2020-09-02 03:32:12 -07:00
|
|
|
default: 'upsert',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2020-09-02 03:25:11 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const customerFields: INodeProperties[] = [
|
2020-09-02 03:25:11 -07:00
|
|
|
|
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
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -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
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The unique identifier for the customer',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'JSON Parameters',
|
|
|
|
name: 'jsonParameters',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'customer',
|
|
|
|
],
|
|
|
|
operation: [
|
2020-09-02 03:32:12 -07:00
|
|
|
'upsert',
|
2020-09-02 03:25:11 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2022-05-20 14:47:24 -07:00
|
|
|
displayName: 'Additional Fields',
|
2020-09-02 03:25:11 -07:00
|
|
|
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,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -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',
|
2021-12-03 00:44:16 -08:00
|
|
|
default: {},
|
2020-09-02 03:25:11 -07:00
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Property',
|
|
|
|
name: 'customProperty',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Key',
|
|
|
|
name: 'key',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Property name',
|
2020-09-02 03:32:12 -07:00
|
|
|
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: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Property value',
|
2020-09-02 03:32:12 -07:00
|
|
|
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',
|
2022-06-20 07:54:01 -07:00
|
|
|
placeholder: 'name@email.com',
|
2020-09-02 03:25:11 -07:00
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The email address of the user',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Created At',
|
2020-09-02 03:25:11 -07:00
|
|
|
name: 'createdAt',
|
|
|
|
type: 'dateTime',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The UNIX timestamp from when the user was created',
|
2020-09-02 03:25:11 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|