@unboundcx/sdk 4.13.146-security.0 → 4.13.146-security.1

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.
Files changed (40) hide show
  1. package/README.md +0 -7
  2. package/index.js +31 -1
  3. package/lib/journeyLayout.js +132 -0
  4. package/package.json +5 -2
  5. package/services/journeys/JourneyDraftService.js +92 -0
  6. package/services/journeys/JourneyGoalsService.js +57 -0
  7. package/services/journeys/JourneyMembersService.js +246 -0
  8. package/services/journeys/JourneyTypesService.js +59 -0
  9. package/services/journeys/JourneyWorklistService.js +74 -0
  10. package/services/journeys/JourneysService.js +392 -0
  11. package/services/layouts.js +13 -4
  12. package/services/messageTemplates.js +109 -2
  13. package/services/messaging/EmailTemplatesService.js +10 -2
  14. package/services/messaging/SmsService.js +0 -3
  15. package/services/messaging.js +0 -2
  16. package/services/objects.js +12 -39
  17. package/services/operatorPanels.js +226 -0
  18. package/services/parking.js +121 -0
  19. package/services/permissions.js +21 -0
  20. package/services/phoneNumbers/carrier.js +60 -0
  21. package/services/phoneNumbers/cnam.js +42 -0
  22. package/services/phoneNumbers/index.js +27 -0
  23. package/services/phoneNumbers/order.js +88 -0
  24. package/services/phoneNumbers/porting-activity.js +289 -0
  25. package/services/phoneNumbers/porting-orders.js +318 -0
  26. package/services/phoneNumbers/search.js +181 -0
  27. package/services/phoneNumbers/update.js +94 -0
  28. package/services/phoneNumbers.js +2 -1037
  29. package/services/recents.js +16 -0
  30. package/services/schedules/SchedulesService.js +232 -0
  31. package/services/schedules/TimeOffService.js +131 -0
  32. package/services/skills.js +207 -0
  33. package/services/taskRouter/MetricsService.js +3 -0
  34. package/services/taskRouter/QueueService.js +343 -0
  35. package/services/taskRouter/TaskRouterService.js +2 -0
  36. package/services/taskRouter/TaskService.js +70 -10
  37. package/services/voice.js +47 -25
  38. package/services/voicemailDrops.js +268 -0
  39. package/services/workflowTemplates/WorkflowTemplatesService.js +68 -0
  40. package/services/messaging/SmsTemplatesService.js +0 -125
@@ -22,6 +22,7 @@ export class EmailTemplatesService {
22
22
  * @param {string} [params.text] - Plain text template body
23
23
  * @param {Object} [params.design] - Block-tree design JSON (compiled server-side)
24
24
  * @param {string} [params.appearance] - `client` or `marketing` (immutable after create)
25
+ * @param {string} [params.emailType] - `marketing` | `sales` | `transactional` (defaults to `marketing`; separate from `appearance`)
25
26
  * @param {boolean} [params.allowOneOff] - Usable as a one-off / compose send
26
27
  * @param {boolean} [params.allowCampaign] - Usable in campaigns / journeys
27
28
  * @param {string} [params.brandKitId] - Brand kit to apply
@@ -57,6 +58,7 @@ export class EmailTemplatesService {
57
58
  variables,
58
59
  design,
59
60
  appearance,
61
+ emailType,
60
62
  allowOneOff,
61
63
  allowCampaign,
62
64
  brandKitId,
@@ -72,6 +74,7 @@ export class EmailTemplatesService {
72
74
  variables: { type: 'array', required: false },
73
75
  design: { type: 'object', required: false },
74
76
  appearance: { type: 'string', required: false },
77
+ emailType: { type: 'string', required: false },
75
78
  allowOneOff: { type: 'boolean', required: false },
76
79
  allowCampaign: { type: 'boolean', required: false },
77
80
  brandKitId: { type: 'string', required: false },
@@ -88,6 +91,7 @@ export class EmailTemplatesService {
88
91
  variables,
89
92
  design,
90
93
  appearance,
94
+ emailType,
91
95
  allowOneOff,
92
96
  allowCampaign,
93
97
  brandKitId,
@@ -95,7 +99,7 @@ export class EmailTemplatesService {
95
99
  }),
96
100
  };
97
101
 
98
- const result = await internalRequest(this.sdk,
102
+ const result = await internalRequest(this.sdk,
99
103
  '/messaging/email/template',
100
104
  'POST',
101
105
  options,
@@ -114,6 +118,7 @@ export class EmailTemplatesService {
114
118
  * @param {string} [params.text] - Plain text template body
115
119
  * @param {Object} [params.design] - Block-tree design JSON (compiled server-side)
116
120
  * @param {string} [params.appearance] - Usually omit; immutable after create
121
+ * @param {string} [params.emailType] - `marketing` | `sales` | `transactional` (not immutable)
117
122
  * @param {boolean} [params.allowOneOff] - Usable as a one-off / compose send
118
123
  * @param {boolean} [params.allowCampaign] - Usable in campaigns / journeys
119
124
  * @param {string} [params.brandKitId] - Brand kit to apply
@@ -147,6 +152,7 @@ export class EmailTemplatesService {
147
152
  variables,
148
153
  design,
149
154
  appearance,
155
+ emailType,
150
156
  allowOneOff,
151
157
  allowCampaign,
152
158
  brandKitId,
@@ -164,6 +170,7 @@ export class EmailTemplatesService {
164
170
  variables: { type: 'array', required: false },
165
171
  design: { type: 'object', required: false },
166
172
  appearance: { type: 'string', required: false },
173
+ emailType: { type: 'string', required: false },
167
174
  allowOneOff: { type: 'boolean', required: false },
168
175
  allowCampaign: { type: 'boolean', required: false },
169
176
  brandKitId: { type: 'string', required: false },
@@ -180,6 +187,7 @@ export class EmailTemplatesService {
180
187
  variables,
181
188
  design,
182
189
  appearance,
190
+ emailType,
183
191
  allowOneOff,
184
192
  allowCampaign,
185
193
  brandKitId,
@@ -187,7 +195,7 @@ export class EmailTemplatesService {
187
195
  }),
188
196
  };
189
197
 
190
- const result = await internalRequest(this.sdk,
198
+ const result = await internalRequest(this.sdk,
191
199
  `/messaging/email/template/${id}`,
192
200
  'PUT',
193
201
  options,
@@ -1,10 +1,7 @@
1
- import { SmsTemplatesService } from './SmsTemplatesService.js';
2
-
3
1
  import { internalRequest } from '../../base.js';
4
2
  export class SmsService {
5
3
  constructor(sdk) {
6
4
  this.sdk = sdk;
7
- this.templates = new SmsTemplatesService(sdk);
8
5
  }
9
6
 
10
7
  /**
@@ -1,7 +1,6 @@
1
1
  // Import all extracted services
2
2
  import { MessagingService } from './messaging/MessagingService.js';
3
3
  import { SmsService } from './messaging/SmsService.js';
4
- import { SmsTemplatesService } from './messaging/SmsTemplatesService.js';
5
4
  import { EmailService } from './messaging/EmailService.js';
6
5
  import { EmailTemplatesService } from './messaging/EmailTemplatesService.js';
7
6
  import { EmailDomainsService } from './messaging/EmailDomainsService.js';
@@ -20,7 +19,6 @@ import { EmailSuppressionService } from './messaging/EmailSuppressionService.js'
20
19
  export {
21
20
  MessagingService,
22
21
  SmsService,
23
- SmsTemplatesService,
24
22
  EmailService,
25
23
  EmailTemplatesService,
26
24
  EmailDomainsService,
@@ -1038,6 +1038,9 @@ export class ObjectsService {
1038
1038
  description = null,
1039
1039
  feedPostChanges = null,
1040
1040
  feedPostWindowSeconds = null,
1041
+ showInNav = null,
1042
+ navLabel = null,
1043
+ icon = null,
1041
1044
  }) {
1042
1045
  this.sdk.validateParams(
1043
1046
  {
@@ -1047,6 +1050,9 @@ export class ObjectsService {
1047
1050
  description,
1048
1051
  feedPostChanges,
1049
1052
  feedPostWindowSeconds,
1053
+ showInNav,
1054
+ navLabel,
1055
+ icon,
1050
1056
  },
1051
1057
  {
1052
1058
  objectName: { type: 'string', required: true },
@@ -1055,6 +1061,9 @@ export class ObjectsService {
1055
1061
  description: { type: 'string', required: false },
1056
1062
  feedPostChanges: { type: 'boolean', required: false },
1057
1063
  feedPostWindowSeconds: { type: 'number', required: false },
1064
+ showInNav: { type: 'boolean', required: false },
1065
+ navLabel: { type: 'string', required: false },
1066
+ icon: { type: 'string', required: false },
1058
1067
  },
1059
1068
  );
1060
1069
 
@@ -1065,6 +1074,9 @@ export class ObjectsService {
1065
1074
  if (feedPostChanges !== null) body.feedPostChanges = feedPostChanges;
1066
1075
  if (feedPostWindowSeconds !== null)
1067
1076
  body.feedPostWindowSeconds = feedPostWindowSeconds;
1077
+ if (showInNav !== null) body.showInNav = showInNav;
1078
+ if (navLabel !== null) body.navLabel = navLabel;
1079
+ if (icon !== null) body.icon = icon;
1068
1080
 
1069
1081
  const params = { body };
1070
1082
 
@@ -1417,43 +1429,4 @@ export class ObjectsService {
1417
1429
  );
1418
1430
  }
1419
1431
 
1420
- /**
1421
- * P7 (workflows-v2-plan.md W10/W11/W23) -- runs an immediate full
1422
- * enter+exit sweep for a journey program. Same diff-and-enqueue path a
1423
- * scheduled tick runs, so this can never 429.
1424
- * @param {string} programId
1425
- * @returns {Promise<{queued: true, enterEnqueued: number, exitEnqueued: number}>}
1426
- */
1427
- async runMarketingProgramNow(programId) {
1428
- this.sdk.validateParams(
1429
- { programId },
1430
- { programId: { type: 'string', required: true } },
1431
- );
1432
- return internalRequest(
1433
- this.sdk,
1434
- `/object/marketing-programs/${programId}/run`,
1435
- 'POST',
1436
- { body: {} },
1437
- );
1438
- }
1439
-
1440
- /**
1441
- * P7 -- paginated member list for a journey program (joined to people
1442
- * for display name; never raw peopleId).
1443
- * @param {string} programId
1444
- * @param {{nextId?: string, limit?: number}} [opts]
1445
- * @returns {Promise<{results: object[], pagination: object}>}
1446
- */
1447
- async listMarketingProgramMembers(programId, opts = {}) {
1448
- this.sdk.validateParams(
1449
- { programId },
1450
- { programId: { type: 'string', required: true } },
1451
- );
1452
- return internalRequest(
1453
- this.sdk,
1454
- `/object/marketing-programs/${programId}/members`,
1455
- 'GET',
1456
- { query: opts },
1457
- );
1458
- }
1459
1432
  }
@@ -0,0 +1,226 @@
1
+ import { internalRequest } from '../base.js';
2
+
3
+ // Operator (receptionist) panels (plans/operator-panel-plan.md §4/§4.1).
4
+ export class OperatorPanelsService {
5
+ constructor(sdk) {
6
+ this.sdk = sdk;
7
+ }
8
+
9
+ /**
10
+ * Non-deleted panels the caller can see, each with `isMyDefault`, plus
11
+ * `prefs`.
12
+ */
13
+ async listMine() {
14
+ return await internalRequest(this.sdk, '/operatorPanels/mine', 'GET', {});
15
+ }
16
+
17
+ /**
18
+ * @param {string} id - panel id
19
+ * @returns {Promise<Object>} render payload: ordered sections → items
20
+ */
21
+ async getResolved(id) {
22
+ this.sdk.validateParams(
23
+ { id },
24
+ { id: { type: 'string', required: true } },
25
+ );
26
+ return await internalRequest(
27
+ this.sdk,
28
+ `/operatorPanels/${id}/resolved`,
29
+ 'GET',
30
+ {},
31
+ );
32
+ }
33
+
34
+ /**
35
+ * @param {Object} body - { defaultPanelId?, viewMode? }
36
+ */
37
+ async setPrefs(body) {
38
+ this.sdk.validateParams(
39
+ { body },
40
+ { body: { type: 'object', required: true } },
41
+ );
42
+ return await internalRequest(this.sdk, '/operatorPanels/me/prefs', 'PUT', {
43
+ body,
44
+ });
45
+ }
46
+
47
+ /**
48
+ * @param {Object} params - { panelId }
49
+ */
50
+ async listMessages({ panelId }) {
51
+ this.sdk.validateParams(
52
+ { panelId },
53
+ { panelId: { type: 'string', required: true } },
54
+ );
55
+ return await internalRequest(this.sdk, '/operatorPanels/messages', 'GET', {
56
+ query: { panelId },
57
+ });
58
+ }
59
+
60
+ async list() {
61
+ return await internalRequest(this.sdk, '/operatorPanels', 'GET', {});
62
+ }
63
+
64
+ /**
65
+ * @param {Object} body - panel fields
66
+ */
67
+ async create(body) {
68
+ this.sdk.validateParams(
69
+ { body },
70
+ { body: { type: 'object', required: true } },
71
+ );
72
+ return await internalRequest(this.sdk, '/operatorPanels', 'POST', {
73
+ body,
74
+ });
75
+ }
76
+
77
+ /**
78
+ * @param {string} id - panel id
79
+ * @param {Object} body - panel fields to update
80
+ */
81
+ async update(id, body) {
82
+ this.sdk.validateParams(
83
+ { id, body },
84
+ {
85
+ id: { type: 'string', required: true },
86
+ body: { type: 'object', required: true },
87
+ },
88
+ );
89
+ return await internalRequest(this.sdk, `/operatorPanels/${id}`, 'PUT', {
90
+ body,
91
+ });
92
+ }
93
+
94
+ /**
95
+ * @param {string} id - panel id
96
+ */
97
+ async remove(id) {
98
+ this.sdk.validateParams(
99
+ { id },
100
+ { id: { type: 'string', required: true } },
101
+ );
102
+ return await internalRequest(this.sdk, `/operatorPanels/${id}`, 'DELETE', {});
103
+ }
104
+
105
+ /**
106
+ * Replace a panel's full ordered item list.
107
+ *
108
+ * @param {string} id - panel id
109
+ * @param {Array<Object>} items
110
+ */
111
+ async setItems(id, items) {
112
+ this.sdk.validateParams(
113
+ { id, items },
114
+ {
115
+ id: { type: 'string', required: true },
116
+ items: { type: 'array', required: true },
117
+ },
118
+ );
119
+ return await internalRequest(
120
+ this.sdk,
121
+ `/operatorPanels/${id}/items`,
122
+ 'PUT',
123
+ { body: { items } },
124
+ );
125
+ }
126
+
127
+ /**
128
+ * @param {string} id - panel id
129
+ * @param {Array<{principalType: 'user'|'group', principalId: string}>} access
130
+ */
131
+ async setAccess(id, access) {
132
+ this.sdk.validateParams(
133
+ { id },
134
+ { id: { type: 'string', required: true } },
135
+ );
136
+ return await internalRequest(
137
+ this.sdk,
138
+ `/operatorPanels/${id}/access`,
139
+ 'PUT',
140
+ { body: { access } },
141
+ );
142
+ }
143
+
144
+ /**
145
+ * @param {string} id - panel id
146
+ * @returns {Promise<{results: Array<{principalType: 'user'|'group', principalId: string, name: string|null}>}>}
147
+ */
148
+ async getAccess(id) {
149
+ this.sdk.validateParams(
150
+ { id },
151
+ { id: { type: 'string', required: true } },
152
+ );
153
+ return await internalRequest(
154
+ this.sdk,
155
+ `/operatorPanels/${id}/access`,
156
+ 'GET',
157
+ {},
158
+ );
159
+ }
160
+
161
+ /**
162
+ * @param {string} kind - users | groups | queues | ringGroups | workflows | records
163
+ * @param {string} [q] - search text
164
+ */
165
+ async search(kind, q) {
166
+ this.sdk.validateParams(
167
+ { kind },
168
+ { kind: { type: 'string', required: true } },
169
+ );
170
+ return await internalRequest(
171
+ this.sdk,
172
+ `/operatorPanels/pickers/${kind}`,
173
+ 'GET',
174
+ { query: q ? { q } : {} },
175
+ );
176
+ }
177
+
178
+ /**
179
+ * @param {Object} body - message template fields
180
+ */
181
+ async createMessage(body) {
182
+ this.sdk.validateParams(
183
+ { body },
184
+ { body: { type: 'object', required: true } },
185
+ );
186
+ return await internalRequest(this.sdk, '/operatorPanels/messages', 'POST', {
187
+ body,
188
+ });
189
+ }
190
+
191
+ /**
192
+ * @param {string} id - message id
193
+ * @param {Object} body - message fields to update
194
+ */
195
+ async updateMessage(id, body) {
196
+ this.sdk.validateParams(
197
+ { id, body },
198
+ {
199
+ id: { type: 'string', required: true },
200
+ body: { type: 'object', required: true },
201
+ },
202
+ );
203
+ return await internalRequest(
204
+ this.sdk,
205
+ `/operatorPanels/messages/${id}`,
206
+ 'PUT',
207
+ { body },
208
+ );
209
+ }
210
+
211
+ /**
212
+ * @param {string} id - message id
213
+ */
214
+ async deleteMessage(id) {
215
+ this.sdk.validateParams(
216
+ { id },
217
+ { id: { type: 'string', required: true } },
218
+ );
219
+ return await internalRequest(
220
+ this.sdk,
221
+ `/operatorPanels/messages/${id}`,
222
+ 'DELETE',
223
+ {},
224
+ );
225
+ }
226
+ }
@@ -0,0 +1,121 @@
1
+ import { internalRequest } from '../base.js';
2
+
3
+ // Call parking (plans/call-parking-plan.md). P0: pools + slots CRUD only.
4
+ // park/retrieve/listActive are P1/P3 -- stubs below, no routes yet.
5
+ export class ParkingService {
6
+ constructor(sdk) {
7
+ this.sdk = sdk;
8
+ }
9
+
10
+ async listPools() {
11
+ return await internalRequest(this.sdk, '/parking/pools', 'GET', {});
12
+ }
13
+
14
+ /**
15
+ * @param {Object} body - name, rangeStart?, slotCount?, recordTypeId?,
16
+ * accessMode?, access?: [{principalType, principalId}]
17
+ */
18
+ async createPool(body) {
19
+ this.sdk.validateParams(
20
+ { body },
21
+ { body: { type: 'object', required: true } },
22
+ );
23
+ return await internalRequest(this.sdk, '/parking/pools', 'POST', { body });
24
+ }
25
+
26
+ async updatePool(id, body) {
27
+ this.sdk.validateParams(
28
+ { id, body },
29
+ {
30
+ id: { type: 'string', required: true },
31
+ body: { type: 'object', required: true },
32
+ },
33
+ );
34
+ return await internalRequest(this.sdk, `/parking/pools/${id}`, 'PATCH', {
35
+ body,
36
+ });
37
+ }
38
+
39
+ /**
40
+ * @param {string} id
41
+ * @param {Array<{principalType: 'user'|'group', principalId: string}>} access
42
+ */
43
+ async setPoolAccess(id, access) {
44
+ this.sdk.validateParams(
45
+ { id },
46
+ { id: { type: 'string', required: true } },
47
+ );
48
+ return await internalRequest(
49
+ this.sdk,
50
+ `/parking/pools/${id}/access`,
51
+ 'PUT',
52
+ { body: { access } },
53
+ );
54
+ }
55
+
56
+ async deletePool(id) {
57
+ this.sdk.validateParams(
58
+ { id },
59
+ { id: { type: 'string', required: true } },
60
+ );
61
+ return await internalRequest(this.sdk, `/parking/pools/${id}`, 'DELETE', {});
62
+ }
63
+
64
+ /**
65
+ * @param {string} id pool id
66
+ * @param {number} [count] how many slots to add, default 1
67
+ */
68
+ async addSlots(id, count) {
69
+ this.sdk.validateParams(
70
+ { id },
71
+ { id: { type: 'string', required: true } },
72
+ );
73
+ return await internalRequest(
74
+ this.sdk,
75
+ `/parking/pools/${id}/slots`,
76
+ 'POST',
77
+ { body: { count } },
78
+ );
79
+ }
80
+
81
+ async deleteSlot(slotId) {
82
+ this.sdk.validateParams(
83
+ { slotId },
84
+ { slotId: { type: 'string', required: true } },
85
+ );
86
+ return await internalRequest(
87
+ this.sdk,
88
+ `/parking/slots/${slotId}`,
89
+ 'DELETE',
90
+ {},
91
+ );
92
+ }
93
+
94
+ /**
95
+ * @param {Object} body - { callId, slotId? } -- omit slotId for next-free
96
+ */
97
+ async park(body) {
98
+ this.sdk.validateParams(
99
+ { body },
100
+ { body: { type: 'object', required: true } },
101
+ );
102
+ return await internalRequest(this.sdk, '/parking/park', 'POST', { body });
103
+ }
104
+
105
+ /**
106
+ * @param {string} slotId
107
+ */
108
+ async retrieve(slotId) {
109
+ this.sdk.validateParams(
110
+ { slotId },
111
+ { slotId: { type: 'string', required: true } },
112
+ );
113
+ return await internalRequest(this.sdk, '/parking/retrieve', 'POST', {
114
+ body: { slotId },
115
+ });
116
+ }
117
+
118
+ async listActive() {
119
+ return await internalRequest(this.sdk, '/parking/active', 'GET', {});
120
+ }
121
+ }
@@ -541,6 +541,27 @@ export class PermissionsService {
541
541
  );
542
542
  }
543
543
 
544
+ /**
545
+ * Account-wide defaults for any settings-catalog key (settingsAccountDefaults
546
+ * table) — a generic tier below systemDefault and above nothing; resolver
547
+ * order is user override -> group -> account default -> systemDefault.
548
+ * @returns {Promise<Object>} { [key]: value }
549
+ */
550
+ async getAccountSettingDefaults() {
551
+ return internalRequest(this.sdk, '/permissions/settings/accountDefaults', 'GET');
552
+ }
553
+
554
+ /** Set one account-wide default for a settings-catalog key. */
555
+ async setAccountSettingDefault(key, value) {
556
+ key = String(key);
557
+ this.sdk.validateParams({ key }, { key: { type: 'string', required: true } });
558
+ return internalRequest(this.sdk,
559
+ `/permissions/settings/accountDefaults/${key}`,
560
+ 'PUT',
561
+ { body: { value } },
562
+ );
563
+ }
564
+
544
565
  /**
545
566
  * Per-user, per-account JSON app state (UI state such as saved tab-sets).
546
567
  * Distinct from settings: free-form JSON, not catalog-validated.
@@ -0,0 +1,60 @@
1
+ import { internalRequest } from '../../base.js';
2
+
3
+ // phoneNumbers/carrier.js :: PhoneNumberCarrierService :: carrier sync/lookup/delete for owned numbers
4
+ export class PhoneNumberCarrierService {
5
+ constructor(sdk) {
6
+ this.sdk = sdk;
7
+ }
8
+
9
+ async sync(carrier, { updateVoiceConnection, updateMessagingConnection }) {
10
+ this.sdk.validateParams(
11
+ { carrier },
12
+ {
13
+ carrier: { type: 'string', required: true },
14
+ updateVoiceConnection: { type: 'boolean', required: false },
15
+ updateMessagingConnection: { type: 'boolean', required: false },
16
+ },
17
+ );
18
+
19
+ const params = {
20
+ query: { updateVoiceConnection, updateMessagingConnection },
21
+ };
22
+
23
+ const result = await internalRequest(this.sdk,
24
+ `/phoneNumbers/carrier/syncPhoneNumbers/${carrier}`,
25
+ 'POST',
26
+ params,
27
+ );
28
+ return result;
29
+ }
30
+
31
+ async getDetails(phoneNumber) {
32
+ this.sdk.validateParams(
33
+ { phoneNumber },
34
+ {
35
+ phoneNumber: { type: 'string', required: true },
36
+ },
37
+ );
38
+
39
+ const result = await internalRequest(this.sdk,
40
+ `/phoneNumbers/carrier/${phoneNumber}`,
41
+ 'GET',
42
+ );
43
+ return result;
44
+ }
45
+
46
+ async delete(phoneNumber) {
47
+ this.sdk.validateParams(
48
+ { phoneNumber },
49
+ {
50
+ phoneNumber: { type: 'string', required: true },
51
+ },
52
+ );
53
+
54
+ const result = await internalRequest(this.sdk,
55
+ `/phoneNumbers/carrier/${phoneNumber}`,
56
+ 'DELETE',
57
+ );
58
+ return result;
59
+ }
60
+ }
@@ -0,0 +1,42 @@
1
+ import { internalRequest } from '../../base.js';
2
+
3
+ // phoneNumbers/cnam.js :: CNAM methods :: caller-id name enable/update + carrier check
4
+ export const cnamMethods = {
5
+ async updateCnam(id, { enabled, name }) {
6
+ this.sdk.validateParams(
7
+ { id, enabled, name },
8
+ {
9
+ id: { type: 'string', required: true },
10
+ enabled: { type: 'boolean', required: true },
11
+ name: { type: 'string', required: false },
12
+ },
13
+ );
14
+
15
+ const params = {
16
+ body: { enabled, ...(name !== undefined ? { name } : {}) },
17
+ };
18
+
19
+ const result = await internalRequest(this.sdk,
20
+ `/phoneNumbers/${id}/cnam`,
21
+ 'PUT',
22
+ params,
23
+ );
24
+ return result;
25
+ },
26
+
27
+ async checkCnam(id) {
28
+ this.sdk.validateParams(
29
+ { id },
30
+ {
31
+ id: { type: 'string', required: true },
32
+ },
33
+ );
34
+
35
+ const result = await internalRequest(this.sdk,
36
+ `/phoneNumbers/${id}/cnam/check`,
37
+ 'POST',
38
+ {},
39
+ );
40
+ return result;
41
+ },
42
+ };
@@ -0,0 +1,27 @@
1
+ import { searchMethods } from './search.js';
2
+ import { orderMethods } from './order.js';
3
+ import { updateMethods } from './update.js';
4
+ import { cnamMethods } from './cnam.js';
5
+ import { portingOrderMethods } from './porting-orders.js';
6
+ import { portingActivityMethods } from './porting-activity.js';
7
+ import { PhoneNumberCarrierService } from './carrier.js';
8
+
9
+ // phoneNumbers/index.js :: PhoneNumbersService :: composes the split method modules back into one class
10
+ export class PhoneNumbersService {
11
+ constructor(sdk) {
12
+ this.sdk = sdk;
13
+ this.carrier = new PhoneNumberCarrierService(sdk);
14
+ }
15
+ }
16
+
17
+ Object.assign(
18
+ PhoneNumbersService.prototype,
19
+ searchMethods,
20
+ orderMethods,
21
+ updateMethods,
22
+ cnamMethods,
23
+ portingOrderMethods,
24
+ portingActivityMethods,
25
+ );
26
+
27
+ export { PhoneNumberCarrierService };