mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Minor improvement to GetResponse Node
This commit is contained in:
parent
bbef8b7f71
commit
2d74ebb9ab
|
@ -241,6 +241,7 @@ export const contactFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* contact:get */
|
/* contact:get */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -288,6 +289,7 @@ export const contactFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* contact:getAll */
|
/* contact:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -551,7 +553,6 @@ export const contactFields = [
|
||||||
loadOptionsMethod: 'getCampaigns',
|
loadOptionsMethod: 'getCampaigns',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: '',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Custom Fields',
|
displayName: 'Custom Fields',
|
||||||
|
@ -600,7 +601,6 @@ export const contactFields = [
|
||||||
name: 'email',
|
name: 'email',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: '',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'IP Address',
|
displayName: 'IP Address',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
OptionsWithUri,
|
OptionsWithUri,
|
||||||
} from 'request';
|
} from 'request';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
|
@ -41,7 +41,7 @@ export async function getresponseApiRequest(this: IWebhookFunctions | IHookFunct
|
||||||
} else {
|
} else {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
return await this.helpers.requestOAuth2.call(this, 'getResponseOAuth2Api', options);
|
return await this.helpers.requestOAuth2.call(this, 'getResponseOAuth2Api', options);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response && error.response.body && error.response.body.message) {
|
if (error.response && error.response.body && error.response.body.message) {
|
||||||
// Try to return the error prettier
|
// Try to return the error prettier
|
||||||
|
@ -68,4 +68,3 @@ export async function getResponseApiRequestAllItems(this: IExecuteFunctions | IL
|
||||||
|
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ export class GetResponse implements INodeType {
|
||||||
authentication: [
|
authentication: [
|
||||||
'apiKey',
|
'apiKey',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ export class GetResponse implements INodeType {
|
||||||
...contactFields,
|
...contactFields,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
methods = {
|
methods = {
|
||||||
loadOptions: {
|
loadOptions: {
|
||||||
// Get all the campaigns to display them to user so that he can
|
// Get all the campaigns to display them to user so that he can
|
||||||
|
@ -252,7 +252,7 @@ export class GetResponse implements INodeType {
|
||||||
'changeOnTo',
|
'changeOnTo',
|
||||||
];
|
];
|
||||||
|
|
||||||
const dateMapToKey: { [key: string]: string; } = {
|
const dateMapToKey: { [key: string]: string; } = {
|
||||||
'createdOnFrom': '[createdOn][from]',
|
'createdOnFrom': '[createdOn][from]',
|
||||||
'createdOnTo': '[createdOn][to]',
|
'createdOnTo': '[createdOn][to]',
|
||||||
'changeOnFrom': '[changeOn][from]',
|
'changeOnFrom': '[changeOn][from]',
|
||||||
|
@ -264,7 +264,7 @@ export class GetResponse implements INodeType {
|
||||||
if (isDate.includes(key)) {
|
if (isDate.includes(key)) {
|
||||||
qs[`query${dateMapToKey[key]}`] = moment.tz(qs[key], timezone).format('YYYY-MM-DDTHH:mm:ssZZ');
|
qs[`query${dateMapToKey[key]}`] = moment.tz(qs[key], timezone).format('YYYY-MM-DDTHH:mm:ssZZ');
|
||||||
} else {
|
} else {
|
||||||
qs[`query[${key}]`] = qs[key];
|
qs[`query[${key}]`] = qs[key];
|
||||||
}
|
}
|
||||||
delete qs[key];
|
delete qs[key];
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ export class GetResponse implements INodeType {
|
||||||
}
|
}
|
||||||
if (Array.isArray(responseData)) {
|
if (Array.isArray(responseData)) {
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||||
|
|
||||||
} else if (responseData !== undefined) {
|
} else if (responseData !== undefined) {
|
||||||
returnData.push(responseData as IDataObject);
|
returnData.push(responseData as IDataObject);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 750 B |
Loading…
Reference in a new issue