@unboundcx/sdk 4.6.1 → 4.6.2
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/package.json +1 -1
- package/services/permissions.js +131 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.2",
|
|
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",
|
package/services/permissions.js
CHANGED
|
@@ -408,7 +408,7 @@ export class PermissionsService {
|
|
|
408
408
|
return this.sdk._fetch(
|
|
409
409
|
`/permissions/groups/${groupId}/settings/${settingKey}`,
|
|
410
410
|
'PUT',
|
|
411
|
-
{ value },
|
|
411
|
+
{ body: { value } },
|
|
412
412
|
);
|
|
413
413
|
}
|
|
414
414
|
|
|
@@ -436,7 +436,7 @@ export class PermissionsService {
|
|
|
436
436
|
async setGroupPriority(order) {
|
|
437
437
|
this.sdk.validateParams({ order }, { order: { type: 'array', required: true } });
|
|
438
438
|
return this.sdk._fetch('/permissions/groups/priority', 'PUT', {
|
|
439
|
-
order: order.map(String),
|
|
439
|
+
body: { order: order.map(String) },
|
|
440
440
|
});
|
|
441
441
|
}
|
|
442
442
|
|
|
@@ -465,7 +465,7 @@ export class PermissionsService {
|
|
|
465
465
|
return this.sdk._fetch(
|
|
466
466
|
`/permissions/users/${userId}/settings/${settingKey}`,
|
|
467
467
|
'PUT',
|
|
468
|
-
{ value },
|
|
468
|
+
{ body: { value } },
|
|
469
469
|
);
|
|
470
470
|
}
|
|
471
471
|
|
|
@@ -485,4 +485,132 @@ export class PermissionsService {
|
|
|
485
485
|
'DELETE',
|
|
486
486
|
);
|
|
487
487
|
}
|
|
488
|
+
|
|
489
|
+
// ---- Group-assigned skills and queues (§9.5) --------------------------
|
|
490
|
+
// Set-shaped, not scalar: they union across every group a user belongs to
|
|
491
|
+
// and never consult group priority. Writes fan out to each member's
|
|
492
|
+
// materialized userSkills/queueUsers rows and re-push their live worker.
|
|
493
|
+
//
|
|
494
|
+
// NOTE for anyone adding a method here: `_fetch`'s third argument is the
|
|
495
|
+
// params envelope — a request body MUST be passed as `{ body: {...} }`.
|
|
496
|
+
// Passing the payload bare silently sends no body at all.
|
|
497
|
+
|
|
498
|
+
/** Skill + queue vocabulary for the group assignment pickers. */
|
|
499
|
+
async getTaskRoutingCatalog() {
|
|
500
|
+
return this.sdk._fetch('/permissions/task-routing/catalog', 'GET');
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/** Skills this group grants. @returns {Promise<{results: Array<{skillId}>}>} */
|
|
504
|
+
async listGroupSkills(groupId) {
|
|
505
|
+
groupId = String(groupId);
|
|
506
|
+
this.sdk.validateParams(
|
|
507
|
+
{ groupId },
|
|
508
|
+
{ groupId: { type: 'string', required: true } },
|
|
509
|
+
);
|
|
510
|
+
return this.sdk._fetch(`/permissions/groups/${groupId}/skills`, 'GET');
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/** Replace the group's full skill list. */
|
|
514
|
+
async setGroupSkills(groupId, skillIds) {
|
|
515
|
+
groupId = String(groupId);
|
|
516
|
+
this.sdk.validateParams(
|
|
517
|
+
{ groupId, skillIds },
|
|
518
|
+
{
|
|
519
|
+
groupId: { type: 'string', required: true },
|
|
520
|
+
skillIds: { type: 'array', required: true },
|
|
521
|
+
},
|
|
522
|
+
);
|
|
523
|
+
return this.sdk._fetch(`/permissions/groups/${groupId}/skills`, 'PUT', {
|
|
524
|
+
body: { skillIds: skillIds.map(String) },
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/** Queues this group grants. @returns {Promise<{results: Array<{queueId, access, autoLogin}>}>} */
|
|
529
|
+
async listGroupQueues(groupId) {
|
|
530
|
+
groupId = String(groupId);
|
|
531
|
+
this.sdk.validateParams(
|
|
532
|
+
{ groupId },
|
|
533
|
+
{ groupId: { type: 'string', required: true } },
|
|
534
|
+
);
|
|
535
|
+
return this.sdk._fetch(`/permissions/groups/${groupId}/queues`, 'GET');
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Replace the group's full queue list.
|
|
540
|
+
* @param {Array<{queueId: string, access?: boolean, autoLogin?: boolean}>} queues
|
|
541
|
+
* `autoLogin` seeds the derived membership row and takes effect at the
|
|
542
|
+
* agent's next availability transition — it never logs anyone in
|
|
543
|
+
* mid-session.
|
|
544
|
+
*/
|
|
545
|
+
async setGroupQueues(groupId, queues) {
|
|
546
|
+
groupId = String(groupId);
|
|
547
|
+
this.sdk.validateParams(
|
|
548
|
+
{ groupId, queues },
|
|
549
|
+
{
|
|
550
|
+
groupId: { type: 'string', required: true },
|
|
551
|
+
queues: { type: 'array', required: true },
|
|
552
|
+
},
|
|
553
|
+
);
|
|
554
|
+
return this.sdk._fetch(`/permissions/groups/${groupId}/queues`, 'PUT', {
|
|
555
|
+
body: {
|
|
556
|
+
queues: queues.map((q) => ({
|
|
557
|
+
queueId: String(q.queueId),
|
|
558
|
+
access: q.access !== false,
|
|
559
|
+
autoLogin: Boolean(q.autoLogin),
|
|
560
|
+
})),
|
|
561
|
+
},
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* A user's effective skills/queues with the source of each row, so the UI
|
|
567
|
+
* can show "granted by group X" instead of offering a control that would
|
|
568
|
+
* silently no-op.
|
|
569
|
+
*/
|
|
570
|
+
async getUserTaskRouting(userId) {
|
|
571
|
+
userId = String(userId);
|
|
572
|
+
this.sdk.validateParams(
|
|
573
|
+
{ userId },
|
|
574
|
+
{ userId: { type: 'string', required: true } },
|
|
575
|
+
);
|
|
576
|
+
return this.sdk._fetch(`/permissions/users/${userId}/task-routing`, 'GET');
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/** Exclude one group-granted skill/queue from this user ("in Sales but not queue X"). */
|
|
580
|
+
async addTaskRoutingExclusion(userId, settingKey, value) {
|
|
581
|
+
userId = String(userId);
|
|
582
|
+
settingKey = String(settingKey);
|
|
583
|
+
value = String(value);
|
|
584
|
+
this.sdk.validateParams(
|
|
585
|
+
{ userId, settingKey, value },
|
|
586
|
+
{
|
|
587
|
+
userId: { type: 'string', required: true },
|
|
588
|
+
settingKey: { type: 'string', required: true },
|
|
589
|
+
value: { type: 'string', required: true },
|
|
590
|
+
},
|
|
591
|
+
);
|
|
592
|
+
return this.sdk._fetch(
|
|
593
|
+
`/permissions/users/${userId}/task-routing/exclusions/${settingKey}/${value}`,
|
|
594
|
+
'PUT',
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/** Drop an exclusion, letting the group grant apply again. */
|
|
599
|
+
async removeTaskRoutingExclusion(userId, settingKey, value) {
|
|
600
|
+
userId = String(userId);
|
|
601
|
+
settingKey = String(settingKey);
|
|
602
|
+
value = String(value);
|
|
603
|
+
this.sdk.validateParams(
|
|
604
|
+
{ userId, settingKey, value },
|
|
605
|
+
{
|
|
606
|
+
userId: { type: 'string', required: true },
|
|
607
|
+
settingKey: { type: 'string', required: true },
|
|
608
|
+
value: { type: 'string', required: true },
|
|
609
|
+
},
|
|
610
|
+
);
|
|
611
|
+
return this.sdk._fetch(
|
|
612
|
+
`/permissions/users/${userId}/task-routing/exclusions/${settingKey}/${value}`,
|
|
613
|
+
'DELETE',
|
|
614
|
+
);
|
|
615
|
+
}
|
|
488
616
|
}
|