@unboundcx/sdk 4.8.1 → 4.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -31,6 +31,7 @@ import { DocumentsService } from './services/documents.js';
31
31
  import { PermissionsService } from './services/permissions.js';
32
32
  import { TriggersService } from './services/triggers.js';
33
33
  import { InboxService } from './services/inbox.js';
34
+ import { SearchService } from './services/search.js';
34
35
  import { DirectoryService } from './services/directory.js';
35
36
 
36
37
  class UnboundSDK extends BaseSDK {
@@ -104,6 +105,7 @@ class UnboundSDK extends BaseSDK {
104
105
  this.permissions = new PermissionsService(this);
105
106
  this.triggers = new TriggersService(this);
106
107
  this.inbox = new InboxService(this);
108
+ this.search = new SearchService(this);
107
109
  this.directory = new DirectoryService(this);
108
110
 
109
111
  // Add additional services that might be missing
@@ -286,5 +288,6 @@ export { KnowledgeBaseService } from './services/knowledgeBase.js';
286
288
  export { FaxService } from './services/fax.js';
287
289
  export { PermissionsService } from './services/permissions.js';
288
290
  export { InboxService } from './services/inbox.js';
291
+ export { SearchService } from './services/search.js';
289
292
  export { DirectoryService } from './services/directory.js';
290
293
  export { BaseSDK } from './base.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.8.1",
3
+ "version": "4.8.3",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -0,0 +1,48 @@
1
+ /**
2
+ * SearchService -- cross-entity fan-out search (WP6.1).
3
+ * Backed by GET /search on app1-api: parallel per-store LIKE/fulltext
4
+ * queries behind one stable interface (a dedicated index can replace the
5
+ * implementation later without changing this contract).
6
+ */
7
+ export class SearchService {
8
+ constructor(sdk) {
9
+ this.sdk = sdk;
10
+ }
11
+
12
+ /**
13
+ * Search across entities.
14
+ *
15
+ * @param {Object} params
16
+ * @param {string} params.q - Search term (min 2 chars).
17
+ * @param {number} [params.limit] - Max results per entity (default 5, cap 10).
18
+ * @param {string|string[]} [params.entities] - Subset of
19
+ * people|company|opportunities|users|workflows; omit for all.
20
+ * @returns {Promise<{query: string, results: Object}>} results keyed by
21
+ * entity, each an array of { id, objectName, title, subtitle, meta }.
22
+ */
23
+ async query({ q, limit, entities } = {}) {
24
+ this.sdk.validateParams(
25
+ { q, limit },
26
+ {
27
+ q: { type: 'string', required: true },
28
+ limit: { type: 'number', required: false },
29
+ },
30
+ );
31
+
32
+ if (
33
+ entities !== undefined &&
34
+ typeof entities !== 'string' &&
35
+ !Array.isArray(entities)
36
+ ) {
37
+ throw new Error('entities must be a string or an array of strings');
38
+ }
39
+
40
+ const query = { q };
41
+ if (limit !== undefined) query.limit = limit;
42
+ if (entities !== undefined) {
43
+ query.entities = Array.isArray(entities) ? entities.join(',') : entities;
44
+ }
45
+
46
+ return await this.sdk._fetch('/search', 'GET', { query });
47
+ }
48
+ }
package/services/voice.js CHANGED
@@ -151,6 +151,32 @@ export class VoiceService {
151
151
  return result;
152
152
  }
153
153
 
154
+ /**
155
+ * Get the discrete event timeline for a call
156
+ * Returns the ordered sequence of discrete CDR events (ringing, answered,
157
+ * hold, transfer, queue/assignment transitions, recording, dtmf, etc.)
158
+ * recorded for a call, ordered oldest-first.
159
+ *
160
+ * @param {string} cdrId - The CDR id to fetch events for (required)
161
+ * @returns {Promise<Object>} result
162
+ * @returns {Array<Object>} result.events - Ordered list of `{ eventType, ts, actorType, actorId, data }`
163
+ *
164
+ * @example
165
+ * const { events } = await sdk.voice.getCdrEvents(cdrId);
166
+ * events.forEach((e) => console.log(e.eventType, e.ts));
167
+ */
168
+ async getCdrEvents(cdrId) {
169
+ this.sdk.validateParams(
170
+ { cdrId },
171
+ {
172
+ cdrId: { type: 'string', required: true },
173
+ },
174
+ );
175
+
176
+ const result = await this.sdk._fetch(`/voice/cdr/${cdrId}/events`, 'GET');
177
+ return result;
178
+ }
179
+
154
180
  /* legacy methods, to be updated and replaced */
155
181
 
156
182
  async hold(channels) {