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.

106 lines 3.62 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: 'text', type: 'string', default: '', description: 'Text search query for use cases', }, { displayName: 'Query Type', name: 'queryType', type: 'options', options: [ { name: 'All', value: 'ALL' }, { name: 'Team', value: 'TEAM' }, { name: 'Mine', value: 'MINE' }, ], default: 'ALL', description: 'Type of query to perform', }, { displayName: 'Product OID (Filter)', name: 'productOId', type: 'string', default: '', description: 'Filter list by a specific Product OId (optional)', }, { displayName: 'Playbook OID (Filter)', name: 'playbookOId', type: 'string', default: '', description: 'Filter list by a specific Playbook OId (optional)', }, ]; const displayOptions = { show: { resource: ['useCase'], 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.text = this.getNodeParameter('text', itemIndex); qs.queryType = this.getNodeParameter('queryType', itemIndex, 'ALL'); qs.productOId = this.getNodeParameter('productOId', itemIndex); qs.playbookOId = this.getNodeParameter('playbookOId', itemIndex); 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/use-case/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/use-case/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