mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 04:47:29 -08:00
🐛 Fix issue sending parameter Opt In Reason on Keap Node (#1674)
This commit is contained in:
parent
0c779de704
commit
3fe52c84d5
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
|
@ -15,7 +15,7 @@ import {
|
|||
|
||||
import {
|
||||
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
|
||||
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[] = [];
|
||||
|
||||
|
@ -62,7 +62,7 @@ export async function keapApiRequestAllItems(this: IHookFunctions| IExecuteFunct
|
|||
return returnData;
|
||||
}
|
||||
|
||||
export function keysToSnakeCase(elements: IDataObject[] | IDataObject) : IDataObject[] {
|
||||
export function keysToSnakeCase(elements: IDataObject[] | IDataObject): IDataObject[] {
|
||||
if (!Array.isArray(elements)) {
|
||||
elements = [elements];
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ import {
|
|||
import {
|
||||
companyFields,
|
||||
companyOperations,
|
||||
} from './CompanyDescription';
|
||||
} from './CompanyDescription';
|
||||
|
||||
import {
|
||||
IAddress,
|
||||
|
@ -78,9 +78,9 @@ import {
|
|||
} from './ContactNoteInterface';
|
||||
|
||||
import {
|
||||
IEcommerceOrder,
|
||||
IItem,
|
||||
IShippingAddress,
|
||||
IEcommerceOrder,
|
||||
IItem,
|
||||
IShippingAddress,
|
||||
} from './EcommerceOrderInterface';
|
||||
|
||||
import {
|
||||
|
@ -310,9 +310,9 @@ export class Keap implements INodeType {
|
|||
keysToSnakeCase(additionalFields);
|
||||
Object.assign(body, additionalFields);
|
||||
if (addresses) {
|
||||
body.address = keysToSnakeCase(addresses)[0] ;
|
||||
}
|
||||
if (faxes) {
|
||||
body.address = keysToSnakeCase(addresses)[0];
|
||||
}
|
||||
if (faxes) {
|
||||
body.fax_number = faxes[0];
|
||||
}
|
||||
if (phones) {
|
||||
|
@ -407,13 +407,16 @@ export class Keap implements INodeType {
|
|||
if (additionalFields.companyId) {
|
||||
body.company = { id: additionalFields.companyId as number };
|
||||
}
|
||||
if (additionalFields.optInReason) {
|
||||
body.opt_in_reason = additionalFields.optInReason as string;
|
||||
}
|
||||
if (addresses) {
|
||||
body.addresses = keysToSnakeCase(addresses) as IAddress[];
|
||||
}
|
||||
if (emails) {
|
||||
body.email_addresses = emails as IEmailContact[];
|
||||
}
|
||||
if (faxes) {
|
||||
}
|
||||
if (emails) {
|
||||
body.email_addresses = emails as IEmailContact[];
|
||||
}
|
||||
if (faxes) {
|
||||
body.fax_numbers = faxes as IFax[];
|
||||
}
|
||||
if (socialAccounts) {
|
||||
|
@ -706,7 +709,7 @@ export class Keap implements INodeType {
|
|||
attachments = attachmentsUi.attachmentsValues as IAttachment[];
|
||||
}
|
||||
if (attachmentsUi.attachmentsBinary
|
||||
&& (attachmentsUi.attachmentsBinary as IDataObject).length) {
|
||||
&& (attachmentsUi.attachmentsBinary as IDataObject).length) {
|
||||
|
||||
if (items[i].binary === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!');
|
||||
|
|
Loading…
Reference in a new issue