@signalhousellc/sdk 1.0.13 → 1.0.15

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.13",
3
+ "version": "1.0.15",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -19,6 +19,7 @@ import { Shortlinks } from "./domains/Shortlinks.js";
19
19
  import { Subgroups } from "./domains/Subgroups.js";
20
20
  import { Subscriptions } from "./domains/Subscriptions.js";
21
21
  import { Users } from "./domains/Users.js";
22
+ import { Notifications } from "./domains/Notifications.js";
22
23
  import { Webhooks } from "./domains/Webhooks.js";
23
24
 
24
25
  export class SignalHouseSDK {
@@ -61,6 +62,7 @@ export class SignalHouseSDK {
61
62
  this.subgroups = new Subgroups(client, this.enableAdmin);
62
63
  this.subscriptions = new Subscriptions(client, this.enableAdmin);
63
64
  this.users = new Users(client, this.enableAdmin);
65
+ this.notifications = new Notifications(client, this.enableAdmin);
64
66
  this.webhooks = new Webhooks(client, this.enableAdmin);
65
67
  }
66
68
 
@@ -78,7 +78,7 @@ export class Billing {
78
78
  async getPaymentMethods({ groupId, options = {} }) {
79
79
  this.client._require({ groupId });
80
80
  const safeGroupId = encodeURIComponent(groupId);
81
- return this.client(`/billing/wallet/paymentmethods/${safeGroupId}`, { method: "GET", ...options });
81
+ return this.client(`/billing/wallet/paymentMethods/${safeGroupId}`, { method: "GET", ...options });
82
82
  }
83
83
 
84
84
  /**
@@ -113,7 +113,7 @@ export class Billing {
113
113
  async addPaymentMethod({ groupId, paymentMethodId, options = {} }) {
114
114
  this.client._require({ groupId, paymentMethodId });
115
115
  const safeGroupId = encodeURIComponent(groupId);
116
- return this.client(`/billing/wallet/paymentmethods/${safeGroupId}`, { method: "POST", body: { paymentMethodId }, ...options });
116
+ return this.client(`/billing/wallet/paymentMethod/${safeGroupId}`, { method: "POST", body: { paymentMethodId }, ...options });
117
117
  }
118
118
 
119
119
  /**
@@ -131,7 +131,7 @@ export class Billing {
131
131
  this.client._require({ groupId, paymentMethodId });
132
132
  const safeGroupId = encodeURIComponent(groupId);
133
133
  const safePaymentMethodId = encodeURIComponent(paymentMethodId);
134
- return this.client(`/billing/wallet/paymentmethods/${safeGroupId}/${safePaymentMethodId}`, { method: "DELETE", ...options });
134
+ return this.client(`/billing/wallet/paymentMethod/${safeGroupId}/${safePaymentMethodId}`, { method: "DELETE", ...options });
135
135
  }
136
136
 
137
137
  /**
@@ -175,7 +175,7 @@ export class Brands {
175
175
  async revetBrand({ brandId, options = {} }) {
176
176
  this.client._require({ brandId });
177
177
  const safeBrandId = encodeURIComponent(brandId);
178
- return this.client(`/brand/revet/${safeBrandId}`, { method: "POST", ...options });
178
+ return this.client(`/brand/revet/${safeBrandId}`, { method: "PUT", ...options });
179
179
  }
180
180
 
181
181
  /**
@@ -0,0 +1,56 @@
1
+ export class Notifications {
2
+ constructor(client, enableAdmin) {
3
+ this.client = client;
4
+ this.enableAdmin = enableAdmin;
5
+ }
6
+
7
+ /**
8
+ * Get notifications by id or by groupId with optional filters
9
+ * @async
10
+ * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
11
+ * @param {Object} params
12
+ * @param {string} [params.id] - Notification id (one of id/groupId required)
13
+ * @param {string} [params.groupId] - Group id to fetch notifications for (one of id/groupId required)
14
+ * @param {number} [params.page] - Page number (min 1, default 1)
15
+ * @param {number} [params.limit] - Results per page (min 1, max 100, default 10)
16
+ * @param {string} [params.status] - Filter by status: "READ" or "UNREAD"
17
+ * @param {string|string[]} [params.eventTypes] - Event types to filter by (comma-separated string or array)
18
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
19
+ * @returns {Promise<Object>} The response from the server
20
+ */
21
+ async getNotifications({ id, groupId, page, limit, status, eventTypes, options = {} }) {
22
+ this.client._require({ "id or groupId": id ?? groupId });
23
+ const queryString = this.client._getQueryString({ id, groupId, page, limit, status, eventTypes });
24
+ return this.client(`/notifications${queryString}`, { method: "GET", ...options });
25
+ }
26
+
27
+ /**
28
+ * Update the status of one or more notifications
29
+ * @async
30
+ * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
31
+ * @param {Object} params
32
+ * @param {string|string[]} params.ids - Notification id or array of notification ids
33
+ * @param {string} params.status - New status: "READ" or "UNREAD"
34
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
35
+ * @returns {Promise<Object>} The response from the server
36
+ */
37
+ async updateNotificationStatus({ ids, status, options = {} }) {
38
+ this.client._require({ ids, status });
39
+ return this.client(`/notifications/status`, { method: "PUT", body: { ids, status }, ...options });
40
+ }
41
+
42
+ /**
43
+ * Delete a notification by id
44
+ * @async
45
+ * @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
46
+ * @param {Object} params
47
+ * @param {string} params.id - The notification id to delete
48
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
49
+ * @returns {Promise<Object>} The response from the server
50
+ */
51
+ async deleteNotification({ id, options = {} }) {
52
+ this.client._require({ id });
53
+ const safeId = encodeURIComponent(id);
54
+ return this.client(`/notifications/${safeId}`, { method: "DELETE", ...options });
55
+ }
56
+ }