mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(ServiceNow Node): Add attachment functionality (#3137)
* ✨ Add ServiceNow attachment functionality * 🔨 download fix * ⚡ improvements * ⚡ parameter name fix * ⚡ download attachment for get all operation * ⚡ filters update * ⚡ hint update * ⚡ Small improvements Co-authored-by: Michael Kret <michael.k@radency.com> Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
@@ -82,9 +82,34 @@ export async function serviceNowRequestAllItems(this: IExecuteFunctions | ILoadO
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export async function serviceNowDownloadAttachment(
|
||||
this: IExecuteFunctions,
|
||||
endpoint: string,
|
||||
fileName: string,
|
||||
contentType: string,
|
||||
) {
|
||||
const fileData = await serviceNowApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`${endpoint}/file`,
|
||||
{},
|
||||
{},
|
||||
'',
|
||||
{ json: false, encoding: null, resolveWithFullResponse: true },
|
||||
);
|
||||
const binaryData = await this.helpers.prepareBinaryData(
|
||||
Buffer.from(fileData.body as string),
|
||||
fileName,
|
||||
contentType,
|
||||
);
|
||||
|
||||
return binaryData;
|
||||
}
|
||||
|
||||
|
||||
export const mapEndpoint = (resource: string, operation: string) => {
|
||||
const resourceEndpoint = new Map([
|
||||
['attachment', 'sys_dictionary'],
|
||||
['tableRecord', 'sys_dictionary'],
|
||||
['businessService', 'cmdb_ci_service'],
|
||||
['configurationItems', 'cmdb_ci'],
|
||||
|
||||
Reference in New Issue
Block a user