n8n-nodes-base
Version:
Base nodes of n8n
26 lines • 926 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.workableApiRequest = workableApiRequest;
const n8n_workflow_1 = require("n8n-workflow");
async function workableApiRequest(method, resource, body = {}, qs = {}, uri, option = {}) {
const credentials = await this.getCredentials('workableApi');
let options = {
headers: { Authorization: `Bearer ${credentials.accessToken}` },
method,
qs,
body,
uri: uri || `https://${credentials.subdomain}.workable.com/spi/v3${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