@signalhousellc/sdk 1.0.45 → 1.0.46

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.46",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -201,6 +201,25 @@ export class Billing {
201
201
  return this.client(`/billing/invoiceDetails${queryString}`, { method: "GET", ...options });
202
202
  }
203
203
 
204
+ /**
205
+ * Get ledger-backed invoice summary from raw ClickHouse transactions
206
+ * @async
207
+ * @roles api, admin, developer, billing, user
208
+ * @param {Object} params
209
+ * @param {string} params.groupId - The ID of the group to filter by
210
+ * @param {string} [params.subgroupId] - The ID of the subgroup to filter by
211
+ * @param {string} params.startDate - Start date in YYYY-MM-DD format (inclusive)
212
+ * @param {string} params.endDate - End date in YYYY-MM-DD format (inclusive)
213
+ * @param {string} [params.timezone] - IANA timezone (default: "UTC")
214
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
215
+ * @returns {Promise<Array<{entryType: string, transactionType: string, unitPrice: number, quantity: number, amount: number}>>}
216
+ */
217
+ async getInvoiceLedger({ groupId, subgroupId, startDate, endDate, timezone, options = {} }) {
218
+ const filters = { groupId, subgroupId, startDate, endDate, timezone };
219
+ const queryString = this.client._getQueryString(filters);
220
+ return this.client(`/billing/invoiceDetails/ledger${queryString}`, { method: "GET", ...options });
221
+ }
222
+
204
223
  /**
205
224
  * Get the fee schedule for a specific group
206
225
  * @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 }
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