@signalhousellc/sdk 1.0.67 → 1.0.68

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.
@@ -1,3 +1,9 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
1
7
  /**
2
8
  * @typedef {Object} CreateCampaignData
3
9
  * @property {string} brandId - The ID of the brand associated with the campaign (required)
@@ -148,9 +154,9 @@ export class Campaigns {
148
154
  * @roles signalhouse
149
155
  * @param {Object} params - The parameters for approving the campaign
150
156
  * @param {string} params.campaignId - The ID of the campaign to approve
151
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
157
+ * @param {RequestOptions} [params.options] - Additional options for the request
152
158
  * @throws {Error} Throws an error if the campaignId parameter is missing
153
- * @returns {Promise<Object>} The response from the server
159
+ * @returns {Promise<SdkResponse<any>>} The response from the server
154
160
  */
155
161
  approveCampaign: async ({ campaignId, options = {} }) => {
156
162
  this.client._require({ campaignId });
@@ -163,9 +169,9 @@ export class Campaigns {
163
169
  * @roles signalhouse
164
170
  * @param {Object} params - The parameters for rejecting the campaign
165
171
  * @param {string} params.campaignId - The ID of the campaign to reject
166
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request (body should include { rejectionReason })
172
+ * @param {RequestOptions} [params.options] - Additional options for the request (body should include { rejectionReason })
167
173
  * @throws {Error} Throws an error if the campaignId parameter is missing
168
- * @returns {Promise<Object>} The response from the server
174
+ * @returns {Promise<SdkResponse<any>>} The response from the server
169
175
  */
170
176
  rejectCampaign: async ({ campaignId, options = {} }) => {
171
177
  this.client._require({ campaignId });
@@ -177,8 +183,8 @@ export class Campaigns {
177
183
  * @async
178
184
  * @roles signalhouse
179
185
  * @param {Object} params - The parameters for retrieving CNP campaigns
180
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
181
- * @returns {Promise<Array>} The response from the server
186
+ * @param {RequestOptions} [params.options] - Additional options for the request
187
+ * @returns {Promise<SdkResponse<Array>>} The response from the server
182
188
  */
183
189
  getCNPCampaigns: async ({ options = {} } = {}) => {
184
190
  return this.client(`/campaign/cnp`, { method: 'GET', ...options });
@@ -194,9 +200,9 @@ export class Campaigns {
194
200
  * @param {string} params.campaignId - The ID of the campaign to transition
195
201
  * @param {string} params.status - The target status: "PENDING_REVIEW", "REJECTED", "PENDING_DCA_APPROVAL", "DCA_REJECTED", or "ACTIVE". "PENDING_DCA_APPROVAL" requires a Signal House-approved Short Code brand, issued code, and captured opt-in proof.
196
202
  * @param {string} [params.rejectionReason] - Required, nonblank reason for "REJECTED"/"DCA_REJECTED" (max 1024 characters)
197
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
203
+ * @param {RequestOptions} [params.options] - Additional options for the request
198
204
  * @throws {Error} Throws an error if the campaignId or status parameter is missing
199
- * @returns {Promise<Object>} The updated campaign
205
+ * @returns {Promise<SdkResponse<any>>} The updated campaign
200
206
  */
201
207
  updateShortCodeCampaignStatus: async ({ campaignId, status, rejectionReason, options = {} }) => {
202
208
  this.client._require({ campaignId, status });
@@ -216,8 +222,8 @@ export class Campaigns {
216
222
  * @param {string} params.actualCode - Issued five- or six-digit Short Code.
217
223
  * @param {string} params.leaseEndDate - Fixed future lease end date. A YYYY-MM-DD value expires at 23:59:59 UTC; timestamps retain their supplied time.
218
224
  * @param {string} [params.internalNotes] - Staff-only fulfillment notes.
219
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options.
220
- * @returns {Promise<Object>} The updated campaign.
225
+ * @param {RequestOptions} [params.options] - Additional options.
226
+ * @returns {Promise<SdkResponse<any>>} The updated campaign.
221
227
  */
222
228
  fulfillShortCodeCampaign: async ({ campaignId, actualCode, leaseEndDate, internalNotes, options = {} }) => {
223
229
  this.client._require({ campaignId, actualCode, leaseEndDate });
@@ -234,8 +240,8 @@ export class Campaigns {
234
240
  * @roles signalhouse
235
241
  * @param {Object} params - Submission parameters.
236
242
  * @param {string} params.campaignId - Campaign identifier.
237
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options.
238
- * @returns {Promise<Object>} The updated campaign.
243
+ * @param {RequestOptions} [params.options] - Additional options.
244
+ * @returns {Promise<SdkResponse<any>>} The updated campaign.
239
245
  */
240
246
  submitShortCodeCampaignToCarrier: async ({ campaignId, options = {} }) => {
241
247
  this.client._require({ campaignId });
@@ -245,7 +251,16 @@ export class Campaigns {
245
251
  ...options,
246
252
  });
247
253
  },
248
- /** Confirm Registry offboarding and complete a pending Short Code cancellation. */
254
+ /**
255
+ * Confirm Registry offboarding and complete a pending Short Code cancellation.
256
+ * @async
257
+ * @param {Object} params - Request parameters.
258
+ * @param {string} params.campaignId - Campaign identifier.
259
+ * @param {string} params.requestId - The pending cancellation request to complete.
260
+ * @param {string} [params.note] - Operator note recorded with the completion.
261
+ * @param {RequestOptions} [params.options] - Additional options.
262
+ * @returns {Promise<SdkResponse<any>>} The updated campaign.
263
+ */
249
264
  completeShortCodeCancellation: async ({ campaignId, requestId, note, options = {} }) => {
250
265
  this.client._require({ campaignId, requestId });
251
266
  const safeCampaignId = encodeURIComponent(campaignId);
@@ -255,7 +270,16 @@ export class Campaigns {
255
270
  ...options,
256
271
  });
257
272
  },
258
- /** Dismiss a pending Short Code cancellation and restore its prior lifecycle state. */
273
+ /**
274
+ * Dismiss a pending Short Code cancellation and restore its prior lifecycle state.
275
+ * @async
276
+ * @param {Object} params - Request parameters.
277
+ * @param {string} params.campaignId - Campaign identifier.
278
+ * @param {string} params.requestId - The pending cancellation request to dismiss.
279
+ * @param {string} [params.note] - Operator note recorded with the dismissal.
280
+ * @param {RequestOptions} [params.options] - Additional options.
281
+ * @returns {Promise<SdkResponse<any>>} The updated campaign.
282
+ */
259
283
  dismissShortCodeCancellation: async ({ campaignId, requestId, note, options = {} }) => {
260
284
  this.client._require({ campaignId, requestId });
261
285
  const safeCampaignId = encodeURIComponent(campaignId);
@@ -265,12 +289,28 @@ export class Campaigns {
265
289
  ...options,
266
290
  });
267
291
  },
268
- /** Read expired Short Code leases awaiting manual Registry offboarding. */
292
+ /**
293
+ * Read expired Short Code leases awaiting manual Registry offboarding.
294
+ * @async
295
+ * @param {Object} [params] - Request parameters.
296
+ * @param {number} [params.page] - Page number for pagination.
297
+ * @param {number} [params.limit] - Results per page.
298
+ * @param {RequestOptions} [params.options] - Additional options.
299
+ * @returns {Promise<SdkResponse<any>>} The expired leases page.
300
+ */
269
301
  getExpiredShortCodeLeases: async ({ page, limit, options = {} } = {}) => {
270
302
  const query = this.client._getQueryString({ page, limit });
271
303
  return this.client(`/campaign/short-code/expired-leases${query}`, { method: 'GET', ...options });
272
304
  },
273
- /** Confirm Registry offboarding and mark an expired Short Code released. */
305
+ /**
306
+ * Confirm Registry offboarding and mark an expired Short Code released.
307
+ * @async
308
+ * @param {Object} params - Request parameters.
309
+ * @param {string} params.campaignId - Campaign identifier.
310
+ * @param {string} [params.note] - Operator note recorded with the release.
311
+ * @param {RequestOptions} [params.options] - Additional options.
312
+ * @returns {Promise<SdkResponse<any>>} The updated campaign.
313
+ */
274
314
  releaseExpiredShortCodeLease: async ({ campaignId, note, options = {} }) => {
275
315
  this.client._require({ campaignId });
276
316
  const safeCampaignId = encodeURIComponent(campaignId);
@@ -298,7 +338,7 @@ export class Campaigns {
298
338
  * @param {string} [params.sortBy] - Field to sort by (e.g. "createdAt", "campaignId", "brandId", "groupId", "subgroupId", "usecase", "status")
299
339
  * @param {string} [params.sortOrder] - Sort direction ("asc" or "desc")
300
340
  * @param {string} [params.registrationType] - Filter by registration type ("TEN_DLC", "TOLL_FREE", or "SHORT_CODE")
301
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
341
+ * @param {RequestOptions} [params.options] - Additional options for the request
302
342
  *
303
343
  * Every record carries a `sentiment` object -- trailing 7-day and 30-day inbound reply sentiment,
304
344
  * refreshed periodically from analytics rather than computed per request: `{ sevenDay, thirtyDay,
@@ -316,7 +356,7 @@ export class Campaigns {
316
356
  * in the window; the volumes say how much traffic sits behind it. A campaign's figure is scored from the
317
357
  * campaign's own summed counters, never averaged from its numbers. For a live figure use GET /number/health
318
358
  * or GET /campaign/health.
319
- * @returns {Promise<Array|Object>} The response from the server - array when unpaginated, or { data, total, page, limit, totalPages } when paginated
359
+ * @returns {Promise<SdkResponse<Array|Object>>} The response from the server - array when unpaginated, or { data, total, page, limit, totalPages } when paginated
320
360
  */
321
361
  async getCampaigns({
322
362
  id,
@@ -356,8 +396,8 @@ export class Campaigns {
356
396
  * @param {Object} params - Parameters for reading campaign health
357
397
  * @param {string} params.campaignId - Campaign identifier
358
398
  * @param {boolean} [params.includeNumbers=false] - When true, include per-number health entries
359
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional request options
360
- * @returns {Promise<Object>} A promise that resolves to `{ campaignId, sevenDay, thirtyDay, numbers? }`
399
+ * @param {RequestOptions} [params.options] - Additional request options
400
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ campaignId, sevenDay, thirtyDay, numbers? }`
361
401
  */
362
402
  async getCampaignHealth({ campaignId, includeNumbers = false, options = {} }) {
363
403
  this.client._require({ campaignId });
@@ -365,15 +405,34 @@ export class Campaigns {
365
405
  return this.client(`/campaign/health${queryString}`, { method: 'GET', ...options });
366
406
  }
367
407
 
408
+ /**
409
+ * Get the carrier throughput ceilings a campaign is currently sending under: the AT&T per-minute limit
410
+ * (per campaign, held 10% under the published ceiling) and the T-Mobile daily cap (per brand), each with
411
+ * its current tier and the next rung on the ladder, plus today's T-Mobile usage. Resolved from the same
412
+ * brand status / brand score rules the send path enforces with.
413
+ * @async
414
+ * @roles api, admin, developer, billing, user
415
+ * @param {Object} params - Parameters for reading campaign throughput limits
416
+ * @param {string} params.campaignId - Campaign identifier
417
+ * @param {RequestOptions} [params.options] - Additional request options
418
+ * @throws {Error} Throws an error if the campaignId parameter is missing
419
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ campaignId, brandId, usecase, brand: { status, brandScore, entityType }, att: { tier, scope, unit, sms: { limit }, mms: { limit }, marginPercent, nextTier }, tmobile: { tier, scope, unit, dailyLimit, thresholds, nextTier, usedToday: { date, segments, resetsAt } | null } }`. A null tier/limit means the carrier ladder does not apply (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase); a null nextTier means the top rung or a usecase-capped (LOW_VOLUME) campaign.
420
+ */
421
+ async getCampaignThroughputLimits({ campaignId, options = {} }) {
422
+ this.client._require({ campaignId });
423
+ const queryString = this.client._getQueryString({ campaignId });
424
+ return this.client(`/campaign/throughput-limits${queryString}`, { method: 'GET', ...options });
425
+ }
426
+
368
427
  /**
369
428
  * Create a new campaign
370
429
  * @async
371
430
  * @roles api, admin, developer, billing, user
372
431
  * @param {Object} params - The parameters for creating the campaign (see CreateCampaignData typedef for details)
373
432
  * @param {CreateCampaignData} params.campaignData - The data for the campaign to be created (see CreateCampaignData typedef for details)
374
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
433
+ * @param {RequestOptions} [params.options] - Additional options for the request
375
434
  * @throws {Error} Throws an error if the campaignData parameter is missing or if required fields in campaignData are missing
376
- * @returns {Promise<Object>} The response from the server
435
+ * @returns {Promise<SdkResponse<any>>} The response from the server
377
436
  */
378
437
  async createCampaign({ campaignData, options = {} }) {
379
438
  this.client._require({ campaignData: campaignData });
@@ -386,9 +445,9 @@ export class Campaigns {
386
445
  * @roles api, admin, developer, user
387
446
  * @param {Object} params - The parameters for creating the toll-free campaign
388
447
  * @param {CreateTollFreeCampaignData} params.campaignData - The data for the toll-free campaign to be created (see CreateTollFreeCampaignData typedef for details)
389
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
448
+ * @param {RequestOptions} [params.options] - Additional options for the request
390
449
  * @throws {Error} Throws an error if the campaignData parameter is missing
391
- * @returns {Promise<Object>} The response from the server
450
+ * @returns {Promise<SdkResponse<any>>} The response from the server
392
451
  */
393
452
  async createTollFreeCampaign({ campaignData, options = {} }) {
394
453
  this.client._require({ campaignData });
@@ -404,9 +463,9 @@ export class Campaigns {
404
463
  * @roles api, admin, developer, user
405
464
  * @param {Object} params - The parameters for creating the Short Code campaign
406
465
  * @param {CreateShortCodeCampaignData} params.campaignData - The Short Code campaign data (see CreateShortCodeCampaignData typedef for details)
407
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
466
+ * @param {RequestOptions} [params.options] - Additional options for the request
408
467
  * @throws {Error} Throws an error if the campaignData parameter is missing
409
- * @returns {Promise<Object>} The response from the server
468
+ * @returns {Promise<SdkResponse<any>>} The response from the server
410
469
  */
411
470
  async createShortCodeCampaign({ campaignData, options = {} }) {
412
471
  this.client._require({ campaignData });
@@ -423,9 +482,9 @@ export class Campaigns {
423
482
  * @param {Object} params - The parameters for updating the Short Code campaign
424
483
  * @param {string} params.campaignId - The ID of the campaign to update
425
484
  * @param {Object} params.updateData - The fields to update (top-level campaign fields plus an optional `shortCode` object of editable Short Code fields; pass a new `uploadOptInImage` URL as `shortCode.screenshotUrl` to replace the opt-in proof)
426
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
485
+ * @param {RequestOptions} [params.options] - Additional options for the request
427
486
  * @throws {Error} Throws an error if the campaignId parameter is missing
428
- * @returns {Promise<Object>} The updated campaign
487
+ * @returns {Promise<SdkResponse<any>>} The updated campaign
429
488
  */
430
489
  async updateShortCodeCampaign({ campaignId, updateData, options = {} }) {
431
490
  this.client._require({ campaignId });
@@ -441,9 +500,9 @@ export class Campaigns {
441
500
  * @roles api, admin, developer, user
442
501
  * @param {Object} params - The parameters for cancelling the campaign
443
502
  * @param {string} params.campaignId - The ID of the campaign to cancel
444
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
503
+ * @param {RequestOptions} [params.options] - Additional options for the request
445
504
  * @throws {Error} Throws an error if the campaignId parameter is missing
446
- * @returns {Promise<Object>} The cancelled campaign
505
+ * @returns {Promise<SdkResponse<any>>} The cancelled campaign
447
506
  */
448
507
  async cancelShortCodeCampaign({ campaignId, options = {} }) {
449
508
  this.client._require({ campaignId });
@@ -460,9 +519,9 @@ export class Campaigns {
460
519
  * @roles api, admin, developer, user
461
520
  * @param {Object} params - The parameters for downloading the artifact
462
521
  * @param {string} params.artifactId - The receipt identifier from `numberSource.externalLease.receiptArtifactId`
463
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
522
+ * @param {RequestOptions} [params.options] - Additional options for the request
464
523
  * @throws {Error} Throws an error if the artifactId parameter is missing
465
- * @returns {Promise<Object>} The response from the server (raw file bytes as `data` when a binary responseType is used)
524
+ * @returns {Promise<SdkResponse<any>>} The response from the server (raw file bytes as `data` when a binary responseType is used)
466
525
  */
467
526
  async readCampaignArtifact({ artifactId, options = {} }) {
468
527
  this.client._require({ artifactId });
@@ -476,10 +535,10 @@ export class Campaigns {
476
535
  * @async
477
536
  * @roles api, admin, developer, user
478
537
  * @param {Object} params - The parameters for uploading the opt-in image
479
- * @param {Buffer|Blob|File} params.file - The image file to upload, provided as a Buffer/Blob/File
480
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
538
+ * @param {Blob|File} params.file - The image file to upload, provided as a Blob/File
539
+ * @param {RequestOptions} [params.options] - Additional options for the request
481
540
  * @throws {Error} Throws an error if the file parameter is missing
482
- * @returns {Promise<Object>} The response from the server containing the hosted image's id and URL
541
+ * @returns {Promise<SdkResponse<any>>} The response from the server containing the hosted image's id and URL
483
542
  */
484
543
  async uploadOptInImage({ file, options = {} }) {
485
544
  this.client._require({ file });
@@ -498,9 +557,9 @@ export class Campaigns {
498
557
  * @param {string} [params.landingId] - The specific page to capture. Required for Toll-Free brands, which have
499
558
  * one page per campaign — omitted, the request is refused rather than guessing which page to shoot. A 10DLC
500
559
  * brand has a single page, so it may be omitted there
501
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
560
+ * @param {RequestOptions} [params.options] - Additional options for the request
502
561
  * @throws {Error} Throws an error if the brandId parameter is missing
503
- * @returns {Promise<Object>} The response from the server containing the hosted image's id and URL
562
+ * @returns {Promise<SdkResponse<any>>} The response from the server containing the hosted image's id and URL
504
563
  */
505
564
  async captureOptInImageFromLanding({ brandId, landingId, options = {} }) {
506
565
  this.client._require({ brandId });
@@ -516,9 +575,9 @@ export class Campaigns {
516
575
  * @param {Object} params - The parameters for updating the campaign (see UpdateCampaignData typedef for details)
517
576
  * @param {string} params.campaignId - The ID of the campaign to update
518
577
  * @param {UpdateCampaignData} params.campaignData - The data for the campaign to be updated (see UpdateCampaignData typedef for details)
519
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
578
+ * @param {RequestOptions} [params.options] - Additional options for the request
520
579
  * @throws {Error} Throws an error if the campaignId parameter is missing or if required fields in campaignData are missing
521
- * @returns {Promise<Object>} The response from the server
580
+ * @returns {Promise<SdkResponse<any>>} The response from the server
522
581
  */
523
582
  async updateCampaign({ campaignId, campaignData, options = {} }) {
524
583
  this.client._require({ campaignId: campaignId });
@@ -533,9 +592,9 @@ export class Campaigns {
533
592
  * @param {Object} params - The parameters for adding the comment
534
593
  * @param {string} params.campaignId - The ID of the campaign
535
594
  * @param {string} params.comment - The comment/note text
536
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
595
+ * @param {RequestOptions} [params.options] - Additional options for the request
537
596
  * @throws {Error} Throws an error if the campaignId or comment parameter is missing
538
- * @returns {Promise<Object>} The updated campaign object
597
+ * @returns {Promise<SdkResponse<any>>} The updated campaign object
539
598
  */
540
599
  async addCampaignComment({ campaignId, comment, options = {} }) {
541
600
  this.client._require({ campaignId, comment });
@@ -549,9 +608,9 @@ export class Campaigns {
549
608
  * @roles api, admin, developer, billing, user
550
609
  * @param {Object} params - The parameters for deleting the campaign
551
610
  * @param {string} params.campaignId - The ID of the campaign to delete
552
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
611
+ * @param {RequestOptions} [params.options] - Additional options for the request
553
612
  * @throws {Error} Throws an error if the campaignId parameter is missing
554
- * @returns {Promise<Object>} The response from the server
613
+ * @returns {Promise<SdkResponse<any>>} The response from the server
555
614
  */
556
615
  async deleteCampaign({ campaignId, options = {} }) {
557
616
  this.client._require({ campaignId: campaignId });
@@ -565,9 +624,9 @@ export class Campaigns {
565
624
  * @roles api, admin, developer, billing, user
566
625
  * @param {Object} params - The parameters for appealing the campaign rejection
567
626
  * @param {string} params.campaignId - The ID of the campaign to appeal
568
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request (body should include { reason })
627
+ * @param {RequestOptions} [params.options] - Additional options for the request (body should include { reason })
569
628
  * @throws {Error} Throws an error if the campaignId parameter is missing
570
- * @returns {Promise<Object>} The response from the server
629
+ * @returns {Promise<SdkResponse<any>>} The response from the server
571
630
  */
572
631
  async appealDcaRejection({ campaignId, options = {} }) {
573
632
  this.client._require({ campaignId: campaignId });
@@ -581,9 +640,9 @@ export class Campaigns {
581
640
  * @roles api, admin, developer, billing, user
582
641
  * @param {Object} params - The parameters for nudging the campaign
583
642
  * @param {string} params.campaignId - The ID of the campaign to nudge
584
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
643
+ * @param {RequestOptions} [params.options] - Additional options for the request
585
644
  * @throws {Error} Throws an error if the campaignId parameter is missing
586
- * @returns {Promise<Object>} The response from the server
645
+ * @returns {Promise<SdkResponse<any>>} The response from the server
587
646
  */
588
647
  async nudgeDcaForCampaign({ campaignId, options = {} }) {
589
648
  this.client._require({ campaignId: campaignId });
@@ -1,3 +1,9 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
1
7
  export class Groups {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -15,8 +21,8 @@ export class Groups {
15
21
  * @param {string} [params.groupId] - Restrict results to a group.
16
22
  * @param {number} [params.limit] - Maximum rows to return.
17
23
  * @param {number} [params.offset] - Rows to skip; requires limit.
18
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
19
- * @returns {Promise<Object>} - Group-level resource count rows.
24
+ * @param {RequestOptions} [params.options] - Additional options for the request.
25
+ * @returns {Promise<SdkResponse<any>>} - Group-level resource count rows.
20
26
  */
21
27
  getGroupCounts: async ({ groupId, limit, offset, options = {} } = {}) => {
22
28
  const queryString = this.client._getQueryString({ groupId, limit, offset });
@@ -30,8 +36,8 @@ export class Groups {
30
36
  * @param {Object} params - The parameters for getting groups
31
37
  * @param {number} [params.page] - The page number for pagination
32
38
  * @param {number} [params.limit] - The number of items per page
33
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
34
- * @returns {Promise<Object>} - The list of groups returned from the server
39
+ * @param {RequestOptions} [params.options] - Additional options for the request
40
+ * @returns {Promise<SdkResponse<any>>} - The list of groups returned from the server
35
41
  */
36
42
  getGroups: async ({ page, limit, options = {} }) => {
37
43
  const filters = { page, limit };
@@ -45,24 +51,55 @@ export class Groups {
45
51
  * @roles signalhouse
46
52
  * @param {Object} params - The parameters for creating a new group
47
53
  * @param {Object} params.groupData - The data for the new group, including required fields such as groupName. Optionally accepts `psPartnerKey` and `ownerEmail` to credit a referring partner.
48
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
54
+ * @param {RequestOptions} [params.options] - Additional options for the request
49
55
  * @throws {Error} Throws an error if the groupData parameter is missing or if required fields within groupData are missing
50
- * @returns {Promise<Object>} - The created group object returned from the server
56
+ * @returns {Promise<SdkResponse<any>>} - The created group object returned from the server
51
57
  */
52
58
  createGroup: async ({ groupData, options = {} }) => {
53
59
  this.client._require({ groupData: groupData });
54
60
  return this.client(`/group`, { method: "POST", body: groupData, ...options });
55
61
  },
56
62
 
63
+ /**
64
+ * Record a GHL-app or Shopify-app install's registration for the per-surface
65
+ * customer-lifecycle webhook system. Call this right after admin.createGroup when
66
+ * provisioning a group outside the Portal's self-registration flow (which records
67
+ * itself automatically) — without it, the group never fires a registration webhook and
68
+ * is never eligible for the "registered but no brand submitted" staleness webhook.
69
+ * Internal-only: not documented in the public API reference (deliberate exception, see
70
+ * CLAUDE.md's API Change Propagation Rules — mirrors the /oauth exception).
71
+ * @async
72
+ * @roles signalhouse_api, signalhouse_admin
73
+ * @param {Object} params - The parameters for recording a registration
74
+ * @param {string} params.groupId - The just-provisioned group's ID
75
+ * @param {string} params.registrationSource - Which surface provisioned this group ("ghl" or "shopify")
76
+ * @param {string} [params.firstName] - The account owner's first name
77
+ * @param {string} [params.fullName] - The account owner's full name
78
+ * @param {string} [params.email] - The account owner's email
79
+ * @param {string} [params.phone] - The account owner's phone number
80
+ * @param {string} [params.estimatedVolume] - Estimated monthly message volume
81
+ * @param {RequestOptions} [params.options] - Additional options for the request
82
+ * @throws {Error} Throws an error if the groupId or registrationSource parameter is missing
83
+ * @returns {Promise<SdkResponse<any>>} - `{ success: true }`
84
+ */
85
+ recordLifecycleRegistration: async ({ groupId, registrationSource, firstName, fullName, email, phone, estimatedVolume, options = {} }) => {
86
+ this.client._require({ groupId, registrationSource });
87
+ return this.client(`/group/lifecycle/registration`, {
88
+ method: "POST",
89
+ body: { groupId, registrationSource, firstName, fullName, email, phone, estimatedVolume },
90
+ ...options,
91
+ });
92
+ },
93
+
57
94
  /**
58
95
  * Delete a group with the specified group ID
59
96
  * @async
60
97
  * @roles signalhouse
61
98
  * @param {Object} params - The parameters for deleting a group
62
99
  * @param {string} params.groupId - The ID of the group to delete
63
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
100
+ * @param {RequestOptions} [params.options] - Additional options for the request
64
101
  * @throws {Error} Throws an error if the groupId parameter is missing
65
- * @returns {Promise<Object>} - The deleted group object returned from the server
102
+ * @returns {Promise<SdkResponse<any>>} - The deleted group object returned from the server
66
103
  */
67
104
  deleteGroup: async ({ groupId, options = {} }) => {
68
105
  this.client._require({ groupId });
@@ -78,9 +115,9 @@ export class Groups {
78
115
  * @param {Object} params - The parameters for updating a group's compliance status
79
116
  * @param {string} params.groupId - The ID of the group to update
80
117
  * @param {string} params.complianceStatus - One of "unverified", "pending", "verified", "rejected"
81
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
118
+ * @param {RequestOptions} [params.options] - Additional options for the request
82
119
  * @throws {Error} Throws an error if the groupId or complianceStatus parameter is missing
83
- * @returns {Promise<Object>} - The updated group object returned from the server
120
+ * @returns {Promise<SdkResponse<any>>} - The updated group object returned from the server
84
121
  */
85
122
  updateComplianceStatus: async ({ groupId, complianceStatus, options = {} }) => {
86
123
  this.client._require({ groupId, complianceStatus });
@@ -99,9 +136,9 @@ export class Groups {
99
136
  * @param {string} params.externalSystem - The external system ("ghl" or "shopify")
100
137
  * @param {string} params.externalId - The external tenant identifier
101
138
  * @param {string} [params.existingGroupId] - An existing V2 group ID to repoint to, if any
102
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
139
+ * @param {RequestOptions} [params.options] - Additional options for the request
103
140
  * @throws {Error} Throws an error if linkToken, externalSystem, or externalId is missing
104
- * @returns {Promise<Object>} - The link outcome ({ status, canonicalGroupId, ... })
141
+ * @returns {Promise<SdkResponse<any>>} - The link outcome ({ status, canonicalGroupId, ... })
105
142
  */
106
143
  linkExternal: async ({ linkToken, externalSystem, externalId, existingGroupId, options = {} }) => {
107
144
  this.client._require({ linkToken, externalSystem, externalId });
@@ -121,8 +158,8 @@ export class Groups {
121
158
  * @roles api, admin, developer, billing, user
122
159
  * @param {Object} params - The parameters for getting a group
123
160
  * @param {string} params.id - The ID of the group to retrieve
124
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
125
- * @returns {Promise<Object>} - The group object returned from the server
161
+ * @param {RequestOptions} [params.options] - Additional options for the request
162
+ * @returns {Promise<SdkResponse<any>>} - The group object returned from the server
126
163
  */
127
164
  async getGroup({ id, options = {} }) {
128
165
  const filters = { id };
@@ -138,9 +175,9 @@ export class Groups {
138
175
  * @param {string} params.id - The ID of the group to update
139
176
  * @param {Object} params.groupData - The data for the group, including required fields such as groupName.
140
177
  * Optional CNP fields: cspId (string|null), defaultCnpSubgroupId (string|null)
141
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
178
+ * @param {RequestOptions} [params.options] - Additional options for the request
142
179
  * @throws {Error} Throws an error if the id or groupData parameter is missing
143
- * @returns {Promise<Object>} - The updated group object returned from the server
180
+ * @returns {Promise<SdkResponse<any>>} - The updated group object returned from the server
144
181
  */
145
182
  async updateGroup({ id, groupData, options = {} }) {
146
183
  this.client._require({ id, groupData: groupData });
@@ -1,3 +1,9 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
1
7
  /**
2
8
  * @typedef {Object} TollFreeConsentBox
3
9
  * @property {string} useCase - The use case the checkbox covers
@@ -67,9 +73,9 @@ export class Landings {
67
73
  * @roles api, admin, developer, billing, user
68
74
  * @param {Object} params - The parameters for getting a landing page
69
75
  * @param {string} params.landingId - The ID of the landing page to retrieve
70
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
76
+ * @param {RequestOptions} [params.options] - Additional options for the request
71
77
  * @throws {Error} Throws an error if the landingId parameter is missing
72
- * @returns {Promise<Object>} - The landing page object returned from the server
78
+ * @returns {Promise<SdkResponse<any>>} - The landing page object returned from the server
73
79
  */
74
80
  async getLandings({ landingId, options = {} }) {
75
81
  this.client._require({ landingId });
@@ -82,9 +88,9 @@ export class Landings {
82
88
  * @async
83
89
  * @param {Object} params - The parameters for getting a public landing page
84
90
  * @param {string} params.landingId - The ID of the public landing page to retrieve
85
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
91
+ * @param {RequestOptions} [params.options] - Additional options for the request
86
92
  * @throws {Error} Throws an error if the landingId parameter is missing
87
- * @returns {Promise<Object>} - The public landing page object returned from the server
93
+ * @returns {Promise<SdkResponse<any>>} - The public landing page object returned from the server
88
94
  */
89
95
  async getPublicLanding({ landingId, options = {} }) {
90
96
  this.client._require({ landingId });
@@ -98,9 +104,9 @@ export class Landings {
98
104
  * @roles api, admin, developer, billing, user
99
105
  * @param {Object} params - The parameters for creating a new landing page (see CreateLandingData typedef for details)
100
106
  * @param {CreateLandingData} params.landingData - The data for the new landing page, including required fields such as brandId and description
101
- * @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
102
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
103
- * @returns {Promise<Object>} - The newly created landing page object returned from the server
107
+ * @param {Blob|File} params.file - A logo image file for the landing page, provided as a Blob/File
108
+ * @param {RequestOptions} [params.options] - Additional options for the request
109
+ * @returns {Promise<SdkResponse<any>>} - The newly created landing page object returned from the server
104
110
  */
105
111
  async createLanding({ landingData, file, options = {} }) {
106
112
  const formData = new FormData();
@@ -111,7 +117,7 @@ export class Landings {
111
117
 
112
118
  Object.entries(landingData).forEach(([key, value]) => {
113
119
  if (value !== undefined) {
114
- formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
120
+ formData.append(key, typeof value === "object" ? JSON.stringify(value) : String(value));
115
121
  }
116
122
  });
117
123
 
@@ -125,10 +131,10 @@ export class Landings {
125
131
  * @param {Object} params - The parameters for updating a landing page (see UpdateLandingData typedef for details)
126
132
  * @param {string} params.landingId - The ID of the landing page to update
127
133
  * @param {UpdateLandingData} params.landingData - The data for the landing page, including required fields such as brandId and description
128
- * @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
129
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
134
+ * @param {Blob|File} params.file - A logo image file for the landing page, provided as a Blob/File
135
+ * @param {RequestOptions} [params.options] - Additional options for the request
130
136
  * @throws {Error} Throws an error if the landingId parameter is missing
131
- * @returns {Promise<Object>} - The updated landing page object returned from the server
137
+ * @returns {Promise<SdkResponse<any>>} - The updated landing page object returned from the server
132
138
  */
133
139
  async updateLanding({ landingId, landingData, file, options = {} }) {
134
140
  this.client._require({ landingId });
@@ -141,32 +147,22 @@ export class Landings {
141
147
 
142
148
  Object.entries(landingData).forEach(([key, value]) => {
143
149
  if (value !== undefined) {
144
- formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
150
+ formData.append(key, typeof value === "object" ? JSON.stringify(value) : String(value));
145
151
  }
146
152
  });
147
153
 
148
154
  return this.multipartClient(`/landing/${safeLandingId}`, { method: "PUT", body: formData, ...options });
149
155
  }
150
156
 
151
- /**
152
- * Delete a landing page by its ID
153
- * @async
154
- * @roles api, admin, developer, billing, user
155
- * @param {Object} params - The parameters for deleting a landing page
156
- * @param {string} params.landingId - The ID of the landing page to delete
157
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
158
- * @throws {Error} Throws an error if the landingId parameter is missing
159
- * @returns {Promise<Object>} - The response from the server after deleting the landing page
160
- */
161
157
  /**
162
158
  * Get a landing page by its associated brand ID
163
159
  * @async
164
160
  * @roles api, admin, developer, billing, user
165
161
  * @param {Object} params - The parameters for getting a landing page by brand
166
162
  * @param {string} params.brandId - The brand ID to look up the landing page for
167
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
163
+ * @param {RequestOptions} [params.options] - Additional options for the request
168
164
  * @throws {Error} Throws an error if the brandId parameter is missing
169
- * @returns {Promise<Object>} - The landing page object returned from the server
165
+ * @returns {Promise<SdkResponse<any>>} - The landing page object returned from the server
170
166
  */
171
167
  async getLandingByBrandId({ brandId, options = {} }) {
172
168
  this.client._require({ brandId });
@@ -181,9 +177,9 @@ export class Landings {
181
177
  * @roles api, admin, developer, billing, user
182
178
  * @param {Object} params - The parameters for getting a landing page template
183
179
  * @param {string} params.brandId - The brand ID to look up the template for
184
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
180
+ * @param {RequestOptions} [params.options] - Additional options for the request
185
181
  * @throws {Error} Throws an error if the brandId parameter is missing
186
- * @returns {Promise<Object>} - The template returned from the server
182
+ * @returns {Promise<SdkResponse<any>>} - The template returned from the server
187
183
  */
188
184
  async getLandingTemplate({ brandId, options = {} }) {
189
185
  this.client._require({ brandId });
@@ -199,11 +195,11 @@ export class Landings {
199
195
  * @param {Object} params - The parameters for saving a landing page template
200
196
  * @param {string} params.brandId - The brand the template belongs to
201
197
  * @param {LandingTemplateData} params.templateData - The template fields (see LandingTemplateData typedef)
202
- * @param {Buffer} [params.file] - A logo image file, provided as a Buffer. Required the first time only;
198
+ * @param {Blob|File} [params.file] - A logo image file, provided as a Blob/File. Required the first time only;
203
199
  * omit it on a later save to keep the stored logo
204
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
200
+ * @param {RequestOptions} [params.options] - Additional options for the request
205
201
  * @throws {Error} Throws an error if the brandId parameter is missing
206
- * @returns {Promise<Object>} - The saved template returned from the server
202
+ * @returns {Promise<SdkResponse<any>>} - The saved template returned from the server
207
203
  */
208
204
  async upsertLandingTemplate({ brandId, templateData, file, options = {} }) {
209
205
  this.client._require({ brandId });
@@ -216,13 +212,23 @@ export class Landings {
216
212
 
217
213
  Object.entries(templateData).forEach(([key, value]) => {
218
214
  if (value !== undefined) {
219
- formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
215
+ formData.append(key, typeof value === "object" ? JSON.stringify(value) : String(value));
220
216
  }
221
217
  });
222
218
 
223
219
  return this.multipartClient(`/landing/template/${safeBrandId}`, { method: "PUT", body: formData, ...options });
224
220
  }
225
221
 
222
+ /**
223
+ * Delete a landing page by its ID
224
+ * @async
225
+ * @roles api, admin, developer, billing, user
226
+ * @param {Object} params - The parameters for deleting a landing page
227
+ * @param {string} params.landingId - The ID of the landing page to delete
228
+ * @param {RequestOptions} [params.options] - Additional options for the request
229
+ * @throws {Error} Throws an error if the landingId parameter is missing
230
+ * @returns {Promise<SdkResponse<any>>} - The response from the server after deleting the landing page
231
+ */
226
232
  async deleteLanding({ landingId, options = {} }) {
227
233
  this.client._require({ landingId });
228
234
  const safeLandingId = encodeURIComponent(landingId);