@vitalfit/sdk 0.0.70 → 0.0.72
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/LICENSE +21 -21
- package/README.md +25 -25
- package/dist/index.cjs +121 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -3
- package/dist/index.d.ts +96 -3
- package/dist/index.js +121 -1
- package/dist/index.js.map +1 -1
- package/package.json +53 -53
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 VitalFit
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 VitalFit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# VitalFit API's SDK
|
|
2
|
-
|
|
3
|
-
## The VitalFit SDK provides a set of services to interact with the VitalFit API. It includes support for authentication, managing entities like branches, services, equipments, etc. . .
|
|
4
|
-
|
|
5
|
-
## Using the SDK
|
|
6
|
-
|
|
7
|
-
### Installation
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
npm install @vitalFit/sdk@latest
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### `VitalFit` Class
|
|
14
|
-
|
|
15
|
-
The `VitalFit` class is the main entry point for interacting with the SDK. It provides access to various services for managing entities.
|
|
16
|
-
|
|
17
|
-
#### Singleton Pattern
|
|
18
|
-
|
|
19
|
-
The `VitalFit` class uses the Singleton pattern. Use the `getInstance` method to get the single instance of the class.
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
import { VitalFit } from '@vitalFit/sdk';
|
|
23
|
-
|
|
24
|
-
const VitalFit = VitalFit.getInstance(true); // Pass `true` for development mode
|
|
25
|
-
```
|
|
1
|
+
# VitalFit API's SDK
|
|
2
|
+
|
|
3
|
+
## The VitalFit SDK provides a set of services to interact with the VitalFit API. It includes support for authentication, managing entities like branches, services, equipments, etc. . .
|
|
4
|
+
|
|
5
|
+
## Using the SDK
|
|
6
|
+
|
|
7
|
+
### Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @vitalFit/sdk@latest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### `VitalFit` Class
|
|
14
|
+
|
|
15
|
+
The `VitalFit` class is the main entry point for interacting with the SDK. It provides access to various services for managing entities.
|
|
16
|
+
|
|
17
|
+
#### Singleton Pattern
|
|
18
|
+
|
|
19
|
+
The `VitalFit` class uses the Singleton pattern. Use the `getInstance` method to get the single instance of the class.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { VitalFit } from '@vitalFit/sdk';
|
|
23
|
+
|
|
24
|
+
const VitalFit = VitalFit.getInstance(true); // Pass `true` for development mode
|
|
25
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -164,6 +164,7 @@ var AuthService = class {
|
|
|
164
164
|
this.validateResetToken = this.validateResetToken.bind(this);
|
|
165
165
|
this.verifyEmail = this.verifyEmail.bind(this);
|
|
166
166
|
this.verifyStaff = this.verifyStaff.bind(this);
|
|
167
|
+
this.oAuthLogin = this.oAuthLogin.bind(this);
|
|
167
168
|
this.logout = this.logout.bind(this);
|
|
168
169
|
this.saveJWT = this.saveJWT.bind(this);
|
|
169
170
|
}
|
|
@@ -248,6 +249,13 @@ var AuthService = class {
|
|
|
248
249
|
}
|
|
249
250
|
});
|
|
250
251
|
}
|
|
252
|
+
async oAuthLogin(data) {
|
|
253
|
+
const response = await this.client.post({
|
|
254
|
+
url: "/auth/oauth-login",
|
|
255
|
+
data
|
|
256
|
+
});
|
|
257
|
+
return response;
|
|
258
|
+
}
|
|
251
259
|
};
|
|
252
260
|
|
|
253
261
|
// src/services/user.ts
|
|
@@ -260,6 +268,7 @@ var UserService = class {
|
|
|
260
268
|
this.getClientUsers = this.getClientUsers.bind(this);
|
|
261
269
|
this.getStaffUsers = this.getStaffUsers.bind(this);
|
|
262
270
|
this.getUserByEmail = this.getUserByEmail.bind(this);
|
|
271
|
+
this.QrToken = this.QrToken.bind(this);
|
|
263
272
|
this.GetUserByID = this.GetUserByID.bind(this);
|
|
264
273
|
this.updateUserClient = this.updateUserClient.bind(this);
|
|
265
274
|
this.updateUserStaff = this.updateUserStaff.bind(this);
|
|
@@ -335,6 +344,13 @@ var UserService = class {
|
|
|
335
344
|
});
|
|
336
345
|
return response;
|
|
337
346
|
}
|
|
347
|
+
async QrToken(jwt) {
|
|
348
|
+
const response = await this.client.get({
|
|
349
|
+
url: `/user/qr-token`,
|
|
350
|
+
jwt
|
|
351
|
+
});
|
|
352
|
+
return response;
|
|
353
|
+
}
|
|
338
354
|
};
|
|
339
355
|
|
|
340
356
|
// src/services/branch.ts
|
|
@@ -731,6 +747,9 @@ var MembershipService = class {
|
|
|
731
747
|
this.updateMembershipType = this.updateMembershipType.bind(this);
|
|
732
748
|
this.deleteMembershipType = this.deleteMembershipType.bind(this);
|
|
733
749
|
this.publicGetMemberships = this.publicGetMemberships.bind(this);
|
|
750
|
+
this.getClientMemberships = this.getClientMemberships.bind(this);
|
|
751
|
+
this.getClientMembershipByID = this.getClientMembershipByID.bind(this);
|
|
752
|
+
this.updateClientMembership = this.updateClientMembership.bind(this);
|
|
734
753
|
}
|
|
735
754
|
async createMembershipType(data, jwt) {
|
|
736
755
|
await this.client.post({
|
|
@@ -793,6 +812,33 @@ var MembershipService = class {
|
|
|
793
812
|
});
|
|
794
813
|
return response;
|
|
795
814
|
}
|
|
815
|
+
async getClientMemberships(jwt, { page = 10, limit = 10, sort = "desc", search }) {
|
|
816
|
+
const response = await this.client.get({
|
|
817
|
+
url: "/client-memberships",
|
|
818
|
+
jwt,
|
|
819
|
+
params: {
|
|
820
|
+
page,
|
|
821
|
+
limit,
|
|
822
|
+
sort,
|
|
823
|
+
search
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
return response;
|
|
827
|
+
}
|
|
828
|
+
async getClientMembershipByID(membershipId, jwt) {
|
|
829
|
+
const response = await this.client.get({
|
|
830
|
+
url: `/client-memberships/${membershipId}`,
|
|
831
|
+
jwt
|
|
832
|
+
});
|
|
833
|
+
return response;
|
|
834
|
+
}
|
|
835
|
+
async updateClientMembership(membershipId, data, jwt) {
|
|
836
|
+
await this.client.put({
|
|
837
|
+
url: `/client-memberships/${membershipId}`,
|
|
838
|
+
jwt,
|
|
839
|
+
data
|
|
840
|
+
});
|
|
841
|
+
}
|
|
796
842
|
};
|
|
797
843
|
|
|
798
844
|
// src/services/public.ts
|
|
@@ -1205,6 +1251,7 @@ var BillingService = class {
|
|
|
1205
1251
|
this.getInvoiceByID = this.getInvoiceByID.bind(this);
|
|
1206
1252
|
this.getPaymentByID = this.getPaymentByID.bind(this);
|
|
1207
1253
|
this.updatePaymentStatus = this.updatePaymentStatus.bind(this);
|
|
1254
|
+
this.getClientInvoices = this.getClientInvoices.bind(this);
|
|
1208
1255
|
}
|
|
1209
1256
|
async createInvoice(data, jwt) {
|
|
1210
1257
|
const response = await this.client.post({
|
|
@@ -1245,6 +1292,75 @@ var BillingService = class {
|
|
|
1245
1292
|
}
|
|
1246
1293
|
});
|
|
1247
1294
|
}
|
|
1295
|
+
async getClientInvoices(jwt, { page = 1, limit = 10, sort = "desc", search }, userID) {
|
|
1296
|
+
const response = await this.client.get({
|
|
1297
|
+
url: `/billing/invoices/client/${userID}`,
|
|
1298
|
+
jwt,
|
|
1299
|
+
params: {
|
|
1300
|
+
page,
|
|
1301
|
+
limit,
|
|
1302
|
+
sort,
|
|
1303
|
+
search
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
return response;
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1310
|
+
// src/services/booking.ts
|
|
1311
|
+
var BookingService = class {
|
|
1312
|
+
client;
|
|
1313
|
+
constructor(client) {
|
|
1314
|
+
this.client = client;
|
|
1315
|
+
this.bookClass = this.bookClass.bind(this);
|
|
1316
|
+
this.cancelBooking = this.cancelBooking.bind(this);
|
|
1317
|
+
this.getClientBooking = this.getClientBooking.bind(this);
|
|
1318
|
+
this.getClientBranchBooking = this.getClientBranchBooking.bind(this);
|
|
1319
|
+
}
|
|
1320
|
+
async bookClass(data, classID, jwt) {
|
|
1321
|
+
await this.client.post({
|
|
1322
|
+
url: `/bookings/${classID}/book`,
|
|
1323
|
+
jwt,
|
|
1324
|
+
data
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
async cancelBooking(bookingId, jwt) {
|
|
1328
|
+
await this.client.delete({
|
|
1329
|
+
url: `/booking/${bookingId}/cancel`,
|
|
1330
|
+
jwt
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
async getClientBooking(userID, jwt) {
|
|
1334
|
+
const response = await this.client.get({
|
|
1335
|
+
url: `/bookings/client/${userID}`,
|
|
1336
|
+
jwt
|
|
1337
|
+
});
|
|
1338
|
+
return response;
|
|
1339
|
+
}
|
|
1340
|
+
async getClientBranchBooking(branchID, userID, jwt) {
|
|
1341
|
+
const response = await this.client.get({
|
|
1342
|
+
url: `/schedule/branch/${branchID}/client/${userID}`,
|
|
1343
|
+
jwt
|
|
1344
|
+
});
|
|
1345
|
+
return response;
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
|
|
1349
|
+
// src/services/access.ts
|
|
1350
|
+
var AccessService = class {
|
|
1351
|
+
client;
|
|
1352
|
+
constructor(client) {
|
|
1353
|
+
this.client = client;
|
|
1354
|
+
this.checkIn = this.checkIn.bind(this);
|
|
1355
|
+
}
|
|
1356
|
+
async checkIn(jwt, data) {
|
|
1357
|
+
const response = await this.client.post({
|
|
1358
|
+
url: "/access/check-in",
|
|
1359
|
+
jwt,
|
|
1360
|
+
data
|
|
1361
|
+
});
|
|
1362
|
+
return response;
|
|
1363
|
+
}
|
|
1248
1364
|
};
|
|
1249
1365
|
|
|
1250
1366
|
// src/types/auth.ts
|
|
@@ -1365,6 +1481,8 @@ var VitalFit = class _VitalFit {
|
|
|
1365
1481
|
schedule;
|
|
1366
1482
|
packages;
|
|
1367
1483
|
billing;
|
|
1484
|
+
booking;
|
|
1485
|
+
access;
|
|
1368
1486
|
constructor(isDevMode, origin) {
|
|
1369
1487
|
this.client = new Client(isDevMode, origin);
|
|
1370
1488
|
this.auth = new AuthService(this.client);
|
|
@@ -1381,6 +1499,8 @@ var VitalFit = class _VitalFit {
|
|
|
1381
1499
|
this.schedule = new ScheduleService(this.client);
|
|
1382
1500
|
this.packages = new PackagesService(this.client);
|
|
1383
1501
|
this.billing = new BillingService(this.client);
|
|
1502
|
+
this.booking = new BookingService(this.client);
|
|
1503
|
+
this.access = new AccessService(this.client);
|
|
1384
1504
|
}
|
|
1385
1505
|
static getInstance(isDevMode = false) {
|
|
1386
1506
|
if (!_VitalFit.instance) {
|
|
@@ -1389,7 +1509,7 @@ var VitalFit = class _VitalFit {
|
|
|
1389
1509
|
return _VitalFit.instance;
|
|
1390
1510
|
}
|
|
1391
1511
|
version() {
|
|
1392
|
-
return "0.0.
|
|
1512
|
+
return "0.0.72";
|
|
1393
1513
|
}
|
|
1394
1514
|
};
|
|
1395
1515
|
// Annotate the CommonJS export names for ESM import in node:
|