UNPKG

n8n-nodes-placid

Version:

n8n node to interact with Placid API for creative generation

39 lines 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.execute = execute; const n8n_workflow_1 = require("n8n-workflow"); const config_1 = require("../../utils/config"); async function execute(index) { try { const templateId = this.getNodeParameter('templateId', index); if (!templateId) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template ID is required', { itemIndex: index, }); } const options = { method: 'DELETE', url: `${config_1.PlacidConfig.getRestUrl(config_1.PlacidConfig.ENDPOINTS.TEMPLATES)}/${templateId}`, headers: { 'Accept': config_1.PlacidConfig.HTTP.HEADERS.ACCEPT, 'Content-Type': config_1.PlacidConfig.HTTP.HEADERS.CONTENT_TYPE, 'x-placid-integration': config_1.PlacidConfig.HTTP.HEADERS.PLACID_INTEGRATION, }, }; await this.helpers.httpRequestWithAuthentication.call(this, 'placidApi', options); return { json: { success: true, templateId, message: 'Template deleted successfully' }, pairedItem: { item: index }, }; } catch (error) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to delete template: ${error.message}`, { itemIndex: index, }); } } //# sourceMappingURL=delete.operation.js.map