feat(Wise Node): Add Support to download statements as JSON, CSV or PDF (#3468)

This commit is contained in:
Valentin Mocanu
2022-06-13 23:29:21 +03:00
committed by GitHub
parent 7346da0b34
commit 51663c1fcb
3 changed files with 105 additions and 28 deletions

View File

@@ -58,6 +58,10 @@ export async function wiseApiRequest(
delete options.qs;
}
if (option.encoding) {
delete options.json;
}
if (Object.keys(option)) {
Object.assign(options, option);
}
@@ -112,26 +116,6 @@ export async function wiseApiRequest(
}
}
/**
* Populate the binary property of node items with binary data for a PDF file.
*/
export async function handleBinaryData(
this: IExecuteFunctions,
items: INodeExecutionData[],
i: number,
endpoint: string,
) {
const data = await wiseApiRequest.call(this, 'GET', endpoint, {}, {}, { encoding: null });
const binaryProperty = this.getNodeParameter('binaryProperty', i) as string;
items[i].binary = items[i].binary ?? {};
items[i].binary![binaryProperty] = await this.helpers.prepareBinaryData(data);
items[i].binary![binaryProperty].fileName = this.getNodeParameter('fileName', i) as string;
items[i].binary![binaryProperty].fileExtension = 'pdf';
return items;
}
export function getTriggerName(eventName: string) {
const events: IDataObject = {
'tranferStateChange': 'transfers#state-change',