mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor: Format nodes-base package (A-F) (#3800)
* 🔨 prettier formated nodes - A * 🔨 prettier formated nodes - B * ⚡ prettier formated nodes - C * ⚡ prettier formated nodes - D * ⚡ prettier formated nodes - E-F * 🎨 Adjust nodes-base formatting command (#3805) * Format additional files in nodes A-F (#3811) * ⚡ fixes * 🎨 Add Mindee to ignored dirs Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -11,34 +8,17 @@ import {
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
convertKitApiRequest,
|
||||
} from './GenericFunctions';
|
||||
import { convertKitApiRequest } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
customFieldFields,
|
||||
customFieldOperations,
|
||||
} from './CustomFieldDescription';
|
||||
import { customFieldFields, customFieldOperations } from './CustomFieldDescription';
|
||||
|
||||
import {
|
||||
formFields,
|
||||
formOperations,
|
||||
} from './FormDescription';
|
||||
import { formFields, formOperations } from './FormDescription';
|
||||
|
||||
import {
|
||||
sequenceFields,
|
||||
sequenceOperations,
|
||||
} from './SequenceDescription';
|
||||
import { sequenceFields, sequenceOperations } from './SequenceDescription';
|
||||
|
||||
import {
|
||||
tagFields,
|
||||
tagOperations,
|
||||
} from './TagDescription';
|
||||
import { tagFields, tagOperations } from './TagDescription';
|
||||
|
||||
import {
|
||||
tagSubscriberFields,
|
||||
tagSubscriberOperations,
|
||||
} from './TagSubscriberDescription';
|
||||
import { tagSubscriberFields, tagSubscriberOperations } from './TagSubscriberDescription';
|
||||
|
||||
export class ConvertKit implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -183,30 +163,30 @@ export class ConvertKit implements INodeType {
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
|
||||
try {
|
||||
|
||||
if (resource === 'customField') {
|
||||
if (operation === 'create') {
|
||||
|
||||
const label = this.getNodeParameter('label', i) as string;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'POST', '/custom_fields', { label }, qs);
|
||||
responseData = await convertKitApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/custom_fields',
|
||||
{ label },
|
||||
qs,
|
||||
);
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'DELETE', `/custom_fields/${id}`);
|
||||
}
|
||||
if (operation === 'get') {
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'GET', `/custom_fields/${id}`);
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'GET', `/custom_fields`);
|
||||
@@ -214,19 +194,19 @@ export class ConvertKit implements INodeType {
|
||||
responseData = responseData.custom_fields;
|
||||
|
||||
if (!returnAll) {
|
||||
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = responseData.slice(0, limit);
|
||||
}
|
||||
}
|
||||
if (operation === 'update') {
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const label = this.getNodeParameter('label', i) as string;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'PUT', `/custom_fields/${id}`, { label });
|
||||
responseData = await convertKitApiRequest.call(this, 'PUT', `/custom_fields/${id}`, {
|
||||
label,
|
||||
});
|
||||
|
||||
responseData = { success: true };
|
||||
}
|
||||
@@ -234,7 +214,6 @@ export class ConvertKit implements INodeType {
|
||||
|
||||
if (resource === 'form') {
|
||||
if (operation === 'addSubscriber') {
|
||||
|
||||
const email = this.getNodeParameter('email', i) as string;
|
||||
|
||||
const formId = this.getNodeParameter('id', i) as string;
|
||||
@@ -254,7 +233,8 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
|
||||
if (additionalFields.fieldsUi) {
|
||||
const fieldValues = (additionalFields.fieldsUi as IDataObject).fieldsValues as IDataObject[];
|
||||
const fieldValues = (additionalFields.fieldsUi as IDataObject)
|
||||
.fieldsValues as IDataObject[];
|
||||
if (fieldValues) {
|
||||
body.fields = {};
|
||||
for (const fieldValue of fieldValues) {
|
||||
@@ -264,12 +244,16 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
const { subscription } = await convertKitApiRequest.call(this, 'POST', `/forms/${formId}/subscribe`, body);
|
||||
const { subscription } = await convertKitApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/forms/${formId}/subscribe`,
|
||||
body,
|
||||
);
|
||||
|
||||
responseData = subscription;
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'GET', `/forms`);
|
||||
@@ -277,14 +261,12 @@ export class ConvertKit implements INodeType {
|
||||
responseData = responseData.forms;
|
||||
|
||||
if (!returnAll) {
|
||||
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = responseData.slice(0, limit);
|
||||
}
|
||||
}
|
||||
if (operation === 'getSubscriptions') {
|
||||
|
||||
const formId = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
@@ -295,12 +277,17 @@ export class ConvertKit implements INodeType {
|
||||
qs.subscriber_state = additionalFields.subscriberState as string;
|
||||
}
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'GET', `/forms/${formId}/subscriptions`, {}, qs);
|
||||
responseData = await convertKitApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/forms/${formId}/subscriptions`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
responseData = responseData.subscriptions;
|
||||
|
||||
if (!returnAll) {
|
||||
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = responseData.slice(0, limit);
|
||||
@@ -310,7 +297,6 @@ export class ConvertKit implements INodeType {
|
||||
|
||||
if (resource === 'sequence') {
|
||||
if (operation === 'addSubscriber') {
|
||||
|
||||
const email = this.getNodeParameter('email', i) as string;
|
||||
|
||||
const sequenceId = this.getNodeParameter('id', i) as string;
|
||||
@@ -330,7 +316,8 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
|
||||
if (additionalFields.fieldsUi) {
|
||||
const fieldValues = (additionalFields.fieldsUi as IDataObject).fieldsValues as IDataObject[];
|
||||
const fieldValues = (additionalFields.fieldsUi as IDataObject)
|
||||
.fieldsValues as IDataObject[];
|
||||
if (fieldValues) {
|
||||
body.fields = {};
|
||||
for (const fieldValue of fieldValues) {
|
||||
@@ -340,12 +327,16 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
const { subscription } = await convertKitApiRequest.call(this, 'POST', `/sequences/${sequenceId}/subscribe`, body);
|
||||
const { subscription } = await convertKitApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/sequences/${sequenceId}/subscribe`,
|
||||
body,
|
||||
);
|
||||
|
||||
responseData = subscription;
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'GET', `/sequences`);
|
||||
@@ -353,14 +344,12 @@ export class ConvertKit implements INodeType {
|
||||
responseData = responseData.courses;
|
||||
|
||||
if (!returnAll) {
|
||||
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = responseData.slice(0, limit);
|
||||
}
|
||||
}
|
||||
if (operation === 'getSubscriptions') {
|
||||
|
||||
const sequenceId = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
@@ -371,12 +360,17 @@ export class ConvertKit implements INodeType {
|
||||
qs.subscriber_state = additionalFields.subscriberState as string;
|
||||
}
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'GET', `/sequences/${sequenceId}/subscriptions`, {}, qs);
|
||||
responseData = await convertKitApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/sequences/${sequenceId}/subscriptions`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
responseData = responseData.subscriptions;
|
||||
|
||||
if (!returnAll) {
|
||||
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = responseData.slice(0, limit);
|
||||
@@ -386,8 +380,9 @@ export class ConvertKit implements INodeType {
|
||||
|
||||
if (resource === 'tag') {
|
||||
if (operation === 'create') {
|
||||
|
||||
const names = ((this.getNodeParameter('name', i) as string).split(',') as string[]).map((e) => ({ name: e }));
|
||||
const names = ((this.getNodeParameter('name', i) as string).split(',') as string[]).map(
|
||||
(e) => ({ name: e }),
|
||||
);
|
||||
|
||||
const body: IDataObject = {
|
||||
tag: names,
|
||||
@@ -397,7 +392,6 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'GET', `/tags`);
|
||||
@@ -405,7 +399,6 @@ export class ConvertKit implements INodeType {
|
||||
responseData = responseData.tags;
|
||||
|
||||
if (!returnAll) {
|
||||
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = responseData.slice(0, limit);
|
||||
@@ -414,9 +407,7 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
|
||||
if (resource === 'tagSubscriber') {
|
||||
|
||||
if (operation === 'add') {
|
||||
|
||||
const tagId = this.getNodeParameter('tagId', i) as string;
|
||||
|
||||
const email = this.getNodeParameter('email', i) as string;
|
||||
@@ -432,7 +423,8 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
|
||||
if (additionalFields.fieldsUi) {
|
||||
const fieldValues = (additionalFields.fieldsUi as IDataObject).fieldsValues as IDataObject[];
|
||||
const fieldValues = (additionalFields.fieldsUi as IDataObject)
|
||||
.fieldsValues as IDataObject[];
|
||||
if (fieldValues) {
|
||||
body.fields = {};
|
||||
for (const fieldValue of fieldValues) {
|
||||
@@ -442,23 +434,30 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
const { subscription } = await convertKitApiRequest.call(this, 'POST', `/tags/${tagId}/subscribe`, body);
|
||||
const { subscription } = await convertKitApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/tags/${tagId}/subscribe`,
|
||||
body,
|
||||
);
|
||||
|
||||
responseData = subscription;
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
|
||||
const tagId = this.getNodeParameter('tagId', i) as string;
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'GET', `/tags/${tagId}/subscriptions`);
|
||||
responseData = await convertKitApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/tags/${tagId}/subscriptions`,
|
||||
);
|
||||
|
||||
responseData = responseData.subscriptions;
|
||||
|
||||
if (!returnAll) {
|
||||
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = responseData.slice(0, limit);
|
||||
@@ -466,12 +465,16 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
|
||||
if (operation === 'delete') {
|
||||
|
||||
const tagId = this.getNodeParameter('tagId', i) as string;
|
||||
|
||||
const email = this.getNodeParameter('email', i) as string;
|
||||
|
||||
responseData = await convertKitApiRequest.call(this, 'POST', `/tags/${tagId}>/unsubscribe`, { email });
|
||||
responseData = await convertKitApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/tags/${tagId}>/unsubscribe`,
|
||||
{ email },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,7 +483,6 @@ export class ConvertKit implements INodeType {
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IHookFunctions, IWebhookFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -12,13 +9,9 @@ import {
|
||||
IWebhookResponseData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
convertKitApiRequest,
|
||||
} from './GenericFunctions';
|
||||
import { convertKitApiRequest } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
snakeCase,
|
||||
} from 'change-case';
|
||||
import { snakeCase } from 'change-case';
|
||||
|
||||
export class ConvertKitTrigger implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -103,7 +96,8 @@ export class ConvertKitTrigger implements INodeType {
|
||||
displayName: 'Form Name or ID',
|
||||
name: 'formId',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getForms',
|
||||
},
|
||||
@@ -111,9 +105,7 @@ export class ConvertKitTrigger implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
event: [
|
||||
'formSubscribe',
|
||||
],
|
||||
event: ['formSubscribe'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -121,7 +113,8 @@ export class ConvertKitTrigger implements INodeType {
|
||||
displayName: 'Sequence Name or ID',
|
||||
name: 'courseId',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSequences',
|
||||
},
|
||||
@@ -129,10 +122,7 @@ export class ConvertKitTrigger implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
event: [
|
||||
'courseSubscribe',
|
||||
'courseComplete',
|
||||
],
|
||||
event: ['courseSubscribe', 'courseComplete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -145,9 +135,7 @@ export class ConvertKitTrigger implements INodeType {
|
||||
description: 'The URL of the initiating link',
|
||||
displayOptions: {
|
||||
show: {
|
||||
event: [
|
||||
'linkClick',
|
||||
],
|
||||
event: ['linkClick'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -159,9 +147,7 @@ export class ConvertKitTrigger implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
event: [
|
||||
'productPurchase',
|
||||
],
|
||||
event: ['productPurchase'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -169,7 +155,8 @@ export class ConvertKitTrigger implements INodeType {
|
||||
displayName: 'Tag Name or ID',
|
||||
name: 'tagId',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
@@ -177,10 +164,7 @@ export class ConvertKitTrigger implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
event: [
|
||||
'tagAdd',
|
||||
'tagRemove',
|
||||
],
|
||||
event: ['tagAdd', 'tagRemove'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -192,13 +176,11 @@ export class ConvertKitTrigger implements INodeType {
|
||||
// Get all the tags to display them to user so that he can
|
||||
// select them easily
|
||||
async getTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
const { tags } = await convertKitApiRequest.call(this, 'GET', '/tags');
|
||||
|
||||
for (const tag of tags) {
|
||||
|
||||
const tagName = tag.name;
|
||||
|
||||
const tagId = tag.id;
|
||||
@@ -214,13 +196,11 @@ export class ConvertKitTrigger implements INodeType {
|
||||
// Get all the forms to display them to user so that he can
|
||||
// select them easily
|
||||
async getForms(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
const { forms } = await convertKitApiRequest.call(this, 'GET', '/forms');
|
||||
|
||||
for (const form of forms) {
|
||||
|
||||
const formName = form.name;
|
||||
|
||||
const formId = form.id;
|
||||
@@ -237,13 +217,11 @@ export class ConvertKitTrigger implements INodeType {
|
||||
// Get all the sequences to display them to user so that he can
|
||||
// select them easily
|
||||
async getSequences(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
const { courses } = await convertKitApiRequest.call(this, 'GET', '/sequences');
|
||||
|
||||
for (const course of courses) {
|
||||
|
||||
const courseName = course.name;
|
||||
|
||||
const courseId = course.id;
|
||||
@@ -263,7 +241,6 @@ export class ConvertKitTrigger implements INodeType {
|
||||
webhookMethods = {
|
||||
default: {
|
||||
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
|
||||
// THe API does not have an endpoint to list all webhooks
|
||||
@@ -276,7 +253,6 @@ export class ConvertKitTrigger implements INodeType {
|
||||
},
|
||||
|
||||
async create(this: IHookFunctions): Promise<boolean> {
|
||||
|
||||
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||
|
||||
let event = this.getNodeParameter('event', 0) as string;
|
||||
@@ -335,11 +311,9 @@ export class ConvertKitTrigger implements INodeType {
|
||||
},
|
||||
|
||||
async delete(this: IHookFunctions): Promise<boolean> {
|
||||
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
|
||||
if (webhookData.webhookId !== undefined) {
|
||||
|
||||
const endpoint = `/automations/hooks/${webhookData.webhookId}`;
|
||||
|
||||
try {
|
||||
@@ -361,9 +335,7 @@ export class ConvertKitTrigger implements INodeType {
|
||||
returnData.push(this.getBodyData());
|
||||
|
||||
return {
|
||||
workflowData: [
|
||||
this.helpers.returnJsonArray(returnData),
|
||||
],
|
||||
workflowData: [this.helpers.returnJsonArray(returnData)],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const customFieldOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const customFieldOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customField',
|
||||
],
|
||||
resource: ['customField'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -53,13 +49,8 @@ export const customFieldFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customField',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
'delete',
|
||||
],
|
||||
resource: ['customField'],
|
||||
operation: ['update', 'delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -72,13 +63,8 @@ export const customFieldFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customField',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
'create',
|
||||
],
|
||||
resource: ['customField'],
|
||||
operation: ['update', 'create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -90,12 +76,8 @@ export const customFieldFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'customField',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['customField'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -107,15 +89,9 @@ export const customFieldFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'customField',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['customField'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const formOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const formOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'form',
|
||||
],
|
||||
resource: ['form'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -45,20 +41,16 @@ export const formFields: INodeProperties[] = [
|
||||
displayName: 'Form Name or ID',
|
||||
name: 'id',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getForms',
|
||||
},
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'form',
|
||||
],
|
||||
operation: [
|
||||
'addSubscriber',
|
||||
'getSubscriptions',
|
||||
],
|
||||
resource: ['form'],
|
||||
operation: ['addSubscriber', 'getSubscriptions'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -71,16 +63,12 @@ export const formFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'form',
|
||||
],
|
||||
operation: [
|
||||
'addSubscriber',
|
||||
],
|
||||
resource: ['form'],
|
||||
operation: ['addSubscriber'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The subscriber\'s email address',
|
||||
description: "The subscriber's email address",
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
@@ -90,12 +78,8 @@ export const formFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'form',
|
||||
],
|
||||
operation: [
|
||||
'addSubscriber',
|
||||
],
|
||||
resource: ['form'],
|
||||
operation: ['addSubscriber'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -103,7 +87,8 @@ export const formFields: INodeProperties[] = [
|
||||
displayName: 'Custom Fields',
|
||||
name: 'fieldsUi',
|
||||
placeholder: 'Add Custom Field',
|
||||
description: 'Object of key/value pairs for custom fields (the custom field must exist before you can use it here)',
|
||||
description:
|
||||
'Object of key/value pairs for custom fields (the custom field must exist before you can use it here)',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
@@ -120,7 +105,7 @@ export const formFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'last_name',
|
||||
description: 'The field\'s key',
|
||||
description: "The field's key",
|
||||
},
|
||||
{
|
||||
displayName: 'Field Value',
|
||||
@@ -139,7 +124,7 @@ export const formFields: INodeProperties[] = [
|
||||
name: 'firstName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The subscriber\'s first name',
|
||||
description: "The subscriber's first name",
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -149,13 +134,8 @@ export const formFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
'getSubscriptions',
|
||||
],
|
||||
resource: [
|
||||
'form',
|
||||
],
|
||||
operation: ['getAll', 'getSubscriptions'],
|
||||
resource: ['form'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -167,16 +147,9 @@ export const formFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
'getSubscriptions',
|
||||
],
|
||||
resource: [
|
||||
'form',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll', 'getSubscriptions'],
|
||||
resource: ['form'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -194,12 +167,8 @@ export const formFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'form',
|
||||
],
|
||||
operation: [
|
||||
'getSubscriptions',
|
||||
],
|
||||
resource: ['form'],
|
||||
operation: ['getSubscriptions'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
import {
|
||||
OptionsWithUri
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
IHookFunctions,
|
||||
NodeApiError,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function convertKitApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||
method: string, endpoint: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
import { IDataObject, IHookFunctions, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
export async function convertKitApiRequest(
|
||||
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('convertKitApi');
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const sequenceOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const sequenceOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'sequence',
|
||||
],
|
||||
resource: ['sequence'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -45,20 +41,16 @@ export const sequenceFields: INodeProperties[] = [
|
||||
displayName: 'Sequence Name or ID',
|
||||
name: 'id',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSequences',
|
||||
},
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'sequence',
|
||||
],
|
||||
operation: [
|
||||
'addSubscriber',
|
||||
'getSubscriptions',
|
||||
],
|
||||
resource: ['sequence'],
|
||||
operation: ['addSubscriber', 'getSubscriptions'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -71,16 +63,12 @@ export const sequenceFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'sequence',
|
||||
],
|
||||
operation: [
|
||||
'addSubscriber',
|
||||
],
|
||||
resource: ['sequence'],
|
||||
operation: ['addSubscriber'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The subscriber\'s email address',
|
||||
description: "The subscriber's email address",
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
@@ -88,13 +76,8 @@ export const sequenceFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
'getSubscriptions',
|
||||
],
|
||||
resource: [
|
||||
'sequence',
|
||||
],
|
||||
operation: ['getAll', 'getSubscriptions'],
|
||||
resource: ['sequence'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -106,16 +89,9 @@ export const sequenceFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
'getSubscriptions',
|
||||
],
|
||||
resource: [
|
||||
'sequence',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll', 'getSubscriptions'],
|
||||
resource: ['sequence'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -133,12 +109,8 @@ export const sequenceFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'sequence',
|
||||
],
|
||||
operation: [
|
||||
'addSubscriber',
|
||||
],
|
||||
resource: ['sequence'],
|
||||
operation: ['addSubscriber'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -146,7 +118,8 @@ export const sequenceFields: INodeProperties[] = [
|
||||
displayName: 'Custom Fields',
|
||||
name: 'fieldsUi',
|
||||
placeholder: 'Add Custom Field',
|
||||
description: 'Object of key/value pairs for custom fields (the custom field must exist before you can use it here)',
|
||||
description:
|
||||
'Object of key/value pairs for custom fields (the custom field must exist before you can use it here)',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
@@ -163,7 +136,7 @@ export const sequenceFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'last_name',
|
||||
description: 'The field\'s key',
|
||||
description: "The field's key",
|
||||
},
|
||||
{
|
||||
displayName: 'Field Value',
|
||||
@@ -182,7 +155,7 @@ export const sequenceFields: INodeProperties[] = [
|
||||
name: 'firstName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The subscriber\'s first name',
|
||||
description: "The subscriber's first name",
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
@@ -192,7 +165,8 @@ export const sequenceFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'Tags. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Tags. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -204,12 +178,8 @@ export const sequenceFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'sequence',
|
||||
],
|
||||
operation: [
|
||||
'getSubscriptions',
|
||||
],
|
||||
resource: ['sequence'],
|
||||
operation: ['getSubscriptions'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const tagOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const tagOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'tag',
|
||||
],
|
||||
resource: ['tag'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -41,12 +37,8 @@ export const tagFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'tag',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['tag'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -58,12 +50,8 @@ export const tagFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'tag',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['tag'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -75,15 +63,9 @@ export const tagFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'tag',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['tag'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const tagSubscriberOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const tagSubscriberOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'tagSubscriber',
|
||||
],
|
||||
resource: ['tagSubscriber'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -44,21 +40,16 @@ export const tagSubscriberFields: INodeProperties[] = [
|
||||
displayName: 'Tag Name or ID',
|
||||
name: 'tagId',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'tagSubscriber',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
'getAll',
|
||||
'delete',
|
||||
],
|
||||
resource: ['tagSubscriber'],
|
||||
operation: ['add', 'getAll', 'delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -71,13 +62,8 @@ export const tagSubscriberFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'tagSubscriber',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
'delete',
|
||||
],
|
||||
resource: ['tagSubscriber'],
|
||||
operation: ['add', 'delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -91,12 +77,8 @@ export const tagSubscriberFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'tagSubscriber',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
],
|
||||
resource: ['tagSubscriber'],
|
||||
operation: ['add'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -104,7 +86,8 @@ export const tagSubscriberFields: INodeProperties[] = [
|
||||
displayName: 'Custom Fields',
|
||||
name: 'fields',
|
||||
placeholder: 'Add Custom Field',
|
||||
description: 'Object of key/value pairs for custom fields (the custom field must exist before you can use it here)',
|
||||
description:
|
||||
'Object of key/value pairs for custom fields (the custom field must exist before you can use it here)',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
@@ -121,7 +104,7 @@ export const tagSubscriberFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'last_name',
|
||||
description: 'The field\'s key',
|
||||
description: "The field's key",
|
||||
},
|
||||
{
|
||||
displayName: 'Field Value',
|
||||
@@ -150,12 +133,8 @@ export const tagSubscriberFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'tagSubscriber',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['tagSubscriber'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -167,15 +146,9 @@ export const tagSubscriberFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'tagSubscriber',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['tagSubscriber'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -193,12 +166,8 @@ export const tagSubscriberFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'tagSubscriber',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['tagSubscriber'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
|
||||
Reference in New Issue
Block a user