UNPKG

n8n-nodes-base

Version:

Base nodes of n8n

28 lines 966 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.oneSimpleApiRequest = oneSimpleApiRequest; const n8n_workflow_1 = require("n8n-workflow"); async function oneSimpleApiRequest(method, resource, body = {}, qs = {}, uri, option = {}) { const credentials = await this.getCredentials('oneSimpleApi'); const outputFormat = 'json'; let options = { method, body, qs, uri: uri || `https://onesimpleapi.com/api${resource}?token=${credentials.apiToken}&output=${outputFormat}`, json: true, }; options = Object.assign({}, options, option); if (Object.keys(body).length === 0) { delete options.body; } try { const responseData = await this.helpers.request(options); return responseData; } catch (error) { throw new n8n_workflow_1.NodeApiError(this.getNode(), error); } } //# sourceMappingURL=GenericFunctions.js.map