2023-01-27 03:22:44 -08:00
|
|
|
import type { INodeProperties } from 'n8n-workflow';
|
2020-09-18 00:42:01 -07:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
import { activeCampaignDefaultGetAllProperties } from './GenericFunctions';
|
2019-11-03 13:17:43 -08:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const connectionOperations: INodeProperties[] = [
|
2019-11-07 01:50:02 -08:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2019-11-07 01:50:02 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create a connection',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Create a connection',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
description: 'Delete a connection',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Delete a connection',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
description: 'Get data of a connection',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get a connection',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
2022-09-07 07:51:14 -07:00
|
|
|
name: 'Get Many',
|
2019-11-07 01:50:02 -08:00
|
|
|
value: 'getAll',
|
2022-09-13 03:36:36 -07:00
|
|
|
description: 'Get data of many connections',
|
2022-09-08 08:10:13 -07:00
|
|
|
action: 'Get many connections',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
description: 'Update a connection',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Update a connection',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2019-11-03 13:17:43 -08:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const connectionFields: INodeProperties[] = [
|
2019-11-07 01:50:02 -08:00
|
|
|
// ----------------------------------
|
|
|
|
// connection:create
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Service',
|
|
|
|
name: 'service',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The name of the service',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'External Account ID',
|
2019-11-07 01:50:02 -08:00
|
|
|
name: 'externalid',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The ID of the account in the external service',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Account Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'The name associated with the account in the external service. Often this will be a company name (e.g., "My Toystore, Inc.").',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Logo URL',
|
|
|
|
name: 'logoUrl',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The URL to a logo image for the external service',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Link URL',
|
|
|
|
name: 'linkUrl',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
"The URL to a page where the integration with the external service can be managed in the third-party's website",
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
2019-11-03 13:17:43 -08:00
|
|
|
|
2019-11-07 01:50:02 -08:00
|
|
|
// ----------------------------------
|
|
|
|
// connection:update
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Connection ID',
|
|
|
|
name: 'connectionId',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['update'],
|
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 0,
|
|
|
|
required: true,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the connection to update',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The fields to update',
|
2019-11-07 01:50:02 -08:00
|
|
|
placeholder: 'Add Field',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['update'],
|
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Service',
|
|
|
|
name: 'service',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The name of the service',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'External Account ID',
|
2019-11-07 01:50:02 -08:00
|
|
|
name: 'externalid',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The ID of the account in the external service',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Account Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'The name associated with the account in the external service. Often this will be a company name (e.g., "My Toystore, Inc.").',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Logo URL',
|
|
|
|
name: 'logoUrl',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The URL to a logo image for the external service',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Link URL',
|
|
|
|
name: 'linkUrl',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
"The URL to a page where the integration with the external service can be managed in the third-party's website",
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Status',
|
|
|
|
name: 'status',
|
|
|
|
type: 'number',
|
|
|
|
default: 1,
|
|
|
|
description: 'The status of the connection (0 = error; 1 = connected)',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Syncronisation Status',
|
|
|
|
name: 'syncStatus',
|
|
|
|
type: 'number',
|
|
|
|
default: 1,
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'The status of a sync triggered on the connection (0 = sync stopped; 1 = sync running)',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
2019-11-03 13:17:43 -08:00
|
|
|
|
2019-11-07 01:50:02 -08:00
|
|
|
// ----------------------------------
|
|
|
|
// connection:delete
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Connection ID',
|
|
|
|
name: 'connectionId',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['delete'],
|
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 0,
|
|
|
|
required: true,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the connection to delete',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
2019-11-03 13:17:43 -08:00
|
|
|
|
2019-11-07 01:50:02 -08:00
|
|
|
// ----------------------------------
|
|
|
|
// connection:get
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Connection ID',
|
|
|
|
name: 'connectionId',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['get'],
|
|
|
|
resource: ['connection'],
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 0,
|
|
|
|
required: true,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the connection to get',
|
2019-11-07 01:50:02 -08:00
|
|
|
},
|
2019-11-03 13:17:43 -08:00
|
|
|
|
2019-11-07 01:50:02 -08:00
|
|
|
// ----------------------------------
|
|
|
|
// connection:getAll
|
|
|
|
// ----------------------------------
|
2020-09-18 00:42:01 -07:00
|
|
|
...activeCampaignDefaultGetAllProperties('connection', 'getAll'),
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|