@contaazul/n8n-nodes-contaazul
Version:
Node para integração com a API da Conta Azul no n8n
35 lines • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAllServices = getAllServices;
exports.getServiceById = getServiceById;
async function getAllServices() {
var _a;
const busca_textual = this.getNodeParameter('busca_textual', 0, '');
const pagina = this.getNodeParameter('pagina', 0, 1);
const tamanho_pagina = this.getNodeParameter('tamanho_pagina', 0, 10);
const qs = {
pagina,
tamanho_pagina,
};
if (busca_textual) {
qs.busca_textual = busca_textual;
}
const responseData = await ((_a = this.helpers.requestOAuth2) === null || _a === void 0 ? void 0 : _a.call(this, 'contaAzulOAuth2Api', {
method: 'GET',
url: 'https://api-v2.contaazul.com/v1/servicos',
qs,
json: true,
}));
return this.helpers.returnJsonArray(responseData.itens);
}
async function getServiceById() {
var _a;
const serviceId = this.getNodeParameter('serviceId', 0);
const responseData = await ((_a = this.helpers.requestOAuth2) === null || _a === void 0 ? void 0 : _a.call(this, 'contaAzulOAuth2Api', {
method: 'GET',
url: `https://api-v2.contaazul.com/v1/servicos/${serviceId}`,
json: true,
}));
return this.helpers.returnJsonArray([responseData]);
}
//# sourceMappingURL=servicos.js.map