@unboundcx/sdk 4.13.114 → 4.13.116

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
@@ -21,6 +21,8 @@ import { VerificationService } from './services/verification.js';
21
21
  import { PortalsService } from './services/portals.js';
22
22
  import { DealRegistrationsService } from './services/dealRegistrations.js';
23
23
  import { SipEndpointsService } from './services/sipEndpoints.js';
24
+ import { RingGroupsService } from './services/ringGroups.js';
25
+ import { LineGroupsService } from './services/lineGroups.js';
24
26
  import { WebchatService } from './services/webchat.js';
25
27
  import { CobrowseService } from './services/cobrowse.js';
26
28
  import { MessageTemplatesService } from './services/messageTemplates.js';
@@ -120,6 +122,8 @@ class UnboundSDK extends BaseSDK {
120
122
  this.portals = new PortalsService(this);
121
123
  this.dealRegistrations = new DealRegistrationsService(this);
122
124
  this.sipEndpoints = new SipEndpointsService(this);
125
+ this.ringGroups = new RingGroupsService(this);
126
+ this.lineGroups = new LineGroupsService(this);
123
127
  this.webchat = new WebchatService(this);
124
128
  this.cobrowse = new CobrowseService(this);
125
129
  this.messageTemplates = new MessageTemplatesService(this);
@@ -320,6 +324,8 @@ export { VerificationService } from './services/verification.js';
320
324
  export { PortalsService } from './services/portals.js';
321
325
  export { DealRegistrationsService } from './services/dealRegistrations.js';
322
326
  export { SipEndpointsService } from './services/sipEndpoints.js';
327
+ export { RingGroupsService } from './services/ringGroups.js';
328
+ export { LineGroupsService } from './services/lineGroups.js';
323
329
  export { WebchatService, WebchatWidgetsService } from './services/webchat.js';
324
330
  export { CobrowseService, CobrowseVisitorService } from './services/cobrowse.js';
325
331
  export { MessageTemplatesService } from './services/messageTemplates.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.114",
3
+ "version": "4.13.116",
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,155 @@
1
+ import { internalRequest } from '../base.js';
2
+
3
+ // Line groups (plans/line-groups-plan.md). CRUD, lines, and members are
4
+ // dedicated routes. Routing pickers use routingTargets().
5
+ export class LineGroupsService {
6
+ constructor(sdk) {
7
+ this.sdk = sdk;
8
+ }
9
+
10
+ async list() {
11
+ return await internalRequest(this.sdk, '/lineGroups', 'GET', {});
12
+ }
13
+
14
+ /**
15
+ * @param {string} id
16
+ * @returns {Promise<Object>} group with lines and members
17
+ */
18
+ async get(id) {
19
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
20
+ return await internalRequest(this.sdk, `/lineGroups/${id}`, 'GET', {});
21
+ }
22
+
23
+ /**
24
+ * @param {Object} body - name, extension?, timers, privacy, lines?, members?
25
+ */
26
+ async create(body) {
27
+ this.sdk.validateParams(
28
+ { body },
29
+ { body: { type: 'object', required: true } },
30
+ );
31
+ return await internalRequest(this.sdk, '/lineGroups', 'POST', { body });
32
+ }
33
+
34
+ async update(id, body) {
35
+ this.sdk.validateParams(
36
+ { id, body },
37
+ {
38
+ id: { type: 'string', required: true },
39
+ body: { type: 'object', required: true },
40
+ },
41
+ );
42
+ return await internalRequest(this.sdk, `/lineGroups/${id}`, 'PATCH', {
43
+ body,
44
+ });
45
+ }
46
+
47
+ async delete(id) {
48
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
49
+ return await internalRequest(this.sdk, `/lineGroups/${id}`, 'DELETE', {});
50
+ }
51
+
52
+ /**
53
+ * @param {string|number} extension
54
+ * @param {string} [excludeId] extensions row to ignore while editing
55
+ */
56
+ async extensionAvailable(extension, excludeId) {
57
+ this.sdk.validateParams(
58
+ { extension },
59
+ { extension: { type: 'string', required: true } },
60
+ );
61
+ const params = {
62
+ query: {
63
+ extension,
64
+ ...(excludeId ? { excludeId } : {}),
65
+ },
66
+ };
67
+ return await internalRequest(
68
+ this.sdk,
69
+ '/lineGroups/extensions/available',
70
+ 'GET',
71
+ params,
72
+ );
73
+ }
74
+
75
+ async routingTargets() {
76
+ return await internalRequest(
77
+ this.sdk,
78
+ '/lineGroups/routingTargets',
79
+ 'GET',
80
+ {},
81
+ );
82
+ }
83
+
84
+ async addLine(id, body = {}) {
85
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
86
+ return await internalRequest(this.sdk, `/lineGroups/${id}/lines`, 'POST', {
87
+ body,
88
+ });
89
+ }
90
+
91
+ async updateLine(id, lineId, body) {
92
+ this.sdk.validateParams(
93
+ { id, lineId, body },
94
+ {
95
+ id: { type: 'string', required: true },
96
+ lineId: { type: 'string', required: true },
97
+ body: { type: 'object', required: true },
98
+ },
99
+ );
100
+ return await internalRequest(
101
+ this.sdk,
102
+ `/lineGroups/${id}/lines/${lineId}`,
103
+ 'PATCH',
104
+ { body },
105
+ );
106
+ }
107
+
108
+ async deleteLine(id, lineId) {
109
+ this.sdk.validateParams(
110
+ { id, lineId },
111
+ {
112
+ id: { type: 'string', required: true },
113
+ lineId: { type: 'string', required: true },
114
+ },
115
+ );
116
+ return await internalRequest(
117
+ this.sdk,
118
+ `/lineGroups/${id}/lines/${lineId}`,
119
+ 'DELETE',
120
+ {},
121
+ );
122
+ }
123
+
124
+ async addMember(id, userId) {
125
+ this.sdk.validateParams(
126
+ { id, userId },
127
+ {
128
+ id: { type: 'string', required: true },
129
+ userId: { type: 'string', required: true },
130
+ },
131
+ );
132
+ return await internalRequest(
133
+ this.sdk,
134
+ `/lineGroups/${id}/members`,
135
+ 'POST',
136
+ { body: { userId } },
137
+ );
138
+ }
139
+
140
+ async deleteMember(id, memberId) {
141
+ this.sdk.validateParams(
142
+ { id, memberId },
143
+ {
144
+ id: { type: 'string', required: true },
145
+ memberId: { type: 'string', required: true },
146
+ },
147
+ );
148
+ return await internalRequest(
149
+ this.sdk,
150
+ `/lineGroups/${id}/members/${memberId}`,
151
+ 'DELETE',
152
+ {},
153
+ );
154
+ }
155
+ }
@@ -115,6 +115,8 @@ export class PhoneNumbersService {
115
115
  textApp,
116
116
  textAppMetaData,
117
117
  textChatVisibility,
118
+ shakenBlockUnsigned,
119
+ shakenMinAttestation,
118
120
  },
119
121
  ) {
120
122
  this.sdk.validateParams(
@@ -131,6 +133,8 @@ export class PhoneNumbersService {
131
133
  textApp,
132
134
  textAppMetaData,
133
135
  textChatVisibility,
136
+ shakenBlockUnsigned,
137
+ shakenMinAttestation,
134
138
  },
135
139
  {
136
140
  id: { type: 'string', required: true },
@@ -146,6 +150,8 @@ export class PhoneNumbersService {
146
150
  textApp: { type: 'string', required: false },
147
151
  textAppMetaData: { type: 'string', required: false },
148
152
  textChatVisibility: { type: 'string', required: false },
153
+ shakenBlockUnsigned: { type: 'boolean', required: false },
154
+ shakenMinAttestation: { type: 'string', required: false },
149
155
  },
150
156
  );
151
157
 
@@ -169,6 +175,11 @@ export class PhoneNumbersService {
169
175
  updateData.textAppMetaData = textAppMetaData;
170
176
  if (textChatVisibility !== undefined)
171
177
  updateData.textChatVisibility = textChatVisibility;
178
+ if (shakenBlockUnsigned !== undefined)
179
+ updateData.shakenBlockUnsigned = shakenBlockUnsigned;
180
+ // null clears the floor when the gate is turned off.
181
+ if (shakenMinAttestation !== undefined)
182
+ updateData.shakenMinAttestation = shakenMinAttestation;
172
183
 
173
184
  const params = {
174
185
  body: updateData,
@@ -0,0 +1,91 @@
1
+ import { internalRequest } from '../base.js';
2
+
3
+ // Ring groups CRUD goes through sdk.objects.* ('ringGroups' /
4
+ // 'ringGroupMembers') -- this service only carries the 3 helper endpoints
5
+ // that don't fit the generic objects shape (ring-groups-plan.md §4.5).
6
+ export class RingGroupsService {
7
+ constructor(sdk) {
8
+ this.sdk = sdk;
9
+ }
10
+
11
+ /**
12
+ * Check whether an extension number is free, with a suggested next free
13
+ * number when it isn't.
14
+ *
15
+ * @param {string|number} extension - Extension number to check
16
+ * @param {string} [excludeId] - An extensions row id to ignore (the
17
+ * group's own extension, when re-checking its current number while
18
+ * editing it)
19
+ * @returns {Promise<Object>} result
20
+ * @returns {boolean} result.available
21
+ * @returns {number|null} result.suggestion - Next free extension when
22
+ * `available` is false
23
+ *
24
+ * @example
25
+ * const { available, suggestion } = await sdk.ringGroups.extensionAvailable(305);
26
+ */
27
+ async extensionAvailable(extension, excludeId) {
28
+ this.sdk.validateParams(
29
+ { extension },
30
+ { extension: { type: 'string', required: true } },
31
+ );
32
+
33
+ const params = {
34
+ query: {
35
+ extension,
36
+ ...(excludeId ? { excludeId } : {}),
37
+ },
38
+ };
39
+
40
+ return await internalRequest(
41
+ this.sdk,
42
+ '/ringGroups/extensions/available',
43
+ 'GET',
44
+ params,
45
+ );
46
+ }
47
+
48
+ /**
49
+ * Rewrites a ring group's hunt-order sortOrder to 1..n in the given
50
+ * order. 400s if `memberIds` isn't exactly the group's current
51
+ * (non-deleted) member set.
52
+ *
53
+ * @param {string} id - Ring group id
54
+ * @param {string[]} memberIds - Member ids in the desired hunt order
55
+ * @returns {Promise<Object>} result with the applied memberIds
56
+ *
57
+ * @example
58
+ * await sdk.ringGroups.reorderMembers('290...', ['291...a', '291...b']);
59
+ */
60
+ async reorderMembers(id, memberIds) {
61
+ this.sdk.validateParams(
62
+ { id, memberIds },
63
+ {
64
+ id: { type: 'string', required: true },
65
+ memberIds: { type: 'array', required: true },
66
+ },
67
+ );
68
+
69
+ const params = { body: { memberIds } };
70
+
71
+ return await internalRequest(
72
+ this.sdk,
73
+ `/ringGroups/${id}/members/reorder`,
74
+ 'POST',
75
+ params,
76
+ );
77
+ }
78
+
79
+ /**
80
+ * Lists ring groups as routing-picker targets: `{ id, name, extension }`
81
+ * per group, for phone-number and final-destination pickers.
82
+ *
83
+ * @returns {Promise<Array<Object>>} targets
84
+ *
85
+ * @example
86
+ * const targets = await sdk.ringGroups.routingTargets();
87
+ */
88
+ async routingTargets() {
89
+ return await internalRequest(this.sdk, '/ringGroups/routingTargets', 'GET', {});
90
+ }
91
+ }
@@ -1338,6 +1338,52 @@ export class TaskService {
1338
1338
  { body: { channel, isTyping } },
1339
1339
  );
1340
1340
  }
1341
+
1342
+ /**
1343
+ * Voice-join offer on an open non-voice task the caller already owns.
1344
+ * @param {string} taskId
1345
+ * @returns {Promise<{taskId: string, expiresAt: string|null, canAccept: boolean}>}
1346
+ */
1347
+ async voiceJoinState(taskId) {
1348
+ this.sdk.validateParams(
1349
+ { taskId },
1350
+ { taskId: { type: 'string', required: true } },
1351
+ );
1352
+ return await internalRequest(
1353
+ this.sdk,
1354
+ `/taskRouter/tasks/${taskId}/voice-join`,
1355
+ 'GET',
1356
+ {},
1357
+ );
1358
+ }
1359
+
1360
+ /** Bridge this worker's phone onto the waiting caller. Sets voiceJoin first. */
1361
+ async voiceJoinAccept(taskId) {
1362
+ this.sdk.validateParams(
1363
+ { taskId },
1364
+ { taskId: { type: 'string', required: true } },
1365
+ );
1366
+ return await internalRequest(
1367
+ this.sdk,
1368
+ `/taskRouter/tasks/${taskId}/voice-join/accept`,
1369
+ 'POST',
1370
+ {},
1371
+ );
1372
+ }
1373
+
1374
+ /** Release the task so a voice-capable worker can be found. */
1375
+ async voiceJoinRelease(taskId) {
1376
+ this.sdk.validateParams(
1377
+ { taskId },
1378
+ { taskId: { type: 'string', required: true } },
1379
+ );
1380
+ return await internalRequest(
1381
+ this.sdk,
1382
+ `/taskRouter/tasks/${taskId}/voice-join/release`,
1383
+ 'POST',
1384
+ {},
1385
+ );
1386
+ }
1341
1387
  }
1342
1388
 
1343
1389
  // CC task-workspace methods (claim/observe/unobserve/observers/take/access)
@@ -599,6 +599,7 @@ export class WorkflowSessionsService {
599
599
  endDate,
600
600
  limit,
601
601
  before,
602
+ activeOnly,
602
603
  } = {}) {
603
604
  this.sdk.validateParams(
604
605
  { workflowId, workflowVersionId },
@@ -622,6 +623,7 @@ export class WorkflowSessionsService {
622
623
  if (endDate) query.endDate = endDate;
623
624
  if (limit) query.limit = limit;
624
625
  if (before) query.before = before;
626
+ if (activeOnly) query.activeOnly = true;
625
627
 
626
628
  const result = await internalRequest(this.sdk, '/workflows/sessions/list', 'GET', {
627
629
  query,