UNPKG

n8n-nodes-base

Version:

Base nodes of n8n

38 lines 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.raindropApiRequest = raindropApiRequest; const n8n_workflow_1 = require("n8n-workflow"); /** * Make an authenticated API request to Raindrop. */ async function raindropApiRequest(method, endpoint, qs, body, option = {}) { const options = { headers: { 'user-agent': 'n8n', 'Content-Type': 'application/json', }, method, uri: `https://api.raindrop.io/rest/v1${endpoint}`, qs, body, json: true, }; if (!Object.keys(body).length) { delete options.body; } if (!Object.keys(qs).length) { delete options.qs; } if (Object.keys(option).length !== 0) { Object.assign(options, option); } try { return await this.helpers.requestOAuth2.call(this, 'raindropOAuth2Api', options, { includeCredentialsOnRefreshOnBody: true, }); } catch (error) { throw new n8n_workflow_1.NodeApiError(this.getNode(), error); } } //# sourceMappingURL=GenericFunctions.js.map