@unboundcx/sdk 2.7.6 → 2.8.0

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.
@@ -0,0 +1,446 @@
1
+ export class TenDlcBrandsService {
2
+ constructor(sdk) {
3
+ this.sdk = sdk;
4
+ }
5
+
6
+ /**
7
+ * List all 10DLC brands with optional filtering
8
+ * @param {Object} [params] - Filter parameters
9
+ * @param {number} [params.page=1] - Page number
10
+ * @param {number} [params.limit=50] - Items per page
11
+ * @param {string} [params.name] - Filter by brand name
12
+ * @param {string} [params.status] - Filter by status
13
+ * @param {string} [params.operatorType='contains'] - Filter operator: contains, equals, startsWith, endsWith
14
+ * @returns {Promise<Array>} List of brands
15
+ */
16
+ async list({ page, limit, name, status, operatorType } = {}) {
17
+ const queryParams = new URLSearchParams();
18
+
19
+ if (page !== undefined) queryParams.append('page', page);
20
+ if (limit !== undefined) queryParams.append('limit', limit);
21
+ if (name) queryParams.append('name', name);
22
+ if (status) queryParams.append('status', status);
23
+ if (operatorType) queryParams.append('operatorType', operatorType);
24
+
25
+ const url = queryParams.toString()
26
+ ? `/messaging/campaigns/10dlc/brand?${queryParams.toString()}`
27
+ : '/messaging/campaigns/10dlc/brand';
28
+
29
+ const result = await this.sdk._fetch(url, 'GET');
30
+ return result;
31
+ }
32
+
33
+ /**
34
+ * Create a new 10DLC brand
35
+ * @param {Object} params - Brand parameters
36
+ * @param {string} params.name - Brand display name (required)
37
+ * @param {string} params.entityType - Entity type: PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT (required)
38
+ * @param {string} [params.cspId] - CSP ID for resellers
39
+ * @param {string} params.companyName - Company name (required)
40
+ * @param {string} [params.ein] - Employer Identification Number
41
+ * @param {string} params.address1 - Street address (required)
42
+ * @param {string} [params.address2] - Street address line 2
43
+ * @param {string} params.city - City (required)
44
+ * @param {string} params.state - State (required)
45
+ * @param {string} params.postalCode - Postal code (required)
46
+ * @param {string} params.country - Country (required)
47
+ * @param {string} [params.pocFirstName] - Point of contact first name
48
+ * @param {string} [params.pocLastName] - Point of contact last name
49
+ * @param {string} params.pocEmail - Point of contact email (required)
50
+ * @param {string} params.pocPhone - Point of contact phone (required)
51
+ * @param {string} [params.stockSymbol] - Stock symbol for public companies
52
+ * @param {string} [params.stockExchange] - Stock exchange for public companies
53
+ * @param {string} [params.website] - Company website
54
+ * @param {string} params.vertical - Business vertical (required)
55
+ * @param {string} [params.altBusinessId] - Alternative business ID
56
+ * @param {string} [params.altBusinessIdType] - Alternative business ID type
57
+ * @param {string} [params.brandRelationship] - Brand relationship
58
+ * @returns {Promise<Object>} Created brand details
59
+ */
60
+ async create({
61
+ name,
62
+ entityType,
63
+ cspId,
64
+ companyName,
65
+ ein,
66
+ address1,
67
+ address2,
68
+ city,
69
+ state,
70
+ postalCode,
71
+ country,
72
+ pocFirstName,
73
+ pocLastName,
74
+ pocEmail,
75
+ pocPhone,
76
+ stockSymbol,
77
+ stockExchange,
78
+ website,
79
+ vertical,
80
+ altBusinessId,
81
+ altBusinessIdType,
82
+ brandRelationship,
83
+ }) {
84
+ this.sdk.validateParams(
85
+ {
86
+ name,
87
+ entityType,
88
+ companyName,
89
+ address1,
90
+ city,
91
+ state,
92
+ postalCode,
93
+ country,
94
+ pocEmail,
95
+ pocPhone,
96
+ vertical,
97
+ },
98
+ {
99
+ name: { type: 'string', required: true },
100
+ entityType: { type: 'string', required: true },
101
+ cspId: { type: 'string', required: false },
102
+ companyName: { type: 'string', required: true },
103
+ ein: { type: 'string', required: false },
104
+ address1: { type: 'string', required: true },
105
+ address2: { type: 'string', required: false },
106
+ city: { type: 'string', required: true },
107
+ state: { type: 'string', required: true },
108
+ postalCode: { type: 'string', required: true },
109
+ country: { type: 'string', required: true },
110
+ pocFirstName: { type: 'string', required: false },
111
+ pocLastName: { type: 'string', required: false },
112
+ pocEmail: { type: 'string', required: true },
113
+ pocPhone: { type: 'string', required: true },
114
+ stockSymbol: { type: 'string', required: false },
115
+ stockExchange: { type: 'string', required: false },
116
+ website: { type: 'string', required: false },
117
+ vertical: { type: 'string', required: true },
118
+ altBusinessId: { type: 'string', required: false },
119
+ altBusinessIdType: { type: 'string', required: false },
120
+ brandRelationship: { type: 'string', required: false },
121
+ },
122
+ );
123
+
124
+ const brandData = {
125
+ name,
126
+ entityType,
127
+ companyName,
128
+ address1,
129
+ city,
130
+ state,
131
+ postalCode,
132
+ country,
133
+ pocEmail,
134
+ pocPhone,
135
+ vertical,
136
+ };
137
+ if (cspId) brandData.cspId = cspId;
138
+ if (ein) brandData.ein = ein;
139
+ if (address2) brandData.address2 = address2;
140
+ if (pocFirstName) brandData.pocFirstName = pocFirstName;
141
+ if (pocLastName) brandData.pocLastName = pocLastName;
142
+ if (stockSymbol) brandData.stockSymbol = stockSymbol;
143
+ if (stockExchange) brandData.stockExchange = stockExchange;
144
+ if (website) brandData.website = website;
145
+ if (altBusinessId) brandData.altBusinessId = altBusinessId;
146
+ if (altBusinessIdType) brandData.altBusinessIdType = altBusinessIdType;
147
+ if (brandRelationship) brandData.brandRelationship = brandRelationship;
148
+
149
+ const options = {
150
+ body: brandData,
151
+ };
152
+
153
+ const result = await this.sdk._fetch(
154
+ '/messaging/campaigns/10dlc/brand',
155
+ 'POST',
156
+ options,
157
+ );
158
+ return result;
159
+ }
160
+
161
+ /**
162
+ * Get a 10DLC brand by ID
163
+ * @param {string} brandId - Brand ID (required)
164
+ * @returns {Promise<Object>} Brand details
165
+ */
166
+ async get(brandId) {
167
+ this.sdk.validateParams(
168
+ { brandId },
169
+ {
170
+ brandId: { type: 'string', required: true },
171
+ },
172
+ );
173
+
174
+ const result = await this.sdk._fetch(
175
+ `/messaging/campaigns/10dlc/brand/${brandId}`,
176
+ 'GET',
177
+ );
178
+ return result;
179
+ }
180
+
181
+ /**
182
+ * Update a 10DLC brand
183
+ * @param {string} brandId - Brand ID to update (required)
184
+ * @param {Object} params - Brand parameters to update
185
+ * @param {string} [params.name] - Brand display name
186
+ * @param {string} [params.entityType] - Entity type: PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT
187
+ * @param {string} [params.cspId] - CSP ID for resellers
188
+ * @param {string} [params.companyName] - Company name
189
+ * @param {string} [params.ein] - Employer Identification Number
190
+ * @param {string} [params.address1] - Street address
191
+ * @param {string} [params.address2] - Street address line 2
192
+ * @param {string} [params.city] - City
193
+ * @param {string} [params.state] - State
194
+ * @param {string} [params.postalCode] - Postal code
195
+ * @param {string} [params.country] - Country
196
+ * @param {string} [params.pocFirstName] - Point of contact first name
197
+ * @param {string} [params.pocLastName] - Point of contact last name
198
+ * @param {string} [params.pocEmail] - Point of contact email
199
+ * @param {string} [params.pocPhone] - Point of contact phone
200
+ * @param {string} [params.stockSymbol] - Stock symbol for public companies
201
+ * @param {string} [params.stockExchange] - Stock exchange for public companies
202
+ * @param {string} [params.website] - Company website
203
+ * @param {string} [params.vertical] - Business vertical
204
+ * @param {string} [params.altBusinessId] - Alternative business ID
205
+ * @param {string} [params.altBusinessIdType] - Alternative business ID type
206
+ * @param {string} [params.brandRelationship] - Brand relationship
207
+ * @param {string} [params.businessContactEmail] - Business contact email for 2025 compliance
208
+ * @param {string} [params.firstName] - First name for 2025 compliance
209
+ * @param {string} [params.lastName] - Last name for 2025 compliance
210
+ * @param {string} [params.mobilePhone] - Mobile phone for 2025 compliance
211
+ * @returns {Promise<Object>} Updated brand details
212
+ */
213
+ async update(
214
+ brandId,
215
+ {
216
+ name,
217
+ entityType,
218
+ cspId,
219
+ companyName,
220
+ ein,
221
+ address1,
222
+ address2,
223
+ city,
224
+ state,
225
+ postalCode,
226
+ country,
227
+ pocFirstName,
228
+ pocLastName,
229
+ pocEmail,
230
+ pocPhone,
231
+ stockSymbol,
232
+ stockExchange,
233
+ website,
234
+ vertical,
235
+ altBusinessId,
236
+ altBusinessIdType,
237
+ brandRelationship,
238
+ businessContactEmail,
239
+ firstName,
240
+ lastName,
241
+ mobilePhone,
242
+ } = {},
243
+ ) {
244
+ this.sdk.validateParams(
245
+ { brandId },
246
+ {
247
+ brandId: { type: 'string', required: true },
248
+ name: { type: 'string', required: false },
249
+ entityType: { type: 'string', required: false },
250
+ cspId: { type: 'string', required: false },
251
+ companyName: { type: 'string', required: false },
252
+ ein: { type: 'string', required: false },
253
+ address1: { type: 'string', required: false },
254
+ address2: { type: 'string', required: false },
255
+ city: { type: 'string', required: false },
256
+ state: { type: 'string', required: false },
257
+ postalCode: { type: 'string', required: false },
258
+ country: { type: 'string', required: false },
259
+ pocFirstName: { type: 'string', required: false },
260
+ pocLastName: { type: 'string', required: false },
261
+ pocEmail: { type: 'string', required: false },
262
+ pocPhone: { type: 'string', required: false },
263
+ stockSymbol: { type: 'string', required: false },
264
+ stockExchange: { type: 'string', required: false },
265
+ website: { type: 'string', required: false },
266
+ vertical: { type: 'string', required: false },
267
+ altBusinessId: { type: 'string', required: false },
268
+ altBusinessIdType: { type: 'string', required: false },
269
+ brandRelationship: { type: 'string', required: false },
270
+ businessContactEmail: { type: 'string', required: false },
271
+ firstName: { type: 'string', required: false },
272
+ lastName: { type: 'string', required: false },
273
+ mobilePhone: { type: 'string', required: false },
274
+ },
275
+ );
276
+
277
+ const updateData = {};
278
+ if (name !== undefined) updateData.name = name;
279
+ if (entityType !== undefined) updateData.entityType = entityType;
280
+ if (cspId !== undefined) updateData.cspId = cspId;
281
+ if (companyName !== undefined) updateData.companyName = companyName;
282
+ if (ein !== undefined) updateData.ein = ein;
283
+ if (address1 !== undefined) updateData.address1 = address1;
284
+ if (address2 !== undefined) updateData.address2 = address2;
285
+ if (city !== undefined) updateData.city = city;
286
+ if (state !== undefined) updateData.state = state;
287
+ if (postalCode !== undefined) updateData.postalCode = postalCode;
288
+ if (country !== undefined) updateData.country = country;
289
+ if (pocFirstName !== undefined) updateData.pocFirstName = pocFirstName;
290
+ if (pocLastName !== undefined) updateData.pocLastName = pocLastName;
291
+ if (pocEmail !== undefined) updateData.pocEmail = pocEmail;
292
+ if (pocPhone !== undefined) updateData.pocPhone = pocPhone;
293
+ if (stockSymbol !== undefined) updateData.stockSymbol = stockSymbol;
294
+ if (stockExchange !== undefined) updateData.stockExchange = stockExchange;
295
+ if (website !== undefined) updateData.website = website;
296
+ if (vertical !== undefined) updateData.vertical = vertical;
297
+ if (altBusinessId !== undefined) updateData.altBusinessId = altBusinessId;
298
+ if (altBusinessIdType !== undefined)
299
+ updateData.altBusinessIdType = altBusinessIdType;
300
+ if (brandRelationship !== undefined)
301
+ updateData.brandRelationship = brandRelationship;
302
+ if (businessContactEmail !== undefined)
303
+ updateData.businessContactEmail = businessContactEmail;
304
+ if (firstName !== undefined) updateData.firstName = firstName;
305
+ if (lastName !== undefined) updateData.lastName = lastName;
306
+ if (mobilePhone !== undefined) updateData.mobilePhone = mobilePhone;
307
+
308
+ const options = {
309
+ body: updateData,
310
+ };
311
+
312
+ const result = await this.sdk._fetch(
313
+ `/messaging/campaigns/10dlc/brand/${brandId}`,
314
+ 'PUT',
315
+ options,
316
+ );
317
+ return result;
318
+ }
319
+
320
+ /**
321
+ * Delete a 10DLC brand
322
+ * @param {string} brandId - Brand ID to delete (required)
323
+ * @returns {Promise<Object>} Deletion confirmation
324
+ */
325
+ async delete(brandId) {
326
+ this.sdk.validateParams(
327
+ { brandId },
328
+ {
329
+ brandId: { type: 'string', required: true },
330
+ },
331
+ );
332
+
333
+ const result = await this.sdk._fetch(
334
+ `/messaging/campaigns/10dlc/brand/${brandId}`,
335
+ 'DELETE',
336
+ );
337
+ return result;
338
+ }
339
+
340
+ /**
341
+ * Revet (re-vet) a 10DLC brand - resubmit brand for carrier approval
342
+ * @param {string} brandId - Brand ID to revet (required)
343
+ * @returns {Promise<Object>} Revet confirmation and updated brand status
344
+ */
345
+ async revet(brandId) {
346
+ this.sdk.validateParams(
347
+ { brandId },
348
+ {
349
+ brandId: { type: 'string', required: true },
350
+ },
351
+ );
352
+
353
+ const result = await this.sdk._fetch(
354
+ `/messaging/campaigns/10dlc/brand/${brandId}/revet`,
355
+ 'PUT',
356
+ );
357
+ return result;
358
+ }
359
+
360
+ /**
361
+ * Get brand feedback from carriers
362
+ * @param {string} brandId - Brand ID to get feedback for (required)
363
+ * @returns {Promise<Object>} Brand feedback details from carriers
364
+ */
365
+ async getFeedback(brandId) {
366
+ this.sdk.validateParams(
367
+ { brandId },
368
+ {
369
+ brandId: { type: 'string', required: true },
370
+ },
371
+ );
372
+
373
+ const result = await this.sdk._fetch(
374
+ `/messaging/campaigns/10dlc/brand/${brandId}/feedback`,
375
+ 'GET',
376
+ );
377
+ return result;
378
+ }
379
+
380
+ /**
381
+ * Create external brand vetting for higher throughput approval
382
+ * @param {string} brandId - Brand ID to create external vetting for (required)
383
+ * @param {Object} [vettingData] - External vetting data
384
+ * @returns {Promise<Object>} External vetting creation confirmation
385
+ */
386
+ async createExternalVetting(brandId, vettingData) {
387
+ this.sdk.validateParams(
388
+ { brandId },
389
+ {
390
+ brandId: { type: 'string', required: true },
391
+ vettingData: { type: 'object', required: false },
392
+ },
393
+ );
394
+
395
+ const options = {
396
+ body: vettingData || {},
397
+ };
398
+
399
+ const result = await this.sdk._fetch(
400
+ `/messaging/campaigns/10dlc/brand/${brandId}/externalVetting`,
401
+ 'POST',
402
+ options,
403
+ );
404
+ return result;
405
+ }
406
+
407
+ /**
408
+ * Get brand external vetting responses
409
+ * @param {string} brandId - Brand ID to get vetting responses for (required)
410
+ * @returns {Promise<Object>} External vetting responses
411
+ */
412
+ async getExternalVettingResponses(brandId) {
413
+ this.sdk.validateParams(
414
+ { brandId },
415
+ {
416
+ brandId: { type: 'string', required: true },
417
+ },
418
+ );
419
+
420
+ const result = await this.sdk._fetch(
421
+ `/messaging/campaigns/10dlc/brand/${brandId}/externalvetting/responses`,
422
+ 'GET',
423
+ );
424
+ return result;
425
+ }
426
+
427
+ /**
428
+ * Resend two-factor authentication email for PUBLIC_PROFIT brands
429
+ * @param {string} brandId - Brand ID to resend 2FA for
430
+ * @returns {Promise<Object>} Success message and details
431
+ */
432
+ async resend2fa(brandId) {
433
+ this.sdk.validateParams(
434
+ { brandId },
435
+ {
436
+ brandId: { type: 'string', required: true },
437
+ },
438
+ );
439
+
440
+ const result = await this.sdk._fetch(
441
+ `/messaging/campaigns/10dlc/brand/${brandId}/resend-2fa`,
442
+ 'POST',
443
+ );
444
+ return result;
445
+ }
446
+ }