@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
  export class Numbers {
2
8
  constructor(client, multipartClient, enableAdmin) {
3
9
  this.client = client;
@@ -14,8 +20,8 @@ export class Numbers {
14
20
  * @param {string} params.portingId - The _id of the port-in request
15
21
  * @param {string} params.status - The new status (PENDING, IN_PROGRESS, REJECTED)
16
22
  * @param {string} [params.description] - Optional description for the status change
17
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
18
- * @returns {Promise<Object>} A promise that resolves to the updated port-in request
23
+ * @param {RequestOptions} [params.options] - Additional options for the request
24
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated port-in request
19
25
  */
20
26
  changePortingStatus: async ({ portingId, status, description, options = {} }) => {
21
27
  this.client._require({ portingId, status });
@@ -33,8 +39,8 @@ export class Numbers {
33
39
  * @roles signalhouse
34
40
  * @param {Object} params - The parameters for approving the request
35
41
  * @param {string} params.portingId - The _id of the port-in request
36
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
37
- * @returns {Promise<Object>} A promise that resolves to the updated port-in request
42
+ * @param {RequestOptions} [params.options] - Additional options for the request
43
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated port-in request
38
44
  */
39
45
  approvePortRequest: async ({ portingId, options = {} }) => {
40
46
  this.client._require({ portingId });
@@ -53,8 +59,8 @@ export class Numbers {
53
59
  * @param {string} [params.search] - Request or associated identifier search.
54
60
  * @param {number} [params.page] - One-based page number.
55
61
  * @param {number} [params.limit] - Page size.
56
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options.
57
- * @returns {Promise<Object>} Paginated acquisition requests.
62
+ * @param {RequestOptions} [params.options] - Additional options.
63
+ * @returns {Promise<SdkResponse<any>>} Paginated acquisition requests.
58
64
  */
59
65
  getShortCodeAcquisitionRequests: async ({ status, search, page, limit, options = {} } = {}) => {
60
66
  const queryString = this.client._getQueryString({ status, search, page, limit });
@@ -76,7 +82,7 @@ export class Numbers {
76
82
  * @param {string} [params.groupId] - Filter by group ID
77
83
  * @param {number} [params.page] - The page number for pagination (default: 1)
78
84
  * @param {number} [params.limit] - The number of items per page for pagination (default: 20)
79
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
85
+ * @param {RequestOptions} [params.options] - Additional options for the request
80
86
  *
81
87
  * Every record carries a `sentiment` object -- trailing 7-day and 30-day inbound reply sentiment,
82
88
  * refreshed periodically from analytics rather than computed per request: `{ sevenDay, thirtyDay,
@@ -94,7 +100,7 @@ export class Numbers {
94
100
  * in the window; the volumes say how much traffic sits behind it. A campaign's figure is scored from the
95
101
  * campaign's own summed counters, never averaged from its numbers. For a live figure use GET /number/health
96
102
  * or GET /campaign/health.
97
- * @returns {Promise<Object>} A promise that resolves to the list of phone numbers
103
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the list of phone numbers
98
104
  */
99
105
  async getPhoneNumbers({ phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
100
106
  const filters = { phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
@@ -108,9 +114,9 @@ export class Numbers {
108
114
  * @roles api, admin, developer, billing, user
109
115
  * @param {Object} params - The parameters for reading number health
110
116
  * @param {string} params.phoneNumber - Owned phone number to score (11 digits, no + prefix)
111
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
117
+ * @param {RequestOptions} [params.options] - Additional options for the request
112
118
  * @throws {Error} Throws an error if the phoneNumber parameter is missing
113
- * @returns {Promise<Object>} A promise that resolves to `{ phoneNumber, groupId, sevenDay, thirtyDay }`
119
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ phoneNumber, groupId, sevenDay, thirtyDay }`
114
120
  */
115
121
  async getNumberHealth({ phoneNumber, options = {} }) {
116
122
  this.client._require({ phoneNumber });
@@ -134,8 +140,8 @@ export class Numbers {
134
140
  * @param {string} [params.phoneNumber] - Filter by phone number
135
141
  * @param {number} [params.limit] - The number of items per page for pagination
136
142
  * @param {number} [params.page] - The page number for pagination
137
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
138
- * @returns {Promise<Object>} A promise that resolves to the list of available phone numbers
143
+ * @param {RequestOptions} [params.options] - Additional options for the request
144
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the list of available phone numbers
139
145
  */
140
146
  async getAvailablePhoneNumbers({
141
147
  smsEnabled,
@@ -167,9 +173,9 @@ export class Numbers {
167
173
  * @param {string[]} params.phoneNumbers - The list of phone numbers to purchase
168
174
  * @param {string} params.subgroupId - The ID of the subgroup to assign the purchased phone numbers to
169
175
  * @param {'US'|'CA'} [params.country='US'] - ISO-2 purchase country. Toll-Free always uses the shared registry.
170
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
176
+ * @param {RequestOptions} [params.options] - Additional options for the request
171
177
  * @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing
172
- * @returns {Promise<Object>} A promise that resolves to `{ message }` once the request is queued.
178
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ message }` once the request is queued.
173
179
  */
174
180
  async purchasePhoneNumber({ phoneNumbers, subgroupId, country = 'US', options = {} }) {
175
181
  this.client._require({ phoneNumbers, subgroupId });
@@ -188,9 +194,9 @@ export class Numbers {
188
194
  * @param {number} params.quantity - The number of toll-free numbers to purchase (1-10)
189
195
  * @param {string} params.subgroupId - The subgroup the purchased numbers are assigned to
190
196
  * @param {'US'|'CA'} [params.country='US'] - ISO-2 purchase country. Toll-Free always uses the shared registry.
191
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
197
+ * @param {RequestOptions} [params.options] - Additional options for the request
192
198
  * @throws {Error} Throws an error if the quantity or subgroupId parameter is missing
193
- * @returns {Promise<Object>} A promise that resolves to `{ message, orderId }` once the request is queued.
199
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ message, orderId }` once the request is queued.
194
200
  */
195
201
  async purchaseTollFreeNumbers({ quantity, subgroupId, country = 'US', options = {} }) {
196
202
  this.client._require({ quantity, subgroupId });
@@ -213,9 +219,9 @@ export class Numbers {
213
219
  * @param {string} [params.actualCode] - Required customer-owned five- or six-digit code for EXTERNAL_LEASE.
214
220
  * @param {string} [params.orderId] - Required Registry order ID for EXTERNAL_LEASE.
215
221
  * @param {string|Date} [params.leaseEndDate] - Required future Registry lease end date for EXTERNAL_LEASE. A YYYY-MM-DD value expires at 23:59:59 UTC.
216
- * @param {Buffer|Blob|File} [params.leaseReceiptFile] - Required PNG, JPEG, or PDF lease receipt for EXTERNAL_LEASE.
217
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
218
- * @returns {Promise<Object>} A pending acquisition request or pending external-lease number.
222
+ * @param {Blob|File} [params.leaseReceiptFile] - Required PNG, JPEG, or PDF lease receipt for EXTERNAL_LEASE.
223
+ * @param {RequestOptions} [params.options] - Additional options for the request.
224
+ * @returns {Promise<SdkResponse<any>>} A pending acquisition request or pending external-lease number.
219
225
  */
220
226
  async requestShortCodeAcquisition({
221
227
  subgroupId,
@@ -254,9 +260,9 @@ export class Numbers {
254
260
  * @roles api, admin, developer, billing, user
255
261
  * @param {Object} params - The parameters for reading the order status
256
262
  * @param {string} params.orderId - The order id returned by `purchaseTollFreeNumbers`
257
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
263
+ * @param {RequestOptions} [params.options] - Additional options for the request
258
264
  * @throws {Error} Throws an error if the orderId parameter is missing
259
- * @returns {Promise<Object>} A promise that resolves to `{ orderId, counts: { ready, provisioning, failed }, failures: [{ reason }], numbers: string[] }`.
265
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ orderId, counts: { ready, provisioning, failed }, failures: [{ reason }], numbers: string[] }`.
260
266
  */
261
267
  async getTollFreeOrderStatus({ orderId, options = {} }) {
262
268
  this.client._require({ orderId });
@@ -274,9 +280,9 @@ export class Numbers {
274
280
  * @param {string} [params.updateData.friendlyName] - An optional friendly name for the phone number
275
281
  * @param {string|null} [params.updateData.primaryInboundWebhookUrl] - Primary inbound voice webhook URL (http/https). When set, inbound calls to this number are driven by the SHML your webhook returns (programmable call control). Pass null or an empty string to clear.
276
282
  * @param {string|null} [params.updateData.secondaryInboundWebhookUrl] - Secondary inbound voice webhook URL (http/https), used for failover when the primary returns an error. Pass null or an empty string to clear.
277
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
283
+ * @param {RequestOptions} [params.options] - Additional options for the request
278
284
  * @throws {Error} Throws an error if the phoneNumber or updateData parameter is missing
279
- * @returns {Promise<Object>} A promise that resolves to the updated phone number object
285
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated phone number object
280
286
  */
281
287
  async updatePhoneNumber({ phoneNumber, updateData, options = {} }) {
282
288
  this.client._require({ phoneNumber, updateData });
@@ -297,9 +303,9 @@ export class Numbers {
297
303
  * @roles api, admin, developer, billing, user
298
304
  * @param {Object} params - The parameters for the port-in request
299
305
  * @param {Object} params.numberData - The port-in request data including owner info, address, phone numbers, and signature
300
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
306
+ * @param {RequestOptions} [params.options] - Additional options for the request
301
307
  * @throws {Error} Throws an error if the numberData parameter is missing
302
- * @returns {Promise<Object>} A promise that resolves to the created port-in request
308
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the created port-in request
303
309
  */
304
310
  async portInPhoneNumber({ numberData, options = {} }) {
305
311
  this.client._require({ numberData });
@@ -316,8 +322,8 @@ export class Numbers {
316
322
  * @param {string} [params.status] - Filter by status (PENDING, IN_PROGRESS, COMPLETED, REJECTED, CANCELLED)
317
323
  * @param {number} [params.page] - The page number for pagination (default: 1)
318
324
  * @param {number} [params.limit] - The number of items per page (default: 20)
319
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
320
- * @returns {Promise<Object>} A promise that resolves to the paginated list of port-in requests
325
+ * @param {RequestOptions} [params.options] - Additional options for the request
326
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the paginated list of port-in requests
321
327
  */
322
328
  async getPortRequests({ groupId, phoneNumber, status, page, limit, options = {} } = {}) {
323
329
  const filters = { groupId, phoneNumber, status, page, limit };
@@ -331,8 +337,8 @@ export class Numbers {
331
337
  * @roles api, admin, developer, billing, user
332
338
  * @param {Object} params - The parameters for getting the port request
333
339
  * @param {string} params.id - The _id of the port-in request
334
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
335
- * @returns {Promise<Object>} A promise that resolves to the port-in request object
340
+ * @param {RequestOptions} [params.options] - Additional options for the request
341
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the port-in request object
336
342
  */
337
343
  async getPortRequestById({ id, options = {} }) {
338
344
  this.client._require({ id });
@@ -348,8 +354,8 @@ export class Numbers {
348
354
  * @param {string} [params.portingId] - If provided, fetches a single port request by ID
349
355
  * @param {number} [params.page] - Page number for pagination (used when listing)
350
356
  * @param {number} [params.limit] - Items per page (used when listing)
351
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
352
- * @returns {Promise<Object>} A promise that resolves to the port-in request(s)
357
+ * @param {RequestOptions} [params.options] - Additional options for the request
358
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the port-in request(s)
353
359
  */
354
360
  async getPortingRequests({ portingId, page, limit, options = {} } = {}) {
355
361
  if (portingId) {
@@ -369,9 +375,9 @@ export class Numbers {
369
375
  * @param {Object} params - The parameters for assigning phone numbers to a campaign
370
376
  * @param {string} params.campaignId - The ID of the campaign to assign phone numbers to
371
377
  * @param {string[]} params.phoneNumbers - The list of phone numbers to assign to the campaign
372
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
378
+ * @param {RequestOptions} [params.options] - Additional options for the request
373
379
  * @throws {Error} Throws an error if the campaignId or phoneNumbers parameter is missing, if none of the phone numbers exist in the account, or if the campaign is not found or in a terminal state
374
- * @returns {Promise<Object>} A promise that resolves to `{ Message, queued, skipped }` - `queued` numbers were sent for assignment; `skipped` numbers were rejected (not found, RELEASED, currently being released, already assigned to a campaign, cross-DCA mismatch, or over the 49-number limit).
380
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ Message, queued, skipped }` - `queued` numbers were sent for assignment; `skipped` numbers were rejected (not found, RELEASED, currently being released, already assigned to a campaign, cross-DCA mismatch, or over the 49-number limit).
375
381
  */
376
382
  async assignPhoneNumberToCampaign({ campaignId, phoneNumbers, options = {} }) {
377
383
  this.client._require({ campaignId, phoneNumbers });
@@ -385,9 +391,9 @@ export class Numbers {
385
391
  * @roles api, admin, developer, billing, user
386
392
  * @param {Object} params - The parameters for unassigning phone numbers from campaigns
387
393
  * @param {string[]} params.phoneNumbers - The list of phone numbers to unassign from campaigns
388
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
394
+ * @param {RequestOptions} [params.options] - Additional options for the request
389
395
  * @throws {Error} Throws an error if the phoneNumbers parameter is missing
390
- * @returns {Promise<Object>} A promise that resolves to the result of the unassignment operation
396
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the result of the unassignment operation
391
397
  */
392
398
  async unassignPhoneNumbersFromCampaigns({ phoneNumbers, options = {} }) {
393
399
  this.client._require({ phoneNumbers });
@@ -400,9 +406,9 @@ export class Numbers {
400
406
  * @roles api, admin, developer, billing, user
401
407
  * @param {Object} params - The parameters for deleting phone numbers
402
408
  * @param {string[]} params.phoneNumbers - The list of phone numbers to delete
403
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
409
+ * @param {RequestOptions} [params.options] - Additional options for the request
404
410
  * @throws {Error} Throws an error if the phoneNumbers parameter is missing
405
- * @returns {Promise<Object>} A promise that resolves to the result of the deletion operation
411
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the result of the deletion operation
406
412
  */
407
413
  async deletePhoneNumbers({ phoneNumbers, options = {} }) {
408
414
  this.client._require({ phoneNumbers });
@@ -415,9 +421,9 @@ export class Numbers {
415
421
  * @roles api, admin, developer, billing, user
416
422
  * @param {Object} params - The parameters for deactivating phone numbers
417
423
  * @param {string[]} params.phoneNumbers - The list of phone numbers to deactivate
418
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
424
+ * @param {RequestOptions} [params.options] - Additional options for the request
419
425
  * @throws {Error} Throws an error if the phoneNumbers parameter is missing
420
- * @returns {Promise<Object>} A promise that resolves to an array of updated phone number objects
426
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to an array of updated phone number objects
421
427
  */
422
428
  async deactivatePhoneNumbers({ phoneNumbers, options = {} }) {
423
429
  this.client._require({ phoneNumbers });
@@ -430,9 +436,9 @@ export class Numbers {
430
436
  * @roles api, admin, developer, billing, user
431
437
  * @param {Object} params - The parameters for reactivating phone numbers
432
438
  * @param {string[]} params.phoneNumbers - The list of phone numbers to reactivate
433
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
439
+ * @param {RequestOptions} [params.options] - Additional options for the request
434
440
  * @throws {Error} Throws an error if the phoneNumbers parameter is missing
435
- * @returns {Promise<Object>} A promise that resolves to an array of updated phone number objects
441
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to an array of updated phone number objects
436
442
  */
437
443
  async reactivatePhoneNumbers({ phoneNumbers, options = {} }) {
438
444
  this.client._require({ phoneNumbers });
@@ -445,8 +451,8 @@ export class Numbers {
445
451
  * @param {Object} params - The parameters for transferring phone numbers
446
452
  * @param {string[]} params.phoneNumbers - The list of phone numbers to transfer
447
453
  * @param {string} params.newSubgroupId - The ID of the new subgroup to transfer the phone numbers to
448
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
449
- * @returns {Promise<Object>} A promise that resolves to the result of the transfer operation
454
+ * @param {RequestOptions} [params.options] - Additional options for the request
455
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the result of the transfer operation
450
456
  */
451
457
  async transferPhoneNumbers({ phoneNumbers, newSubgroupId, options = {} }) {
452
458
  this.client._require({ phoneNumbers, newSubgroupId });
@@ -465,8 +471,8 @@ export class Numbers {
465
471
  * @param {string} [params.city] - Filter by city name (prefix match, case-insensitive; requires country and state)
466
472
  * @param {string} [params.npa] - Area code filter (1-3 digits; optional country, no state/city)
467
473
  * @param {string} [params.nxx] - Central office code filter (1-3 digits; optional country, no state/city)
468
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
469
- * @returns {Promise<Object>} A promise that resolves to matching NPA/NXX records or unique NPA/NXX arrays
474
+ * @param {RequestOptions} [params.options] - Additional options for the request
475
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to matching NPA/NXX records or unique NPA/NXX arrays
470
476
  */
471
477
  async searchNpaNxx({ country, state, city, npa, nxx, options = {} }) {
472
478
  const queryString = this.client._getQueryString({ country, state, city, npa, nxx });
@@ -479,8 +485,8 @@ export class Numbers {
479
485
  * @roles api, admin, developer, billing, user
480
486
  * @param {Object} params - The parameters for the lookup
481
487
  * @param {Array<{npa: string, nxx: string}>} params.entries - NPA/NXX pairs to look up (max 50)
482
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
483
- * @returns {Promise<Object>} A promise that resolves to an array of {npa, nxx, city, state} objects
488
+ * @param {RequestOptions} [params.options] - Additional options for the request
489
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to an array of {npa, nxx, city, state} objects
484
490
  */
485
491
  async lookupLocations({ entries, options = {} }) {
486
492
  return this.client('/number/lookup/location', { method: 'POST', body: { entries }, ...options });
@@ -494,8 +500,8 @@ export class Numbers {
494
500
  * @param {string} [params.phoneNumber] - The phone number to migrate
495
501
  * @param {string} [params.campaignId] - Campaign ID to migrate all numbers for
496
502
  * @param {string} [params.groupId] - Group ID to migrate all numbers for
497
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
498
- * @returns {Promise<Object>} A promise that resolves to a confirmation with count of queued numbers
503
+ * @param {RequestOptions} [params.options] - Additional options for the request
504
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to a confirmation with count of queued numbers
499
505
  */
500
506
  async migratePhoneNumberToV2({ phoneNumber, campaignId, groupId, options = {} }) {
501
507
  return this.client(`/number/migrate`, { method: 'POST', body: { phoneNumber, campaignId, groupId }, ...options });
@@ -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 Onboarding {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -11,8 +17,8 @@ export class Onboarding {
11
17
  * @async
12
18
  * @roles signalhouse
13
19
  * @param {Object} [params] - Optional parameters
14
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
15
- * @returns {Promise<Object>} - Array of onboarding records
20
+ * @param {RequestOptions} [params.options] - Additional options for the request
21
+ * @returns {Promise<SdkResponse<any>>} - Array of onboarding records
16
22
  */
17
23
  getOnboardings: async ({ options = {} } = {}) => {
18
24
  return this.client(`/group/onboarding`, { method: "GET", ...options });
@@ -24,9 +30,9 @@ export class Onboarding {
24
30
  * @roles signalhouse
25
31
  * @param {Object} params
26
32
  * @param {string} params.groupId - The group ID whose onboarding record to retrieve
27
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
33
+ * @param {RequestOptions} [params.options] - Additional options for the request
28
34
  * @throws {Error} Throws an error if the groupId parameter is missing
29
- * @returns {Promise<Object>} - The onboarding record
35
+ * @returns {Promise<SdkResponse<any>>} - The onboarding record
30
36
  */
31
37
  getOnboarding: async ({ groupId, options = {} }) => {
32
38
  this.client._require({ groupId });
@@ -46,8 +52,8 @@ export class Onboarding {
46
52
  * record rather than an error, so callers never have to special-case them.
47
53
  * @async
48
54
  * @param {Object} [params] - Optional parameters
49
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
50
- * @returns {Promise<Object>} - `{ acceptedTermsOfService: boolean, emailVerified: boolean, products: string[], estimatedVolume: string|null, pendingExternalLink: "ghl"|"shopify"|null }`
55
+ * @param {RequestOptions} [params.options] - Additional options for the request
56
+ * @returns {Promise<SdkResponse<any>>} - `{ acceptedTermsOfService: boolean, emailVerified: boolean, products: string[], estimatedVolume: string|null, pendingExternalLink: "ghl"|"shopify"|null }`
51
57
  */
52
58
  async getMyOnboarding({ options = {} } = {}) {
53
59
  return this.client(`/group/onboarding/my`, { method: "GET", ...options });
@@ -57,8 +63,8 @@ export class Onboarding {
57
63
  * Accept the Terms of Service for the caller's active group.
58
64
  * @async
59
65
  * @param {Object} [params] - Optional parameters
60
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
61
- * @returns {Promise<Object>} - `{ acceptedTermsOfService: true }`
66
+ * @param {RequestOptions} [params.options] - Additional options for the request
67
+ * @returns {Promise<SdkResponse<any>>} - `{ acceptedTermsOfService: true }`
62
68
  */
63
69
  async acceptTermsOfService({ options = {} } = {}) {
64
70
  return this.client(`/group/onboarding/my/accept-terms`, {
@@ -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 Shortlinks {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -10,8 +16,8 @@ export class Shortlinks {
10
16
  * @roles public
11
17
  * @param {Object} params - The parameters for getting the shortlink redirect
12
18
  * @param {string} params.shortlinkId - The ID of the shortlink
13
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
14
- * @returns {Promise<Object>} A promise that resolves to the redirect URL for the shortlink
19
+ * @param {RequestOptions} [params.options] - Additional options for the request
20
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the redirect URL for the shortlink
15
21
  */
16
22
  async getShortlinkRedirect({ shortlinkId, options = {} }) {
17
23
  this.client._require({ shortlinkId });
@@ -33,8 +39,8 @@ export class Shortlinks {
33
39
  * @param {string} [params.groupId] - Filter by associated group ID
34
40
  * @param {number} [params.page] - The page number for pagination
35
41
  * @param {number} [params.limit] - The number of items per page for pagination
36
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
37
- * @returns {Promise<Object>} A promise that resolves to the shortlink details
42
+ * @param {RequestOptions} [params.options] - Additional options for the request
43
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the shortlink details
38
44
  */
39
45
  async getShortlink({ shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
40
46
  const filters = { shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
@@ -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} CreateSubgroupData
3
9
  * @property {string} groupId - The ID of the parent group for the subgroup (must be at least 8 characters long and start with 'G')
@@ -51,8 +57,8 @@ export class Subgroups {
51
57
  * @param {string} [params.groupId] - Filter by parent group ID
52
58
  * @param {number} [params.page] - The page number for pagination
53
59
  * @param {number} [params.limit] - The number of items per page for pagination
54
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
55
- * @returns {Promise<Object>} - The list of subgroups returned from the server
60
+ * @param {RequestOptions} [params.options] - Additional options for the request
61
+ * @returns {Promise<SdkResponse<any>>} - The list of subgroups returned from the server
56
62
  */
57
63
  async getSubgroups({ id, groupId, page, limit, options = {} }) {
58
64
  const filters = { id, groupId, page, limit };
@@ -70,8 +76,8 @@ export class Subgroups {
70
76
  * @param {string} [params.subgroupId] - Restrict results to a subgroup.
71
77
  * @param {number} [params.limit] - Maximum rows to return.
72
78
  * @param {number} [params.offset] - Rows to skip; requires limit.
73
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
74
- * @returns {Promise<Object>} - Subgroup-level resource count rows.
79
+ * @param {RequestOptions} [params.options] - Additional options for the request.
80
+ * @returns {Promise<SdkResponse<any>>} - Subgroup-level resource count rows.
75
81
  */
76
82
  async getSubgroupCounts({ groupId, subgroupId, limit, offset, options = {} } = {}) {
77
83
  const queryString = this.client._getQueryString({ groupId, subgroupId, limit, offset });
@@ -84,9 +90,9 @@ export class Subgroups {
84
90
  * @roles api, admin, developer, billing, user
85
91
  * @param {Object} params - The parameters for creating a subgroup (see CreateSubgroupData typedef for details)
86
92
  * @param {CreateSubgroupData} params.subgroupData - The data for the subgroup to be created, including required fields such as groupId and subgroupName
87
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
93
+ * @param {RequestOptions} [params.options] - Additional options for the request
88
94
  * @throws {Error} Throws an error if the subgroupData parameter is missing or if required fields in subgroupData are missing
89
- * @returns {Promise<Object>} - The created subgroup object returned from the server
95
+ * @returns {Promise<SdkResponse<any>>} - The created subgroup object returned from the server
90
96
  */
91
97
  async createSubgroup({ subgroupData, options = {} }) {
92
98
  this.client._require({ subgroupData: subgroupData });
@@ -100,9 +106,9 @@ export class Subgroups {
100
106
  * @param {Object} params - The parameters for updating a subgroup (see UpdateSubgroupData typedef for details)
101
107
  * @param {string} params.id - The ID of the subgroup to update
102
108
  * @param {UpdateSubgroupData} params.updateData - The data for the subgroup to be updated, including fields such as subgroupName, contact information, and status
103
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
109
+ * @param {RequestOptions} [params.options] - Additional options for the request
104
110
  * @throws {Error} Throws an error if the id or updateData parameter is missing
105
- * @returns {Promise<Object>} - The updated subgroup object returned from the server
111
+ * @returns {Promise<SdkResponse<any>>} - The updated subgroup object returned from the server
106
112
  */
107
113
  async updateSubgroup({ id, updateData, options = {} }) {
108
114
  this.client._require({ id, updateData });
@@ -116,9 +122,9 @@ export class Subgroups {
116
122
  * @roles api, admin, developer, billing, user
117
123
  * @param {Object} params - The parameters for deleting a subgroup
118
124
  * @param {string} params.id - The ID of the subgroup to delete
119
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
125
+ * @param {RequestOptions} [params.options] - Additional options for the request
120
126
  * @throws {Error} Throws an error if the id parameter is missing
121
- * @returns {Promise<Object>} - The deleted subgroup object returned from the server
127
+ * @returns {Promise<SdkResponse<any>>} - The deleted subgroup object returned from the server
122
128
  */
123
129
  async deleteSubgroup({ id, options = {} }) {
124
130
  this.client._require({ id });
@@ -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 Subscriptions {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -11,8 +17,8 @@ export class Subscriptions {
11
17
  * @roles signalhouse
12
18
  * @param {Object} params - The parameters for getting subscription templates
13
19
  * @param {string} [params.templateId] - The ID of a specific template to retrieve (optional)
14
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
15
- * @returns {Promise<Object>} - The subscription templates returned from the server
20
+ * @param {RequestOptions} [params.options] - Additional options for the request
21
+ * @returns {Promise<SdkResponse<any>>} - The subscription templates returned from the server
16
22
  */
17
23
  getTemplates: async ({ templateId, options = {} }) => {
18
24
  const filters = { templateId };
@@ -26,9 +32,9 @@ export class Subscriptions {
26
32
  * @roles signalhouse
27
33
  * @param {Object} params - The parameters for creating a subscription template
28
34
  * @param {Object} params.templateData - The data for the new subscription template, including required fields such as templateName and monthlyFee
29
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
35
+ * @param {RequestOptions} [params.options] - Additional options for the request
30
36
  * @throws {Error} Throws an error if the templateData parameter is missing or if required fields within templateData are missing
31
- * @returns {Promise<Object>} - The created subscription template object returned from the server
37
+ * @returns {Promise<SdkResponse<any>>} - The created subscription template object returned from the server
32
38
  */
33
39
  createTemplate: async ({ templateData, options = {} }) => {
34
40
  this.client._require({ templateData: templateData });
@@ -42,9 +48,9 @@ export class Subscriptions {
42
48
  * @param {Object} params - The parameters for updating a subscription template
43
49
  * @param {string} params.templateId - The ID of the subscription template to update
44
50
  * @param {Object} params.templateData - The data for the subscription template, including fields such as templateName and monthlyFee
45
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
51
+ * @param {RequestOptions} [params.options] - Additional options for the request
46
52
  * @throws {Error} Throws an error if the templateId or templateData parameter is missing
47
- * @returns {Promise<Object>} - The updated subscription template object returned from the server
53
+ * @returns {Promise<SdkResponse<any>>} - The updated subscription template object returned from the server
48
54
  */
49
55
  updateTemplate: async ({ templateId, templateData, options = {} }) => {
50
56
  this.client._require({ templateId, templateData });
@@ -58,9 +64,9 @@ export class Subscriptions {
58
64
  * @roles signalhouse
59
65
  * @param {Object} params - The parameters for deleting a subscription template
60
66
  * @param {string} params.templateId - The ID of the subscription template to delete
61
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
67
+ * @param {RequestOptions} [params.options] - Additional options for the request
62
68
  * @throws {Error} Throws an error if the templateId parameter is missing
63
- * @returns {Promise<Object>} - The deleted subscription template object returned from the server
69
+ * @returns {Promise<SdkResponse<any>>} - The deleted subscription template object returned from the server
64
70
  */
65
71
  deleteTemplate: async ({ templateId, options = {} }) => {
66
72
  this.client._require({ templateId });
@@ -75,9 +81,9 @@ export class Subscriptions {
75
81
  * @param {Object} params - The parameters for creating a custom subscription
76
82
  * @param {string} params.groupId - The ID of the group to create the custom subscription for
77
83
  * @param {Object} params.subscriptionData - The data for the custom subscription, including required fields such as subscriptionName and monthlyFee
78
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
84
+ * @param {RequestOptions} [params.options] - Additional options for the request
79
85
  * @throws {Error} Throws an error if the groupId or subscriptionData parameter is missing or if required fields within subscriptionData are missing
80
- * @returns {Promise<Object>} - The created custom subscription object returned from the server
86
+ * @returns {Promise<SdkResponse<any>>} - The created custom subscription object returned from the server
81
87
  */
82
88
  createCustomSubscription: async ({ groupId, subscriptionData, options = {} }) => {
83
89
  this.client._require({ groupId, subscriptionData });
@@ -95,8 +101,8 @@ export class Subscriptions {
95
101
  * @param {Object} params - The parameters for getting subscription history
96
102
  * @param {string} params.groupId - The ID of the group to get subscription history for
97
103
  * @param {boolean} [params.onlyActive] - Whether to only include active subscriptions
98
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
99
- * @returns {Promise<Object>} - The subscription history returned from the server
104
+ * @param {RequestOptions} [params.options] - Additional options for the request
105
+ * @returns {Promise<SdkResponse<any>>} - The subscription history returned from the server
100
106
  */
101
107
  async getSubscriptions({ groupId, onlyActive, options = {} }) {
102
108
  const filters = { groupId, onlyActive };
@@ -111,9 +117,9 @@ export class Subscriptions {
111
117
  * @param {Object} params - The parameters for subscribing a group to a template
112
118
  * @param {string} params.groupId - The ID of the group to subscribe
113
119
  * @param {string} params.templateId - The ID of the template to subscribe the group to
114
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
120
+ * @param {RequestOptions} [params.options] - Additional options for the request
115
121
  * @throws {Error} Throws an error if the groupId or templateId parameter is missing
116
- * @returns {Promise<Object>} - The subscription object returned from the server
122
+ * @returns {Promise<SdkResponse<any>>} - The subscription object returned from the server
117
123
  */
118
124
  async subscribe({ groupId, templateId, options = {} }) {
119
125
  this.client._require({ groupId, templateId });
@@ -128,9 +134,9 @@ export class Subscriptions {
128
134
  * @roles api, admin, developer, billing, user
129
135
  * @param {Object} params - The parameters for unsubscribing a group from a template
130
136
  * @param {string} params.groupId - The ID of the group to unsubscribe
131
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
137
+ * @param {RequestOptions} [params.options] - Additional options for the request
132
138
  * @throws {Error} Throws an error if the groupId parameter is missing
133
- * @returns {Promise<Object>} - The subscription object returned from the server
139
+ * @returns {Promise<SdkResponse<any>>} - The subscription object returned from the server
134
140
  */
135
141
  async unsubscribe({ groupId, options = {} }) {
136
142
  this.client._require({ groupId });
@@ -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 Tickets {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -11,8 +17,8 @@ export class Tickets {
11
17
  * @async
12
18
  * @roles signalhouse
13
19
  * @param {Object} [params] - Optional parameters
14
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
15
- * @returns {Promise<Object>} - Jira form metadata
20
+ * @param {RequestOptions} [params.options] - Additional options for the request
21
+ * @returns {Promise<SdkResponse<any>>} - Jira form metadata
16
22
  */
17
23
  getJiraMetadata: async ({ options = {} } = {}) => {
18
24
  return this.client(`/admin/ticket/jira/metadata`, { method: "GET", ...options });
@@ -24,8 +30,8 @@ export class Tickets {
24
30
  * @roles signalhouse
25
31
  * @param {Object} [params]
26
32
  * @param {string} [params.query] - Optional epic summary/key filter
27
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
28
- * @returns {Promise<Object>} - `{ epics: Array<{ id, key, summary }> }`
33
+ * @param {RequestOptions} [params.options] - Additional options for the request
34
+ * @returns {Promise<SdkResponse<any>>} - `{ epics: Array<{ id, key, summary }> }`
29
35
  */
30
36
  searchJiraEpics: async ({ query, options = {} } = {}) => {
31
37
  const queryString = this.client._getQueryString({ query });
@@ -38,8 +44,8 @@ export class Tickets {
38
44
  * @roles signalhouse
39
45
  * @param {Object} [params]
40
46
  * @param {string} [params.query] - Optional issue summary/key filter
41
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
42
- * @returns {Promise<Object>} - `{ issues: Array<{ id, key, summary }> }`
47
+ * @param {RequestOptions} [params.options] - Additional options for the request
48
+ * @returns {Promise<SdkResponse<any>>} - `{ issues: Array<{ id, key, summary }> }`
43
49
  */
44
50
  searchJiraParentIssues: async ({ query, options = {} } = {}) => {
45
51
  const queryString = this.client._getQueryString({ query });
@@ -52,8 +58,8 @@ export class Tickets {
52
58
  * @roles signalhouse
53
59
  * @param {Object} [params]
54
60
  * @param {string} [params.query] - Partial name or email
55
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
56
- * @returns {Promise<Object>} - `{ users: Array<{ accountId, displayName, emailAddress }> }`
61
+ * @param {RequestOptions} [params.options] - Additional options for the request
62
+ * @returns {Promise<SdkResponse<any>>} - `{ users: Array<{ accountId, displayName, emailAddress }> }`
57
63
  */
58
64
  searchJiraAssignees: async ({ query, options = {} } = {}) => {
59
65
  const queryString = this.client._getQueryString({ query });
@@ -66,8 +72,8 @@ export class Tickets {
66
72
  * @roles signalhouse
67
73
  * @param {Object} [params]
68
74
  * @param {string} [params.query] - Partial label text
69
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
70
- * @returns {Promise<Object>} - `{ labels: string[] }`
75
+ * @param {RequestOptions} [params.options] - Additional options for the request
76
+ * @returns {Promise<SdkResponse<any>>} - `{ labels: string[] }`
71
77
  */
72
78
  searchJiraLabels: async ({ query, options = {} } = {}) => {
73
79
  const queryString = this.client._getQueryString({ query });
@@ -80,9 +86,9 @@ export class Tickets {
80
86
  * @roles signalhouse
81
87
  * @param {Object} params
82
88
  * @param {Object} params.data - Create payload (groupId, issueTypeId, priorityId, summary required)
83
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
89
+ * @param {RequestOptions} [params.options] - Additional options for the request
84
90
  * @throws {Error} Throws an error if the data parameter is missing
85
- * @returns {Promise<Object>} - Created ticket summary (key, browseUrl, reporter, etc.)
91
+ * @returns {Promise<SdkResponse<any>>} - Created ticket summary (key, browseUrl, reporter, etc.)
86
92
  */
87
93
  createJiraTicket: async ({ data, options = {} }) => {
88
94
  this.client._require({ data });