@signalhousellc/sdk 1.0.41 → 1.0.43

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,132 +1,132 @@
1
- /**
2
- * @typedef {Object} CreateLandingData
3
- * @property {string} brandId - The ID of the brand to associate with the landing page
4
- * @property {string} description - A description of the landing page
5
- * @property {string} primaryBackgroundColor - The primary background color for the landing page (e.g., "#FFFFFF")
6
- * @property {string} secondaryBackgroundColor - The secondary background color for the landing page (e.g., "#F0F0F0")
7
- * @property {string} primaryTextColor - The primary text color for the landing page (e.g., "#000000")
8
- * @property {string} secondaryTextColor - The secondary text color for the landing page (e.g., "#333333")
9
- * @property {Buffer} logo - A logo image file for the landing page, provided as a Buffer
10
- */
11
-
12
- /**
13
- * @typedef {Object} UpdateLandingData
14
- * @property {string} [description] - A description of the landing page
15
- * @property {string} [primaryBackgroundColor] - The primary background color for the landing page (e.g., "#FFFFFF")
16
- * @property {string} [secondaryBackgroundColor] - The secondary background color for the landing page (e.g., "#F0F0F0")
17
- * @property {string} [primaryTextColor] - The primary text color for the landing page (e.g., "#000000")
18
- * @property {string} [secondaryTextColor] - The secondary text color for the landing page (e.g., "#333333")
19
- * @property {Buffer} [logo] - A logo image file for the landing page, provided as a Buffer
20
- */
21
-
22
- export class Landings {
23
- constructor(client, multipartClient, enableAdmin) {
24
- this.client = client;
25
- this.multipartClient = multipartClient;
26
- this.enableAdmin = enableAdmin;
27
- }
28
-
29
- /**
30
- * Get details of a landing page by its ID
31
- * @async
32
- * @roles api, admin, developer, billing, user
33
- * @param {Object} params - The parameters for getting a landing page
34
- * @param {string} params.landingId - The ID of the landing page to retrieve
35
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
36
- * @throws {Error} Throws an error if the landingId parameter is missing
37
- * @returns {Promise<Object>} - The landing page object returned from the server
38
- */
39
- async getLandings({ landingId, options = {} }) {
40
- this.client._require({ landingId });
41
- const safeLandingId = encodeURIComponent(landingId);
42
- return this.client(`/landing/${safeLandingId}`, { method: "GET", ...options });
43
- }
44
-
45
- /**
46
- * Create a new landing page with the specified landing data and logo file
47
- * @async
48
- * @roles api, admin, developer, billing, user
49
- * @param {Object} params - The parameters for creating a new landing page (see CreateLandingData typedef for details)
50
- * @param {CreateLandingData} params.landingData - The data for the new landing page, including required fields such as brandId and description
51
- * @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
52
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
53
- * @returns {Promise<Object>} - The newly created landing page object returned from the server
54
- */
55
- async createLanding({ landingData, file, options = {} }) {
56
- const formData = new FormData();
57
-
58
- if (file) {
59
- formData.append("file", file);
60
- }
61
-
62
- Object.entries(landingData).forEach(([key, value]) => {
63
- if (value !== undefined) {
64
- formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
65
- }
66
- });
67
-
68
- return this.multipartClient(`/landing`, { method: "POST", body: formData, ...options });
69
- }
70
-
71
- /**
72
- * Update an existing landing page with the specified landing data and logo file
73
- * @async
74
- * @roles api, admin, developer, billing, user
75
- * @param {Object} params - The parameters for updating a landing page (see UpdateLandingData typedef for details)
76
- * @param {string} params.landingId - The ID of the landing page to update
77
- * @param {UpdateLandingData} params.landingData - The data for the landing page, including required fields such as brandId and description
78
- * @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
79
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
80
- * @throws {Error} Throws an error if the landingId parameter is missing
81
- * @returns {Promise<Object>} - The updated landing page object returned from the server
82
- */
83
- async updateLanding({ landingId, landingData, file, options = {} }) {
84
- this.client._require({ landingId });
85
- const safeLandingId = encodeURIComponent(landingId);
86
- const formData = new FormData();
87
-
88
- if (file) {
89
- formData.append("file", file);
90
- }
91
-
92
- Object.entries(landingData).forEach(([key, value]) => {
93
- if (value !== undefined) {
94
- formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
95
- }
96
- });
97
-
98
- return this.multipartClient(`/landing/${safeLandingId}`, { method: "PUT", body: formData, ...options });
99
- }
100
-
101
- /**
102
- * Delete a landing page by its ID
103
- * @async
104
- * @roles api, admin, developer, billing, user
105
- * @param {Object} params - The parameters for deleting a landing page
106
- * @param {string} params.landingId - The ID of the landing page to delete
107
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
108
- * @throws {Error} Throws an error if the landingId parameter is missing
109
- * @returns {Promise<Object>} - The response from the server after deleting the landing page
110
- */
111
- /**
112
- * Get a landing page by its associated brand ID
113
- * @async
114
- * @roles api, admin, developer, billing, user
115
- * @param {Object} params - The parameters for getting a landing page by brand
116
- * @param {string} params.brandId - The brand ID to look up the landing page for
117
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
118
- * @throws {Error} Throws an error if the brandId parameter is missing
119
- * @returns {Promise<Object>} - The landing page object returned from the server
120
- */
121
- async getLandingByBrandId({ brandId, options = {} }) {
122
- this.client._require({ brandId });
123
- const safeBrandId = encodeURIComponent(brandId);
124
- return this.client(`/landing/brand/${safeBrandId}`, { method: "GET", ...options });
125
- }
126
-
127
- async deleteLanding({ landingId, options = {} }) {
128
- this.client._require({ landingId });
129
- const safeLandingId = encodeURIComponent(landingId);
130
- return this.client(`/landing/${safeLandingId}`, { method: "DELETE", ...options });
131
- }
132
- }
1
+ /**
2
+ * @typedef {Object} CreateLandingData
3
+ * @property {string} brandId - The ID of the brand to associate with the landing page
4
+ * @property {string} description - A description of the landing page
5
+ * @property {string} primaryBackgroundColor - The primary background color for the landing page (e.g., "#FFFFFF")
6
+ * @property {string} secondaryBackgroundColor - The secondary background color for the landing page (e.g., "#F0F0F0")
7
+ * @property {string} primaryTextColor - The primary text color for the landing page (e.g., "#000000")
8
+ * @property {string} secondaryTextColor - The secondary text color for the landing page (e.g., "#333333")
9
+ * @property {Buffer} logo - A logo image file for the landing page, provided as a Buffer
10
+ */
11
+
12
+ /**
13
+ * @typedef {Object} UpdateLandingData
14
+ * @property {string} [description] - A description of the landing page
15
+ * @property {string} [primaryBackgroundColor] - The primary background color for the landing page (e.g., "#FFFFFF")
16
+ * @property {string} [secondaryBackgroundColor] - The secondary background color for the landing page (e.g., "#F0F0F0")
17
+ * @property {string} [primaryTextColor] - The primary text color for the landing page (e.g., "#000000")
18
+ * @property {string} [secondaryTextColor] - The secondary text color for the landing page (e.g., "#333333")
19
+ * @property {Buffer} [logo] - A logo image file for the landing page, provided as a Buffer
20
+ */
21
+
22
+ export class Landings {
23
+ constructor(client, multipartClient, enableAdmin) {
24
+ this.client = client;
25
+ this.multipartClient = multipartClient;
26
+ this.enableAdmin = enableAdmin;
27
+ }
28
+
29
+ /**
30
+ * Get details of a landing page by its ID
31
+ * @async
32
+ * @roles api, admin, developer, billing, user
33
+ * @param {Object} params - The parameters for getting a landing page
34
+ * @param {string} params.landingId - The ID of the landing page to retrieve
35
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
36
+ * @throws {Error} Throws an error if the landingId parameter is missing
37
+ * @returns {Promise<Object>} - The landing page object returned from the server
38
+ */
39
+ async getLandings({ landingId, options = {} }) {
40
+ this.client._require({ landingId });
41
+ const safeLandingId = encodeURIComponent(landingId);
42
+ return this.client(`/landing/${safeLandingId}`, { method: "GET", ...options });
43
+ }
44
+
45
+ /**
46
+ * Create a new landing page with the specified landing data and logo file
47
+ * @async
48
+ * @roles api, admin, developer, billing, user
49
+ * @param {Object} params - The parameters for creating a new landing page (see CreateLandingData typedef for details)
50
+ * @param {CreateLandingData} params.landingData - The data for the new landing page, including required fields such as brandId and description
51
+ * @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
52
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
53
+ * @returns {Promise<Object>} - The newly created landing page object returned from the server
54
+ */
55
+ async createLanding({ landingData, file, options = {} }) {
56
+ const formData = new FormData();
57
+
58
+ if (file) {
59
+ formData.append("file", file);
60
+ }
61
+
62
+ Object.entries(landingData).forEach(([key, value]) => {
63
+ if (value !== undefined) {
64
+ formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
65
+ }
66
+ });
67
+
68
+ return this.multipartClient(`/landing`, { method: "POST", body: formData, ...options });
69
+ }
70
+
71
+ /**
72
+ * Update an existing landing page with the specified landing data and logo file
73
+ * @async
74
+ * @roles api, admin, developer, billing, user
75
+ * @param {Object} params - The parameters for updating a landing page (see UpdateLandingData typedef for details)
76
+ * @param {string} params.landingId - The ID of the landing page to update
77
+ * @param {UpdateLandingData} params.landingData - The data for the landing page, including required fields such as brandId and description
78
+ * @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
79
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
80
+ * @throws {Error} Throws an error if the landingId parameter is missing
81
+ * @returns {Promise<Object>} - The updated landing page object returned from the server
82
+ */
83
+ async updateLanding({ landingId, landingData, file, options = {} }) {
84
+ this.client._require({ landingId });
85
+ const safeLandingId = encodeURIComponent(landingId);
86
+ const formData = new FormData();
87
+
88
+ if (file) {
89
+ formData.append("file", file);
90
+ }
91
+
92
+ Object.entries(landingData).forEach(([key, value]) => {
93
+ if (value !== undefined) {
94
+ formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
95
+ }
96
+ });
97
+
98
+ return this.multipartClient(`/landing/${safeLandingId}`, { method: "PUT", body: formData, ...options });
99
+ }
100
+
101
+ /**
102
+ * Delete a landing page by its ID
103
+ * @async
104
+ * @roles api, admin, developer, billing, user
105
+ * @param {Object} params - The parameters for deleting a landing page
106
+ * @param {string} params.landingId - The ID of the landing page to delete
107
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
108
+ * @throws {Error} Throws an error if the landingId parameter is missing
109
+ * @returns {Promise<Object>} - The response from the server after deleting the landing page
110
+ */
111
+ /**
112
+ * Get a landing page by its associated brand ID
113
+ * @async
114
+ * @roles api, admin, developer, billing, user
115
+ * @param {Object} params - The parameters for getting a landing page by brand
116
+ * @param {string} params.brandId - The brand ID to look up the landing page for
117
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
118
+ * @throws {Error} Throws an error if the brandId parameter is missing
119
+ * @returns {Promise<Object>} - The landing page object returned from the server
120
+ */
121
+ async getLandingByBrandId({ brandId, options = {} }) {
122
+ this.client._require({ brandId });
123
+ const safeBrandId = encodeURIComponent(brandId);
124
+ return this.client(`/landing/brand/${safeBrandId}`, { method: "GET", ...options });
125
+ }
126
+
127
+ async deleteLanding({ landingId, options = {} }) {
128
+ this.client._require({ landingId });
129
+ const safeLandingId = encodeURIComponent(landingId);
130
+ return this.client(`/landing/${safeLandingId}`, { method: "DELETE", ...options });
131
+ }
132
+ }
@@ -21,8 +21,8 @@ export class Messages {
21
21
  * @param {string} [params.carrier] - Filter messages by the carrier used for sending
22
22
  * @param {string} [params.senderPhoneNumber] - Filter messages by the sender's phone number
23
23
  * @param {string} [params.recipientPhoneNumber] - Filter messages by the recipient's phone number
24
- * @param {string} [params.startDate] - Filter messages by their start date
25
- * @param {string} [params.endDate] - Filter messages by their end date
24
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
25
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
26
26
  * @param {string} [params.sortField] - The field to sort the messages by
27
27
  * @param {string} [params.sortOrder] - The order to sort the messages (asc, desc)
28
28
  * @param {number} [params.page] - The page number for pagination
@@ -67,8 +67,8 @@ export class Messages {
67
67
  * @param {string} [params.campaignId] - Filter analytics by the ID of the associated campaign
68
68
  * @param {string} [params.phoneNumber] - Filter analytics by the phone number involved in the messages
69
69
  * @param {string} [params.carrier] - Filter analytics by the carrier used for sending
70
- * @param {string} [params.startDate] - Filter analytics by the start date of the messages
71
- * @param {string} [params.endDate] - Filter analytics by the end date of the messages
70
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
71
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
72
72
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
73
73
  * @returns {Promise<Object>} - A promise that resolves to the analytics data
74
74
  */
@@ -89,8 +89,8 @@ export class Messages {
89
89
  * @param {string} [params.campaignId] - Filter analytics by the ID of the associated campaign
90
90
  * @param {string} [params.phoneNumber] - Filter analytics by the phone number involved in the messages
91
91
  * @param {string} [params.carrier] - Filter analytics by the carrier used for sending
92
- * @param {string} [params.startDate] - Filter analytics by the start date of the messages
93
- * @param {string} [params.endDate] - Filter analytics by the end date of the messages
92
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
93
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
94
94
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
95
95
  * @returns {Promise<Array>} - A promise that resolves to an array of analytics snapshot records
96
96
  */
@@ -111,8 +111,8 @@ export class Messages {
111
111
  * @param {string} [params.campaignId] - Filter by the ID of the associated campaign
112
112
  * @param {string} [params.phoneNumber] - Filter by the phone number
113
113
  * @param {string} [params.carrier] - Filter by the carrier
114
- * @param {string} [params.startDate] - Filter by start date
115
- * @param {string} [params.endDate] - Filter by end date
114
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
115
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
116
116
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
117
117
  * @returns {Promise<Object>} - A promise that resolves to the DNC analytics data (totals, byDate, byPhoneNumber, byCarrier)
118
118
  */
@@ -133,8 +133,8 @@ export class Messages {
133
133
  * @param {string} [params.campaignId] - Filter by the ID of the associated campaign
134
134
  * @param {string} [params.phoneNumber] - Filter by the phone number
135
135
  * @param {string} [params.carrier] - Filter by the carrier
136
- * @param {string} [params.startDate] - Filter by start date
137
- * @param {string} [params.endDate] - Filter by end date
136
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
137
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
138
138
  * @param {number} [params.page] - Page number for pagination
139
139
  * @param {number} [params.limit] - Number of records per page
140
140
  * @param {string} [params.sortField] - Field to sort by
@@ -158,14 +158,15 @@ export class Messages {
158
158
  * @param {string} params.messageBody - The body of the SMS message
159
159
  * @param {string} [params.statusCallbackUrl] - The URL to receive status callbacks
160
160
  * @param {boolean} [params.enableShortlink=false] - Whether to enable shortlink in the message
161
+ * @param {boolean} [params.filterLandlinesAndInactiveNumbers=false] - Whether to filter out landline and inactive numbers before sending
161
162
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
162
163
  * @returns {Promise<Object>} - A promise that resolves to the response data from the server
163
164
  */
164
- async sendSMS({ senderPhoneNumber, recipientPhoneNumbers, messageBody, statusCallbackUrl, enableShortlink = false, options = {} }) {
165
+ async sendSMS({ senderPhoneNumber, recipientPhoneNumbers, messageBody, statusCallbackUrl, enableShortlink = false, filterLandlinesAndInactiveNumbers = false, options = {} }) {
165
166
  this.client._require({ senderPhoneNumber, recipientPhoneNumbers, messageBody });
166
167
  return this.client(`/message/sms`, {
167
168
  method: "POST",
168
- body: { senderPhoneNumber, recipientPhoneNumber: recipientPhoneNumbers, messageBody, statusCallbackUrl, enableShortlink },
169
+ body: { senderPhoneNumber, recipientPhoneNumber: recipientPhoneNumbers, messageBody, statusCallbackUrl, enableShortlink, ...(filterLandlinesAndInactiveNumbers && { filterLandlinesAndInactiveNumbers }) },
169
170
  ...options,
170
171
  });
171
172
  }
@@ -182,6 +183,7 @@ export class Messages {
182
183
  * @param {string} [params.statusCallbackUrl] - The URL to receive status callbacks
183
184
  * @param {boolean} [params.enableShortlink=false] - Whether to enable shortlink in the message
184
185
  * @param {boolean} [params.enableCompression=true] - Whether to enable image compression for the image attachments
186
+ * @param {boolean} [params.filterLandlinesAndInactiveNumbers=false] - Whether to filter out landline and inactive numbers before sending
185
187
  * @param {File[]} [params.images] - The images to attach to the MMS message
186
188
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
187
189
  * @returns {Promise<Object>} - A promise that resolves to the response data from the server
@@ -194,10 +196,11 @@ export class Messages {
194
196
  statusCallbackUrl,
195
197
  enableShortlink = false,
196
198
  enableCompression = true,
199
+ filterLandlinesAndInactiveNumbers = false,
197
200
  images,
198
201
  options = {},
199
202
  }) {
200
- this.client._require({ senderPhoneNumber, recipientPhoneNumbers, messageBody });
203
+ this.client._require({ senderPhoneNumber, recipientPhoneNumbers });
201
204
 
202
205
  const formData = new FormData();
203
206
 
@@ -210,7 +213,7 @@ export class Messages {
210
213
  formData.append("senderPhoneNumber", senderPhoneNumber);
211
214
 
212
215
  formData.append("recipientPhoneNumber", Array.isArray(recipientPhoneNumbers) ? JSON.stringify(recipientPhoneNumbers) : recipientPhoneNumbers);
213
- formData.append("messageBody", messageBody);
216
+ if (messageBody) formData.append("messageBody", messageBody);
214
217
 
215
218
  if (mediaUrls && mediaUrls.length > 0) {
216
219
  formData.append("mediaUrls", JSON.stringify(mediaUrls));
@@ -222,6 +225,7 @@ export class Messages {
222
225
 
223
226
  formData.append("enableShortlink", enableShortlink);
224
227
  formData.append("enableCompression", enableCompression);
228
+ if (filterLandlinesAndInactiveNumbers) formData.append("filterLandlinesAndInactiveNumbers", filterLandlinesAndInactiveNumbers);
225
229
 
226
230
  return this.multipartClient(`/message/mms`, { method: "POST", body: formData, ...options });
227
231
  }
@@ -238,6 +242,7 @@ export class Messages {
238
242
  * @param {string} [params.statusCallbackUrl] - The URL to receive status callbacks
239
243
  * @param {boolean} [params.enableShortlink=false] - Whether to enable shortlink in the message
240
244
  * @param {boolean} [params.enableCompression=true] - Whether to enable image compression for the image attachments
245
+ * @param {boolean} [params.filterLandlinesAndInactiveNumbers=false] - Whether to filter out landline and inactive numbers before sending
241
246
  * @param {File[]} [params.images] - The images to attach to the MMS message
242
247
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
243
248
  * @returns {Promise<Object>} - A promise that resolves to the response data from the server
@@ -250,10 +255,11 @@ export class Messages {
250
255
  statusCallbackUrl,
251
256
  enableShortlink = false,
252
257
  enableCompression = true,
258
+ filterLandlinesAndInactiveNumbers = false,
253
259
  images,
254
260
  options = {},
255
261
  }) {
256
- this.client._require({ senderPhoneNumber, recipientPhoneNumbers, messageBody });
262
+ this.client._require({ senderPhoneNumber, recipientPhoneNumbers });
257
263
 
258
264
  const formData = new FormData();
259
265
 
@@ -266,7 +272,7 @@ export class Messages {
266
272
  formData.append("senderPhoneNumber", senderPhoneNumber);
267
273
 
268
274
  formData.append("recipientPhoneNumber", Array.isArray(recipientPhoneNumbers) ? JSON.stringify(recipientPhoneNumbers) : recipientPhoneNumbers);
269
- formData.append("messageBody", messageBody);
275
+ if (messageBody) formData.append("messageBody", messageBody);
270
276
 
271
277
  if (mediaUrls && mediaUrls.length > 0) {
272
278
  formData.append("mediaUrls", JSON.stringify(mediaUrls));
@@ -278,7 +284,26 @@ export class Messages {
278
284
 
279
285
  formData.append("enableShortlink", enableShortlink);
280
286
  formData.append("enableCompression", enableCompression);
287
+ if (filterLandlinesAndInactiveNumbers) formData.append("filterLandlinesAndInactiveNumbers", filterLandlinesAndInactiveNumbers);
281
288
 
282
289
  return this.multipartClient(`/message/groupMessage`, { method: "POST", body: formData, ...options });
283
290
  }
291
+
292
+ /**
293
+ * Look up the carrier for a phone number. Always performs a fresh lookup (not cached). Billed per request.
294
+ * @async
295
+ * @roles api, admin, developer, billing, user
296
+ * @param {Object} params - The parameters for looking up a carrier
297
+ * @param {string} params.phoneNumber - The phone number to look up (10+ digits, no + prefix)
298
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
299
+ * @returns {Promise<Object>} - A promise that resolves to carrier information
300
+ */
301
+ async carrierIdLookup({ phoneNumber, options = {} }) {
302
+ this.client._require({ phoneNumber });
303
+ return this.client(`/message/carrier-id`, {
304
+ method: "POST",
305
+ body: { phoneNumber },
306
+ ...options,
307
+ });
308
+ }
284
309
  }
@@ -1,56 +1,56 @@
1
- export class Notifications {
2
- constructor(client, enableAdmin) {
3
- this.client = client;
4
- this.enableAdmin = enableAdmin;
5
- }
6
-
7
- /**
8
- * Get notifications by id or by groupId with optional filters
9
- * @async
10
- * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
11
- * @param {Object} params
12
- * @param {string} [params.id] - Notification id (one of id/groupId required)
13
- * @param {string} [params.groupId] - Group id to fetch notifications for (one of id/groupId required)
14
- * @param {number} [params.page] - Page number (min 1, default 1)
15
- * @param {number} [params.limit] - Results per page (min 1, max 100, default 10)
16
- * @param {string} [params.status] - Filter by status: "READ" or "UNREAD"
17
- * @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
20
- */
21
- async getNotifications({ id, groupId, page, limit, status, eventTypes, options = {} }) {
22
- this.client._require({ "id or groupId": id ?? groupId });
23
- const queryString = this.client._getQueryString({ id, groupId, page, limit, status, eventTypes });
24
- return this.client(`/notification${queryString}`, { method: "GET", ...options });
25
- }
26
-
27
- /**
28
- * Update the status of one or more notifications
29
- * @async
30
- * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
31
- * @param {Object} params
32
- * @param {string|string[]} params.ids - Notification id or array of notification ids
33
- * @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
36
- */
37
- async updateNotificationStatus({ ids, status, options = {} }) {
38
- this.client._require({ ids, status });
39
- return this.client(`/notification/status`, { method: "PUT", body: { ids, status }, ...options });
40
- }
41
-
42
- /**
43
- * Delete a notification by id
44
- * @async
45
- * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
46
- * @param {Object} params
47
- * @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
50
- */
51
- async deleteNotification({ id, options = {} }) {
52
- this.client._require({ id });
53
- const safeId = encodeURIComponent(id);
54
- return this.client(`/notification/${safeId}`, { method: "DELETE", ...options });
55
- }
56
- }
1
+ export class Notifications {
2
+ constructor(client, enableAdmin) {
3
+ this.client = client;
4
+ this.enableAdmin = enableAdmin;
5
+ }
6
+
7
+ /**
8
+ * Get notifications by id or by groupId with optional filters
9
+ * @async
10
+ * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
11
+ * @param {Object} params
12
+ * @param {string} [params.id] - Notification id (one of id/groupId required)
13
+ * @param {string} [params.groupId] - Group id to fetch notifications for (one of id/groupId required)
14
+ * @param {number} [params.page] - Page number (min 1, default 1)
15
+ * @param {number} [params.limit] - Results per page (min 1, max 100, default 10)
16
+ * @param {string} [params.status] - Filter by status: "READ" or "UNREAD"
17
+ * @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
20
+ */
21
+ async getNotifications({ id, groupId, page, limit, status, eventTypes, options = {} }) {
22
+ this.client._require({ "id or groupId": id ?? groupId });
23
+ const queryString = this.client._getQueryString({ id, groupId, page, limit, status, eventTypes });
24
+ return this.client(`/notification${queryString}`, { method: "GET", ...options });
25
+ }
26
+
27
+ /**
28
+ * Update the status of one or more notifications
29
+ * @async
30
+ * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
31
+ * @param {Object} params
32
+ * @param {string|string[]} params.ids - Notification id or array of notification ids
33
+ * @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
36
+ */
37
+ async updateNotificationStatus({ ids, status, options = {} }) {
38
+ this.client._require({ ids, status });
39
+ return this.client(`/notification/status`, { method: "PUT", body: { ids, status }, ...options });
40
+ }
41
+
42
+ /**
43
+ * Delete a notification by id
44
+ * @async
45
+ * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
46
+ * @param {Object} params
47
+ * @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
50
+ */
51
+ async deleteNotification({ id, options = {} }) {
52
+ this.client._require({ id });
53
+ const safeId = encodeURIComponent(id);
54
+ return this.client(`/notification/${safeId}`, { method: "DELETE", ...options });
55
+ }
56
+ }
@@ -1,44 +1,44 @@
1
- export class Shortlinks {
2
- constructor(client, enableAdmin) {
3
- this.client = client;
4
- this.enableAdmin = enableAdmin;
5
- }
6
-
7
- /**
8
- * Get the redirect URL for a shortlink by its ID
9
- * @async
10
- * @roles public
11
- * @param {Object} params - The parameters for getting the shortlink redirect
12
- * @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
15
- */
16
- async getShortlinkRedirect({ shortlinkId, options = {} }) {
17
- this.client._require({ shortlinkId });
18
- const safeShortlinkId = encodeURIComponent(shortlinkId);
19
- return this.client(`/shortlink/redirect/${safeShortlinkId}`, { method: "GET", ...options });
20
- }
21
-
22
- /**
23
- * Get details of a shortlink by its ID, with optional filters
24
- * @async
25
- * @roles api, admin, developer, billing, user
26
- * @param {Object} params - The parameters for getting the shortlink details
27
- * @param {string} [params.shortlinkId] - The ID of the shortlink
28
- * @param {string} [params.messageId] - Filter by associated message ID
29
- * @param {string} [params.phoneNumber] - Filter by associated phone number
30
- * @param {string} [params.campaignId] - Filter by associated campaign ID
31
- * @param {string} [params.brandId] - Filter by associated brand ID
32
- * @param {string} [params.subgroupId] - Filter by associated subgroup ID
33
- * @param {string} [params.groupId] - Filter by associated group ID
34
- * @param {number} [params.page] - The page number for pagination
35
- * @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
38
- */
39
- async getShortlink({ shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
40
- const filters = { shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
41
- const queryString = this.client._getQueryString(filters);
42
- return this.client(`/shortlink${queryString}`, { method: "GET", ...options });
43
- }
44
- }
1
+ export class Shortlinks {
2
+ constructor(client, enableAdmin) {
3
+ this.client = client;
4
+ this.enableAdmin = enableAdmin;
5
+ }
6
+
7
+ /**
8
+ * Get the redirect URL for a shortlink by its ID
9
+ * @async
10
+ * @roles public
11
+ * @param {Object} params - The parameters for getting the shortlink redirect
12
+ * @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
15
+ */
16
+ async getShortlinkRedirect({ shortlinkId, options = {} }) {
17
+ this.client._require({ shortlinkId });
18
+ const safeShortlinkId = encodeURIComponent(shortlinkId);
19
+ return this.client(`/shortlink/redirect/${safeShortlinkId}`, { method: "GET", ...options });
20
+ }
21
+
22
+ /**
23
+ * Get details of a shortlink by its ID, with optional filters
24
+ * @async
25
+ * @roles api, admin, developer, billing, user
26
+ * @param {Object} params - The parameters for getting the shortlink details
27
+ * @param {string} [params.shortlinkId] - The ID of the shortlink
28
+ * @param {string} [params.messageId] - Filter by associated message ID
29
+ * @param {string} [params.phoneNumber] - Filter by associated phone number
30
+ * @param {string} [params.campaignId] - Filter by associated campaign ID
31
+ * @param {string} [params.brandId] - Filter by associated brand ID
32
+ * @param {string} [params.subgroupId] - Filter by associated subgroup ID
33
+ * @param {string} [params.groupId] - Filter by associated group ID
34
+ * @param {number} [params.page] - The page number for pagination
35
+ * @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
38
+ */
39
+ async getShortlink({ shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
40
+ const filters = { shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
41
+ const queryString = this.client._getQueryString(filters);
42
+ return this.client(`/shortlink${queryString}`, { method: "GET", ...options });
43
+ }
44
+ }