@poli-digital/n8n-nodes-poli
Version:
Nó para interagir com a API da Poli
28 lines • 886 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.apiRequest = void 0;
const n8n_workflow_1 = require("n8n-workflow");
async function apiRequest(method, endpoint, body = {}, qs = {}) {
const credentials = await this.getCredentials('poliApi');
const baseUrl = 'https://foundation-api.poli.digital/v3';
const options = {
method,
url: `${baseUrl}${endpoint}`,
headers: {
Authorization: `Bearer ${credentials.apiKey}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
body,
qs,
json: true,
};
try {
return await this.helpers.request(options);
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
exports.apiRequest = apiRequest;
//# sourceMappingURL=transport.js.map