@tryvital/vital-node 2.1.16 → 2.1.19

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,4 +1,4 @@
1
- import { AxiosInstance } from 'axios';
1
+ import { AxiosInstance, AxiosResponse } from 'axios';
2
2
  import {
3
3
  AreaInfo,
4
4
  ClientFacingLabTest,
@@ -22,12 +22,13 @@ export class OrdersApi {
22
22
  this.client = axios;
23
23
  }
24
24
 
25
- public async getRequisitionPdf(orderId: string): Promise<string> {
26
- const resp = await this.client.get(
25
+ public async getRequisitionPdf(orderId: string): Promise<NodeJS.ReadableStream> {
26
+ const response: AxiosResponse = await this.client.get(
27
27
  this.baseURL.concat(`/order/${orderId}/requisition/pdf`),
28
- { headers: { 'Accept': 'application/pdf' } }
28
+ { responseType: 'stream', headers: { 'Accept': 'application/pdf' } }
29
29
  );
30
- return resp.data;
30
+
31
+ return response.data;
31
32
  }
32
33
 
33
34
  public async create_unregistered_testkit_order(
@@ -155,12 +156,13 @@ export class ResultsApi {
155
156
  }
156
157
 
157
158
  // GET gets the lab result for the order in PDF format.
158
- // TODO Check response type for PDF
159
- public async getResultsPdf(orderId: string): Promise<string> {
160
- const resp = await this.client.get(
161
- this.baseURL.concat(`/order/${orderId}/result/pdf`)
159
+ public async getResultsPdf(orderId: string): Promise<NodeJS.ReadableStream> {
160
+ const response: AxiosResponse = await this.client.get(
161
+ this.baseURL.concat(`/order/${orderId}/result/pdf`),
162
+ { responseType: 'stream', headers: { 'Accept': 'application/pdf' } }
162
163
  );
163
- return resp.data;
164
+
165
+ return response.data;
164
166
  }
165
167
 
166
168
  // GET metadata related to order results, such as
@@ -1,11 +1,26 @@
1
- export type PasswordProviders = 'whoop' | 'renpho' | 'peloton' | 'zwift' | 'hammerhead';
1
+ export type PasswordProviders =
2
+ | 'whoop'
3
+ | 'renpho'
4
+ | 'peloton'
5
+ | 'zwift'
6
+ | 'hammerhead'
7
+ | 'eight_sleep'
8
+ | 'beurer_api'
9
+ | 'dexcom'
10
+ | 'my_fitness_pal';
11
+
2
12
  export type OAuthProviders =
3
13
  | 'oura'
4
14
  | 'fitbit'
5
15
  | 'garmin'
6
- | 'whoop'
7
16
  | 'strava'
8
- | 'wahoo';
17
+ | 'wahoo'
18
+ | 'ihealth'
19
+ | 'withings'
20
+ | 'google_fit'
21
+ | 'dexcom_v3'
22
+ | 'polar'
23
+ | 'cronometer';
9
24
 
10
25
  export type EmailProviders = 'freestyle_libre';
11
26
  export type DemoProviders = 'apple_health_kit' | 'fitbit' | 'oura' | 'whoop';
@@ -1,10 +1,11 @@
1
+ /// <reference types="node" />
1
2
  import { AxiosInstance } from 'axios';
2
3
  import { AreaInfo, ClientFacingLabTest, Consent, Diagnosis, HealthInsurance, LabResultsMetadata, LabResultsResponse, Order, OrderRequestResponse, PatientAdress, PatientDetails, Payor, Physician, ShippingDetails } from './models/lab_tests_model';
3
4
  export declare class OrdersApi {
4
5
  baseURL: string;
5
6
  client: AxiosInstance;
6
7
  constructor(baseURL: string, axios: AxiosInstance);
7
- getRequisitionPdf(orderId: string): Promise<string>;
8
+ getRequisitionPdf(orderId: string): Promise<NodeJS.ReadableStream>;
8
9
  create_unregistered_testkit_order(user_id: string, lab_test_id: string, shipping_details: ShippingDetails): Promise<OrderRequestResponse>;
9
10
  register_testkit_order(user_id: string, sample_id: string, patient_details: PatientDetails, patient_address: PatientAdress, physician?: Physician, consents?: [Consent]): Promise<OrderRequestResponse>;
10
11
  create_order(user_id: string, patient_details: PatientDetails, patient_address: PatientAdress, lab_test_id: string, physician?: Physician, health_insurance?: HealthInsurance, priority?: boolean, consents?: [Consent]): Promise<OrderRequestResponse>;
@@ -19,7 +20,7 @@ export declare class ResultsApi {
19
20
  client: AxiosInstance;
20
21
  constructor(baseURL: string, axios: AxiosInstance);
21
22
  getResults(orderId: string): Promise<LabResultsResponse>;
22
- getResultsPdf(orderId: string): Promise<string>;
23
+ getResultsPdf(orderId: string): Promise<NodeJS.ReadableStream>;
23
24
  getResultsMetadata(orderId: string): Promise<LabResultsMetadata>;
24
25
  getAreaInfo(zip_code: string): Promise<AreaInfo>;
25
26
  }
@@ -44,13 +44,13 @@ var OrdersApi = /** @class */ (function () {
44
44
  }
45
45
  OrdersApi.prototype.getRequisitionPdf = function (orderId) {
46
46
  return __awaiter(this, void 0, void 0, function () {
47
- var resp;
47
+ var response;
48
48
  return __generator(this, function (_a) {
49
49
  switch (_a.label) {
50
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/order/" + orderId + "/requisition/pdf"), { headers: { 'Accept': 'application/pdf' } })];
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/order/" + orderId + "/requisition/pdf"), { responseType: 'stream', headers: { 'Accept': 'application/pdf' } })];
51
51
  case 1:
52
- resp = _a.sent();
53
- return [2 /*return*/, resp.data];
52
+ response = _a.sent();
53
+ return [2 /*return*/, response.data];
54
54
  }
55
55
  });
56
56
  });
@@ -214,16 +214,15 @@ var ResultsApi = /** @class */ (function () {
214
214
  });
215
215
  };
216
216
  // GET gets the lab result for the order in PDF format.
217
- // TODO Check response type for PDF
218
217
  ResultsApi.prototype.getResultsPdf = function (orderId) {
219
218
  return __awaiter(this, void 0, void 0, function () {
220
- var resp;
219
+ var response;
221
220
  return __generator(this, function (_a) {
222
221
  switch (_a.label) {
223
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/order/" + orderId + "/result/pdf"))];
222
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/order/" + orderId + "/result/pdf"), { responseType: 'stream', headers: { 'Accept': 'application/pdf' } })];
224
223
  case 1:
225
- resp = _a.sent();
226
- return [2 /*return*/, resp.data];
224
+ response = _a.sent();
225
+ return [2 /*return*/, response.data];
227
226
  }
228
227
  });
229
228
  });
@@ -1,5 +1,5 @@
1
- export declare type PasswordProviders = 'whoop' | 'renpho' | 'peloton' | 'zwift' | 'hammerhead';
2
- export declare type OAuthProviders = 'oura' | 'fitbit' | 'garmin' | 'whoop' | 'strava' | 'wahoo';
1
+ export declare type PasswordProviders = 'whoop' | 'renpho' | 'peloton' | 'zwift' | 'hammerhead' | 'eight_sleep' | 'beurer_api' | 'dexcom' | 'my_fitness_pal';
2
+ export declare type OAuthProviders = 'oura' | 'fitbit' | 'garmin' | 'strava' | 'wahoo' | 'ihealth' | 'withings' | 'google_fit' | 'dexcom_v3' | 'polar' | 'cronometer';
3
3
  export declare type EmailProviders = 'freestyle_libre';
4
4
  export declare type DemoProviders = 'apple_health_kit' | 'fitbit' | 'oura' | 'whoop';
5
5
  export interface ProviderLinkResponse {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-node",
3
- "version": "2.1.16",
3
+ "version": "2.1.19",
4
4
  "description": "Node client for Vital",
5
5
  "author": "maitham",
6
6
  "keywords": [