UNPKG

n8n-nodes-ynab

Version:
61 lines 2.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetCategories = void 0; const n8n_workflow_1 = require("n8n-workflow"); class GetCategories { constructor() { this.description = { displayName: 'YNAB - Get Categories', name: 'getCategories', group: ['transform'], version: 1, description: 'YNAB Get Categories', icon: 'file:icons/ynab.svg', defaults: { name: 'Get Categories', }, inputs: ['main'], outputs: ['main'], credentials: [ { name: 'ynabApi', required: true, }, ], properties: [ { displayName: 'Budget ID', name: 'budget_id', type: 'string', default: '', placeholder: 'Placeholder value', description: 'Budget identifier. Check your budgets to find the correct value.', }, ], }; } async execute() { const returnData = []; const items = this.getInputData(); for (let itemIndex = 0; itemIndex < items.length; itemIndex++) { const budgetId = this.getNodeParameter('budget_id', itemIndex, ''); const options = { method: 'GET', url: `https://api.ynab.com/v1/budgets/${budgetId}/categories`, json: true, }; try { const response = await this.helpers.httpRequestWithAuthentication.call(this, 'ynabApi', options); returnData.push({ json: { response }, }); } catch (error) { throw new n8n_workflow_1.NodeApiError(this.getNode(), error); } } return [returnData]; } } exports.GetCategories = GetCategories; //# sourceMappingURL=GetCategories.node.js.map