n8n-nodes-placid
Version:
n8n node to interact with Placid API for creative generation
30 lines • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPdfById = getPdfById;
exports.execute = execute;
const n8n_workflow_1 = require("n8n-workflow");
const config_1 = require("../../utils/config");
async function getPdfById(executeFunctions, pdfId) {
const options = {
method: 'GET',
url: `${config_1.PlacidConfig.getRestUrl(config_1.PlacidConfig.ENDPOINTS.PDFS)}/${pdfId}`,
headers: {
'Accept': config_1.PlacidConfig.HTTP.HEADERS.ACCEPT,
'Content-Type': config_1.PlacidConfig.HTTP.HEADERS.CONTENT_TYPE,
'x-placid-integration': config_1.PlacidConfig.HTTP.HEADERS.PLACID_INTEGRATION,
},
};
return await executeFunctions.helpers.httpRequestWithAuthentication.call(executeFunctions, 'placidApi', options);
}
async function execute(i) {
const pdfId = this.getNodeParameter('pdfId', i);
if (!pdfId) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'PDF ID is required');
}
const response = await getPdfById(this, pdfId);
return {
json: response,
pairedItem: { item: i },
};
}
//# sourceMappingURL=get.operation.js.map