Files
Automata/packages/nodes-base/nodes/BambooHr/v1/actions/employeeDocument/del/execute.ts
2022-01-22 18:48:58 +01:00

31 lines
704 B
TypeScript

import {
IExecuteFunctions,
} from 'n8n-core';
import {
IDataObject,
INodeExecutionData,
} from 'n8n-workflow';
import {
apiRequest,
} from '../../../transport';
export async function del(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
const body: IDataObject = {};
const requestMethod = 'DELETE';
//meta data
const id: string = this.getNodeParameter('employeeId', index) as string;
const fileId: string = this.getNodeParameter('fileId', index) as string;
//endpoint
const endpoint = `employees/${id}/files/${fileId}`;
//response
await apiRequest.call(this, requestMethod, endpoint, body);
//return
return this.helpers.returnJsonArray({ success: true });
}