@tryvital/vital-node 1.4.8 → 1.5.0
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/client/Testkits.ts +5 -1
- package/client/User.ts +13 -5
- package/client/models/user_models.ts +12 -0
- package/dist/client/Testkits.d.ts +1 -1
- package/dist/client/Testkits.js +13 -8
- package/dist/client/User.d.ts +2 -2
- package/dist/client/User.js +11 -6
- package/dist/client/models/user_models.d.ts +10 -0
- package/package.json +1 -1
package/client/Testkits.ts
CHANGED
@@ -28,7 +28,9 @@ export class TestkitsApi {
|
|
28
28
|
endDate: Date,
|
29
29
|
status?: string[],
|
30
30
|
userId?: string,
|
31
|
-
patientName?: string
|
31
|
+
patientName?: string,
|
32
|
+
page?: number,
|
33
|
+
size?: number
|
32
34
|
): Promise<OrderResponse> {
|
33
35
|
const resp = await this.client.get(
|
34
36
|
this.baseURL.concat('/testkit/orders/'),
|
@@ -39,6 +41,8 @@ export class TestkitsApi {
|
|
39
41
|
status: status ? status : null,
|
40
42
|
user_id: userId ? userId : null,
|
41
43
|
patient_name: patientName ? patientName : null,
|
44
|
+
...(page && { page }),
|
45
|
+
...(size && { size }),
|
42
46
|
},
|
43
47
|
}
|
44
48
|
);
|
package/client/User.ts
CHANGED
@@ -5,6 +5,8 @@ import {
|
|
5
5
|
ClientFacingUser,
|
6
6
|
Providers,
|
7
7
|
ProvidersResponse,
|
8
|
+
GetTeamUsersParams,
|
9
|
+
GetTeamUsersResponse,
|
8
10
|
} from './models/user_models';
|
9
11
|
|
10
12
|
export class UserApi {
|
@@ -29,8 +31,16 @@ export class UserApi {
|
|
29
31
|
return resp.data;
|
30
32
|
}
|
31
33
|
|
32
|
-
public async getAll(
|
33
|
-
|
34
|
+
public async getAll({
|
35
|
+
limit = 100,
|
36
|
+
offset = 0,
|
37
|
+
}: GetTeamUsersParams = {}): Promise<GetTeamUsersResponse> {
|
38
|
+
const url = new URL(this.baseURL.concat('/user/'));
|
39
|
+
|
40
|
+
url.searchParams.set('limit', String(limit));
|
41
|
+
url.searchParams.set('offset', String(offset));
|
42
|
+
|
43
|
+
const resp = await this.client.get(url.toString());
|
34
44
|
return resp.data;
|
35
45
|
}
|
36
46
|
|
@@ -63,9 +73,7 @@ export class UserApi {
|
|
63
73
|
return resp.data;
|
64
74
|
}
|
65
75
|
|
66
|
-
public async refresh(
|
67
|
-
userId: string,
|
68
|
-
): Promise<SuccessResponse> {
|
76
|
+
public async refresh(userId: string): Promise<SuccessResponse> {
|
69
77
|
const resp = await this.client.post(
|
70
78
|
this.baseURL.concat(`/user/refresh/${userId}`)
|
71
79
|
);
|
@@ -51,3 +51,15 @@ export enum Providers {
|
|
51
51
|
Zwift = 'zwift',
|
52
52
|
Hammerhead = 'hammerhead',
|
53
53
|
}
|
54
|
+
|
55
|
+
export interface GetTeamUsersParams {
|
56
|
+
limit?: number;
|
57
|
+
offset?: number;
|
58
|
+
}
|
59
|
+
|
60
|
+
export interface GetTeamUsersResponse {
|
61
|
+
users: Array<ClientFacingUser>;
|
62
|
+
offset: number;
|
63
|
+
limit: number;
|
64
|
+
total: number;
|
65
|
+
}
|
@@ -5,7 +5,7 @@ export declare class TestkitsApi {
|
|
5
5
|
client: AxiosInstance;
|
6
6
|
constructor(baseURL: string, axios: AxiosInstance);
|
7
7
|
get(): Promise<TestkitResponse>;
|
8
|
-
get_orders(startDate: Date, endDate: Date, status?: string[], userId?: string, patientName?: string): Promise<OrderResponse>;
|
8
|
+
get_orders(startDate: Date, endDate: Date, status?: string[], userId?: string, patientName?: string, page?: number, size?: number): Promise<OrderResponse>;
|
9
9
|
order(userId: string, testkitId: string, patientAddress: PatientAdress, patientDetails: PatientDetails): Promise<OrderRequestResponse>;
|
10
10
|
get_order(orderId: string): Promise<Order>;
|
11
11
|
cancel_order(orderId: string): Promise<OrderRequestResponse>;
|
package/dist/client/Testkits.js
CHANGED
@@ -1,4 +1,15 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -55,19 +66,13 @@ var TestkitsApi = /** @class */ (function () {
|
|
55
66
|
});
|
56
67
|
});
|
57
68
|
};
|
58
|
-
TestkitsApi.prototype.get_orders = function (startDate, endDate, status, userId, patientName) {
|
69
|
+
TestkitsApi.prototype.get_orders = function (startDate, endDate, status, userId, patientName, page, size) {
|
59
70
|
return __awaiter(this, void 0, void 0, function () {
|
60
71
|
var resp;
|
61
72
|
return __generator(this, function (_a) {
|
62
73
|
switch (_a.label) {
|
63
74
|
case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat('/testkit/orders/'), {
|
64
|
-
params: {
|
65
|
-
start_date: startDate,
|
66
|
-
end_date: endDate,
|
67
|
-
status: status ? status : null,
|
68
|
-
user_id: userId ? userId : null,
|
69
|
-
patient_name: patientName ? patientName : null,
|
70
|
-
},
|
75
|
+
params: __assign(__assign({ start_date: startDate, end_date: endDate, status: status ? status : null, user_id: userId ? userId : null, patient_name: patientName ? patientName : null }, (page && { page: page })), (size && { size: size })),
|
71
76
|
})];
|
72
77
|
case 1:
|
73
78
|
resp = _a.sent();
|
package/dist/client/User.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
2
|
-
import { UserIdResponse, SuccessResponse, ClientFacingUser, Providers, ProvidersResponse } from './models/user_models';
|
2
|
+
import { UserIdResponse, SuccessResponse, ClientFacingUser, Providers, ProvidersResponse, GetTeamUsersParams, GetTeamUsersResponse } from './models/user_models';
|
3
3
|
export declare class UserApi {
|
4
4
|
baseURL: string;
|
5
5
|
client: AxiosInstance;
|
6
6
|
constructor(baseURL: string, axios: AxiosInstance);
|
7
7
|
create(clientUserId: string): Promise<UserIdResponse>;
|
8
8
|
delete(userId: string): Promise<SuccessResponse>;
|
9
|
-
getAll(): Promise<
|
9
|
+
getAll({ limit, offset, }?: GetTeamUsersParams): Promise<GetTeamUsersResponse>;
|
10
10
|
get(userId: string): Promise<ClientFacingUser>;
|
11
11
|
resolve(clientUserId: string): Promise<ClientFacingUser>;
|
12
12
|
providers(userId: string): Promise<ProvidersResponse>;
|
package/dist/client/User.js
CHANGED
@@ -70,14 +70,19 @@ var UserApi = /** @class */ (function () {
|
|
70
70
|
});
|
71
71
|
});
|
72
72
|
};
|
73
|
-
UserApi.prototype.getAll = function () {
|
73
|
+
UserApi.prototype.getAll = function (_a) {
|
74
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.limit, limit = _c === void 0 ? 100 : _c, _d = _b.offset, offset = _d === void 0 ? 0 : _d;
|
74
75
|
return __awaiter(this, void 0, void 0, function () {
|
75
|
-
var resp;
|
76
|
-
return __generator(this, function (
|
77
|
-
switch (
|
78
|
-
case 0:
|
76
|
+
var url, resp;
|
77
|
+
return __generator(this, function (_e) {
|
78
|
+
switch (_e.label) {
|
79
|
+
case 0:
|
80
|
+
url = new URL(this.baseURL.concat('/user/'));
|
81
|
+
url.searchParams.set('limit', String(limit));
|
82
|
+
url.searchParams.set('offset', String(offset));
|
83
|
+
return [4 /*yield*/, this.client.get(url.toString())];
|
79
84
|
case 1:
|
80
|
-
resp =
|
85
|
+
resp = _e.sent();
|
81
86
|
return [2 /*return*/, resp.data];
|
82
87
|
}
|
83
88
|
});
|
@@ -44,3 +44,13 @@ export declare enum Providers {
|
|
44
44
|
Zwift = "zwift",
|
45
45
|
Hammerhead = "hammerhead"
|
46
46
|
}
|
47
|
+
export interface GetTeamUsersParams {
|
48
|
+
limit?: number;
|
49
|
+
offset?: number;
|
50
|
+
}
|
51
|
+
export interface GetTeamUsersResponse {
|
52
|
+
users: Array<ClientFacingUser>;
|
53
|
+
offset: number;
|
54
|
+
limit: number;
|
55
|
+
total: number;
|
56
|
+
}
|