n8n-nodes-pdforge
Version:
pdf noodle (previously pdforge) automates PDF Generation in minutes using AI.Create custom PDF templates in seconds using our AI Agents, fine tune the design with our PDF builder and automate the PDF delivery with our native pdforge node inside n8n. No co
33 lines • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.pdforgeApiRequest = pdforgeApiRequest;
const n8n_workflow_1 = require("n8n-workflow");
async function pdforgeApiRequest(method, endpoint, operation, body = {}, query = {}, uri, headers = {}) {
const credentials = await this.getCredentials('pdforgeApi');
const options = {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${credentials.apiKey}`,
},
method,
body,
qs: query,
uri: uri || `https://api.pdfnoodle.com/v1${endpoint}/${operation}`,
json: true,
};
if (!Object.keys(body).length) {
delete options.body;
}
if (!Object.keys(query).length) {
delete options.qs;
}
options.headers = Object.assign({}, options.headers, headers);
try {
return await this.helpers.request(options);
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
//# sourceMappingURL=GenericFunctions.js.map