@unboundcx/sdk 4.8.8 → 4.8.9
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 +3 -0
- package/package.json +1 -1
- package/services/chat.js +851 -0
- package/services/directory.js +7 -73
- package/services/inbox.js +5 -5
- package/services/taskRouter/MetricsService.js +0 -54
- package/services/taskRouter/TaskRouterService.js +0 -2
- package/services/video.js +0 -144
- package/services/taskRouter/CCService.js +0 -302
package/services/directory.js
CHANGED
|
@@ -15,33 +15,27 @@ export class DirectoryService {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Add a person
|
|
19
|
-
*
|
|
18
|
+
* Add a person or company to directory favorites. Reactivates a
|
|
19
|
+
* soft-deleted favorite on unique conflict.
|
|
20
20
|
*
|
|
21
21
|
* @param {Object} params
|
|
22
|
-
* @param {string} params.objectType - 'person'
|
|
22
|
+
* @param {string} params.objectType - 'person' or 'company' (required).
|
|
23
23
|
* @param {string} params.objectId - Id of the favorited record (required).
|
|
24
24
|
* @param {string[]} [params.channelIds] - Channel ids to pin for this favorite.
|
|
25
|
-
* @param {string} [params.channelId] - Channel id to pin for this favorite.
|
|
26
|
-
* @param {string} [params.numberField] - Number field to associate with this favorite.
|
|
27
25
|
* @returns {Promise<Object>} The created (or reactivated) favorite.
|
|
28
26
|
*/
|
|
29
|
-
async addFavorite({ objectType, objectId, channelIds
|
|
27
|
+
async addFavorite({ objectType, objectId, channelIds }) {
|
|
30
28
|
this.sdk.validateParams(
|
|
31
|
-
{ objectType, objectId, channelIds
|
|
29
|
+
{ objectType, objectId, channelIds },
|
|
32
30
|
{
|
|
33
31
|
objectType: { type: 'string', required: true },
|
|
34
32
|
objectId: { type: 'string', required: true },
|
|
35
33
|
channelIds: { type: 'array', required: false },
|
|
36
|
-
channelId: { type: 'string', required: false },
|
|
37
|
-
numberField: { type: 'string', required: false },
|
|
38
34
|
},
|
|
39
35
|
);
|
|
40
36
|
|
|
41
37
|
const body = { objectType, objectId };
|
|
42
38
|
if (channelIds !== undefined) body.channelIds = channelIds;
|
|
43
|
-
if (channelId !== undefined) body.channelId = channelId;
|
|
44
|
-
if (numberField !== undefined) body.numberField = numberField;
|
|
45
39
|
|
|
46
40
|
const params = { body };
|
|
47
41
|
|
|
@@ -55,27 +49,21 @@ export class DirectoryService {
|
|
|
55
49
|
* @param {string} favoriteId - Id of the favorite to update (required).
|
|
56
50
|
* @param {Object} params
|
|
57
51
|
* @param {string[]} [params.channelIds]
|
|
58
|
-
* @param {string} [params.channelId]
|
|
59
|
-
* @param {string} [params.numberField]
|
|
60
52
|
* @param {number} [params.sortOrder]
|
|
61
53
|
* @returns {Promise<Object>} The updated favorite.
|
|
62
54
|
*/
|
|
63
|
-
async updateFavorite(favoriteId, { channelIds,
|
|
55
|
+
async updateFavorite(favoriteId, { channelIds, sortOrder } = {}) {
|
|
64
56
|
this.sdk.validateParams(
|
|
65
|
-
{ favoriteId, channelIds,
|
|
57
|
+
{ favoriteId, channelIds, sortOrder },
|
|
66
58
|
{
|
|
67
59
|
favoriteId: { type: 'string', required: true },
|
|
68
60
|
channelIds: { type: 'array', required: false },
|
|
69
|
-
channelId: { type: 'string', required: false },
|
|
70
|
-
numberField: { type: 'string', required: false },
|
|
71
61
|
sortOrder: { type: 'number', required: false },
|
|
72
62
|
},
|
|
73
63
|
);
|
|
74
64
|
|
|
75
65
|
const body = {};
|
|
76
66
|
if (channelIds !== undefined) body.channelIds = channelIds;
|
|
77
|
-
if (channelId !== undefined) body.channelId = channelId;
|
|
78
|
-
if (numberField !== undefined) body.numberField = numberField;
|
|
79
67
|
if (sortOrder !== undefined) body.sortOrder = sortOrder;
|
|
80
68
|
|
|
81
69
|
const params = { body };
|
|
@@ -133,58 +121,4 @@ export class DirectoryService {
|
|
|
133
121
|
);
|
|
134
122
|
return result;
|
|
135
123
|
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* List the current user's directory contacts.
|
|
139
|
-
*
|
|
140
|
-
* @returns {Promise<{contacts: Object[]}>}
|
|
141
|
-
*/
|
|
142
|
-
async listContacts() {
|
|
143
|
-
const result = await this.sdk._fetch('/directory/contacts', 'GET');
|
|
144
|
-
return result;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Add a person or company to directory contacts.
|
|
149
|
-
*
|
|
150
|
-
* @param {Object} params
|
|
151
|
-
* @param {string} params.objectType - 'person' or 'company' (required).
|
|
152
|
-
* @param {string} params.objectId - Id of the contacted record (required).
|
|
153
|
-
* @returns {Promise<Object>} The created contact.
|
|
154
|
-
*/
|
|
155
|
-
async addContact({ objectType, objectId }) {
|
|
156
|
-
this.sdk.validateParams(
|
|
157
|
-
{ objectType, objectId },
|
|
158
|
-
{
|
|
159
|
-
objectType: { type: 'string', required: true },
|
|
160
|
-
objectId: { type: 'string', required: true },
|
|
161
|
-
},
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
const params = { body: { objectType, objectId } };
|
|
165
|
-
|
|
166
|
-
const result = await this.sdk._fetch('/directory/contacts', 'POST', params);
|
|
167
|
-
return result;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Remove a directory contact.
|
|
172
|
-
*
|
|
173
|
-
* @param {string} contactId - Id of the contact to remove (required).
|
|
174
|
-
* @returns {Promise<Object>}
|
|
175
|
-
*/
|
|
176
|
-
async removeContact(contactId) {
|
|
177
|
-
this.sdk.validateParams(
|
|
178
|
-
{ contactId },
|
|
179
|
-
{
|
|
180
|
-
contactId: { type: 'string', required: true },
|
|
181
|
-
},
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
const result = await this.sdk._fetch(
|
|
185
|
-
`/directory/contacts/${contactId}`,
|
|
186
|
-
'DELETE',
|
|
187
|
-
);
|
|
188
|
-
return result;
|
|
189
|
-
}
|
|
190
124
|
}
|
package/services/inbox.js
CHANGED
|
@@ -9,8 +9,8 @@ export class InboxService {
|
|
|
9
9
|
*
|
|
10
10
|
* @param {Object} params
|
|
11
11
|
* @param {string|string[]} [params.types] - Source kinds to include
|
|
12
|
-
* ('call','voicemail','fax','sms'
|
|
13
|
-
*
|
|
12
|
+
* ('call','voicemail','fax','sms'). Pass an array or a comma-joined
|
|
13
|
+
* string; omit to include all kinds.
|
|
14
14
|
* @param {number} [params.limit] - Max items to return.
|
|
15
15
|
* @param {string} [params.before] - UTC cursor 'YYYY-MM-DD HH:mm:ss';
|
|
16
16
|
* only items strictly older than this are returned.
|
|
@@ -82,10 +82,10 @@ export class InboxService {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* Fetch inbox stats (calls/talk time/missed/unread voicemail
|
|
86
|
-
*
|
|
85
|
+
* Fetch inbox stats (calls/talk time/missed/unread voicemail) for the
|
|
86
|
+
* current user.
|
|
87
87
|
*
|
|
88
|
-
* @returns {Promise<{callsToday: number, talkTimeSeconds: number, missedToday: number, unreadVoicemail: number, oldestUnreadVoicemailAt: string|null
|
|
88
|
+
* @returns {Promise<{callsToday: number, talkTimeSeconds: number, missedToday: number, unreadVoicemail: number, oldestUnreadVoicemailAt: string|null}>}
|
|
89
89
|
*/
|
|
90
90
|
async stats() {
|
|
91
91
|
const result = await this.sdk._fetch('/inbox/stats', 'GET');
|
|
@@ -108,58 +108,4 @@ export class MetricsService {
|
|
|
108
108
|
);
|
|
109
109
|
return result;
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Get windowed queue/company metrics with a compare-window delta, per
|
|
114
|
-
* queue + an 'all' rollup (avg wait, avg handle, service level, longest
|
|
115
|
-
* wait, live depth/workers, and a waiting-count sparkline).
|
|
116
|
-
*
|
|
117
|
-
* @param {Object} params - Parameters
|
|
118
|
-
* @param {string[]} [params.queueIds] - Queue ids to scope to. Omit/empty for all queues.
|
|
119
|
-
* @param {string} params.from - ISO-8601 window start
|
|
120
|
-
* @param {string} params.to - ISO-8601 window end
|
|
121
|
-
* @param {string} params.compareFrom - ISO-8601 compare-window start
|
|
122
|
-
* @param {string} params.compareTo - ISO-8601 compare-window end
|
|
123
|
-
* @returns {Promise<Object>} result
|
|
124
|
-
* @returns {Object} result.window - `{from, to}`
|
|
125
|
-
* @returns {Object} result.compare - `{from, to}`
|
|
126
|
-
* @returns {Object} result.all - Rollup across every scoped queue (avgWaitSec, avgHandleSec, serviceLevelPct, longestWaitSec, depth, workersAvailable, workersTotal, waitingSparkline, deltas)
|
|
127
|
-
* @returns {Object} result.queues - Same shape as `result.all`, keyed by queueId
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* const { all, queues } = await sdk.taskRouter.metrics.getWindow({
|
|
131
|
-
* queueIds: ['q1', 'q2'],
|
|
132
|
-
* from: '2026-08-19T22:00:00Z',
|
|
133
|
-
* to: '2026-08-19T23:00:00Z',
|
|
134
|
-
* compareFrom: '2026-08-19T21:00:00Z',
|
|
135
|
-
* compareTo: '2026-08-19T22:00:00Z',
|
|
136
|
-
* });
|
|
137
|
-
* console.log(all.serviceLevelPct, all.deltas.serviceLevelPct);
|
|
138
|
-
*/
|
|
139
|
-
async getWindow(params = {}) {
|
|
140
|
-
const { queueIds, from, to, compareFrom, compareTo } = params;
|
|
141
|
-
|
|
142
|
-
this.sdk.validateParams(
|
|
143
|
-
{ queueIds, from, to, compareFrom, compareTo },
|
|
144
|
-
{
|
|
145
|
-
queueIds: { type: 'array', required: false },
|
|
146
|
-
from: { type: 'string', required: true },
|
|
147
|
-
to: { type: 'string', required: true },
|
|
148
|
-
compareFrom: { type: 'string', required: false },
|
|
149
|
-
compareTo: { type: 'string', required: false },
|
|
150
|
-
},
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
const query = { from, to };
|
|
154
|
-
if (queueIds && queueIds.length) query.queueIds = queueIds.join(',');
|
|
155
|
-
if (compareFrom) query.compareFrom = compareFrom;
|
|
156
|
-
if (compareTo) query.compareTo = compareTo;
|
|
157
|
-
|
|
158
|
-
const result = await this.sdk._fetch(
|
|
159
|
-
'/taskRouter/metrics/window',
|
|
160
|
-
'GET',
|
|
161
|
-
{ query },
|
|
162
|
-
);
|
|
163
|
-
return result;
|
|
164
|
-
}
|
|
165
111
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { WorkerService } from './WorkerService.js';
|
|
2
2
|
import { TaskService } from './TaskService.js';
|
|
3
3
|
import { MetricsService } from './MetricsService.js';
|
|
4
|
-
import { CCService } from './CCService.js';
|
|
5
4
|
|
|
6
5
|
export class TaskRouterService {
|
|
7
6
|
constructor(sdk) {
|
|
@@ -9,6 +8,5 @@ export class TaskRouterService {
|
|
|
9
8
|
this.worker = new WorkerService(sdk);
|
|
10
9
|
this.task = new TaskService(sdk);
|
|
11
10
|
this.metrics = new MetricsService(sdk);
|
|
12
|
-
this.cc = new CCService(sdk);
|
|
13
11
|
}
|
|
14
12
|
}
|
package/services/video.js
CHANGED
|
@@ -230,7 +230,6 @@ export class VideoService {
|
|
|
230
230
|
calendarProvider,
|
|
231
231
|
vocabularyTerms,
|
|
232
232
|
shareOcrEnabled,
|
|
233
|
-
earlyJoinMinutes,
|
|
234
233
|
}) {
|
|
235
234
|
this.sdk.validateParams(
|
|
236
235
|
{
|
|
@@ -260,7 +259,6 @@ export class VideoService {
|
|
|
260
259
|
calendarProvider,
|
|
261
260
|
vocabularyTerms,
|
|
262
261
|
shareOcrEnabled,
|
|
263
|
-
earlyJoinMinutes,
|
|
264
262
|
},
|
|
265
263
|
{
|
|
266
264
|
name: { type: 'string', required: false },
|
|
@@ -289,9 +287,6 @@ export class VideoService {
|
|
|
289
287
|
calendarProvider: { type: 'string', required: false },
|
|
290
288
|
vocabularyTerms: { type: 'array', required: false },
|
|
291
289
|
shareOcrEnabled: { type: 'boolean', required: false },
|
|
292
|
-
// 0 = strict at startTime, 5 = 5-min early window (api rejects
|
|
293
|
-
// other values); omit for no schedule-window enforcement.
|
|
294
|
-
earlyJoinMinutes: { type: 'number', required: false },
|
|
295
290
|
},
|
|
296
291
|
);
|
|
297
292
|
const params = {
|
|
@@ -322,7 +317,6 @@ export class VideoService {
|
|
|
322
317
|
calendarProvider,
|
|
323
318
|
vocabularyTerms,
|
|
324
319
|
shareOcrEnabled,
|
|
325
|
-
earlyJoinMinutes,
|
|
326
320
|
},
|
|
327
321
|
};
|
|
328
322
|
const result = await this.sdk._fetch(`/video`, 'POST', params);
|
|
@@ -368,8 +362,6 @@ export class VideoService {
|
|
|
368
362
|
validationSchema.vocabularyTerms = { type: 'array' };
|
|
369
363
|
if ('shareOcrEnabled' in update)
|
|
370
364
|
validationSchema.shareOcrEnabled = { type: 'boolean' };
|
|
371
|
-
if ('earlyJoinMinutes' in update)
|
|
372
|
-
validationSchema.earlyJoinMinutes = { type: 'number' };
|
|
373
365
|
|
|
374
366
|
if (Object.keys(validationSchema).length > 0) {
|
|
375
367
|
this.sdk.validateParams(update, validationSchema);
|
|
@@ -1419,140 +1411,4 @@ export class VideoService {
|
|
|
1419
1411
|
);
|
|
1420
1412
|
return result;
|
|
1421
1413
|
}
|
|
1422
|
-
|
|
1423
|
-
/**
|
|
1424
|
-
* Get (or lazily create) the calling user's personal meeting room for this
|
|
1425
|
-
* account. Every account user has exactly one; the first call provisions
|
|
1426
|
-
* it server-side.
|
|
1427
|
-
*
|
|
1428
|
-
* NOTE: implemented flat (`getPersonalRoom`/`updatePersonalRoom`/
|
|
1429
|
-
* `regeneratePersonalRoomPin`/`resolvePersonalRoom`) rather than the
|
|
1430
|
-
* `sdk.video.personalRoom.{get,update,regeneratePin}` namespace named in
|
|
1431
|
-
* the meet-hub plan — this file has no existing nested-namespace
|
|
1432
|
-
* precedent, so flat matches every other method here.
|
|
1433
|
-
*
|
|
1434
|
-
* @returns {Promise<{personalRoom: {id: string, slug: string, url: string|null, dialInPin: string, guestsCanStart: boolean}}>}
|
|
1435
|
-
*/
|
|
1436
|
-
async getPersonalRoom() {
|
|
1437
|
-
const result = await this.sdk._fetch('/video/personal-room', 'GET');
|
|
1438
|
-
return result;
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
/**
|
|
1442
|
-
* Update the calling user's personal meeting room (slug and/or
|
|
1443
|
-
* guests-can-start). Omit a field to leave it unchanged.
|
|
1444
|
-
*
|
|
1445
|
-
* @param {Object} [update]
|
|
1446
|
-
* @param {string} [update.slug] - New slug (3-32 chars, lowercase/numbers/hyphens, not reserved). 409-equivalent BadRequestError on collision.
|
|
1447
|
-
* @param {boolean} [update.guestsCanStart] - Whether guests can start the room without the host present.
|
|
1448
|
-
* @returns {Promise<{personalRoom: {id: string, slug: string, url: string|null, dialInPin: string, guestsCanStart: boolean}}>}
|
|
1449
|
-
*/
|
|
1450
|
-
async updatePersonalRoom({ slug, guestsCanStart, password } = {}) {
|
|
1451
|
-
const validationSchema = {};
|
|
1452
|
-
if (slug !== undefined) validationSchema.slug = { type: 'string' };
|
|
1453
|
-
if (guestsCanStart !== undefined)
|
|
1454
|
-
validationSchema.guestsCanStart = { type: 'boolean' };
|
|
1455
|
-
// Static room passcode — 4-6 digits (api-enforced); applied to every
|
|
1456
|
-
// session the room link mints.
|
|
1457
|
-
if (password !== undefined) validationSchema.password = { type: 'string' };
|
|
1458
|
-
|
|
1459
|
-
if (Object.keys(validationSchema).length > 0) {
|
|
1460
|
-
this.sdk.validateParams(
|
|
1461
|
-
{ slug, guestsCanStart, password },
|
|
1462
|
-
validationSchema,
|
|
1463
|
-
);
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
const body = {};
|
|
1467
|
-
if (slug !== undefined) body.slug = slug;
|
|
1468
|
-
if (guestsCanStart !== undefined) body.guestsCanStart = guestsCanStart;
|
|
1469
|
-
if (password !== undefined) body.password = password;
|
|
1470
|
-
|
|
1471
|
-
const params = { body };
|
|
1472
|
-
const result = await this.sdk._fetch(
|
|
1473
|
-
'/video/personal-room',
|
|
1474
|
-
'PUT',
|
|
1475
|
-
params,
|
|
1476
|
-
);
|
|
1477
|
-
return result;
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
/**
|
|
1481
|
-
* Regenerate the dial-in PIN for the calling user's personal meeting room.
|
|
1482
|
-
*
|
|
1483
|
-
* @returns {Promise<{personalRoom: {id: string, dialInPin: string}}>}
|
|
1484
|
-
*/
|
|
1485
|
-
async regeneratePersonalRoomPin() {
|
|
1486
|
-
const result = await this.sdk._fetch(
|
|
1487
|
-
'/video/personal-room/regenerate-pin',
|
|
1488
|
-
'POST',
|
|
1489
|
-
{},
|
|
1490
|
-
);
|
|
1491
|
-
return result;
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
/**
|
|
1495
|
-
* Live availability dry-run for a personal-room slug (settings editor).
|
|
1496
|
-
*
|
|
1497
|
-
* @param {string} slug - Candidate slug.
|
|
1498
|
-
* @returns {Promise<{slug: string, available: boolean, reason?: 'invalid'|'taken'}>}
|
|
1499
|
-
*/
|
|
1500
|
-
async checkPersonalRoomSlug(slug) {
|
|
1501
|
-
this.sdk.validateParams(
|
|
1502
|
-
{ slug },
|
|
1503
|
-
{ slug: { type: 'string', required: true } },
|
|
1504
|
-
);
|
|
1505
|
-
const result = await this.sdk._fetch(
|
|
1506
|
-
`/video/personal-room/slug-available?slug=${encodeURIComponent(slug)}`,
|
|
1507
|
-
'GET',
|
|
1508
|
-
{},
|
|
1509
|
-
);
|
|
1510
|
-
return result;
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
/**
|
|
1514
|
-
* Regenerate the static web passcode for the calling user's personal
|
|
1515
|
-
* meeting room (a separate secret from the dial-in PIN). Sessions minted
|
|
1516
|
-
* after this use the new value.
|
|
1517
|
-
*
|
|
1518
|
-
* @returns {Promise<{personalRoom: {id: string, password: string}}>}
|
|
1519
|
-
*/
|
|
1520
|
-
async regeneratePersonalRoomPassword() {
|
|
1521
|
-
const result = await this.sdk._fetch(
|
|
1522
|
-
'/video/personal-room/regenerate-password',
|
|
1523
|
-
'POST',
|
|
1524
|
-
{},
|
|
1525
|
-
);
|
|
1526
|
-
return result;
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
/**
|
|
1530
|
-
* Resolve a personal-room slug to a live session (join page). Guest-capable
|
|
1531
|
-
* — mints/claims a fresh meeting if none is live, or returns the already
|
|
1532
|
-
* -claimed session; if the caller is an unauthenticated guest and the room
|
|
1533
|
-
* doesn't allow guests to start, returns `waitingForHost: true` instead.
|
|
1534
|
-
* Guests only receive `password` when they supply the room's static
|
|
1535
|
-
* passcode; otherwise `passwordRequired: true` is returned and the join
|
|
1536
|
-
* page should prompt.
|
|
1537
|
-
*
|
|
1538
|
-
* @param {string} slug - The personal room's slug.
|
|
1539
|
-
* @param {{password?: string}} [options] - The room's static passcode, when known.
|
|
1540
|
-
* @returns {Promise<{claimed: boolean, meetingId?: string, friendlyName?: string, password?: string, passwordRequired?: boolean, waitingForHost?: boolean}>}
|
|
1541
|
-
*/
|
|
1542
|
-
async resolvePersonalRoom(slug, { password } = {}) {
|
|
1543
|
-
this.sdk.validateParams(
|
|
1544
|
-
{ slug, password },
|
|
1545
|
-
{
|
|
1546
|
-
slug: { type: 'string', required: true },
|
|
1547
|
-
password: { type: 'string', required: false },
|
|
1548
|
-
},
|
|
1549
|
-
);
|
|
1550
|
-
|
|
1551
|
-
const result = await this.sdk._fetch(
|
|
1552
|
-
`/video/personal-room/resolve/${slug}`,
|
|
1553
|
-
'POST',
|
|
1554
|
-
{ body: { password } },
|
|
1555
|
-
);
|
|
1556
|
-
return result;
|
|
1557
|
-
}
|
|
1558
1414
|
}
|