mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Improvements to Webflow-Node
This commit is contained in:
parent
0c144e4b0f
commit
346ae8efc9
|
@ -28,7 +28,7 @@ export class WebflowOAuth2Api implements ICredentialType {
|
||||||
{
|
{
|
||||||
displayName: 'Scope',
|
displayName: 'Scope',
|
||||||
name: 'scope',
|
name: 'scope',
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'hidden' as NodePropertyTypes,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import { OptionsWithUri } from 'request';
|
import {
|
||||||
|
OptionsWithUri,
|
||||||
|
} from 'request';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
IExecuteSingleFunctions,
|
IExecuteSingleFunctions,
|
||||||
|
@ -6,7 +9,10 @@ import {
|
||||||
ILoadOptionsFunctions,
|
ILoadOptionsFunctions,
|
||||||
IWebhookFunctions,
|
IWebhookFunctions,
|
||||||
} from 'n8n-core';
|
} from 'n8n-core';
|
||||||
import { IDataObject } from 'n8n-workflow';
|
|
||||||
|
import {
|
||||||
|
IDataObject,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export async function webflowApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function webflowApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||||
|
@ -40,6 +46,9 @@ export async function webflowApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||||
return await this.helpers.requestOAuth2!.call(this, 'webflowOAuth2Api', options);
|
return await this.helpers.requestOAuth2!.call(this, 'webflowOAuth2Api', options);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error('Webflow Error: ' + error.code + error.msg);
|
if (error.response.body.err) {
|
||||||
|
throw new Error(`Webflow Error: [${error.statusCode}]: ${error.response.body.err}`);
|
||||||
|
}
|
||||||
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue