@vitalfit/sdk 0.3.4 → 0.3.7

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/dist/index.cjs CHANGED
@@ -2329,6 +2329,57 @@ var AuditService = class {
2329
2329
  }
2330
2330
  };
2331
2331
 
2332
+ // src/services/notifications.ts
2333
+ var NotificationService = class {
2334
+ client;
2335
+ constructor(client) {
2336
+ this.client = client;
2337
+ this.getNotifications = this.getNotifications.bind(this);
2338
+ this.getUnreadCount = this.getUnreadCount.bind(this);
2339
+ this.markAsRead = this.markAsRead.bind(this);
2340
+ this.markAllAsRead = this.markAllAsRead.bind(this);
2341
+ this.sendBroadcast = this.sendBroadcast.bind(this);
2342
+ }
2343
+ async getNotifications(jwt, { page = 10, limit = 10, sort = "desc" }) {
2344
+ const response = await this.client.get({
2345
+ url: "/notifications",
2346
+ jwt,
2347
+ params: {
2348
+ page,
2349
+ limit,
2350
+ sort
2351
+ }
2352
+ });
2353
+ return response;
2354
+ }
2355
+ async getUnreadCount(jwt) {
2356
+ const response = await this.client.get({
2357
+ url: "/notifications/unread-count",
2358
+ jwt
2359
+ });
2360
+ return response;
2361
+ }
2362
+ async markAsRead(notificationId, jwt) {
2363
+ await this.client.patch({
2364
+ url: `/notifications/${notificationId}/read`,
2365
+ jwt
2366
+ });
2367
+ }
2368
+ async markAllAsRead(jwt) {
2369
+ await this.client.patch({
2370
+ url: "/notifications/read-all",
2371
+ jwt
2372
+ });
2373
+ }
2374
+ async sendBroadcast(data, jwt) {
2375
+ await this.client.post({
2376
+ url: "/notifications/broadcast",
2377
+ jwt,
2378
+ data
2379
+ });
2380
+ }
2381
+ };
2382
+
2332
2383
  // src/types/auth.ts
2333
2384
  var UserGender = /* @__PURE__ */ ((UserGender2) => {
2334
2385
  UserGender2["male"] = "male";
@@ -2454,6 +2505,7 @@ var VitalFit = class _VitalFit {
2454
2505
  wishList;
2455
2506
  policy;
2456
2507
  audit;
2508
+ notification;
2457
2509
  constructor(isDevMode, origin) {
2458
2510
  this.client = new Client(isDevMode, origin);
2459
2511
  this.auth = new AuthService(this.client);
@@ -2477,6 +2529,7 @@ var VitalFit = class _VitalFit {
2477
2529
  this.wishList = new WishListService(this.client);
2478
2530
  this.policy = new PolicyService(this.client);
2479
2531
  this.audit = new AuditService(this.client);
2532
+ this.notification = new NotificationService(this.client);
2480
2533
  }
2481
2534
  static getInstance(isDevMode = false) {
2482
2535
  if (!_VitalFit.instance) {
@@ -2485,7 +2538,7 @@ var VitalFit = class _VitalFit {
2485
2538
  return _VitalFit.instance;
2486
2539
  }
2487
2540
  version() {
2488
- return "0.3.4";
2541
+ return "0.3.7";
2489
2542
  }
2490
2543
  };
2491
2544
  // Annotate the CommonJS export names for ESM import in node: