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.

90 lines 3.31 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] } }, typeOptions: { minValue: 0 }, default: 0, description: 'Offset for pagination', }, { displayName: 'Text Search', name: 'text', type: 'string', default: '', description: 'Text to search for in playbooks (optional)', }, { displayName: 'Query Type', name: 'queryType', type: 'options', options: [ { name: 'All', value: 'ALL' }, { name: 'Team', value: 'TEAM' }, { name: 'Mine', value: 'MINE' }, ], default: 'ALL', description: 'Scope of the playbook search (optional)', }, { displayName: 'Product OId (Filter)', name: 'productOId', type: 'string', default: '', description: 'Filter by Product OId (optional)', }, ]; const displayOptions = { show: { resource: ['playbook'], operation: ['list'], }, }; exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties); async function execute(itemIndex) { const qs = {}; let responseDataInner; let responseDataOuter; 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); 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/playbook/list', qs); } else { qs.limit = this.getNodeParameter('limit', itemIndex, 10); qs.offset = this.getNodeParameter('offset', itemIndex, 0); responseDataOuter = await OctaveApiRequest_1.octaveApiRequest.call(this, 'GET', '/api/v2/playbook/list', {}, qs); responseDataInner = responseDataOuter === null || responseDataOuter === void 0 ? void 0 : responseDataOuter.data; } const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseDataInner || responseDataOuter || {}), { itemData: { item: itemIndex } }); return [executionData]; } //# sourceMappingURL=list.operation.js.map