UNPKG

n8n-nodes-ynab

Version:
53 lines 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetBudgets = void 0; const n8n_workflow_1 = require("n8n-workflow"); class GetBudgets { constructor() { this.description = { displayName: 'YNAB - Get Budgets', name: 'getBudgets', group: ['transform'], version: 1, description: 'YNAB Get Budgets', icon: 'file:icons/ynab.svg', defaults: { name: 'Get Budgets', }, inputs: ['main'], outputs: ['main'], credentials: [ { name: 'ynabApi', required: true, }, ], properties: [], }; } async execute() { const returnData = []; const apiKey = await this.getCredentials('ynabApi'); const options = { method: 'GET', url: 'https://api.ynab.com/v1/budgets?include_accounts=false', headers: { Authorization: `${apiKey.token ? `Bearer ${apiKey.token}` : ''}`, 'Content-Type': 'application/json', }, 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.GetBudgets = GetBudgets; //# sourceMappingURL=GetBudgets.node.js.map