Files
Automata/packages/nodes-base/nodes/SyncroMSP/v1/actions/customer/get/execute.ts
Michael Kret 91d7e16c81 n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
2022-08-17 17:50:24 +02:00

22 lines
635 B
TypeScript

import { IExecuteFunctions } from 'n8n-core';
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
import { apiRequest } from '../../../transport';
export async function getCustomer(
this: IExecuteFunctions,
index: number,
): Promise<INodeExecutionData[]> {
const id = this.getNodeParameter('customerId', index) as string;
const qs = {} as IDataObject;
const requestMethod = 'GET';
const endpoint = `customers/${id}`;
const body = {} as IDataObject;
let responseData;
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.customer);
}