@vitalfit/sdk 0.3.4 → 0.3.6
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 +49 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +49 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2329,6 +2329,52 @@ 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) {
|
|
2344
|
+
const response = await this.client.get({
|
|
2345
|
+
url: "/notifications",
|
|
2346
|
+
jwt
|
|
2347
|
+
});
|
|
2348
|
+
return response;
|
|
2349
|
+
}
|
|
2350
|
+
async getUnreadCount(jwt) {
|
|
2351
|
+
const response = await this.client.get({
|
|
2352
|
+
url: "/notifications/unread-count",
|
|
2353
|
+
jwt
|
|
2354
|
+
});
|
|
2355
|
+
return response;
|
|
2356
|
+
}
|
|
2357
|
+
async markAsRead(notificationId, jwt) {
|
|
2358
|
+
await this.client.patch({
|
|
2359
|
+
url: `/notifications/${notificationId}/read`,
|
|
2360
|
+
jwt
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
async markAllAsRead(jwt) {
|
|
2364
|
+
await this.client.patch({
|
|
2365
|
+
url: "/notifications/read-all",
|
|
2366
|
+
jwt
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
async sendBroadcast(data, jwt) {
|
|
2370
|
+
await this.client.post({
|
|
2371
|
+
url: "/notifications/broadcast",
|
|
2372
|
+
jwt,
|
|
2373
|
+
data
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
|
|
2332
2378
|
// src/types/auth.ts
|
|
2333
2379
|
var UserGender = /* @__PURE__ */ ((UserGender2) => {
|
|
2334
2380
|
UserGender2["male"] = "male";
|
|
@@ -2454,6 +2500,7 @@ var VitalFit = class _VitalFit {
|
|
|
2454
2500
|
wishList;
|
|
2455
2501
|
policy;
|
|
2456
2502
|
audit;
|
|
2503
|
+
notification;
|
|
2457
2504
|
constructor(isDevMode, origin) {
|
|
2458
2505
|
this.client = new Client(isDevMode, origin);
|
|
2459
2506
|
this.auth = new AuthService(this.client);
|
|
@@ -2477,6 +2524,7 @@ var VitalFit = class _VitalFit {
|
|
|
2477
2524
|
this.wishList = new WishListService(this.client);
|
|
2478
2525
|
this.policy = new PolicyService(this.client);
|
|
2479
2526
|
this.audit = new AuditService(this.client);
|
|
2527
|
+
this.notification = new NotificationService(this.client);
|
|
2480
2528
|
}
|
|
2481
2529
|
static getInstance(isDevMode = false) {
|
|
2482
2530
|
if (!_VitalFit.instance) {
|
|
@@ -2485,7 +2533,7 @@ var VitalFit = class _VitalFit {
|
|
|
2485
2533
|
return _VitalFit.instance;
|
|
2486
2534
|
}
|
|
2487
2535
|
version() {
|
|
2488
|
-
return "0.3.
|
|
2536
|
+
return "0.3.6";
|
|
2489
2537
|
}
|
|
2490
2538
|
};
|
|
2491
2539
|
// Annotate the CommonJS export names for ESM import in node:
|