mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
✨ Add customer resource to WooCommerce node (#2031)
This commit is contained in:
@@ -32,6 +32,10 @@ import {
|
||||
snakeCase,
|
||||
} from 'change-case';
|
||||
|
||||
import {
|
||||
omit
|
||||
} from 'lodash';
|
||||
|
||||
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) {
|
||||
@@ -144,3 +148,18 @@ export function toSnakeCase(data:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function adjustMetadata(fields: IDataObject & Metadata) {
|
||||
if (!fields.meta_data) return fields;
|
||||
|
||||
return {
|
||||
...omit(fields, ['meta_data']),
|
||||
meta_data: fields.meta_data.meta_data_fields,
|
||||
};
|
||||
}
|
||||
|
||||
type Metadata = {
|
||||
meta_data?: {
|
||||
meta_data_fields: Array<{ key: string; value: string }>;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user