@tryvital/vital-node 2.1.4 → 2.1.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/client/LabTests.ts +91 -101
- package/client/Sleep.ts +1 -1
- package/client/models/lab_tests_model.ts +2 -1
- package/client/models/sleep_models.ts +1 -1
- package/dist/client/LabTests.js +8 -10
- package/dist/client/Sleep.js +1 -1
- package/dist/client/models/lab_tests_model.d.ts +2 -1
- package/dist/client/models/sleep_models.d.ts +1 -1
- package/package.json +1 -1
package/client/LabTests.ts
CHANGED
@@ -1,118 +1,108 @@
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
2
2
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
ClientFacingLabTest,
|
4
|
+
LabResultsMetadata,
|
5
|
+
LabResultsResponse,
|
6
|
+
Order,
|
7
|
+
OrderRequestResponse,
|
8
|
+
PatientAdress,
|
9
|
+
PatientDetails,
|
10
|
+
Physician,
|
11
11
|
} from './models/lab_tests_model';
|
12
12
|
|
13
|
-
|
14
|
-
|
15
13
|
export class OrdersApi {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
baseURL: string;
|
15
|
+
client: AxiosInstance;
|
16
|
+
constructor(baseURL: string, axios: AxiosInstance) {
|
17
|
+
this.baseURL = baseURL;
|
18
|
+
this.client = axios;
|
19
|
+
}
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
},
|
41
|
-
}
|
42
|
-
);
|
43
|
-
return resp.data;
|
44
|
-
}
|
21
|
+
// Create new order
|
22
|
+
public async create_order(
|
23
|
+
user_id: string,
|
24
|
+
patient_details: PatientDetails,
|
25
|
+
patient_address: PatientAdress,
|
26
|
+
lab_test_id: string,
|
27
|
+
physician?: Physician
|
28
|
+
): Promise<OrderRequestResponse> {
|
29
|
+
const resp = await this.client.post(this.baseURL.concat('/order'), {
|
30
|
+
user_id: user_id,
|
31
|
+
patient_details: patient_details,
|
32
|
+
patient_address: patient_address,
|
33
|
+
lab_test_id: lab_test_id,
|
34
|
+
physician: physician ? physician : null,
|
35
|
+
});
|
36
|
+
return resp.data;
|
37
|
+
}
|
45
38
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
39
|
+
// Get order status.
|
40
|
+
public async getOrder(orderId: string): Promise<Order> {
|
41
|
+
const resp = await this.client.get(
|
42
|
+
this.baseURL.concat(`/order/${orderId}`)
|
43
|
+
);
|
44
|
+
return resp.data;
|
45
|
+
}
|
53
46
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
47
|
+
// Cancels order.
|
48
|
+
public async cancelOrder(orderId: string): Promise<OrderRequestResponse> {
|
49
|
+
const resp = await this.client.post(
|
50
|
+
this.baseURL.concat(`/order/${orderId}/cancel`)
|
51
|
+
);
|
52
|
+
return resp.data;
|
53
|
+
}
|
61
54
|
}
|
62
55
|
|
63
56
|
export class ResultsApi {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
57
|
+
baseURL: string;
|
58
|
+
client: AxiosInstance;
|
59
|
+
constructor(baseURL: string, axios: AxiosInstance) {
|
60
|
+
this.baseURL = baseURL;
|
61
|
+
this.client = axios;
|
62
|
+
}
|
63
|
+
// GET both metadata and raw json test data.
|
64
|
+
public async getResults(orderId: string): Promise<LabResultsResponse> {
|
65
|
+
const resp = await this.client.get(
|
66
|
+
this.baseURL.concat(`/order/${orderId}/result`)
|
67
|
+
);
|
68
|
+
return resp.data;
|
69
|
+
}
|
77
70
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
71
|
+
// GET gets the lab result for the order in PDF format.
|
72
|
+
// TODO Check response type for PDF
|
73
|
+
public async getResultsPdf(orderId: string): Promise<string> {
|
74
|
+
const resp = await this.client.get(
|
75
|
+
this.baseURL.concat(`/order/${orderId}/result/pdf`)
|
76
|
+
);
|
77
|
+
return resp.data;
|
78
|
+
}
|
86
79
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
80
|
+
// GET metadata related to order results, such as
|
81
|
+
// lab metadata, provider and sample dates.
|
82
|
+
public async getResultsMetadata(
|
83
|
+
orderId: string
|
84
|
+
): Promise<LabResultsMetadata> {
|
85
|
+
const resp = await this.client.get(
|
86
|
+
this.baseURL.concat(`/order/${orderId}/result/metadata`)
|
87
|
+
);
|
88
|
+
return resp.data;
|
89
|
+
}
|
95
90
|
}
|
96
91
|
|
97
|
-
|
98
|
-
|
99
92
|
export class LabTestsApi {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
constructor(baseURL: string, axios: AxiosInstance) {
|
106
|
-
this.baseURL = baseURL;
|
107
|
-
this.client = axios;
|
108
|
-
this.Orders = new OrdersApi(baseURL, axios)
|
109
|
-
this.Results = new ResultsApi(baseURL, axios)
|
93
|
+
baseURL: string;
|
94
|
+
client: AxiosInstance;
|
95
|
+
Orders: OrdersApi;
|
96
|
+
Results: ResultsApi;
|
110
97
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
98
|
+
constructor(baseURL: string, axios: AxiosInstance) {
|
99
|
+
this.baseURL = baseURL;
|
100
|
+
this.client = axios;
|
101
|
+
this.Orders = new OrdersApi(baseURL, axios);
|
102
|
+
this.Results = new ResultsApi(baseURL, axios);
|
103
|
+
}
|
104
|
+
public async getTests(): Promise<ClientFacingLabTest> {
|
105
|
+
const resp = await this.client.get(this.baseURL.concat(`/lab_tests`));
|
106
|
+
return resp.data;
|
107
|
+
}
|
108
|
+
}
|
package/client/Sleep.ts
CHANGED
@@ -52,7 +52,7 @@ export class SleepApi {
|
|
52
52
|
let response = resp.data as ClientSleepResponse;
|
53
53
|
for (let i = 0; i < response.sleep.length; i++) {
|
54
54
|
const stream = await this.getStream(response.sleep[i].id);
|
55
|
-
response.sleep[i].sleep_stream =
|
55
|
+
response.sleep[i].sleep_stream = stream;
|
56
56
|
}
|
57
57
|
|
58
58
|
return resp.data;
|
package/dist/client/LabTests.js
CHANGED
@@ -42,20 +42,18 @@ var OrdersApi = /** @class */ (function () {
|
|
42
42
|
this.baseURL = baseURL;
|
43
43
|
this.client = axios;
|
44
44
|
}
|
45
|
-
// Create new order
|
45
|
+
// Create new order
|
46
46
|
OrdersApi.prototype.create_order = function (user_id, patient_details, patient_address, lab_test_id, physician) {
|
47
47
|
return __awaiter(this, void 0, void 0, function () {
|
48
48
|
var resp;
|
49
49
|
return __generator(this, function (_a) {
|
50
50
|
switch (_a.label) {
|
51
51
|
case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat('/order'), {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
physician: physician ? physician : null
|
58
|
-
},
|
52
|
+
user_id: user_id,
|
53
|
+
patient_details: patient_details,
|
54
|
+
patient_address: patient_address,
|
55
|
+
lab_test_id: lab_test_id,
|
56
|
+
physician: physician ? physician : null,
|
59
57
|
})];
|
60
58
|
case 1:
|
61
59
|
resp = _a.sent();
|
@@ -114,7 +112,7 @@ var ResultsApi = /** @class */ (function () {
|
|
114
112
|
});
|
115
113
|
});
|
116
114
|
};
|
117
|
-
// GET gets the lab result for the order in PDF format.
|
115
|
+
// GET gets the lab result for the order in PDF format.
|
118
116
|
// TODO Check response type for PDF
|
119
117
|
ResultsApi.prototype.getResultsPdf = function (orderId) {
|
120
118
|
return __awaiter(this, void 0, void 0, function () {
|
@@ -129,7 +127,7 @@ var ResultsApi = /** @class */ (function () {
|
|
129
127
|
});
|
130
128
|
});
|
131
129
|
};
|
132
|
-
// GET metadata related to order results, such as
|
130
|
+
// GET metadata related to order results, such as
|
133
131
|
// lab metadata, provider and sample dates.
|
134
132
|
ResultsApi.prototype.getResultsMetadata = function (orderId) {
|
135
133
|
return __awaiter(this, void 0, void 0, function () {
|
package/dist/client/Sleep.js
CHANGED
@@ -81,7 +81,7 @@ var SleepApi = /** @class */ (function () {
|
|
81
81
|
return [4 /*yield*/, this.getStream(response.sleep[i].id)];
|
82
82
|
case 3:
|
83
83
|
stream = _a.sent();
|
84
|
-
response.sleep[i].sleep_stream =
|
84
|
+
response.sleep[i].sleep_stream = stream;
|
85
85
|
_a.label = 4;
|
86
86
|
case 4:
|
87
87
|
i++;
|