n8n-nodes-base
Version:
Base nodes of n8n
26 lines • 898 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.gumroadApiRequest = gumroadApiRequest;
const n8n_workflow_1 = require("n8n-workflow");
async function gumroadApiRequest(method, resource, body = {}, qs = {}, uri, option = {}) {
const credentials = await this.getCredentials('gumroadApi');
body = Object.assign({ access_token: credentials.accessToken }, body);
let options = {
method,
qs,
body,
uri: uri || `https://api.gumroad.com/v2${resource}`,
json: true,
};
options = Object.assign({}, options, option);
if (Object.keys(options.body).length === 0) {
delete options.body;
}
try {
return await this.helpers.request(options);
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
//# sourceMappingURL=GenericFunctions.js.map