@unboundcx/sdk 4.13.115 → 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 +3 -0
- package/package.json +1 -1
- package/services/lineGroups.js +155 -0
package/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import { PortalsService } from './services/portals.js';
|
|
|
22
22
|
import { DealRegistrationsService } from './services/dealRegistrations.js';
|
|
23
23
|
import { SipEndpointsService } from './services/sipEndpoints.js';
|
|
24
24
|
import { RingGroupsService } from './services/ringGroups.js';
|
|
25
|
+
import { LineGroupsService } from './services/lineGroups.js';
|
|
25
26
|
import { WebchatService } from './services/webchat.js';
|
|
26
27
|
import { CobrowseService } from './services/cobrowse.js';
|
|
27
28
|
import { MessageTemplatesService } from './services/messageTemplates.js';
|
|
@@ -122,6 +123,7 @@ class UnboundSDK extends BaseSDK {
|
|
|
122
123
|
this.dealRegistrations = new DealRegistrationsService(this);
|
|
123
124
|
this.sipEndpoints = new SipEndpointsService(this);
|
|
124
125
|
this.ringGroups = new RingGroupsService(this);
|
|
126
|
+
this.lineGroups = new LineGroupsService(this);
|
|
125
127
|
this.webchat = new WebchatService(this);
|
|
126
128
|
this.cobrowse = new CobrowseService(this);
|
|
127
129
|
this.messageTemplates = new MessageTemplatesService(this);
|
|
@@ -323,6 +325,7 @@ export { PortalsService } from './services/portals.js';
|
|
|
323
325
|
export { DealRegistrationsService } from './services/dealRegistrations.js';
|
|
324
326
|
export { SipEndpointsService } from './services/sipEndpoints.js';
|
|
325
327
|
export { RingGroupsService } from './services/ringGroups.js';
|
|
328
|
+
export { LineGroupsService } from './services/lineGroups.js';
|
|
326
329
|
export { WebchatService, WebchatWidgetsService } from './services/webchat.js';
|
|
327
330
|
export { CobrowseService, CobrowseVisitorService } from './services/cobrowse.js';
|
|
328
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.
|
|
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
|
+
}
|