UNPKG

n8n-nodes-octavehq

Version:

Octave is the AI-powered messaging brain for B2B go-to-market teams, helping articulate product value, synthesize customer interaction data, and deploy consistent, effective messaging across all channels.

96 lines 3.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.exportedProperties = void 0; exports.execute = execute; const OctaveApiRequest_1 = require("../../transport/OctaveApiRequest"); const utils_1 = require("../utils"); const properties = [ { displayName: 'Return All', name: 'returnAll', type: 'boolean', default: true, description: 'Whether to return all results or only up to a given limit', }, { displayName: 'Limit', name: 'limit', type: 'number', displayOptions: { show: { returnAll: [false], }, }, typeOptions: { minValue: 1, }, default: 50, description: 'Max number of results to return', }, { displayName: 'Offset', name: 'offset', type: 'number', displayOptions: { show: { returnAll: [false], }, }, default: 0, description: 'Offset of the results to return', }, { displayName: 'Text Search', name: 'textSearchQuery', type: 'string', default: '', description: 'Text search query for proof points', }, { displayName: 'Product OID (Filter)', name: 'productOId', type: 'string', default: '', description: 'Filter list by a specific Product OId (optional)', }, { displayName: 'OIds (Filter)', name: 'oIds', type: 'string', default: '', description: 'Comma-separated list of proof point OIds to filter by (optional)', }, ]; const displayOptions = { show: { resource: ['proofPoint'], operation: ['list'], }, }; exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties); async function execute(itemIndex) { const qs = {}; let responseDataInner; const returnAll = this.getNodeParameter('returnAll', itemIndex, true); qs.textSearchQuery = this.getNodeParameter('textSearchQuery', itemIndex); qs.productOId = this.getNodeParameter('productOId', itemIndex); const oIdsString = this.getNodeParameter('oIds', itemIndex); if (oIdsString && oIdsString.trim()) { qs.oIds = oIdsString.split(',').map((id) => id.trim()); } Object.keys(qs).forEach(key => (qs[key] === undefined) && delete qs[key]); if (returnAll) { qs.limit = this.getNodeParameter('limit', itemIndex, 100); qs.offset = this.getNodeParameter('offset', itemIndex, 0); responseDataInner = await OctaveApiRequest_1.octaveApiRequestListAll.call(this, 'GET', '/api/v2/proof-point/list', qs); } else { qs.limit = this.getNodeParameter('limit', itemIndex, 50); qs.offset = this.getNodeParameter('offset', itemIndex, 0); const responseDataOuter = await OctaveApiRequest_1.octaveApiRequest.call(this, 'GET', '/api/v2/proof-point/list', {}, qs); responseDataInner = responseDataOuter === null || responseDataOuter === void 0 ? void 0 : responseDataOuter.data; } const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseDataInner || []), { itemData: { item: itemIndex } }); return [executionData]; } //# sourceMappingURL=list.operation.js.map