@signalhousellc/sdk 1.0.66 → 1.0.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,9 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
1
7
  export class Subscriptions {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -11,8 +17,8 @@ export class Subscriptions {
11
17
  * @roles signalhouse
12
18
  * @param {Object} params - The parameters for getting subscription templates
13
19
  * @param {string} [params.templateId] - The ID of a specific template to retrieve (optional)
14
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
15
- * @returns {Promise<Object>} - The subscription templates returned from the server
20
+ * @param {RequestOptions} [params.options] - Additional options for the request
21
+ * @returns {Promise<SdkResponse<any>>} - The subscription templates returned from the server
16
22
  */
17
23
  getTemplates: async ({ templateId, options = {} }) => {
18
24
  const filters = { templateId };
@@ -26,9 +32,9 @@ export class Subscriptions {
26
32
  * @roles signalhouse
27
33
  * @param {Object} params - The parameters for creating a subscription template
28
34
  * @param {Object} params.templateData - The data for the new subscription template, including required fields such as templateName and monthlyFee
29
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
35
+ * @param {RequestOptions} [params.options] - Additional options for the request
30
36
  * @throws {Error} Throws an error if the templateData parameter is missing or if required fields within templateData are missing
31
- * @returns {Promise<Object>} - The created subscription template object returned from the server
37
+ * @returns {Promise<SdkResponse<any>>} - The created subscription template object returned from the server
32
38
  */
33
39
  createTemplate: async ({ templateData, options = {} }) => {
34
40
  this.client._require({ templateData: templateData });
@@ -42,9 +48,9 @@ export class Subscriptions {
42
48
  * @param {Object} params - The parameters for updating a subscription template
43
49
  * @param {string} params.templateId - The ID of the subscription template to update
44
50
  * @param {Object} params.templateData - The data for the subscription template, including fields such as templateName and monthlyFee
45
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
51
+ * @param {RequestOptions} [params.options] - Additional options for the request
46
52
  * @throws {Error} Throws an error if the templateId or templateData parameter is missing
47
- * @returns {Promise<Object>} - The updated subscription template object returned from the server
53
+ * @returns {Promise<SdkResponse<any>>} - The updated subscription template object returned from the server
48
54
  */
49
55
  updateTemplate: async ({ templateId, templateData, options = {} }) => {
50
56
  this.client._require({ templateId, templateData });
@@ -58,9 +64,9 @@ export class Subscriptions {
58
64
  * @roles signalhouse
59
65
  * @param {Object} params - The parameters for deleting a subscription template
60
66
  * @param {string} params.templateId - The ID of the subscription template to delete
61
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
67
+ * @param {RequestOptions} [params.options] - Additional options for the request
62
68
  * @throws {Error} Throws an error if the templateId parameter is missing
63
- * @returns {Promise<Object>} - The deleted subscription template object returned from the server
69
+ * @returns {Promise<SdkResponse<any>>} - The deleted subscription template object returned from the server
64
70
  */
65
71
  deleteTemplate: async ({ templateId, options = {} }) => {
66
72
  this.client._require({ templateId });
@@ -75,9 +81,9 @@ export class Subscriptions {
75
81
  * @param {Object} params - The parameters for creating a custom subscription
76
82
  * @param {string} params.groupId - The ID of the group to create the custom subscription for
77
83
  * @param {Object} params.subscriptionData - The data for the custom subscription, including required fields such as subscriptionName and monthlyFee
78
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
84
+ * @param {RequestOptions} [params.options] - Additional options for the request
79
85
  * @throws {Error} Throws an error if the groupId or subscriptionData parameter is missing or if required fields within subscriptionData are missing
80
- * @returns {Promise<Object>} - The created custom subscription object returned from the server
86
+ * @returns {Promise<SdkResponse<any>>} - The created custom subscription object returned from the server
81
87
  */
82
88
  createCustomSubscription: async ({ groupId, subscriptionData, options = {} }) => {
83
89
  this.client._require({ groupId, subscriptionData });
@@ -95,8 +101,8 @@ export class Subscriptions {
95
101
  * @param {Object} params - The parameters for getting subscription history
96
102
  * @param {string} params.groupId - The ID of the group to get subscription history for
97
103
  * @param {boolean} [params.onlyActive] - Whether to only include active subscriptions
98
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
99
- * @returns {Promise<Object>} - The subscription history returned from the server
104
+ * @param {RequestOptions} [params.options] - Additional options for the request
105
+ * @returns {Promise<SdkResponse<any>>} - The subscription history returned from the server
100
106
  */
101
107
  async getSubscriptions({ groupId, onlyActive, options = {} }) {
102
108
  const filters = { groupId, onlyActive };
@@ -111,9 +117,9 @@ export class Subscriptions {
111
117
  * @param {Object} params - The parameters for subscribing a group to a template
112
118
  * @param {string} params.groupId - The ID of the group to subscribe
113
119
  * @param {string} params.templateId - The ID of the template to subscribe the group to
114
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
120
+ * @param {RequestOptions} [params.options] - Additional options for the request
115
121
  * @throws {Error} Throws an error if the groupId or templateId parameter is missing
116
- * @returns {Promise<Object>} - The subscription object returned from the server
122
+ * @returns {Promise<SdkResponse<any>>} - The subscription object returned from the server
117
123
  */
118
124
  async subscribe({ groupId, templateId, options = {} }) {
119
125
  this.client._require({ groupId, templateId });
@@ -128,9 +134,9 @@ export class Subscriptions {
128
134
  * @roles api, admin, developer, billing, user
129
135
  * @param {Object} params - The parameters for unsubscribing a group from a template
130
136
  * @param {string} params.groupId - The ID of the group to unsubscribe
131
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
137
+ * @param {RequestOptions} [params.options] - Additional options for the request
132
138
  * @throws {Error} Throws an error if the groupId parameter is missing
133
- * @returns {Promise<Object>} - The subscription object returned from the server
139
+ * @returns {Promise<SdkResponse<any>>} - The subscription object returned from the server
134
140
  */
135
141
  async unsubscribe({ groupId, options = {} }) {
136
142
  this.client._require({ groupId });
@@ -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 Tickets {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -11,8 +17,8 @@ export class Tickets {
11
17
  * @async
12
18
  * @roles signalhouse
13
19
  * @param {Object} [params] - Optional parameters
14
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
15
- * @returns {Promise<Object>} - Jira form metadata
20
+ * @param {RequestOptions} [params.options] - Additional options for the request
21
+ * @returns {Promise<SdkResponse<any>>} - Jira form metadata
16
22
  */
17
23
  getJiraMetadata: async ({ options = {} } = {}) => {
18
24
  return this.client(`/admin/ticket/jira/metadata`, { method: "GET", ...options });
@@ -24,8 +30,8 @@ export class Tickets {
24
30
  * @roles signalhouse
25
31
  * @param {Object} [params]
26
32
  * @param {string} [params.query] - Optional epic summary/key filter
27
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
28
- * @returns {Promise<Object>} - `{ epics: Array<{ id, key, summary }> }`
33
+ * @param {RequestOptions} [params.options] - Additional options for the request
34
+ * @returns {Promise<SdkResponse<any>>} - `{ epics: Array<{ id, key, summary }> }`
29
35
  */
30
36
  searchJiraEpics: async ({ query, options = {} } = {}) => {
31
37
  const queryString = this.client._getQueryString({ query });
@@ -38,8 +44,8 @@ export class Tickets {
38
44
  * @roles signalhouse
39
45
  * @param {Object} [params]
40
46
  * @param {string} [params.query] - Optional issue summary/key filter
41
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
42
- * @returns {Promise<Object>} - `{ issues: Array<{ id, key, summary }> }`
47
+ * @param {RequestOptions} [params.options] - Additional options for the request
48
+ * @returns {Promise<SdkResponse<any>>} - `{ issues: Array<{ id, key, summary }> }`
43
49
  */
44
50
  searchJiraParentIssues: async ({ query, options = {} } = {}) => {
45
51
  const queryString = this.client._getQueryString({ query });
@@ -52,8 +58,8 @@ export class Tickets {
52
58
  * @roles signalhouse
53
59
  * @param {Object} [params]
54
60
  * @param {string} [params.query] - Partial name or email
55
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
56
- * @returns {Promise<Object>} - `{ users: Array<{ accountId, displayName, emailAddress }> }`
61
+ * @param {RequestOptions} [params.options] - Additional options for the request
62
+ * @returns {Promise<SdkResponse<any>>} - `{ users: Array<{ accountId, displayName, emailAddress }> }`
57
63
  */
58
64
  searchJiraAssignees: async ({ query, options = {} } = {}) => {
59
65
  const queryString = this.client._getQueryString({ query });
@@ -66,8 +72,8 @@ export class Tickets {
66
72
  * @roles signalhouse
67
73
  * @param {Object} [params]
68
74
  * @param {string} [params.query] - Partial label text
69
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
70
- * @returns {Promise<Object>} - `{ labels: string[] }`
75
+ * @param {RequestOptions} [params.options] - Additional options for the request
76
+ * @returns {Promise<SdkResponse<any>>} - `{ labels: string[] }`
71
77
  */
72
78
  searchJiraLabels: async ({ query, options = {} } = {}) => {
73
79
  const queryString = this.client._getQueryString({ query });
@@ -80,9 +86,9 @@ export class Tickets {
80
86
  * @roles signalhouse
81
87
  * @param {Object} params
82
88
  * @param {Object} params.data - Create payload (groupId, issueTypeId, priorityId, summary required)
83
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
89
+ * @param {RequestOptions} [params.options] - Additional options for the request
84
90
  * @throws {Error} Throws an error if the data parameter is missing
85
- * @returns {Promise<Object>} - Created ticket summary (key, browseUrl, reporter, etc.)
91
+ * @returns {Promise<SdkResponse<any>>} - Created ticket summary (key, browseUrl, reporter, etc.)
86
92
  */
87
93
  createJiraTicket: async ({ data, options = {} }) => {
88
94
  this.client._require({ data });
@@ -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)
@@ -61,8 +67,8 @@ export class Users {
61
67
  * @param {string} [params.search] - Search users by email (case-insensitive)
62
68
  * @param {string} [params.sortBy] - Field to sort by (createdAt, email, activeGroupId, companyName, status, _id)
63
69
  * @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
70
+ * @param {RequestOptions} [params.options] - Additional options for the request
71
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of users
66
72
  */
67
73
  getUsers: async ({ email, userType, page, limit, search, sortBy, sortOrder, options = {} }) => {
68
74
  const filters = { email, userType, page, limit, search, sortBy, sortOrder };
@@ -75,8 +81,8 @@ export class Users {
75
81
  * @roles signalhouse
76
82
  * @param {Object} params - The parameters for creating an internal user
77
83
  * @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
84
+ * @param {RequestOptions} [params.options] - Additional options for the request
85
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the created internal user
80
86
  */
81
87
  createInternalUser: async ({ data, options = {} }) => {
82
88
  this.client._require({ data: data });
@@ -99,8 +105,8 @@ export class Users {
99
105
  * @param {string} [params.search] - Search users by email (case-insensitive)
100
106
  * @param {string} [params.sortBy] - Field to sort by (createdAt, email, activeGroupId, companyName, status, _id)
101
107
  * @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
108
+ * @param {RequestOptions} [params.options] - Additional options for the request
109
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of users
104
110
  */
105
111
  async getUsers({ id, groupId, userType, page, limit, search, sortBy, sortOrder, options = {} }) {
106
112
  const filters = { id, groupId, userType, page, limit, search, sortBy, sortOrder };
@@ -114,9 +120,9 @@ export class Users {
114
120
  * @roles api, admin
115
121
  * @param {Object} params - The parameters for creating a user (see CreateUserData typedef for details)
116
122
  * @param {CreateUserData} params.data - The data for the new user
117
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
123
+ * @param {RequestOptions} [params.options] - Additional options for the request
118
124
  * @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
125
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the created user
120
126
  */
121
127
  async createUser({ data, options = {} }) {
122
128
  this.client._require({ data: data });
@@ -129,9 +135,9 @@ export class Users {
129
135
  * @roles admin, developer
130
136
  * @param {Object} params - The parameters for creating a service user (see CreateServiceUserData typedef for details)
131
137
  * @param {CreateServiceUserData} params.data - The data for the new service user
132
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
138
+ * @param {RequestOptions} [params.options] - Additional options for the request
133
139
  * @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
140
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the created service user
135
141
  */
136
142
  async createServiceUser({ data, options = {} }) {
137
143
  this.client._require({ data: data });
@@ -145,9 +151,9 @@ export class Users {
145
151
  * @param {Object} params - The parameters for updating a user (see UpdateUserData typedef for details)
146
152
  * @param {string} params.id - The ID of the user to update
147
153
  * @param {UpdateUserData} params.data - The data to update for the user
148
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
154
+ * @param {RequestOptions} [params.options] - Additional options for the request
149
155
  * @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
156
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the updated user
151
157
  */
152
158
  async updateUser({ id, data, options = {} }) {
153
159
  this.client._require({ id, data: data });
@@ -161,9 +167,9 @@ export class Users {
161
167
  * @roles api, admin
162
168
  * @param {Object} params - The parameters for deleting a user
163
169
  * @param {string} params.id - The ID of the user to delete
164
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
170
+ * @param {RequestOptions} [params.options] - Additional options for the request
165
171
  * @throws {Error} Throws an error if the id parameter is missing
166
- * @returns {Promise<Object>} - A promise that resolves to the deleted user
172
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the deleted user
167
173
  */
168
174
  async deleteUser({ id, options = {} }) {
169
175
  this.client._require({ id });
@@ -176,8 +182,8 @@ export class Users {
176
182
  * @async
177
183
  * @roles api, admin, developer, billing, user
178
184
  * @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 })
185
+ * @param {RequestOptions} [params.options] - Additional options for the request
186
+ * @returns {Promise<SdkResponse<any>>} The response from the server ({ acceptedTermsOfService: true })
181
187
  */
182
188
  async acceptTermsOfService({ options = {} } = {}) {
183
189
  return this.client(`/user/accept-terms`, { method: "PUT", body: { acceptedTermsOfService: true }, ...options });
@@ -189,8 +195,8 @@ export class Users {
189
195
  * @roles api, admin, self
190
196
  * @param {Object} params
191
197
  * @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
198
+ * @param {RequestOptions} [params.options] - Additional options for the request
199
+ * @returns {Promise<SdkResponse<any>>} The response from the server
194
200
  */
195
201
  async getNotificationPreferences({ id, options = {} }) {
196
202
  this.client._require({ id });
@@ -205,8 +211,8 @@ export class Users {
205
211
  * @param {Object} params
206
212
  * @param {string} params.id - The ID of the user
207
213
  * @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
214
+ * @param {RequestOptions} [params.options] - Additional options for the request
215
+ * @returns {Promise<SdkResponse<any>>} The response from the server
210
216
  */
211
217
  async updateNotificationPreferences({ id, notificationPreferences, options = {} }) {
212
218
  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;
@@ -5,7 +11,9 @@ export class Webhooks {
5
11
  }
6
12
 
7
13
  /**
8
- * Get a list of webhooks with optional filters
14
+ * Get a list of webhooks with optional filters. Each returned endpoint carries `hasSigningSecret`
15
+ * (boolean) instead of the signing secret itself — the plaintext secret is only ever returned once,
16
+ * from `createWebhook`, and is never exposed again on any read (SHGHL-2944).
9
17
  * @async
10
18
  * @roles api, admin, developer
11
19
  * @param {Object} params - The parameters for getting webhooks
@@ -15,8 +23,8 @@ export class Webhooks {
15
23
  * @param {string} [params.phoneNumber] - Filter by associated phone number (for SMS webhooks)
16
24
  * @param {number} [params.page] - The page number for pagination
17
25
  * @param {number} [params.limit] - The number of items per page for pagination
18
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
19
- * @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
20
28
  */
21
29
  async getWebhooks({ id, groupId, endpointType, phoneNumber, page, limit, options = {} }) {
22
30
  const filters = { id, groupId, endpointType, phoneNumber, page, limit };
@@ -25,14 +33,19 @@ export class Webhooks {
25
33
  }
26
34
 
27
35
  /**
28
- * Create a new webhook with the specified data
36
+ * Create a new webhook with the specified data. The response includes a `signingSecret` — a
37
+ * plaintext HMAC-SHA256 secret used to sign every delivery to this endpoint, sent as the
38
+ * `X-SignalHouse-Signature` header alongside `X-SignalHouse-Timestamp` (the signed string is
39
+ * `${timestamp}.${rawRequestBody}`) and `X-SignalHouse-Delivery-Id` (stable across retries of the
40
+ * same event, for receiver-side dedup). Store this secret now: it is never returned again by any
41
+ * read (SHGHL-2944).
29
42
  * @async
30
43
  * @roles api, admin, developer
31
44
  * @param {Object} params - The parameters for creating a webhook
32
45
  * @param {Object} params.webhookData - The data for the new webhook
33
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
46
+ * @param {RequestOptions} [params.options] - Additional options for the request
34
47
  * @throws {Error} Throws an error if the webhookData parameter is missing or if required fields in webhookData are missing
35
- * @returns {Promise<Object>} The response from the server
48
+ * @returns {Promise<SdkResponse<any>>} The response from the server, including the plaintext `signingSecret` (this one time only)
36
49
  */
37
50
  async createWebhook({ webhookData, options = {} }) {
38
51
  this.client._require({ webhookData: webhookData });
@@ -40,15 +53,17 @@ export class Webhooks {
40
53
  }
41
54
 
42
55
  /**
43
- * Update an existing webhook with the specified data
56
+ * Update an existing webhook with the specified data. Like every other read of a webhook, the
57
+ * response carries `hasSigningSecret` (boolean), never the signing secret itself — see
58
+ * `createWebhook` (SHGHL-2944).
44
59
  * @async
45
60
  * @roles api, admin, developer
46
61
  * @param {Object} params - The parameters for updating a webhook
47
62
  * @param {string} params.id - The ID of the webhook to update
48
63
  * @param {Object} params.updateData - The data for the webhook to be updated, including fields such as endpoint URL and event types
49
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
64
+ * @param {RequestOptions} [params.options] - Additional options for the request
50
65
  * @throws {Error} Throws an error if the id or updateData parameter is missing
51
- * @returns {Promise<Object>} The response from the server
66
+ * @returns {Promise<SdkResponse<any>>} The response from the server
52
67
  */
53
68
  async updateWebhook({ id, updateData, options = {} }) {
54
69
  this.client._require({ id, updateData });
@@ -62,9 +77,9 @@ export class Webhooks {
62
77
  * @roles api, admin, developer
63
78
  * @param {Object} params - The parameters for deleting a webhook
64
79
  * @param {string} params.id - The ID of the webhook to delete
65
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
80
+ * @param {RequestOptions} [params.options] - Additional options for the request
66
81
  * @throws {Error} Throws an error if the id parameter is missing
67
- * @returns {Promise<Object>} The response from the server
82
+ * @returns {Promise<SdkResponse<any>>} The response from the server
68
83
  */
69
84
  async deleteWebhook({ id, options = {} }) {
70
85
  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 });