UNPKG

@poli-digital/n8n-nodes-poli

Version:
66 lines 2.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppResource = exports.appDescription = void 0; const base_1 = require("./base"); exports.appDescription = { displayName: 'App', name: 'app', value: 'app', operations: [ { displayName: 'Create', name: 'operation', value: 'createApp', description: 'Create a new app', action: 'Create an app', }, { displayName: 'List', name: 'operation', value: 'listApps', description: 'Get list of apps', action: 'Get list of apps', }, ], properties: [ { displayName: 'Operation', name: 'operation', type: 'options', displayOptions: { show: { resource: ['app'] } }, options: [ { name: 'Create', value: 'createApp', }, { name: 'List', value: 'listApps', }, ], default: 'createApp', }, ], }; class AppResource extends base_1.BaseResource { static async create(executeFunctions, index) { const body = { accountId: executeFunctions.getNodeParameter('accountId', index), name: executeFunctions.getNodeParameter('appName', index), description: executeFunctions.getNodeParameter('description', index), responsible: executeFunctions.getNodeParameter('responsible', index), phone: executeFunctions.getNodeParameter('phone', index), email: executeFunctions.getNodeParameter('email', index), pictureFileId: executeFunctions.getNodeParameter('pictureFileId', index), visibility: executeFunctions.getNodeParameter('visibility', index), }; return await this.makeRequest(executeFunctions, 'POST', '/apps', body, index); } static async list(executeFunctions, index) { const accountId = executeFunctions.getNodeParameter('accountId', index); const response = await this.makeRequest(executeFunctions, 'GET', `/accounts/${accountId}/apps`, {}, index); return response.apps || []; } } exports.AppResource = AppResource; //# sourceMappingURL=app.js.map