@signalhousellc/sdk 1.0.67 → 1.0.69

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.
Files changed (40) hide show
  1. package/README.md +0 -10
  2. package/package.json +11 -3
  3. package/skills/VENDORED.json +8 -8
  4. package/skills/signalhouse-10dlc/SKILL.md +5 -9
  5. package/skills/signalhouse-10dlc/references/tcr-rejection-causes.md +5 -12
  6. package/skills/signalhouse-advisor/SKILL.md +3 -3
  7. package/skills/signalhouse-numbers/SKILL.md +1 -2
  8. package/skills/signalhouse-setup/SKILL.md +41 -11
  9. package/skills/signalhouse-sms/SKILL.md +4 -4
  10. package/skills/signalhouse-webhooks/SKILL.md +76 -56
  11. package/src/SignalHouseSDK.js +26 -13
  12. package/src/domains/Agents.js +204 -55
  13. package/src/domains/Auth.js +30 -24
  14. package/src/domains/Billing.js +32 -26
  15. package/src/domains/Brands.js +45 -34
  16. package/src/domains/Campaigns.js +106 -47
  17. package/src/domains/Dnc.js +168 -0
  18. package/src/domains/Groups.js +53 -16
  19. package/src/domains/Landings.js +36 -30
  20. package/src/domains/Messages.js +110 -65
  21. package/src/domains/Notifications.js +12 -6
  22. package/src/domains/Numbers.js +58 -52
  23. package/src/domains/Onboarding.js +14 -8
  24. package/src/domains/Shortlinks.js +10 -4
  25. package/src/domains/Subgroups.js +16 -10
  26. package/src/domains/Subscriptions.js +22 -16
  27. package/src/domains/Tickets.js +18 -12
  28. package/src/domains/Users.js +32 -22
  29. package/src/domains/Webhooks.js +45 -13
  30. package/src/domains/voice/Analytics.js +8 -2
  31. package/src/domains/voice/CallLogs.js +14 -8
  32. package/src/domains/voice/Calls.js +14 -8
  33. package/src/domains/voice/GlobalVoiceSettings.js +10 -4
  34. package/src/domains/voice/ProgrammableVoiceProfiles.js +22 -16
  35. package/src/domains/voice/SipProfiles.js +24 -18
  36. package/src/domains/voice/SipTrunks.js +26 -20
  37. package/src/domains/voice/Tokens.js +10 -4
  38. package/src/domains/voice/browser/Call.js +2 -0
  39. package/src/domains/voice/browser/Device.js +23 -11
  40. package/src/webhooks/verifySignature.js +66 -0
@@ -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} CreateUserData
3
9
  * @property {string} groupId - The ID of the group to which the user belongs (must start with "G" and be at least 8 characters long)
@@ -20,9 +26,11 @@
20
26
 
21
27
  /**
22
28
  * @typedef {Object} CreateServiceUserData
23
- * @property {string} groupId - The ID of the group to which the service user belongs (required)
29
+ * @property {string} groupId - The ID of the group to which the service user belongs (required for customer API keys)
24
30
  * @property {string} name - The name of the service user (required)
25
- * @property {string} role - The role of the service user (admin, developer, billing, user) (required)
31
+ * @property {string} role - The role of the service user: "api" for a customer API key (required)
32
+ * @property {string[]} [allowedIps] - Only accept this API key from these IPv4/IPv6 addresses or CIDR ranges (max 100). Omit or pass [] for no IP restriction. Customer API keys only.
33
+ * @property {string[]} [allowedCountries] - Only accept this API key from these countries, as ISO 3166-1 alpha-2 codes such as "US" (max 250). Omit or pass [] for no country restriction. Customer API keys only.
26
34
  */
27
35
 
28
36
  /**
@@ -41,6 +49,8 @@
41
49
  * @property {string} [country] - The country of the user's address (optional)
42
50
  * @property {string} [postalCode] - The postal code of the user's address (optional)
43
51
  * @property {string} [status] - The status of the user (e.g., "active", "inactive")
52
+ * @property {string[]} [allowedIps] - Customer API keys only: replace the key's allowed IPv4/IPv6 addresses or CIDR ranges ([] removes the restriction). Requires an interactive admin or developer session; an API key cannot change its own restrictions.
53
+ * @property {string[]} [allowedCountries] - Customer API keys only: replace the key's allowed ISO 3166-1 alpha-2 country codes ([] removes the restriction). Requires an interactive admin or developer session.
44
54
  */
45
55
 
46
56
  export class Users {
@@ -61,8 +71,8 @@ export class Users {
61
71
  * @param {string} [params.search] - Search users by email (case-insensitive)
62
72
  * @param {string} [params.sortBy] - Field to sort by (createdAt, email, activeGroupId, companyName, status, _id)
63
73
  * @param {string} [params.sortOrder] - Sort direction (asc, desc)
64
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
65
- * @returns {Promise<Object>} - A promise that resolves to the list of users
74
+ * @param {RequestOptions} [params.options] - Additional options for the request
75
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of users
66
76
  */
67
77
  getUsers: async ({ email, userType, page, limit, search, sortBy, sortOrder, options = {} }) => {
68
78
  const filters = { email, userType, page, limit, search, sortBy, sortOrder };
@@ -75,8 +85,8 @@ export class Users {
75
85
  * @roles signalhouse
76
86
  * @param {Object} params - The parameters for creating an internal user
77
87
  * @param {CreateServiceUserData} params.data - The data for the new internal user
78
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
79
- * @returns {Promise<Object>} - A promise that resolves to the created internal user
88
+ * @param {RequestOptions} [params.options] - Additional options for the request
89
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the created internal user
80
90
  */
81
91
  createInternalUser: async ({ data, options = {} }) => {
82
92
  this.client._require({ data: data });
@@ -99,8 +109,8 @@ export class Users {
99
109
  * @param {string} [params.search] - Search users by email (case-insensitive)
100
110
  * @param {string} [params.sortBy] - Field to sort by (createdAt, email, activeGroupId, companyName, status, _id)
101
111
  * @param {string} [params.sortOrder] - Sort direction (asc, desc)
102
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
103
- * @returns {Promise<Object>} - A promise that resolves to the list of users
112
+ * @param {RequestOptions} [params.options] - Additional options for the request
113
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of users
104
114
  */
105
115
  async getUsers({ id, groupId, userType, page, limit, search, sortBy, sortOrder, options = {} }) {
106
116
  const filters = { id, groupId, userType, page, limit, search, sortBy, sortOrder };
@@ -114,9 +124,9 @@ export class Users {
114
124
  * @roles api, admin
115
125
  * @param {Object} params - The parameters for creating a user (see CreateUserData typedef for details)
116
126
  * @param {CreateUserData} params.data - The data for the new user
117
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
127
+ * @param {RequestOptions} [params.options] - Additional options for the request
118
128
  * @throws {Error} Throws an error if required fields in the data parameter are missing
119
- * @returns {Promise<Object>} - A promise that resolves to the created user
129
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the created user
120
130
  */
121
131
  async createUser({ data, options = {} }) {
122
132
  this.client._require({ data: data });
@@ -129,9 +139,9 @@ export class Users {
129
139
  * @roles admin, developer
130
140
  * @param {Object} params - The parameters for creating a service user (see CreateServiceUserData typedef for details)
131
141
  * @param {CreateServiceUserData} params.data - The data for the new service user
132
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
142
+ * @param {RequestOptions} [params.options] - Additional options for the request
133
143
  * @throws {Error} Throws an error if required fields in the data parameter are missing
134
- * @returns {Promise<Object>} - A promise that resolves to the created service user
144
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the created service user
135
145
  */
136
146
  async createServiceUser({ data, options = {} }) {
137
147
  this.client._require({ data: data });
@@ -145,9 +155,9 @@ export class Users {
145
155
  * @param {Object} params - The parameters for updating a user (see UpdateUserData typedef for details)
146
156
  * @param {string} params.id - The ID of the user to update
147
157
  * @param {UpdateUserData} params.data - The data to update for the user
148
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
158
+ * @param {RequestOptions} [params.options] - Additional options for the request
149
159
  * @throws {Error} Throws an error if required fields in the data parameter are missing
150
- * @returns {Promise<Object>} - A promise that resolves to the updated user
160
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the updated user
151
161
  */
152
162
  async updateUser({ id, data, options = {} }) {
153
163
  this.client._require({ id, data: data });
@@ -161,9 +171,9 @@ export class Users {
161
171
  * @roles api, admin
162
172
  * @param {Object} params - The parameters for deleting a user
163
173
  * @param {string} params.id - The ID of the user to delete
164
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
174
+ * @param {RequestOptions} [params.options] - Additional options for the request
165
175
  * @throws {Error} Throws an error if the id parameter is missing
166
- * @returns {Promise<Object>} - A promise that resolves to the deleted user
176
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the deleted user
167
177
  */
168
178
  async deleteUser({ id, options = {} }) {
169
179
  this.client._require({ id });
@@ -176,8 +186,8 @@ export class Users {
176
186
  * @async
177
187
  * @roles api, admin, developer, billing, user
178
188
  * @param {Object} [params]
179
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
180
- * @returns {Promise<Object>} The response from the server ({ acceptedTermsOfService: true })
189
+ * @param {RequestOptions} [params.options] - Additional options for the request
190
+ * @returns {Promise<SdkResponse<any>>} The response from the server ({ acceptedTermsOfService: true })
181
191
  */
182
192
  async acceptTermsOfService({ options = {} } = {}) {
183
193
  return this.client(`/user/accept-terms`, { method: "PUT", body: { acceptedTermsOfService: true }, ...options });
@@ -189,8 +199,8 @@ export class Users {
189
199
  * @roles api, admin, self
190
200
  * @param {Object} params
191
201
  * @param {string} params.id - The ID of the user
192
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
193
- * @returns {Promise<Object>} The response from the server
202
+ * @param {RequestOptions} [params.options] - Additional options for the request
203
+ * @returns {Promise<SdkResponse<any>>} The response from the server
194
204
  */
195
205
  async getNotificationPreferences({ id, options = {} }) {
196
206
  this.client._require({ id });
@@ -205,8 +215,8 @@ export class Users {
205
215
  * @param {Object} params
206
216
  * @param {string} params.id - The ID of the user
207
217
  * @param {Array<{name: string, web: boolean, email: boolean}>} params.notificationPreferences - Array of notification preference objects
208
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
209
- * @returns {Promise<Object>} The response from the server
218
+ * @param {RequestOptions} [params.options] - Additional options for the request
219
+ * @returns {Promise<SdkResponse<any>>} The response from the server
210
220
  */
211
221
  async updateNotificationPreferences({ id, notificationPreferences, options = {} }) {
212
222
  this.client._require({ id, notificationPreferences });
@@ -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 Webhooks {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -17,8 +23,8 @@ export class Webhooks {
17
23
  * @param {string} [params.phoneNumber] - Filter by associated phone number (for SMS webhooks)
18
24
  * @param {number} [params.page] - The page number for pagination
19
25
  * @param {number} [params.limit] - The number of items per page for pagination
20
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
21
- * @returns {Promise<Array>} The response from the server
26
+ * @param {RequestOptions} [params.options] - Additional options for the request
27
+ * @returns {Promise<SdkResponse<Array>>} The response from the server
22
28
  */
23
29
  async getWebhooks({ id, groupId, endpointType, phoneNumber, page, limit, options = {} }) {
24
30
  const filters = { id, groupId, endpointType, phoneNumber, page, limit };
@@ -31,15 +37,17 @@ export class Webhooks {
31
37
  * plaintext HMAC-SHA256 secret used to sign every delivery to this endpoint, sent as the
32
38
  * `X-SignalHouse-Signature` header alongside `X-SignalHouse-Timestamp` (the signed string is
33
39
  * `${timestamp}.${rawRequestBody}`) and `X-SignalHouse-Delivery-Id` (stable across retries of the
34
- * same event, for receiver-side dedup). Store this secret now: it is never returned again by any
35
- * read (SHGHL-2944).
40
+ * same event, for receiver-side dedup), plus `X-SignalHouse-Signature-V1` (`t=<ms>,v1=<hex>[,v1=<hex>]`,
41
+ * every currently valid signature). Store this secret now: it is never returned again by any read
42
+ * (SHGHL-2944). If it's lost, call `rotateWebhookSecret`. Verify deliveries with
43
+ * `verifyWebhookSignature` from `@signalhousellc/sdk/webhooks` (Node only).
36
44
  * @async
37
45
  * @roles api, admin, developer
38
46
  * @param {Object} params - The parameters for creating a webhook
39
47
  * @param {Object} params.webhookData - The data for the new webhook
40
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
48
+ * @param {RequestOptions} [params.options] - Additional options for the request
41
49
  * @throws {Error} Throws an error if the webhookData parameter is missing or if required fields in webhookData are missing
42
- * @returns {Promise<Object>} The response from the server, including the plaintext `signingSecret` (this one time only)
50
+ * @returns {Promise<SdkResponse<any>>} The response from the server, including the plaintext `signingSecret` (this one time only)
43
51
  */
44
52
  async createWebhook({ webhookData, options = {} }) {
45
53
  this.client._require({ webhookData: webhookData });
@@ -47,17 +55,19 @@ export class Webhooks {
47
55
  }
48
56
 
49
57
  /**
50
- * Update an existing webhook with the specified data. Like every other read of a webhook, the
51
- * response carries `hasSigningSecret` (boolean), never the signing secret itself — see
52
- * `createWebhook` (SHGHL-2944).
58
+ * Update an existing webhook with the specified data. `updateData` may include `name`, `url`,
59
+ * `subscribedEvents` and (SHGHL-3486) `authType`, `apiHeaderPrefix` and `credentials` (`{ key, secret? }`)
60
+ * to change the endpoint's own credentials in place: credentials are required when switching to an auth
61
+ * type that needs them, and omitted credentials keep the stored ones. Like every read of a webhook, the
62
+ * response carries `hasSigningSecret` and `hasCredentials` (booleans), never a secret or credential.
53
63
  * @async
54
64
  * @roles api, admin, developer
55
65
  * @param {Object} params - The parameters for updating a webhook
56
66
  * @param {string} params.id - The ID of the webhook to update
57
67
  * @param {Object} params.updateData - The data for the webhook to be updated, including fields such as endpoint URL and event types
58
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
68
+ * @param {RequestOptions} [params.options] - Additional options for the request
59
69
  * @throws {Error} Throws an error if the id or updateData parameter is missing
60
- * @returns {Promise<Object>} The response from the server
70
+ * @returns {Promise<SdkResponse<any>>} The response from the server
61
71
  */
62
72
  async updateWebhook({ id, updateData, options = {} }) {
63
73
  this.client._require({ id, updateData });
@@ -65,15 +75,37 @@ export class Webhooks {
65
75
  return this.client(`/webhook/${safeId}`, { method: "PUT", body: updateData, ...options });
66
76
  }
67
77
 
78
+ /**
79
+ * Rotate a webhook's signing secret, or give a webhook created before signing existed its first one
80
+ * (SHGHL-3486). The response includes the new plaintext `signingSecret`, returned this one time only.
81
+ * The replaced secret keeps working for `graceSeconds` (default 86400, max 604800, 0 = stop now):
82
+ * during that window each delivery's `X-SignalHouse-Signature-V1` header carries a signature for both,
83
+ * and `previousSecretExpiresAt` in the response says when the old one stops. Not available to OAuth
84
+ * connector tokens.
85
+ * @async
86
+ * @roles api, admin, developer
87
+ * @param {Object} params - The parameters for rotating the secret
88
+ * @param {string} params.id - The ID of the webhook
89
+ * @param {number} [params.graceSeconds] - How long the replaced secret stays valid
90
+ * @param {RequestOptions} [params.options] - Additional options for the request
91
+ * @throws {Error} Throws an error if the id parameter is missing
92
+ * @returns {Promise<SdkResponse<any>>} The webhook, including the new plaintext `signingSecret` (this one time only)
93
+ */
94
+ async rotateWebhookSecret({ id, graceSeconds, options = {} }) {
95
+ this.client._require({ id });
96
+ const safeId = encodeURIComponent(id);
97
+ return this.client(`/webhook/${safeId}/rotate-secret`, { method: "POST", body: graceSeconds === undefined ? {} : { graceSeconds }, ...options });
98
+ }
99
+
68
100
  /**
69
101
  * Delete a webhook by its ID (mark as inactive)
70
102
  * @async
71
103
  * @roles api, admin, developer
72
104
  * @param {Object} params - The parameters for deleting a webhook
73
105
  * @param {string} params.id - The ID of the webhook to delete
74
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
106
+ * @param {RequestOptions} [params.options] - Additional options for the request
75
107
  * @throws {Error} Throws an error if the id parameter is missing
76
- * @returns {Promise<Object>} The response from the server
108
+ * @returns {Promise<SdkResponse<any>>} The response from the server
77
109
  */
78
110
  async deleteWebhook({ id, options = {} }) {
79
111
  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
  /**
2
8
  * @typedef {Object} VoiceAnalyticsFilters
3
9
  * @property {string} [dateFrom] - ISO-8601 lower bound on call start time.
@@ -61,8 +67,8 @@ export class Analytics {
61
67
  * @roles api, admin, developer, billing, user
62
68
  * @param {Object} [params] - Request parameters.
63
69
  * @param {VoiceAnalyticsFilters} [params.filters] - Optional filters. Summary tiles honor every filter except `direction`; breakdowns honor all filters.
64
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
65
- * @returns {Promise<Object>} `{ success, range, outbound: VoiceDirectionSummary, inbound: VoiceDirectionSummary, byDate: VoiceBreakdownBucket[], byNumber: VoiceBreakdownBucket[], byCarrier: VoiceBreakdownBucket[], byChannel: VoiceBreakdownBucket[] }` (byChannel = per-callSource breakdown).
70
+ * @param {RequestOptions} [params.options] - Additional options for the request.
71
+ * @returns {Promise<SdkResponse<any>>} `{ success, range, outbound: VoiceDirectionSummary, inbound: VoiceDirectionSummary, byDate: VoiceBreakdownBucket[], byNumber: VoiceBreakdownBucket[], byCarrier: VoiceBreakdownBucket[], byChannel: VoiceBreakdownBucket[] }` (byChannel = per-callSource breakdown).
66
72
  */
67
73
  async get({ filters = {}, options = {} } = {}) {
68
74
  const query = new URLSearchParams();
@@ -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} ListCallLogsFilters
3
9
  * @property {number} [page] - 1-indexed page (default 1).
@@ -40,8 +46,8 @@ export class CallLogs {
40
46
  * @roles api, admin, developer, billing, user
41
47
  * @param {Object} [params] - Request parameters.
42
48
  * @param {ListCallLogsFilters} [params.filters] - Optional filters.
43
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
44
- * @returns {Promise<Object>} `{ success, data: [...call logs], meta: { total, page, limit, totalPages } }`.
49
+ * @param {RequestOptions} [params.options] - Additional options for the request.
50
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: [...call logs], meta: { total, page, limit, totalPages } }`.
45
51
  */
46
52
  async list({ filters = {}, options = {} } = {}) {
47
53
  const query = new URLSearchParams();
@@ -59,9 +65,9 @@ export class CallLogs {
59
65
  * @roles api, admin, developer, billing, user
60
66
  * @param {Object} params - Request parameters.
61
67
  * @param {string} params.id - The call log UUID or callId.
62
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
68
+ * @param {RequestOptions} [params.options] - Additional options for the request.
63
69
  * @throws {Error} If id is missing.
64
- * @returns {Promise<Object>} `{ success, data: { ...call log } }`.
70
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { ...call log } }`.
65
71
  */
66
72
  async get({ id, options = {} }) {
67
73
  this.client._require({ id });
@@ -76,9 +82,9 @@ export class CallLogs {
76
82
  * @roles api, admin, developer, billing, user
77
83
  * @param {Object} params - Request parameters.
78
84
  * @param {string} params.id - The call log UUID or callId.
79
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
85
+ * @param {RequestOptions} [params.options] - Additional options for the request.
80
86
  * @throws {Error} If id is missing.
81
- * @returns {Promise<Object>} `{ success, data: { callId, url, expiresIn } }`.
87
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { callId, url, expiresIn } }`.
82
88
  */
83
89
  async getRecording({ id, options = {} }) {
84
90
  this.client._require({ id });
@@ -93,9 +99,9 @@ export class CallLogs {
93
99
  * @param {Object} params - Request parameters.
94
100
  * @param {string} params.id - The call log UUID or callId.
95
101
  * @param {boolean} [params.read=true] - true = read, false = unread.
96
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
102
+ * @param {RequestOptions} [params.options] - Additional options for the request.
97
103
  * @throws {Error} If id is missing.
98
- * @returns {Promise<Object>} `{ success, data: { id, voicemailReadAt } }`.
104
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { id, voicemailReadAt } }`.
99
105
  */
100
106
  async markVoicemailRead({ id, read = true, options = {} }) {
101
107
  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
  /**
2
8
  * @typedef {Object} CreateCallData
3
9
  * @property {string} to - Destination phone number in E.164 format (e.g. "+15551234567") or SIP URI.
@@ -48,9 +54,9 @@ export class Calls {
48
54
  * @roles api, admin, developer, billing, user
49
55
  * @param {Object} params - Request parameters.
50
56
  * @param {CreateCallData} params.callData - The call to place.
51
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
57
+ * @param {RequestOptions} [params.options] - Additional options for the request.
52
58
  * @throws {Error} If callData is missing.
53
- * @returns {Promise<Object>} The created call: `{ call_id, status, direction, from, to, created_at }`.
59
+ * @returns {Promise<SdkResponse<any>>} The created call: `{ call_id, status, direction, from, to, created_at }`.
54
60
  */
55
61
  async create({ callData, options = {} }) {
56
62
  this.client._require({ callData });
@@ -63,8 +69,8 @@ export class Calls {
63
69
  * @roles api, admin, developer, billing, user
64
70
  * @param {Object} [params] - Request parameters.
65
71
  * @param {ListCallsFilters} [params.filters] - Optional filters.
66
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
67
- * @returns {Promise<Object>} `{ calls: [...], total, page, limit }`.
72
+ * @param {RequestOptions} [params.options] - Additional options for the request.
73
+ * @returns {Promise<SdkResponse<any>>} `{ calls: [...], total, page, limit }`.
68
74
  */
69
75
  async list({ filters = {}, options = {} } = {}) {
70
76
  const query = new URLSearchParams();
@@ -82,9 +88,9 @@ export class Calls {
82
88
  * @roles api, admin, developer, billing, user
83
89
  * @param {Object} params - Request parameters.
84
90
  * @param {string} params.id - The call log UUID (the value returned as `call_id` from `create`).
85
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
91
+ * @param {RequestOptions} [params.options] - Additional options for the request.
86
92
  * @throws {Error} If id is missing.
87
- * @returns {Promise<Object>} The call log.
93
+ * @returns {Promise<SdkResponse<any>>} The call log.
88
94
  */
89
95
  async get({ id, options = {} }) {
90
96
  this.client._require({ id });
@@ -99,9 +105,9 @@ export class Calls {
99
105
  * @param {Object} params - Request parameters.
100
106
  * @param {string} params.id - The call log UUID.
101
107
  * @param {"NORMAL"|"BUSY"|"NO_ANSWER"|"REJECTED"} [params.reason] - Hangup reason recorded on the call log. Defaults to NORMAL.
102
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
108
+ * @param {RequestOptions} [params.options] - Additional options for the request.
103
109
  * @throws {Error} If id is missing.
104
- * @returns {Promise<Object>} `{ success: boolean, message: string }`.
110
+ * @returns {Promise<SdkResponse<any>>} `{ success: boolean, message: string }`.
105
111
  */
106
112
  async hangup({ id, reason, options = {} }) {
107
113
  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
  /**
2
8
  * @typedef {Object} GlobalVoiceSettingsData
3
9
  * @property {string[]} [acceptedRegions] - Accepted regions as country calling codes; empty = all allowed.
@@ -23,8 +29,8 @@ export class GlobalVoiceSettings {
23
29
  * @async
24
30
  * @roles api, admin, developer, billing, user
25
31
  * @param {Object} [params] - Request parameters.
26
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
27
- * @returns {Promise<Object>} `{ success, data: { accountId, acceptedRegions, maxSpendPerMinute, e911Enabled, ... } | null }`.
32
+ * @param {RequestOptions} [params.options] - Additional options for the request.
33
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { accountId, acceptedRegions, maxSpendPerMinute, e911Enabled, ... } | null }`.
28
34
  */
29
35
  async get({ options = {} } = {}) {
30
36
  return this.client(`/voice/api/v1/global-voice-settings`, { method: "GET", ...options });
@@ -37,9 +43,9 @@ export class GlobalVoiceSettings {
37
43
  * @roles api, admin, developer
38
44
  * @param {Object} params - Request parameters.
39
45
  * @param {GlobalVoiceSettingsData} params.settingsData - Fields to set.
40
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
46
+ * @param {RequestOptions} [params.options] - Additional options for the request.
41
47
  * @throws {Error} If settingsData is missing.
42
- * @returns {Promise<Object>} `{ success, data: { ...settings } }`.
48
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { ...settings } }`.
43
49
  */
44
50
  async update({ settingsData, options = {} }) {
45
51
  this.client._require({ settingsData });
@@ -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} CreateProgrammableVoiceProfileData
3
9
  * @property {string} name - Profile name (required).
@@ -49,8 +55,8 @@ export class ProgrammableVoiceProfiles {
49
55
  * @async
50
56
  * @roles api, admin, developer, billing, user
51
57
  * @param {Object} [params] - Request parameters.
52
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
53
- * @returns {Promise<Object>} `{ profiles: [...] }`.
58
+ * @param {RequestOptions} [params.options] - Additional options for the request.
59
+ * @returns {Promise<SdkResponse<any>>} `{ profiles: [...] }`.
54
60
  */
55
61
  async list({ options = {} } = {}) {
56
62
  return this.client(`/voice/api/v1/programmable-voice-profiles`, { method: "GET", ...options });
@@ -62,9 +68,9 @@ export class ProgrammableVoiceProfiles {
62
68
  * @roles api, admin, developer, billing, user
63
69
  * @param {Object} params - Request parameters.
64
70
  * @param {string} params.id - The profile UUID.
65
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
71
+ * @param {RequestOptions} [params.options] - Additional options for the request.
66
72
  * @throws {Error} If id is missing.
67
- * @returns {Promise<Object>} `{ profile: {...} }`.
73
+ * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
68
74
  */
69
75
  async get({ id, options = {} }) {
70
76
  this.client._require({ id });
@@ -78,9 +84,9 @@ export class ProgrammableVoiceProfiles {
78
84
  * @roles api, admin, developer
79
85
  * @param {Object} params - Request parameters.
80
86
  * @param {CreateProgrammableVoiceProfileData} params.profileData - The profile to create.
81
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
87
+ * @param {RequestOptions} [params.options] - Additional options for the request.
82
88
  * @throws {Error} If profileData is missing.
83
- * @returns {Promise<Object>} `{ profile: {...} }`.
89
+ * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
84
90
  */
85
91
  async create({ profileData, options = {} }) {
86
92
  this.client._require({ profileData });
@@ -94,9 +100,9 @@ export class ProgrammableVoiceProfiles {
94
100
  * @param {Object} params - Request parameters.
95
101
  * @param {string} params.id - The profile UUID.
96
102
  * @param {UpdateProgrammableVoiceProfileData} params.updateData - Fields to update.
97
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
103
+ * @param {RequestOptions} [params.options] - Additional options for the request.
98
104
  * @throws {Error} If id or updateData is missing.
99
- * @returns {Promise<Object>} `{ profile: {...} }`.
105
+ * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
100
106
  */
101
107
  async update({ id, updateData, options = {} }) {
102
108
  this.client._require({ id, updateData });
@@ -110,9 +116,9 @@ export class ProgrammableVoiceProfiles {
110
116
  * @roles api, admin, developer
111
117
  * @param {Object} params - Request parameters.
112
118
  * @param {string} params.id - The profile UUID.
113
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
119
+ * @param {RequestOptions} [params.options] - Additional options for the request.
114
120
  * @throws {Error} If id is missing.
115
- * @returns {Promise<Object>} `{ profile: {...} }`.
121
+ * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
116
122
  */
117
123
  async toggleActive({ id, options = {} }) {
118
124
  this.client._require({ id });
@@ -127,9 +133,9 @@ export class ProgrammableVoiceProfiles {
127
133
  * @roles api, admin, developer
128
134
  * @param {Object} params - Request parameters.
129
135
  * @param {string} params.id - The profile UUID.
130
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
136
+ * @param {RequestOptions} [params.options] - Additional options for the request.
131
137
  * @throws {Error} If id is missing.
132
- * @returns {Promise<Object>} `{ message: string }`.
138
+ * @returns {Promise<SdkResponse<any>>} `{ message: string }`.
133
139
  */
134
140
  async delete({ id, options = {} }) {
135
141
  this.client._require({ id });
@@ -146,9 +152,9 @@ export class ProgrammableVoiceProfiles {
146
152
  * @param {Object} params - Request parameters.
147
153
  * @param {string} params.id - The profile UUID.
148
154
  * @param {string} params.e164 - The phone number in E.164 (a leading "+" is optional).
149
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
155
+ * @param {RequestOptions} [params.options] - Additional options for the request.
150
156
  * @throws {Error} If id or e164 is missing.
151
- * @returns {Promise<Object>} `{ profile: {...} }`.
157
+ * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
152
158
  */
153
159
  async assignNumber({ id, e164, options = {} }) {
154
160
  this.client._require({ id, e164 });
@@ -167,9 +173,9 @@ export class ProgrammableVoiceProfiles {
167
173
  * @param {Object} params - Request parameters.
168
174
  * @param {string} params.id - The profile UUID.
169
175
  * @param {string} params.e164 - The phone number in E.164 (a leading "+" is optional).
170
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
176
+ * @param {RequestOptions} [params.options] - Additional options for the request.
171
177
  * @throws {Error} If id or e164 is missing.
172
- * @returns {Promise<Object>} `{ profile: {...} }`.
178
+ * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
173
179
  */
174
180
  async unassignNumber({ id, e164, options = {} }) {
175
181
  this.client._require({ id, e164 });
@@ -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} CreateSipProfileData
3
9
  * @property {string} name - Profile name (required).
@@ -37,8 +43,8 @@ export class SipProfiles {
37
43
  * @async
38
44
  * @roles api, admin, developer, billing, user
39
45
  * @param {Object} [params] - Request parameters.
40
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
41
- * @returns {Promise<Object>} `{ sipProfiles: [...] }`.
46
+ * @param {RequestOptions} [params.options] - Additional options for the request.
47
+ * @returns {Promise<SdkResponse<any>>} `{ sipProfiles: [...] }`.
42
48
  */
43
49
  async list({ options = {} } = {}) {
44
50
  return this.client(`/voice/sip-profiles`, { method: "GET", ...options });
@@ -51,9 +57,9 @@ export class SipProfiles {
51
57
  * @roles api, admin, developer, billing, user
52
58
  * @param {Object} params - Request parameters.
53
59
  * @param {string} params.id - The SIP profile UUID.
54
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
60
+ * @param {RequestOptions} [params.options] - Additional options for the request.
55
61
  * @throws {Error} If id is missing.
56
- * @returns {Promise<Object>} `{ sipProfile: {...} }`.
62
+ * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...} }`.
57
63
  */
58
64
  async get({ id, options = {} }) {
59
65
  this.client._require({ id });
@@ -70,9 +76,9 @@ export class SipProfiles {
70
76
  * @roles api, admin, developer, billing, user
71
77
  * @param {Object} params - Request parameters.
72
78
  * @param {string} params.id - The SIP profile UUID.
73
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
79
+ * @param {RequestOptions} [params.options] - Additional options for the request.
74
80
  * @throws {Error} If id is missing.
75
- * @returns {Promise<Object>} `{ password: string|null }`.
81
+ * @returns {Promise<SdkResponse<any>>} `{ password: string|null }`.
76
82
  */
77
83
  async getPassword({ id, options = {} }) {
78
84
  this.client._require({ id });
@@ -86,8 +92,8 @@ export class SipProfiles {
86
92
  * @async
87
93
  * @roles api, admin, developer, billing, user
88
94
  * @param {Object} [params] - Request parameters.
89
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
90
- * @returns {Promise<Object>} `{ transports: [{ transport, address, port }, ...] }`.
95
+ * @param {RequestOptions} [params.options] - Additional options for the request.
96
+ * @returns {Promise<SdkResponse<any>>} `{ transports: [{ transport, address, port }, ...] }`.
91
97
  */
92
98
  async getTransports({ options = {} } = {}) {
93
99
  return this.client(`/voice/sip-profiles/transports`, { method: "GET", ...options });
@@ -102,9 +108,9 @@ export class SipProfiles {
102
108
  * @roles api, admin, developer, billing, user
103
109
  * @param {Object} params - Request parameters.
104
110
  * @param {CreateSipProfileData} params.profileData - The SIP profile to create.
105
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
111
+ * @param {RequestOptions} [params.options] - Additional options for the request.
106
112
  * @throws {Error} If profileData is missing.
107
- * @returns {Promise<Object>} `{ sipProfile: {...}, password: string, sipServer: string, message: string }`.
113
+ * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...}, password: string, sipServer: string, message: string }`.
108
114
  */
109
115
  async create({ profileData, options = {} }) {
110
116
  this.client._require({ profileData });
@@ -119,9 +125,9 @@ export class SipProfiles {
119
125
  * @param {Object} params - Request parameters.
120
126
  * @param {string} params.id - The SIP profile UUID.
121
127
  * @param {UpdateSipProfileData} params.updateData - Fields to update.
122
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
128
+ * @param {RequestOptions} [params.options] - Additional options for the request.
123
129
  * @throws {Error} If id or updateData is missing.
124
- * @returns {Promise<Object>} `{ sipProfile: {...} }`.
130
+ * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...} }`.
125
131
  */
126
132
  async update({ id, updateData, options = {} }) {
127
133
  this.client._require({ id, updateData });
@@ -136,9 +142,9 @@ export class SipProfiles {
136
142
  * @roles api, admin, developer, billing, user
137
143
  * @param {Object} params - Request parameters.
138
144
  * @param {string} params.id - The SIP profile UUID.
139
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
145
+ * @param {RequestOptions} [params.options] - Additional options for the request.
140
146
  * @throws {Error} If id is missing.
141
- * @returns {Promise<Object>} `{ message: string }`.
147
+ * @returns {Promise<SdkResponse<any>>} `{ message: string }`.
142
148
  */
143
149
  async delete({ id, options = {} }) {
144
150
  this.client._require({ id });
@@ -156,9 +162,9 @@ export class SipProfiles {
156
162
  * @param {string} params.id - The SIP profile UUID.
157
163
  * @param {string} [params.e164] - The phone number in E.164 to assign (preferred).
158
164
  * @param {string} [params.phoneNumberId] - Legacy: a voice-backend phone number UUID.
159
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
165
+ * @param {RequestOptions} [params.options] - Additional options for the request.
160
166
  * @throws {Error} If id is missing, or neither e164 nor phoneNumberId is provided.
161
- * @returns {Promise<Object>} `{ sipProfile: {...} }`.
167
+ * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...} }`.
162
168
  */
163
169
  async assignNumber({ id, e164, phoneNumberId, options = {} }) {
164
170
  this.client._require({ id });
@@ -180,9 +186,9 @@ export class SipProfiles {
180
186
  * @param {string} params.id - The SIP profile UUID.
181
187
  * @param {string} [params.e164] - The phone number in E.164 to unassign (preferred).
182
188
  * @param {string} [params.phoneNumberId] - Legacy: a voice-backend phone number UUID.
183
- * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
189
+ * @param {RequestOptions} [params.options] - Additional options for the request.
184
190
  * @throws {Error} If id is missing, or neither e164 nor phoneNumberId is provided.
185
- * @returns {Promise<Object>} `{ sipProfile: {...} }`.
191
+ * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...} }`.
186
192
  */
187
193
  async unassignNumber({ id, e164, phoneNumberId, options = {} }) {
188
194
  this.client._require({ id });