@signalhousellc/sdk 1.0.15 → 1.0.17
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 +1 -1
- package/src/domains/Notifications.js +3 -3
- package/src/domains/Users.js +31 -0
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ export class Notifications {
|
|
|
21
21
|
async getNotifications({ id, groupId, page, limit, status, eventTypes, options = {} }) {
|
|
22
22
|
this.client._require({ "id or groupId": id ?? groupId });
|
|
23
23
|
const queryString = this.client._getQueryString({ id, groupId, page, limit, status, eventTypes });
|
|
24
|
-
return this.client(`/
|
|
24
|
+
return this.client(`/notification${queryString}`, { method: "GET", ...options });
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -36,7 +36,7 @@ export class Notifications {
|
|
|
36
36
|
*/
|
|
37
37
|
async updateNotificationStatus({ ids, status, options = {} }) {
|
|
38
38
|
this.client._require({ ids, status });
|
|
39
|
-
return this.client(`/
|
|
39
|
+
return this.client(`/notification/status`, { method: "PUT", body: { ids, status }, ...options });
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -51,6 +51,6 @@ export class Notifications {
|
|
|
51
51
|
async deleteNotification({ id, options = {} }) {
|
|
52
52
|
this.client._require({ id });
|
|
53
53
|
const safeId = encodeURIComponent(id);
|
|
54
|
-
return this.client(`/
|
|
54
|
+
return this.client(`/notification/${safeId}`, { method: "DELETE", ...options });
|
|
55
55
|
}
|
|
56
56
|
}
|
package/src/domains/Users.js
CHANGED
|
@@ -160,4 +160,35 @@ export class Users {
|
|
|
160
160
|
const safeId = encodeURIComponent(id);
|
|
161
161
|
return this.client(`/user/${safeId}`, { method: "DELETE", ...options });
|
|
162
162
|
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Get notification preferences for a user
|
|
166
|
+
* @async
|
|
167
|
+
* @roles api, admin, self
|
|
168
|
+
* @param {Object} params
|
|
169
|
+
* @param {string} params.id - The ID of the user
|
|
170
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
171
|
+
* @returns {Promise<Object>} The response from the server
|
|
172
|
+
*/
|
|
173
|
+
async getNotificationPreferences({ id, options = {} }) {
|
|
174
|
+
this.client._require({ id });
|
|
175
|
+
const safeId = encodeURIComponent(id);
|
|
176
|
+
return this.client(`/user/${safeId}/notification-preferences`, { method: "GET", ...options });
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Update notification preferences for a user
|
|
181
|
+
* @async
|
|
182
|
+
* @roles api, admin, self
|
|
183
|
+
* @param {Object} params
|
|
184
|
+
* @param {string} params.id - The ID of the user
|
|
185
|
+
* @param {Array<{name: string, web: boolean, email: boolean}>} params.notificationPreferences - Array of notification preference objects
|
|
186
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
187
|
+
* @returns {Promise<Object>} The response from the server
|
|
188
|
+
*/
|
|
189
|
+
async updateNotificationPreferences({ id, notificationPreferences, options = {} }) {
|
|
190
|
+
this.client._require({ id, notificationPreferences });
|
|
191
|
+
const safeId = encodeURIComponent(id);
|
|
192
|
+
return this.client(`/user/${safeId}/notification-preferences`, { method: "PUT", body: { notificationPreferences }, ...options });
|
|
193
|
+
}
|
|
163
194
|
}
|