@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 +54 -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 +54 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -951,19 +951,23 @@ type CheckInResponse = {
|
|
|
951
951
|
message: string;
|
|
952
952
|
service_name: string;
|
|
953
953
|
};
|
|
954
|
-
type
|
|
954
|
+
type ServiceUsage = {
|
|
955
955
|
attendance_id: string;
|
|
956
|
-
user_id: string;
|
|
957
|
-
user_name: string;
|
|
958
956
|
service_id: string;
|
|
959
957
|
service_name: string;
|
|
958
|
+
branch_id?: string;
|
|
959
|
+
branch_name?: string;
|
|
960
960
|
check_in_time: string;
|
|
961
961
|
status: string;
|
|
962
962
|
};
|
|
963
|
-
type
|
|
963
|
+
type AttendanceHistory = {
|
|
964
964
|
attendance_id: string;
|
|
965
|
+
user_id: string;
|
|
966
|
+
user_name: string;
|
|
965
967
|
service_id: string;
|
|
966
968
|
service_name: string;
|
|
969
|
+
class_name?: string;
|
|
970
|
+
class_time?: string;
|
|
967
971
|
check_in_time: string;
|
|
968
972
|
status: string;
|
|
969
973
|
};
|
|
@@ -1446,6 +1450,16 @@ declare class AuditService {
|
|
|
1446
1450
|
getUserLogs(jwt: string, userId: string, { page, limit, sort, search }: PaginationRequest): Promise<PaginatedTotal<AuditLog[]>>;
|
|
1447
1451
|
}
|
|
1448
1452
|
|
|
1453
|
+
declare class NotificationService {
|
|
1454
|
+
private client;
|
|
1455
|
+
constructor(client: Client);
|
|
1456
|
+
getNotifications(jwt: string, { page, limit, sort }: PaginationRequest): Promise<DataResponse<NotificationResponse[]>>;
|
|
1457
|
+
getUnreadCount(jwt: string): Promise<UnreadCountResponse>;
|
|
1458
|
+
markAsRead(notificationId: string, jwt: string): Promise<void>;
|
|
1459
|
+
markAllAsRead(jwt: string): Promise<void>;
|
|
1460
|
+
sendBroadcast(data: BroadcastRequest, jwt: string): Promise<void>;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1449
1463
|
declare class APIError extends Error {
|
|
1450
1464
|
status: number;
|
|
1451
1465
|
messages: string[];
|
|
@@ -1477,6 +1491,7 @@ declare class VitalFit {
|
|
|
1477
1491
|
wishList: WishListService;
|
|
1478
1492
|
policy: PolicyService;
|
|
1479
1493
|
audit: AuditService;
|
|
1494
|
+
notification: NotificationService;
|
|
1480
1495
|
constructor(isDevMode: boolean, origin?: string);
|
|
1481
1496
|
static getInstance(isDevMode?: boolean): VitalFit;
|
|
1482
1497
|
version(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -951,19 +951,23 @@ type CheckInResponse = {
|
|
|
951
951
|
message: string;
|
|
952
952
|
service_name: string;
|
|
953
953
|
};
|
|
954
|
-
type
|
|
954
|
+
type ServiceUsage = {
|
|
955
955
|
attendance_id: string;
|
|
956
|
-
user_id: string;
|
|
957
|
-
user_name: string;
|
|
958
956
|
service_id: string;
|
|
959
957
|
service_name: string;
|
|
958
|
+
branch_id?: string;
|
|
959
|
+
branch_name?: string;
|
|
960
960
|
check_in_time: string;
|
|
961
961
|
status: string;
|
|
962
962
|
};
|
|
963
|
-
type
|
|
963
|
+
type AttendanceHistory = {
|
|
964
964
|
attendance_id: string;
|
|
965
|
+
user_id: string;
|
|
966
|
+
user_name: string;
|
|
965
967
|
service_id: string;
|
|
966
968
|
service_name: string;
|
|
969
|
+
class_name?: string;
|
|
970
|
+
class_time?: string;
|
|
967
971
|
check_in_time: string;
|
|
968
972
|
status: string;
|
|
969
973
|
};
|
|
@@ -1446,6 +1450,16 @@ declare class AuditService {
|
|
|
1446
1450
|
getUserLogs(jwt: string, userId: string, { page, limit, sort, search }: PaginationRequest): Promise<PaginatedTotal<AuditLog[]>>;
|
|
1447
1451
|
}
|
|
1448
1452
|
|
|
1453
|
+
declare class NotificationService {
|
|
1454
|
+
private client;
|
|
1455
|
+
constructor(client: Client);
|
|
1456
|
+
getNotifications(jwt: string, { page, limit, sort }: PaginationRequest): Promise<DataResponse<NotificationResponse[]>>;
|
|
1457
|
+
getUnreadCount(jwt: string): Promise<UnreadCountResponse>;
|
|
1458
|
+
markAsRead(notificationId: string, jwt: string): Promise<void>;
|
|
1459
|
+
markAllAsRead(jwt: string): Promise<void>;
|
|
1460
|
+
sendBroadcast(data: BroadcastRequest, jwt: string): Promise<void>;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1449
1463
|
declare class APIError extends Error {
|
|
1450
1464
|
status: number;
|
|
1451
1465
|
messages: string[];
|
|
@@ -1477,6 +1491,7 @@ declare class VitalFit {
|
|
|
1477
1491
|
wishList: WishListService;
|
|
1478
1492
|
policy: PolicyService;
|
|
1479
1493
|
audit: AuditService;
|
|
1494
|
+
notification: NotificationService;
|
|
1480
1495
|
constructor(isDevMode: boolean, origin?: string);
|
|
1481
1496
|
static getInstance(isDevMode?: boolean): VitalFit;
|
|
1482
1497
|
version(): string;
|
package/dist/index.js
CHANGED
|
@@ -2289,6 +2289,57 @@ var AuditService = class {
|
|
|
2289
2289
|
}
|
|
2290
2290
|
};
|
|
2291
2291
|
|
|
2292
|
+
// src/services/notifications.ts
|
|
2293
|
+
var NotificationService = class {
|
|
2294
|
+
client;
|
|
2295
|
+
constructor(client) {
|
|
2296
|
+
this.client = client;
|
|
2297
|
+
this.getNotifications = this.getNotifications.bind(this);
|
|
2298
|
+
this.getUnreadCount = this.getUnreadCount.bind(this);
|
|
2299
|
+
this.markAsRead = this.markAsRead.bind(this);
|
|
2300
|
+
this.markAllAsRead = this.markAllAsRead.bind(this);
|
|
2301
|
+
this.sendBroadcast = this.sendBroadcast.bind(this);
|
|
2302
|
+
}
|
|
2303
|
+
async getNotifications(jwt, { page = 10, limit = 10, sort = "desc" }) {
|
|
2304
|
+
const response = await this.client.get({
|
|
2305
|
+
url: "/notifications",
|
|
2306
|
+
jwt,
|
|
2307
|
+
params: {
|
|
2308
|
+
page,
|
|
2309
|
+
limit,
|
|
2310
|
+
sort
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
return response;
|
|
2314
|
+
}
|
|
2315
|
+
async getUnreadCount(jwt) {
|
|
2316
|
+
const response = await this.client.get({
|
|
2317
|
+
url: "/notifications/unread-count",
|
|
2318
|
+
jwt
|
|
2319
|
+
});
|
|
2320
|
+
return response;
|
|
2321
|
+
}
|
|
2322
|
+
async markAsRead(notificationId, jwt) {
|
|
2323
|
+
await this.client.patch({
|
|
2324
|
+
url: `/notifications/${notificationId}/read`,
|
|
2325
|
+
jwt
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
async markAllAsRead(jwt) {
|
|
2329
|
+
await this.client.patch({
|
|
2330
|
+
url: "/notifications/read-all",
|
|
2331
|
+
jwt
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
async sendBroadcast(data, jwt) {
|
|
2335
|
+
await this.client.post({
|
|
2336
|
+
url: "/notifications/broadcast",
|
|
2337
|
+
jwt,
|
|
2338
|
+
data
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
};
|
|
2342
|
+
|
|
2292
2343
|
// src/types/auth.ts
|
|
2293
2344
|
var UserGender = /* @__PURE__ */ ((UserGender2) => {
|
|
2294
2345
|
UserGender2["male"] = "male";
|
|
@@ -2414,6 +2465,7 @@ var VitalFit = class _VitalFit {
|
|
|
2414
2465
|
wishList;
|
|
2415
2466
|
policy;
|
|
2416
2467
|
audit;
|
|
2468
|
+
notification;
|
|
2417
2469
|
constructor(isDevMode, origin) {
|
|
2418
2470
|
this.client = new Client(isDevMode, origin);
|
|
2419
2471
|
this.auth = new AuthService(this.client);
|
|
@@ -2437,6 +2489,7 @@ var VitalFit = class _VitalFit {
|
|
|
2437
2489
|
this.wishList = new WishListService(this.client);
|
|
2438
2490
|
this.policy = new PolicyService(this.client);
|
|
2439
2491
|
this.audit = new AuditService(this.client);
|
|
2492
|
+
this.notification = new NotificationService(this.client);
|
|
2440
2493
|
}
|
|
2441
2494
|
static getInstance(isDevMode = false) {
|
|
2442
2495
|
if (!_VitalFit.instance) {
|
|
@@ -2445,7 +2498,7 @@ var VitalFit = class _VitalFit {
|
|
|
2445
2498
|
return _VitalFit.instance;
|
|
2446
2499
|
}
|
|
2447
2500
|
version() {
|
|
2448
|
-
return "0.3.
|
|
2501
|
+
return "0.3.7";
|
|
2449
2502
|
}
|
|
2450
2503
|
};
|
|
2451
2504
|
export {
|