@signalhousellc/sdk 1.0.45 → 1.0.47

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalhousellc/sdk",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -73,6 +73,26 @@ export class Billing {
73
73
  return this.client(`/billing/wallet/transactionHistory${queryString}`, { method: "GET", ...options });
74
74
  }
75
75
 
76
+ /**
77
+ * Get payment history (wallet recharge transactions) with server-side pagination
78
+ * @async
79
+ * @roles api, admin, developer, billing, user
80
+ * @param {Object} params - The parameters for filtering payment history
81
+ * @param {string} params.groupId - The ID of the group to filter by
82
+ * @param {string} params.startDate - Start date in YYYY-MM-DD format (inclusive)
83
+ * @param {string} params.endDate - End date in YYYY-MM-DD format (inclusive)
84
+ * @param {number} [params.page=1] - Page number (positive integer)
85
+ * @param {number} [params.limit=10] - Results per page (positive integer, max 10000)
86
+ * @param {string} [params.timezone] - IANA timezone (default: "UTC")
87
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
88
+ * @returns {Promise<{data: Array<Object>, pagination: {page: number, limit: number, totalRecords: number, totalPages: number, totalAmount: number}}>}
89
+ */
90
+ async getPaymentHistory({ groupId, startDate, endDate, page, limit, timezone, options = {} }) {
91
+ const filters = { groupId, startDate, endDate, page, limit, timezone };
92
+ const queryString = this.client._getQueryString(filters);
93
+ return this.client(`/billing/wallet/paymentHistory${queryString}`, { method: "GET", ...options });
94
+ }
95
+
76
96
  /**
77
97
  * Get the wallet information for a specific group
78
98
  * @async
@@ -201,6 +221,25 @@ export class Billing {
201
221
  return this.client(`/billing/invoiceDetails${queryString}`, { method: "GET", ...options });
202
222
  }
203
223
 
224
+ /**
225
+ * Get ledger-backed invoice summary from raw ClickHouse transactions
226
+ * @async
227
+ * @roles api, admin, developer, billing, user
228
+ * @param {Object} params
229
+ * @param {string} params.groupId - The ID of the group to filter by
230
+ * @param {string} [params.subgroupId] - The ID of the subgroup to filter by
231
+ * @param {string} params.startDate - Start date in YYYY-MM-DD format (inclusive)
232
+ * @param {string} params.endDate - End date in YYYY-MM-DD format (inclusive)
233
+ * @param {string} [params.timezone] - IANA timezone (default: "UTC")
234
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
235
+ * @returns {Promise<Array<{entryType: string, transactionType: string, unitPrice: number, quantity: number, amount: number}>>}
236
+ */
237
+ async getInvoiceLedger({ groupId, subgroupId, startDate, endDate, timezone, options = {} }) {
238
+ const filters = { groupId, subgroupId, startDate, endDate, timezone };
239
+ const queryString = this.client._getQueryString(filters);
240
+ return this.client(`/billing/invoiceDetails/ledger${queryString}`, { method: "GET", ...options });
241
+ }
242
+
204
243
  /**
205
244
  * Get the fee schedule for a specific group
206
245
  * @async
@@ -17,7 +17,7 @@ export class Messages {
17
17
  * @param {string} [params.groupId] - Filter messages by the ID of the associated group
18
18
  * @param {string} [params.status] - Filter messages by their status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED)
19
19
  * @param {string} [params.direction] - Filter messages by their direction (INBOUND, OUTBOUND)
20
- * @param {string} [params.messageType] - Filter messages by their type (SMS, MMS)
20
+ * @param {string|string[]} [params.messageType] - Filter messages by their type. Accepts a single value or an array (e.g. ["SMS", "MMS"]). Allowed values: SMS, MMS, RCS, WHATSAPP, VIBER, P2P. When omitted, defaults to all non-P2P types.
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
@@ -116,6 +116,58 @@ export class Messages {
116
116
  return this.client(`/message/analytics/filter-options${queryString}`, { method: "GET", ...options });
117
117
  }
118
118
 
119
+ /**
120
+ * Get a paginated breakdown of message metrics grouped by subgroup. Each row carries the
121
+ * full set of sms/mms/p2p metric columns so the caller can apply channel toggles client-side.
122
+ * @async
123
+ * @roles api, admin, developer, billing, user
124
+ * @param {Object} params
125
+ * @param {string} params.groupId - The Group ID
126
+ * @param {string|string[]} [params.subgroupId]
127
+ * @param {string|string[]} [params.brandId]
128
+ * @param {string|string[]} [params.campaignId]
129
+ * @param {string|string[]} [params.phoneNumber]
130
+ * @param {string|string[]} [params.carrier]
131
+ * @param {string} [params.startDate]
132
+ * @param {string} [params.endDate]
133
+ * @param {number} [params.page=1]
134
+ * @param {number} [params.limit=50] - max 50 per page
135
+ * @param {"tenDLC"|"p2p"|"both"} [params.channel="both"] - Scope the ORDER BY + row inclusion. "tenDLC" excludes rows with no SMS/MMS activity; "p2p" excludes rows with no P2P activity; "both" returns rows with any activity.
136
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options]
137
+ * @returns {Promise<Object>} - { rows, totalCount, page, limit }. Each row carries sms/mms/p2p metric columns plus `smsOptOuts` and `mmsOptOuts` from the DNC analytics MV (P2P has no opt-outs).
138
+ */
139
+ async getAnalyticsBySubgroup({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, channel, options = {} }) {
140
+ const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, channel };
141
+ const queryString = this.client._getQueryString(filters);
142
+ return this.client(`/message/analytics/by-subgroup${queryString}`, { method: "GET", ...options });
143
+ }
144
+
145
+ /**
146
+ * Get a paginated breakdown of failed messages grouped by error code.
147
+ * Each row contains per-channel (sms/mms/p2p) error counts plus an enriched description.
148
+ * @async
149
+ * @roles api, admin, developer, billing, user
150
+ * @param {Object} params
151
+ * @param {string} params.groupId - The Group ID
152
+ * @param {string|string[]} [params.subgroupId]
153
+ * @param {string|string[]} [params.brandId]
154
+ * @param {string|string[]} [params.campaignId]
155
+ * @param {string|string[]} [params.phoneNumber]
156
+ * @param {string|string[]} [params.carrier]
157
+ * @param {string} [params.startDate]
158
+ * @param {string} [params.endDate]
159
+ * @param {number} [params.page=1]
160
+ * @param {number} [params.limit=50] - max 50 per page
161
+ * @param {"tenDLC"|"p2p"|"both"} [params.channel="both"] - Scope the ORDER BY + totalCount. "tenDLC" excludes rows with no SMS/MMS errors; "p2p" excludes rows with no P2P errors; "both" returns rows with any error.
162
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options]
163
+ * @returns {Promise<Object>} - { rows, totalCount, totalErrors: { sms, mms, p2p, all }, page, limit }
164
+ */
165
+ async getAnalyticsByErrorCode({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, channel, options = {} }) {
166
+ const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, channel };
167
+ const queryString = this.client._getQueryString(filters);
168
+ return this.client(`/message/analytics/by-error-code${queryString}`, { method: "GET", ...options });
169
+ }
170
+
119
171
  /**
120
172
  * Get aggregated DNC (Do Not Contact) opt-out analytics with optional filters
121
173
  * @async