UNPKG

@poli-digital/n8n-nodes-poli

Version:
63 lines 2.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TemplateResource = exports.templateDescription = void 0; const base_1 = require("./base"); exports.templateDescription = { displayName: 'Template', name: 'template', value: 'template', operations: [ { displayName: 'Create', name: 'operation', value: 'createTemplate', description: 'Create a template', action: 'Create a template', }, { displayName: 'List', name: 'operation', value: 'listTemplates', description: 'Get list of templates', action: 'Get list of templates', }, ], properties: [ { displayName: 'Operation', name: 'operation', type: 'options', displayOptions: { show: { resource: ['template'] } }, options: [ { name: 'Create', value: 'createTemplate', }, { name: 'List', value: 'listTemplates', }, ], default: 'createTemplate', }, ], }; class TemplateResource extends base_1.BaseResource { static async create(executeFunctions, index) { const body = { channelId: executeFunctions.getNodeParameter('channelId', index), name: executeFunctions.getNodeParameter('templateName', index), content: executeFunctions.getNodeParameter('content', index), category: executeFunctions.getNodeParameter('category', index), language: executeFunctions.getNodeParameter('language', index), }; return await this.makeRequest(executeFunctions, 'POST', '/templates', body, index); } static async list(executeFunctions, index) { const channelId = executeFunctions.getNodeParameter('channelId', index); const response = await this.makeRequest(executeFunctions, 'GET', `/channels/${channelId}/templates`, {}, index); return response.templates || []; } } exports.TemplateResource = TemplateResource; //# sourceMappingURL=template.js.map