@tryvital/vital-node 2.1.5 → 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.
@@ -1,118 +1,108 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import {
3
- ClientFacingLabTest,
4
- LabResultsMetadata,
5
- LabResultsResponse,
6
- Order,
7
- OrderRequestResponse,
8
- PatientAdress,
9
- PatientDetails,
10
- Physician,
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
- baseURL: string;
17
- client: AxiosInstance;
18
- constructor(baseURL: string, axios: AxiosInstance) {
19
- this.baseURL = baseURL;
20
- this.client = axios;
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
- // Create new order
24
- public async create_order(
25
- user_id: string,
26
- patient_details: PatientDetails,
27
- patient_address: PatientAdress,
28
- lab_test_id: string,
29
- physician?: Physician,
30
- ): Promise<OrderRequestResponse> {
31
- const resp = await this.client.post(
32
- this.baseURL.concat('/order'),
33
- {
34
- params: {
35
- user_id: user_id,
36
- patient_details: patient_details,
37
- patient_address: patient_address,
38
- lab_test_id: lab_test_id,
39
- physician: physician ? physician : null
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
- // Get order status.
47
- public async getOrder(orderId: string): Promise<Order> {
48
- const resp = await this.client.get(
49
- this.baseURL.concat(`/order/${orderId}`)
50
- );
51
- return resp.data;
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
- // Cancels order.
55
- public async cancelOrder(orderId: string): Promise<OrderRequestResponse> {
56
- const resp = await this.client.post(
57
- this.baseURL.concat(`/order/${orderId}/cancel`)
58
- );
59
- return resp.data;
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
- baseURL: string;
65
- client: AxiosInstance;
66
- constructor(baseURL: string, axios: AxiosInstance) {
67
- this.baseURL = baseURL;
68
- this.client = axios;
69
- }
70
- // GET both metadata and raw json test data.
71
- public async getResults(orderId: string): Promise<LabResultsResponse> {
72
- const resp = await this.client.get(
73
- this.baseURL.concat(`/order/${orderId}/result`)
74
- );
75
- return resp.data;
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
- // GET gets the lab result for the order in PDF format.
79
- // TODO Check response type for PDF
80
- public async getResultsPdf(orderId: string): Promise<string> {
81
- const resp = await this.client.get(
82
- this.baseURL.concat(`/order/${orderId}/result/pdf`)
83
- );
84
- return resp.data;
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
- // GET metadata related to order results, such as
88
- // lab metadata, provider and sample dates.
89
- public async getResultsMetadata(orderId: string): Promise<LabResultsMetadata> {
90
- const resp = await this.client.get(
91
- this.baseURL.concat(`/order/${orderId}/result/metadata`)
92
- );
93
- return resp.data;
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
- baseURL: string;
101
- client: AxiosInstance;
102
- Orders: OrdersApi;
103
- Results: ResultsApi;
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
- public async getTests(): Promise<ClientFacingLabTest> {
113
- const resp = await this.client.get(
114
- this.baseURL.concat(`/lab_tests`)
115
- );
116
- return resp.data;
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
+ }
@@ -4,7 +4,8 @@ export interface PatientAdress {
4
4
  state: string;
5
5
  zip: string;
6
6
  country: string;
7
- street_number?: string;
7
+ first_line: string;
8
+ second_line?: string;
8
9
  }
9
10
 
10
11
  export interface PatientDetails {
@@ -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
- params: {
53
- user_id: user_id,
54
- patient_details: patient_details,
55
- patient_address: patient_address,
56
- lab_test_id: lab_test_id,
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 () {
@@ -4,7 +4,8 @@ export interface PatientAdress {
4
4
  state: string;
5
5
  zip: string;
6
6
  country: string;
7
- street_number?: string;
7
+ first_line: string;
8
+ second_line?: string;
8
9
  }
9
10
  export interface PatientDetails {
10
11
  dob: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-node",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Node client for Vital",
5
5
  "author": "maitham",
6
6
  "keywords": [