n8n-nodes-mallabe-barcodes
Version:
n8n community node that allows the generation & scanning of different barcodes, such as the popular QR code, UPC, EAN & others using Mallabe Barcodes
49 lines • 1.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mallabeBarcodesRequest = mallabeBarcodesRequest;
exports.mallabeBarcodesCdnRequest = mallabeBarcodesCdnRequest;
const n8n_workflow_1 = require("n8n-workflow");
async function mallabeBarcodesRequest(method, resource, body = {}, qs = {}, url, option = {}) {
const { apiKey } = await this.getCredentials('mallabeBarcodesApi');
const n8nApiKey = 'xPHYKn7ar42idNoYrbyuc1xTk6LDWpPoIGvCRLK2';
const productionUrl = 'https://api.mallabe.com';
const options = {
headers: {
'Content-Type': 'application/json',
'User-Agent': 'n8n',
'x-api-key': n8nApiKey,
'x-account-api-key': apiKey,
},
method,
body,
qs,
url: url || `${productionUrl}${resource}`,
json: true,
};
try {
const responseData = await this.helpers.httpRequest(options);
return responseData;
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
async function mallabeBarcodesCdnRequest(url) {
const options = {
headers: {
'User-Agent': 'n8n'
},
method: 'GET',
url,
json: false,
encoding: 'arraybuffer'
};
try {
const responseData = await this.helpers.httpRequest(options);
return responseData;
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
//# sourceMappingURL=GenericFunctions.js.map