n8n-nodes-base
Version:
Base nodes of n8n
31 lines • 959 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCustomers = getCustomers;
const n8n_workflow_1 = require("n8n-workflow");
const transport_1 = require("../transport");
// Get all the available channels
async function getCustomers() {
const endpoint = 'customers';
const responseData = await transport_1.apiRequestAllItems.call(this, 'GET', endpoint, {});
if (responseData === undefined) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No data got returned');
}
const returnData = [];
for (const data of responseData) {
returnData.push({
name: data.fullname,
value: data.id,
});
}
returnData.sort((a, b) => {
if (a.name < b.name) {
return -1;
}
if (a.name > b.name) {
return 1;
}
return 0;
});
return returnData;
}
//# sourceMappingURL=loadOptions.js.map