mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Reuse webhook if one exists - Woocommerce Trigger (#1196)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { OptionsWithUri } from 'request';
|
||||
import { createHash } from 'crypto';
|
||||
import { snakeCase } from 'change-case';
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
ICredentialDataDecryptedObject,
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
ICouponLine,
|
||||
IFeeLine,
|
||||
@@ -20,6 +21,14 @@ import {
|
||||
IShoppingLine,
|
||||
} from './OrderInterface';
|
||||
|
||||
import {
|
||||
createHash,
|
||||
} from 'crypto';
|
||||
|
||||
import {
|
||||
snakeCase,
|
||||
} from 'change-case';
|
||||
|
||||
export async function woocommerceApiRequest(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 credentials = this.getCredentials('wooCommerceApi');
|
||||
if (credentials === undefined) {
|
||||
@@ -40,6 +49,7 @@ export async function woocommerceApiRequest(this: IHookFunctions | IExecuteFunct
|
||||
delete options.form;
|
||||
}
|
||||
options = Object.assign({}, options, option);
|
||||
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
@@ -58,7 +68,7 @@ export async function woocommerceApiRequest(this: IHookFunctions | IExecuteFunct
|
||||
}
|
||||
}
|
||||
|
||||
export async function woocommerceApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function woocommerceApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
@@ -135,4 +145,4 @@ export function toSnakeCase(data:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user