2022-08-01 13:47:55 -07:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
2020-09-18 00:42:01 -07:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
import { activeCampaignDefaultGetAllProperties } from './GenericFunctions';
|
2020-09-18 00:42:01 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const accountOperations: INodeProperties[] = [
|
2020-09-18 00:42:01 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2020-09-18 00:42:01 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['account'],
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create an account',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Create an account',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
description: 'Delete an account',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Delete an account',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
description: 'Get data of an account',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get an account',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
2022-09-07 07:51:14 -07:00
|
|
|
name: 'Get Many',
|
2020-09-18 00:42:01 -07:00
|
|
|
value: 'getAll',
|
|
|
|
description: 'Get data of all accounts',
|
2022-09-08 08:10:13 -07:00
|
|
|
action: 'Get many accounts',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
description: 'Update an account',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Update an account',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2020-09-18 00:42:01 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const accountFields: INodeProperties[] = [
|
2020-09-18 00:42:01 -07:00
|
|
|
// ----------------------------------
|
|
|
|
// contact:create
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['account'],
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
},
|
2022-08-01 13:47:55 -07:00
|
|
|
description: "Account's name",
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['account'],
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Account URL',
|
|
|
|
name: 'accountUrl',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description: "Account's website",
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Fields',
|
|
|
|
name: 'fields',
|
|
|
|
placeholder: 'Add Custom Fields',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Adds a custom fields to set also values which have not been predefined',
|
2020-09-18 00:42:01 -07:00
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'property',
|
|
|
|
displayName: 'Field',
|
|
|
|
values: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Field Name or ID',
|
2020-09-18 00:42:01 -07:00
|
|
|
name: 'customFieldId',
|
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getAccountCustomFields',
|
|
|
|
},
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'ID of the field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Field Value',
|
|
|
|
name: 'fieldValue',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Value of the field to set',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// contact:update
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Account ID',
|
|
|
|
name: 'accountId',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['update'],
|
|
|
|
resource: ['account'],
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 0,
|
|
|
|
required: true,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the account to update',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The fields to update',
|
2020-09-18 00:42:01 -07:00
|
|
|
placeholder: 'Add Field',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['update'],
|
|
|
|
resource: ['account'],
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description: "Account's name",
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Account URL',
|
|
|
|
name: 'accountUrl',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description: "Account's website",
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Fields',
|
|
|
|
name: 'fields',
|
|
|
|
placeholder: 'Add Fields',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Adds a custom fields to set also values which have not been predefined',
|
2020-09-18 00:42:01 -07:00
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'property',
|
|
|
|
displayName: 'Field',
|
|
|
|
values: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Field Name or ID',
|
2020-09-18 00:42:01 -07:00
|
|
|
name: 'customFieldId',
|
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getAccountCustomFields',
|
|
|
|
},
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'ID of the field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Field Value',
|
|
|
|
name: 'fieldValue',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Value of the field to set',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// ----------------------------------
|
|
|
|
// account:delete
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Account ID',
|
|
|
|
name: 'accountId',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['delete'],
|
|
|
|
resource: ['account'],
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 0,
|
|
|
|
required: true,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the account to delete',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
// ----------------------------------
|
|
|
|
// account:get
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Account ID',
|
|
|
|
name: 'accountId',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['get'],
|
|
|
|
resource: ['account'],
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 0,
|
|
|
|
required: true,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the account to get',
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
// ----------------------------------
|
|
|
|
// account:getAll
|
|
|
|
// ----------------------------------
|
|
|
|
...activeCampaignDefaultGetAllProperties('account', 'getAll'),
|
|
|
|
{
|
|
|
|
displayName: 'Filters',
|
|
|
|
name: 'filters',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Filter',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['getAll'],
|
|
|
|
resource: ['account'],
|
2020-09-18 00:42:01 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Search',
|
|
|
|
name: 'search',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Search by name',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|