@unboundcx/sdk 4.13.115 → 4.13.117

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
@@ -22,6 +22,8 @@ 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';
26
+ import { EmergencyService } from './services/emergency.js';
25
27
  import { WebchatService } from './services/webchat.js';
26
28
  import { CobrowseService } from './services/cobrowse.js';
27
29
  import { MessageTemplatesService } from './services/messageTemplates.js';
@@ -122,6 +124,8 @@ class UnboundSDK extends BaseSDK {
122
124
  this.dealRegistrations = new DealRegistrationsService(this);
123
125
  this.sipEndpoints = new SipEndpointsService(this);
124
126
  this.ringGroups = new RingGroupsService(this);
127
+ this.lineGroups = new LineGroupsService(this);
128
+ this.emergency = new EmergencyService(this);
125
129
  this.webchat = new WebchatService(this);
126
130
  this.cobrowse = new CobrowseService(this);
127
131
  this.messageTemplates = new MessageTemplatesService(this);
@@ -323,6 +327,8 @@ export { PortalsService } from './services/portals.js';
323
327
  export { DealRegistrationsService } from './services/dealRegistrations.js';
324
328
  export { SipEndpointsService } from './services/sipEndpoints.js';
325
329
  export { RingGroupsService } from './services/ringGroups.js';
330
+ export { LineGroupsService } from './services/lineGroups.js';
331
+ export { EmergencyService } from './services/emergency.js';
326
332
  export { WebchatService, WebchatWidgetsService } from './services/webchat.js';
327
333
  export { CobrowseService, CobrowseVisitorService } from './services/cobrowse.js';
328
334
  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.115",
3
+ "version": "4.13.117",
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,148 @@
1
+ import { internalRequest } from '../base.js';
2
+
3
+ export class EmergencyService {
4
+ constructor(sdk) {
5
+ this.sdk = sdk;
6
+ }
7
+
8
+ async getMyLocation() {
9
+ return await internalRequest(this.sdk, '/emergency/me', 'GET', {});
10
+ }
11
+
12
+ async saveMyLocation(body) {
13
+ this.sdk.validateParams(
14
+ { body },
15
+ { body: { type: 'object', required: true } },
16
+ );
17
+ return await internalRequest(this.sdk, '/emergency/me', 'PUT', { body });
18
+ }
19
+
20
+ async validateAddress(body) {
21
+ this.sdk.validateParams(
22
+ { body },
23
+ { body: { type: 'object', required: true } },
24
+ );
25
+ return await internalRequest(this.sdk, '/emergency/validate', 'POST', {
26
+ body,
27
+ });
28
+ }
29
+
30
+ async listSites() {
31
+ return await internalRequest(this.sdk, '/emergency/sites', 'GET', {});
32
+ }
33
+
34
+ async createSite(body) {
35
+ this.sdk.validateParams(
36
+ { body },
37
+ { body: { type: 'object', required: true } },
38
+ );
39
+ return await internalRequest(this.sdk, '/emergency/sites', 'POST', { body });
40
+ }
41
+
42
+ async updateSite(id, body) {
43
+ this.sdk.validateParams(
44
+ { id, body },
45
+ {
46
+ id: { type: 'string', required: true },
47
+ body: { type: 'object', required: true },
48
+ },
49
+ );
50
+ return await internalRequest(this.sdk, `/emergency/sites/${id}`, 'PATCH', {
51
+ body,
52
+ });
53
+ }
54
+
55
+ async deleteSite(id) {
56
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
57
+ return await internalRequest(this.sdk, `/emergency/sites/${id}`, 'DELETE', {});
58
+ }
59
+
60
+ async addFloor(id, body) {
61
+ this.sdk.validateParams(
62
+ { id, body },
63
+ {
64
+ id: { type: 'string', required: true },
65
+ body: { type: 'object', required: true },
66
+ },
67
+ );
68
+ return await internalRequest(
69
+ this.sdk,
70
+ `/emergency/sites/${id}/floors`,
71
+ 'POST',
72
+ { body },
73
+ );
74
+ }
75
+
76
+ async deleteFloor(id, floorId) {
77
+ this.sdk.validateParams(
78
+ { id, floorId },
79
+ {
80
+ id: { type: 'string', required: true },
81
+ floorId: { type: 'string', required: true },
82
+ },
83
+ );
84
+ return await internalRequest(
85
+ this.sdk,
86
+ `/emergency/sites/${id}/floors/${floorId}`,
87
+ 'DELETE',
88
+ {},
89
+ );
90
+ }
91
+
92
+ async listAlertRules() {
93
+ return await internalRequest(this.sdk, '/emergency/alert-rules', 'GET', {});
94
+ }
95
+
96
+ async createAlertRule(body) {
97
+ this.sdk.validateParams(
98
+ { body },
99
+ { body: { type: 'object', required: true } },
100
+ );
101
+ return await internalRequest(this.sdk, '/emergency/alert-rules', 'POST', {
102
+ body,
103
+ });
104
+ }
105
+
106
+ async updateAlertRule(id, body) {
107
+ this.sdk.validateParams(
108
+ { id, body },
109
+ {
110
+ id: { type: 'string', required: true },
111
+ body: { type: 'object', required: true },
112
+ },
113
+ );
114
+ return await internalRequest(
115
+ this.sdk,
116
+ `/emergency/alert-rules/${id}`,
117
+ 'PATCH',
118
+ { body },
119
+ );
120
+ }
121
+
122
+ async deleteAlertRule(id) {
123
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
124
+ return await internalRequest(
125
+ this.sdk,
126
+ `/emergency/alert-rules/${id}`,
127
+ 'DELETE',
128
+ {},
129
+ );
130
+ }
131
+
132
+ async listPoolNumbers() {
133
+ return await internalRequest(this.sdk, '/emergency/pool', 'GET', {});
134
+ }
135
+
136
+ async markPoolNumber(body) {
137
+ this.sdk.validateParams(
138
+ { body },
139
+ { body: { type: 'object', required: true } },
140
+ );
141
+ return await internalRequest(this.sdk, '/emergency/pool', 'POST', { body });
142
+ }
143
+
144
+ async unmarkPoolNumber(id) {
145
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
146
+ return await internalRequest(this.sdk, `/emergency/pool/${id}`, 'DELETE', {});
147
+ }
148
+ }
@@ -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
+ }