mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
🐛 Fix issue sending parameter Opt In Reason on Keap Node (#1674)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
OptionsWithUri,
|
OptionsWithUri,
|
||||||
} from 'request';
|
} from 'request';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
snakeCase,
|
snakeCase,
|
||||||
} from 'change-case';
|
} from 'change-case';
|
||||||
|
|
||||||
export async function keapApiRequest(this: IWebhookFunctions | IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function keapApiRequest(this: IWebhookFunctions | IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
let options: OptionsWithUri = {
|
let options: OptionsWithUri = {
|
||||||
@@ -43,7 +43,7 @@ export async function keapApiRequest(this: IWebhookFunctions | IHookFunctions |
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function keapApiRequestAllItems(this: IHookFunctions| IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function keapApiRequestAllItems(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: IDataObject[] = [];
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ export async function keapApiRequestAllItems(this: IHookFunctions| IExecuteFunct
|
|||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function keysToSnakeCase(elements: IDataObject[] | IDataObject) : IDataObject[] {
|
export function keysToSnakeCase(elements: IDataObject[] | IDataObject): IDataObject[] {
|
||||||
if (!Array.isArray(elements)) {
|
if (!Array.isArray(elements)) {
|
||||||
elements = [elements];
|
elements = [elements];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
companyFields,
|
companyFields,
|
||||||
companyOperations,
|
companyOperations,
|
||||||
} from './CompanyDescription';
|
} from './CompanyDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IAddress,
|
IAddress,
|
||||||
@@ -310,7 +310,7 @@ export class Keap implements INodeType {
|
|||||||
keysToSnakeCase(additionalFields);
|
keysToSnakeCase(additionalFields);
|
||||||
Object.assign(body, additionalFields);
|
Object.assign(body, additionalFields);
|
||||||
if (addresses) {
|
if (addresses) {
|
||||||
body.address = keysToSnakeCase(addresses)[0] ;
|
body.address = keysToSnakeCase(addresses)[0];
|
||||||
}
|
}
|
||||||
if (faxes) {
|
if (faxes) {
|
||||||
body.fax_number = faxes[0];
|
body.fax_number = faxes[0];
|
||||||
@@ -407,6 +407,9 @@ export class Keap implements INodeType {
|
|||||||
if (additionalFields.companyId) {
|
if (additionalFields.companyId) {
|
||||||
body.company = { id: additionalFields.companyId as number };
|
body.company = { id: additionalFields.companyId as number };
|
||||||
}
|
}
|
||||||
|
if (additionalFields.optInReason) {
|
||||||
|
body.opt_in_reason = additionalFields.optInReason as string;
|
||||||
|
}
|
||||||
if (addresses) {
|
if (addresses) {
|
||||||
body.addresses = keysToSnakeCase(addresses) as IAddress[];
|
body.addresses = keysToSnakeCase(addresses) as IAddress[];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user