n8n-nodes-pdforge
Version:
Pdforge Automate PDF Generation in minutes using AI.Create custom PDF templates in seconds using our AI Agents, fine tune the design with our no-code builder and automate the PDF delivery with our native pdforge node inside n8n. No code or design experien
32 lines • 1.06 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',
Authorization: `Bearer ${credentials.apiKey}`,
},
method,
body,
qs: query,
uri: uri || `https://api.pdforge.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