UNPKG

n8n-nodes-everest-tms

Version:

Everest TMS n8n integration

29 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.executeWebhookOperations = executeWebhookOperations; const GenericFunctions_1 = require("../GenericFunctions"); async function executeWebhookOperations(itemIndex) { const operation = this.getNodeParameter('operation', itemIndex); if (operation === 'subscribe') { const url = this.getNodeParameter('url', itemIndex); const event = this.getNodeParameter('event', itemIndex); (0, GenericFunctions_1.validateRequiredFields)({ url, event }, ['url', 'event']); const body = { url, event, }; return await GenericFunctions_1.everestApiRequest.call(this, 'POST', '/hooks/subscribe', body); } if (operation === 'unsubscribe') { const url = this.getNodeParameter('url', itemIndex); const event = this.getNodeParameter('event', itemIndex); (0, GenericFunctions_1.validateRequiredFields)({ url, event }, ['url', 'event']); const body = { url, event, }; return await GenericFunctions_1.everestApiRequest.call(this, 'POST', '/hooks/unsubscribe', body); } throw new Error(`The operation "${operation}" is not known!`); } //# sourceMappingURL=WebhookOperations.js.map