mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
✨ Add Wufoo-Trigger node (#597)
* Generic functions, credentials, interface, logo, triggernode * TSLint tabs rule, request error handling, webhook done On hold until Wufoo responds with sandbox account * Removed test logging, fixed various errors, cleaned up * Sorted imports, adjusted data display, removed anys, tslint import sort rule * RAAAAAW data * ⚡ Fix logo and improve formatting * ⚡ Improvements * ⚡ Minor improvements to WuFoo-Trigger Co-authored-by: Rupenieks <ru@myos,co> Co-authored-by: ricardo <ricardoespinoza105@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
45
packages/nodes-base/nodes/Wufoo/GenericFunctions.ts
Normal file
45
packages/nodes-base/nodes/Wufoo/GenericFunctions.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function wufooApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = this.getCredentials('wufooApi');
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
auth: {
|
||||
username: credentials!.apiKey as string,
|
||||
password: '',
|
||||
},
|
||||
method,
|
||||
form: body,
|
||||
body,
|
||||
qs,
|
||||
uri: `https://${credentials!.subdomain}.wufoo.com/api/v3/${resource}`,
|
||||
json: true
|
||||
};
|
||||
|
||||
options = Object.assign({}, options, option);
|
||||
if (Object.keys(options.body).length === 0 || method === 'PUT') {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
throw new Error(error.message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user