@signalhousellc/sdk 1.0.66 → 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 Notifications {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -15,8 +21,8 @@ export class Notifications {
15
21
  * @param {number} [params.limit] - Results per page (min 1, max 100, default 10)
16
22
  * @param {string} [params.status] - Filter by status: "READ" or "UNREAD"
17
23
  * @param {string|string[]} [params.eventTypes] - Event types to filter by (comma-separated string or array)
18
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
19
- * @returns {Promise<Object>} The response from the server
24
+ * @param {RequestOptions} [params.options] - Additional options for the request
25
+ * @returns {Promise<SdkResponse<any>>} The response from the server
20
26
  */
21
27
  async getNotifications({ id, groupId, page, limit, status, eventTypes, options = {} }) {
22
28
  this.client._require({ "id or groupId": id ?? groupId });
@@ -31,8 +37,8 @@ export class Notifications {
31
37
  * @param {Object} params
32
38
  * @param {string|string[]} params.ids - Notification id or array of notification ids
33
39
  * @param {string} params.status - New status: "READ" or "UNREAD"
34
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
35
- * @returns {Promise<Object>} The response from the server
40
+ * @param {RequestOptions} [params.options] - Additional options for the request
41
+ * @returns {Promise<SdkResponse<any>>} The response from the server
36
42
  */
37
43
  async updateNotificationStatus({ ids, status, options = {} }) {
38
44
  this.client._require({ ids, status });
@@ -45,8 +51,8 @@ export class Notifications {
45
51
  * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
46
52
  * @param {Object} params
47
53
  * @param {string} params.id - The notification id to delete
48
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
49
- * @returns {Promise<Object>} The response from the server
54
+ * @param {RequestOptions} [params.options] - Additional options for the request
55
+ * @returns {Promise<SdkResponse<any>>} The response from the server
50
56
  */
51
57
  async deleteNotification({ id, options = {} }) {
52
58
  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 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,
@@ -86,7 +92,15 @@ export class Numbers {
86
92
  * window, which is not the same as a score of 0 -- null means nobody replied, 0 means replies
87
93
  * averaged neutral. `updatedAt` is null until the first rollup writes the record, and it tracks when
88
94
  * the figures last CHANGED, not when the job last ran.
89
- * @returns {Promise<Object>} A promise that resolves to the list of phone numbers
95
+ *
96
+ * Every record also carries a `health` object -- trailing 7-day and 30-day delivery/opt-out health from
97
+ * the same periodic refresh: `{ sevenDay, thirtyDay, updatedAt }`, each window being `{ score,
98
+ * deliveryRate, optOutRate, deliveryScore, optOutScore, messagesSent, messagesDelivered, messagesFailed,
99
+ * optOuts }`. `score` is 1.0..10.0 (the mean of the two bucket scores) and is null when nothing was sent
100
+ * in the window; the volumes say how much traffic sits behind it. A campaign's figure is scored from the
101
+ * campaign's own summed counters, never averaged from its numbers. For a live figure use GET /number/health
102
+ * or GET /campaign/health.
103
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the list of phone numbers
90
104
  */
91
105
  async getPhoneNumbers({ phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
92
106
  const filters = { phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
@@ -100,9 +114,9 @@ export class Numbers {
100
114
  * @roles api, admin, developer, billing, user
101
115
  * @param {Object} params - The parameters for reading number health
102
116
  * @param {string} params.phoneNumber - Owned phone number to score (11 digits, no + prefix)
103
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
117
+ * @param {RequestOptions} [params.options] - Additional options for the request
104
118
  * @throws {Error} Throws an error if the phoneNumber parameter is missing
105
- * @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 }`
106
120
  */
107
121
  async getNumberHealth({ phoneNumber, options = {} }) {
108
122
  this.client._require({ phoneNumber });
@@ -120,13 +134,14 @@ export class Numbers {
120
134
  * @param {boolean} [params.voiceEnabled] - Filter for phone numbers that are voice enabled
121
135
  * @param {string} [params.country] - Filter by country code (e.g., "US")
122
136
  * @param {string} [params.state] - Filter by state code (e.g., "CA")
137
+ * @param {string} [params.city] - City prefix; requires country US/CA and state/province.
123
138
  * @param {string} [params.npa] - Filter by NPA (area code)
124
139
  * @param {string} [params.nxx] - Filter by NXX (central office code) - the first three digits of the local phone number after the area code
125
140
  * @param {string} [params.phoneNumber] - Filter by phone number
126
141
  * @param {number} [params.limit] - The number of items per page for pagination
127
142
  * @param {number} [params.page] - The page number for pagination
128
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
129
- * @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
130
145
  */
131
146
  async getAvailablePhoneNumbers({
132
147
  smsEnabled,
@@ -134,6 +149,7 @@ export class Numbers {
134
149
  voiceEnabled,
135
150
  country,
136
151
  state,
152
+ city,
137
153
  npa,
138
154
  nxx,
139
155
  phoneNumber,
@@ -141,7 +157,7 @@ export class Numbers {
141
157
  page,
142
158
  options = {},
143
159
  }) {
144
- const filters = { smsEnabled, mmsEnabled, voiceEnabled, country, state, npa, nxx, phoneNumber, limit, page };
160
+ const filters = { smsEnabled, mmsEnabled, voiceEnabled, country, state, city, npa, nxx, phoneNumber, limit, page };
145
161
  const queryString = this.client._getQueryString(filters);
146
162
  return this.client(`/number/available${queryString}`, { method: 'GET', ...options });
147
163
  }
@@ -156,13 +172,14 @@ export class Numbers {
156
172
  * @param {Object} params - The parameters for purchasing phone numbers
157
173
  * @param {string[]} params.phoneNumbers - The list of phone numbers to purchase
158
174
  * @param {string} params.subgroupId - The ID of the subgroup to assign the purchased phone numbers to
159
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
175
+ * @param {'US'|'CA'} [params.country='US'] - ISO-2 purchase country. Toll-Free always uses the shared registry.
176
+ * @param {RequestOptions} [params.options] - Additional options for the request
160
177
  * @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing
161
- * @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.
162
179
  */
163
- async purchasePhoneNumber({ phoneNumbers, subgroupId, options = {} }) {
180
+ async purchasePhoneNumber({ phoneNumbers, subgroupId, country = 'US', options = {} }) {
164
181
  this.client._require({ phoneNumbers, subgroupId });
165
- return this.client(`/number`, { method: 'POST', body: { phoneNumbers, subgroupId }, ...options });
182
+ return this.client(`/number`, { method: 'POST', body: { phoneNumbers, subgroupId, country }, ...options });
166
183
  }
167
184
 
168
185
  /**
@@ -176,19 +193,19 @@ export class Numbers {
176
193
  * @param {Object} params - The parameters for purchasing toll-free numbers
177
194
  * @param {number} params.quantity - The number of toll-free numbers to purchase (1-10)
178
195
  * @param {string} params.subgroupId - The subgroup the purchased numbers are assigned to
179
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
196
+ * @param {'US'|'CA'} [params.country='US'] - ISO-2 purchase country. Toll-Free always uses the shared registry.
197
+ * @param {RequestOptions} [params.options] - Additional options for the request
180
198
  * @throws {Error} Throws an error if the quantity or subgroupId parameter is missing
181
- * @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.
182
200
  */
183
- async purchaseTollFreeNumbers({ quantity, subgroupId, options = {} }) {
201
+ async purchaseTollFreeNumbers({ quantity, subgroupId, country = 'US', options = {} }) {
184
202
  this.client._require({ quantity, subgroupId });
185
- return this.client(`/number/toll-free`, { method: 'POST', body: { quantity, subgroupId }, ...options });
203
+ return this.client(`/number/toll-free`, { method: 'POST', body: { quantity, subgroupId, country }, ...options });
186
204
  }
187
205
 
188
206
  /**
189
- * Request a campaign-bound Short Code acquisition or register a customer-owned Registry lease.
190
- * An inventory request soft-holds an existing unassigned Short Code. Random and vanity requests remain pending
191
- * until Signal House staff fulfill them. An external lease creates a pending Short Code number immediately; it
207
+ * Request a campaign-bound Short Code acquisition or register a customer-owned Registry lease.
208
+ * Random and vanity requests remain pending until Signal House staff fulfill them. An external lease creates a pending Short Code number immediately; it
192
209
  * becomes READY only when its campaign becomes ACTIVE.
193
210
  * @async
194
211
  * @roles api, admin, developer, billing, user
@@ -196,23 +213,21 @@ export class Numbers {
196
213
  * @param {string} params.subgroupId - The owning subgroup ID.
197
214
  * @param {string} params.brandId - The owning Short Code brand ID.
198
215
  * @param {string} params.campaignId - The owning Short Code campaign ID.
199
- * @param {'INVENTORY'|'RANDOM'|'VANITY'|'EXTERNAL_LEASE'} params.requestType - Acquisition path.
200
- * @param {string} [params.existingPhoneNumber] - Required existing five- or six-digit Short Code for INVENTORY.
216
+ * @param {'RANDOM'|'VANITY'|'EXTERNAL_LEASE'} params.requestType - Acquisition path.
201
217
  * @param {number} [params.leaseTermMonths] - Required 3, 6, or 12-month term for RANDOM/VANITY.
202
218
  * @param {string} [params.requestedVanityCode] - Required five- or six-digit desired code for VANITY.
203
219
  * @param {string} [params.actualCode] - Required customer-owned five- or six-digit code for EXTERNAL_LEASE.
204
220
  * @param {string} [params.orderId] - Required Registry order ID for EXTERNAL_LEASE.
205
- * @param {string|Date} [params.leaseEndDate] - Required future Registry lease end date for EXTERNAL_LEASE.
206
- * @param {Buffer|Blob|File} [params.leaseReceiptFile] - Required PNG, JPEG, or PDF lease receipt for EXTERNAL_LEASE.
207
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
208
- * @returns {Promise<Object>} A pending acquisition request or pending external-lease number.
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.
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.
209
225
  */
210
226
  async requestShortCodeAcquisition({
211
227
  subgroupId,
212
228
  brandId,
213
229
  campaignId,
214
230
  requestType,
215
- existingPhoneNumber,
216
231
  requestedVanityCode,
217
232
  leaseTermMonths,
218
233
  actualCode,
@@ -225,7 +240,7 @@ export class Numbers {
225
240
  const formData = new FormData();
226
241
  formData.append(
227
242
  'acquisitionData',
228
- JSON.stringify({ subgroupId, brandId, campaignId, requestType, existingPhoneNumber, requestedVanityCode, leaseTermMonths, actualCode, orderId, leaseEndDate }),
243
+ JSON.stringify({ subgroupId, brandId, campaignId, requestType, requestedVanityCode, leaseTermMonths, actualCode, orderId, leaseEndDate }),
229
244
  );
230
245
  if (leaseReceiptFile) formData.append('leaseReceipt', leaseReceiptFile);
231
246
  return this.multipartClient(`/number/short-code`, {
@@ -245,9 +260,9 @@ export class Numbers {
245
260
  * @roles api, admin, developer, billing, user
246
261
  * @param {Object} params - The parameters for reading the order status
247
262
  * @param {string} params.orderId - The order id returned by `purchaseTollFreeNumbers`
248
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
263
+ * @param {RequestOptions} [params.options] - Additional options for the request
249
264
  * @throws {Error} Throws an error if the orderId parameter is missing
250
- * @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[] }`.
251
266
  */
252
267
  async getTollFreeOrderStatus({ orderId, options = {} }) {
253
268
  this.client._require({ orderId });
@@ -265,9 +280,9 @@ export class Numbers {
265
280
  * @param {string} [params.updateData.friendlyName] - An optional friendly name for the phone number
266
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.
267
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.
268
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
283
+ * @param {RequestOptions} [params.options] - Additional options for the request
269
284
  * @throws {Error} Throws an error if the phoneNumber or updateData parameter is missing
270
- * @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
271
286
  */
272
287
  async updatePhoneNumber({ phoneNumber, updateData, options = {} }) {
273
288
  this.client._require({ phoneNumber, updateData });
@@ -288,9 +303,9 @@ export class Numbers {
288
303
  * @roles api, admin, developer, billing, user
289
304
  * @param {Object} params - The parameters for the port-in request
290
305
  * @param {Object} params.numberData - The port-in request data including owner info, address, phone numbers, and signature
291
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
306
+ * @param {RequestOptions} [params.options] - Additional options for the request
292
307
  * @throws {Error} Throws an error if the numberData parameter is missing
293
- * @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
294
309
  */
295
310
  async portInPhoneNumber({ numberData, options = {} }) {
296
311
  this.client._require({ numberData });
@@ -307,8 +322,8 @@ export class Numbers {
307
322
  * @param {string} [params.status] - Filter by status (PENDING, IN_PROGRESS, COMPLETED, REJECTED, CANCELLED)
308
323
  * @param {number} [params.page] - The page number for pagination (default: 1)
309
324
  * @param {number} [params.limit] - The number of items per page (default: 20)
310
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
311
- * @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
312
327
  */
313
328
  async getPortRequests({ groupId, phoneNumber, status, page, limit, options = {} } = {}) {
314
329
  const filters = { groupId, phoneNumber, status, page, limit };
@@ -322,8 +337,8 @@ export class Numbers {
322
337
  * @roles api, admin, developer, billing, user
323
338
  * @param {Object} params - The parameters for getting the port request
324
339
  * @param {string} params.id - The _id of the port-in request
325
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
326
- * @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
327
342
  */
328
343
  async getPortRequestById({ id, options = {} }) {
329
344
  this.client._require({ id });
@@ -339,8 +354,8 @@ export class Numbers {
339
354
  * @param {string} [params.portingId] - If provided, fetches a single port request by ID
340
355
  * @param {number} [params.page] - Page number for pagination (used when listing)
341
356
  * @param {number} [params.limit] - Items per page (used when listing)
342
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
343
- * @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)
344
359
  */
345
360
  async getPortingRequests({ portingId, page, limit, options = {} } = {}) {
346
361
  if (portingId) {
@@ -351,17 +366,18 @@ export class Numbers {
351
366
 
352
367
  /**
353
368
  * Assign phone numbers to a campaign by providing the campaign ID and a list of phone numbers to assign.
354
- * Numbers that are not found, already RELEASED, already assigned to a different campaign, on a mismatched
355
- * DCA, or (for a 10DLC campaign without a number pool) beyond the remaining 49-number-per-campaign limit
356
- * are not queued - each is reported back individually in `skipped` instead of failing the whole request.
369
+ * Numbers that are not found, already RELEASED, currently being released (transient PENDING_RELEASE
370
+ * status), already assigned to a different campaign, on a mismatched DCA, or (for a 10DLC campaign
371
+ * without a number pool) beyond the remaining 49-number-per-campaign limit are not queued - each is
372
+ * reported back individually in `skipped` instead of failing the whole request.
357
373
  * @async
358
374
  * @roles api, admin, developer, billing, user
359
375
  * @param {Object} params - The parameters for assigning phone numbers to a campaign
360
376
  * @param {string} params.campaignId - The ID of the campaign to assign phone numbers to
361
377
  * @param {string[]} params.phoneNumbers - The list of phone numbers to assign to the campaign
362
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
378
+ * @param {RequestOptions} [params.options] - Additional options for the request
363
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
364
- * @returns {Promise<Object>} A promise that resolves to `{ Message, queued, skipped }` - `queued` numbers were sent for assignment; `skipped` numbers were rejected (not found, 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).
365
381
  */
366
382
  async assignPhoneNumberToCampaign({ campaignId, phoneNumbers, options = {} }) {
367
383
  this.client._require({ campaignId, phoneNumbers });
@@ -375,9 +391,9 @@ export class Numbers {
375
391
  * @roles api, admin, developer, billing, user
376
392
  * @param {Object} params - The parameters for unassigning phone numbers from campaigns
377
393
  * @param {string[]} params.phoneNumbers - The list of phone numbers to unassign from campaigns
378
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
394
+ * @param {RequestOptions} [params.options] - Additional options for the request
379
395
  * @throws {Error} Throws an error if the phoneNumbers parameter is missing
380
- * @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
381
397
  */
382
398
  async unassignPhoneNumbersFromCampaigns({ phoneNumbers, options = {} }) {
383
399
  this.client._require({ phoneNumbers });
@@ -385,14 +401,14 @@ export class Numbers {
385
401
  }
386
402
 
387
403
  /**
388
- * Delete a list of phone numbers (mark them as RELEASED). The phone numbers will no longer be active or usable but they will still be visible in the system with a status of "RELEASED". Note: This operation is irreversible and should be used with caution.
404
+ * Delete a list of phone numbers (mark them as RELEASED). The phone numbers will no longer be active or usable but they will still be visible in the system with a status of "RELEASED". A number briefly shows a transient "PENDING_RELEASE" status while the deletion is being processed, before settling to "RELEASED". Note: This operation is irreversible and should be used with caution.
389
405
  * @async
390
406
  * @roles api, admin, developer, billing, user
391
407
  * @param {Object} params - The parameters for deleting phone numbers
392
408
  * @param {string[]} params.phoneNumbers - The list of phone numbers to delete
393
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
409
+ * @param {RequestOptions} [params.options] - Additional options for the request
394
410
  * @throws {Error} Throws an error if the phoneNumbers parameter is missing
395
- * @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
396
412
  */
397
413
  async deletePhoneNumbers({ phoneNumbers, options = {} }) {
398
414
  this.client._require({ phoneNumbers });
@@ -405,9 +421,9 @@ export class Numbers {
405
421
  * @roles api, admin, developer, billing, user
406
422
  * @param {Object} params - The parameters for deactivating phone numbers
407
423
  * @param {string[]} params.phoneNumbers - The list of phone numbers to deactivate
408
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
424
+ * @param {RequestOptions} [params.options] - Additional options for the request
409
425
  * @throws {Error} Throws an error if the phoneNumbers parameter is missing
410
- * @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
411
427
  */
412
428
  async deactivatePhoneNumbers({ phoneNumbers, options = {} }) {
413
429
  this.client._require({ phoneNumbers });
@@ -420,9 +436,9 @@ export class Numbers {
420
436
  * @roles api, admin, developer, billing, user
421
437
  * @param {Object} params - The parameters for reactivating phone numbers
422
438
  * @param {string[]} params.phoneNumbers - The list of phone numbers to reactivate
423
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
439
+ * @param {RequestOptions} [params.options] - Additional options for the request
424
440
  * @throws {Error} Throws an error if the phoneNumbers parameter is missing
425
- * @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
426
442
  */
427
443
  async reactivatePhoneNumbers({ phoneNumbers, options = {} }) {
428
444
  this.client._require({ phoneNumbers });
@@ -435,8 +451,8 @@ export class Numbers {
435
451
  * @param {Object} params - The parameters for transferring phone numbers
436
452
  * @param {string[]} params.phoneNumbers - The list of phone numbers to transfer
437
453
  * @param {string} params.newSubgroupId - The ID of the new subgroup to transfer the phone numbers to
438
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
439
- * @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
440
456
  */
441
457
  async transferPhoneNumbers({ phoneNumbers, newSubgroupId, options = {} }) {
442
458
  this.client._require({ phoneNumbers, newSubgroupId });
@@ -446,17 +462,17 @@ export class Numbers {
446
462
  /**
447
463
  * Search NPA/NXX lookup data with optional filters.
448
464
  * At least one search parameter is required.
449
- * Location filters (country, state, city) cannot be combined with NPA/NXX filters.
465
+ * Country may scope NPA/NXX filters; state and city cannot be combined with them.
450
466
  * @async
451
467
  * @roles api, admin, developer, billing, user
452
468
  * @param {Object} params - The parameters for searching NPA/NXX data
453
469
  * @param {string} [params.country] - Filter by country code
454
470
  * @param {string} [params.state] - Filter by state code (2 characters)
455
471
  * @param {string} [params.city] - Filter by city name (prefix match, case-insensitive; requires country and state)
456
- * @param {string} [params.npa] - Area code filter (1-3 digits; cannot combine with location filters)
457
- * @param {string} [params.nxx] - Central office code filter (1-3 digits; cannot combine with location filters)
458
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
459
- * @returns {Promise<Object>} A promise that resolves to matching NPA/NXX records or unique NPA/NXX arrays
472
+ * @param {string} [params.npa] - Area code filter (1-3 digits; optional country, no state/city)
473
+ * @param {string} [params.nxx] - Central office code filter (1-3 digits; optional country, no state/city)
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
460
476
  */
461
477
  async searchNpaNxx({ country, state, city, npa, nxx, options = {} }) {
462
478
  const queryString = this.client._getQueryString({ country, state, city, npa, nxx });
@@ -469,8 +485,8 @@ export class Numbers {
469
485
  * @roles api, admin, developer, billing, user
470
486
  * @param {Object} params - The parameters for the lookup
471
487
  * @param {Array<{npa: string, nxx: string}>} params.entries - NPA/NXX pairs to look up (max 50)
472
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
473
- * @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
474
490
  */
475
491
  async lookupLocations({ entries, options = {} }) {
476
492
  return this.client('/number/lookup/location', { method: 'POST', body: { entries }, ...options });
@@ -484,8 +500,8 @@ export class Numbers {
484
500
  * @param {string} [params.phoneNumber] - The phone number to migrate
485
501
  * @param {string} [params.campaignId] - Campaign ID to migrate all numbers for
486
502
  * @param {string} [params.groupId] - Group ID to migrate all numbers for
487
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
488
- * @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
489
505
  */
490
506
  async migratePhoneNumberToV2({ phoneNumber, campaignId, groupId, options = {} }) {
491
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 });