mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-13 16:14:07 -08:00
rename fields to how they appear in APi to prevent bug
This commit is contained in:
parent
12a0592896
commit
78997ddeac
|
@ -37,17 +37,6 @@ function addAdditionalFields(body: IDataObject, additionalFields: IDataObject) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add one additional field to the body
|
|
||||||
*
|
|
||||||
* @param {IDataObject} body The body object to add the field to
|
|
||||||
* @param {IDataObject} additionalField The field to add
|
|
||||||
*/
|
|
||||||
function addAdditionalField(body: IDataObject, additionalField: string | number) {
|
|
||||||
body.additionalField = additionalField;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export class ActiveCampaign implements INodeType {
|
export class ActiveCampaign implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
displayName: 'ActiveCampaign',
|
displayName: 'ActiveCampaign',
|
||||||
|
@ -511,7 +500,7 @@ export class ActiveCampaign implements INodeType {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
{
|
{
|
||||||
displayName: 'Title',
|
displayName: 'Title',
|
||||||
name: 'dealTitle',
|
name: 'title',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -529,7 +518,7 @@ export class ActiveCampaign implements INodeType {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal\'s contact ID',
|
displayName: 'Deal\'s contact ID',
|
||||||
name: 'dealContactId',
|
name: 'contact',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -547,7 +536,7 @@ export class ActiveCampaign implements INodeType {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal value',
|
displayName: 'Deal value',
|
||||||
name: 'dealValue',
|
name: 'value',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -565,7 +554,7 @@ export class ActiveCampaign implements INodeType {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Currency',
|
displayName: 'Currency',
|
||||||
name: 'dealCurrency',
|
name: 'currency',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -600,42 +589,42 @@ export class ActiveCampaign implements INodeType {
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
displayName: 'Description',
|
displayName: 'Description',
|
||||||
name: 'dealDescription',
|
name: 'description',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The description of the deal',
|
description: 'The description of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal group ID',
|
displayName: 'Deal group ID',
|
||||||
name: 'dealGroup',
|
name: 'group',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The group ID of the deal',
|
description: 'The group ID of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal stage ID',
|
displayName: 'Deal stage ID',
|
||||||
name: 'dealStage',
|
name: 'stage',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The stage ID of the deal',
|
description: 'The stage ID of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal owner ID',
|
displayName: 'Deal owner ID',
|
||||||
name: 'dealOwner',
|
name: 'owner',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The owner ID of the deal',
|
description: 'The owner ID of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal percentage',
|
displayName: 'Deal percentage',
|
||||||
name: 'dealPercentage',
|
name: 'percent',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
description: 'The percentage of the deal',
|
description: 'The percentage of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal status',
|
displayName: 'Deal status',
|
||||||
name: 'dealStatus',
|
name: 'status',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
description: 'The status of the deal',
|
description: 'The status of the deal',
|
||||||
|
@ -676,7 +665,7 @@ export class ActiveCampaign implements INodeType {
|
||||||
'update',
|
'update',
|
||||||
],
|
],
|
||||||
resource: [
|
resource: [
|
||||||
'contact',
|
'deal',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -684,70 +673,70 @@ export class ActiveCampaign implements INodeType {
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
displayName: 'Title',
|
displayName: 'Title',
|
||||||
name: 'dealTitle',
|
name: 'title',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The title of the deal',
|
description: 'The title of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal\'s contact ID',
|
displayName: 'Deal\'s contact ID',
|
||||||
name: 'dealContactId',
|
name: 'contact',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
description: 'The ID of the deal\'s contact',
|
description: 'The ID of the deal\'s contact',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal value',
|
displayName: 'Deal value',
|
||||||
name: 'dealValue',
|
name: 'value',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
description: 'The value of the deal in cents',
|
description: 'The value of the deal in cents',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Currency',
|
displayName: 'Currency',
|
||||||
name: 'dealCurrency',
|
name: 'currency',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The currency of the deal in 3-character ISO format',
|
description: 'The currency of the deal in 3-character ISO format',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Description',
|
displayName: 'Description',
|
||||||
name: 'dealDescription',
|
name: 'description',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The description of the deal',
|
description: 'The description of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal group ID',
|
displayName: 'Deal group ID',
|
||||||
name: 'dealGroup',
|
name: 'group',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The group ID of the deal',
|
description: 'The group ID of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal stage ID',
|
displayName: 'Deal stage ID',
|
||||||
name: 'dealStage',
|
name: 'stage',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The stage ID of the deal',
|
description: 'The stage ID of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal owner ID',
|
displayName: 'Deal owner ID',
|
||||||
name: 'dealOwner',
|
name: 'owner',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The owner ID of the deal',
|
description: 'The owner ID of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal percentage',
|
displayName: 'Deal percentage',
|
||||||
name: 'dealPercentage',
|
name: 'percent',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
description: 'The percentage of the deal',
|
description: 'The percentage of the deal',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal status',
|
displayName: 'Deal status',
|
||||||
name: 'dealStatus',
|
name: 'status',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
description: 'The status of the deal',
|
description: 'The status of the deal',
|
||||||
|
@ -1059,13 +1048,13 @@ export class ActiveCampaign implements INodeType {
|
||||||
dataKey = 'deal';
|
dataKey = 'deal';
|
||||||
|
|
||||||
body.deal = {
|
body.deal = {
|
||||||
title: this.getNodeParameter('dealTitle', i) as string,
|
title: this.getNodeParameter('title', i) as string,
|
||||||
contact: this.getNodeParameter('dealContactId', i) as string,
|
contact: this.getNodeParameter('contact', i) as string,
|
||||||
value: this.getNodeParameter('dealValue', i) as number,
|
value: this.getNodeParameter('value', i) as number,
|
||||||
} as IDataObject;
|
} as IDataObject;
|
||||||
|
|
||||||
let currency = this.getNodeParameter('dealCurrency', i).toString().toLowerCase() as string
|
let currency = this.getNodeParameter('currency', i).toString().toLowerCase() as string
|
||||||
addAdditionalField(body.deal as IDataObject, currency)
|
addAdditionalFields(body.deal as IDataObject, { currency })
|
||||||
|
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
addAdditionalFields(body.deal as IDataObject, additionalFields);
|
addAdditionalFields(body.deal as IDataObject, additionalFields);
|
||||||
|
@ -1154,7 +1143,11 @@ export class ActiveCampaign implements INodeType {
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`The resource "${resource}" is not known!`);
|
throw new Error(`The resource "${resource}" is not known!`);
|
||||||
}
|
}
|
||||||
|
console.log(requestMethod)
|
||||||
|
console.log(endpoint)
|
||||||
|
console.log(body)
|
||||||
|
console.log(qs)
|
||||||
|
console.log(dataKey)
|
||||||
let responseData;
|
let responseData;
|
||||||
if (returnAll === true) {
|
if (returnAll === true) {
|
||||||
responseData = await activeCampaignApiRequestAllItems.call(this, requestMethod, endpoint, body, qs, dataKey);
|
responseData = await activeCampaignApiRequestAllItems.call(this, requestMethod, endpoint, body, qs, dataKey);
|
||||||
|
|
Loading…
Reference in a new issue