@tryvital/vital-node 2.1.6 → 2.1.8

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.
@@ -0,0 +1,107 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { camelize, camelizeKeys } from 'humps';
3
+
4
+ import {
5
+ Appointment,
6
+ AppointmentAvailability,
7
+ CancellationReason,
8
+ USAddress,
9
+ } from './models/athome_phlebotomy_models';
10
+
11
+ export class AtHomePhlebotomyApi {
12
+ baseURL: string;
13
+ client: AxiosInstance;
14
+
15
+ constructor(baseURL: string, axios: AxiosInstance) {
16
+ this.baseURL = baseURL;
17
+ this.client = axios;
18
+ }
19
+
20
+ public async appointmentAvailability(
21
+ orderId: string,
22
+ address?: USAddress
23
+ ): Promise<AppointmentAvailability> {
24
+ const resp = await this.client.post(
25
+ this.baseURL.concat(
26
+ `/order/${orderId}/phlebotomy/appointment/availability`
27
+ ),
28
+ address
29
+ ? {
30
+ first_line: address.firstLine,
31
+ second_line: address.secondLine,
32
+ city: address.city,
33
+ state: address.state,
34
+ zip_code: address.zipCode,
35
+ unit: address.unit,
36
+ }
37
+ : undefined
38
+ );
39
+
40
+ return camelizeKeys<AppointmentAvailability>(resp.data);
41
+ }
42
+
43
+ public async bookAppointment(
44
+ orderId: string,
45
+ bookingKey: string
46
+ ): Promise<Appointment> {
47
+ const resp = await this.client.post(
48
+ this.baseURL.concat(`/order/${orderId}/phlebotomy/appointment/book`),
49
+ {
50
+ booking_key: bookingKey,
51
+ }
52
+ );
53
+
54
+ return camelizeKeys<Appointment>(resp.data);
55
+ }
56
+
57
+ public async rescheduleAppointment(
58
+ orderId: string,
59
+ bookingKey: string
60
+ ): Promise<Appointment> {
61
+ const resp = await this.client.patch(
62
+ this.baseURL.concat(
63
+ `/order/${orderId}/phlebotomy/appointment/reschedule`
64
+ ),
65
+ {
66
+ booking_key: bookingKey,
67
+ }
68
+ );
69
+
70
+ return camelizeKeys<Appointment>(resp.data);
71
+ }
72
+
73
+ public async cancelAppointment(
74
+ orderId: string,
75
+ cancellationReasonId: string
76
+ ): Promise<Appointment> {
77
+ const resp = await this.client.patch(
78
+ this.baseURL.concat(`/order/${orderId}/phlebotomy/appointment/cancel`),
79
+ {
80
+ cancellation_reason_id: cancellationReasonId,
81
+ }
82
+ );
83
+
84
+ return camelizeKeys<Appointment>(resp.data);
85
+ }
86
+
87
+ public async cancellationReasons(): Promise<CancellationReason[]> {
88
+ const resp = await this.client.get(
89
+ this.baseURL.concat(`/order/phlebotomy/appointment/cancellation-reasons`)
90
+ );
91
+
92
+ let cancellationReasons: CancellationReason[] = [];
93
+ for (const reason of resp.data) {
94
+ cancellationReasons.push(camelizeKeys<CancellationReason>(reason));
95
+ }
96
+
97
+ return cancellationReasons;
98
+ }
99
+
100
+ public async getAppointment(orderId: string): Promise<Appointment> {
101
+ const resp = await this.client.get(
102
+ this.baseURL.concat(`/order/${orderId}/phlebotomy/appointment`)
103
+ );
104
+
105
+ return camelizeKeys<Appointment>(resp.data);
106
+ }
107
+ }
@@ -1,6 +1,8 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import {
3
+ AreaInfo,
3
4
  ClientFacingLabTest,
5
+ HealthInsurance,
4
6
  LabResultsMetadata,
5
7
  LabResultsResponse,
6
8
  Order,
@@ -24,7 +26,8 @@ export class OrdersApi {
24
26
  patient_details: PatientDetails,
25
27
  patient_address: PatientAdress,
26
28
  lab_test_id: string,
27
- physician?: Physician
29
+ physician?: Physician,
30
+ health_insurance?: HealthInsurance
28
31
  ): Promise<OrderRequestResponse> {
29
32
  const resp = await this.client.post(this.baseURL.concat('/order'), {
30
33
  user_id: user_id,
@@ -32,6 +35,7 @@ export class OrdersApi {
32
35
  patient_address: patient_address,
33
36
  lab_test_id: lab_test_id,
34
37
  physician: physician ? physician : null,
38
+ health_insurance: health_insurance ? health_insurance : null,
35
39
  });
36
40
  return resp.data;
37
41
  }
@@ -87,6 +91,16 @@ export class ResultsApi {
87
91
  );
88
92
  return resp.data;
89
93
  }
94
+
95
+ // GET lab-testing information about a geographical area,
96
+ // such as whether the area is served by our Phlebotomy network.
97
+ public async getAreaInfo(zip_code: string): Promise<AreaInfo> {
98
+ const resp = await this.client.get(
99
+ this.baseURL.concat('/area/info?') +
100
+ new URLSearchParams({ zip_code: zip_code })
101
+ );
102
+ return resp.data;
103
+ }
90
104
  }
91
105
 
92
106
  export class LabTestsApi {
package/client/Vitals.ts CHANGED
@@ -25,6 +25,51 @@ export class VitalsApi {
25
25
  return resp.data;
26
26
  }
27
27
 
28
+ public async bloodOxygen(
29
+ userId: string,
30
+ startDate: Date,
31
+ endDate?: Date,
32
+ provider?: string,
33
+ ): Promise<TimeseriesPoint[]> {
34
+ return this.timeseriesData(
35
+ userId,
36
+ 'blood_oxygen',
37
+ startDate,
38
+ endDate,
39
+ provider
40
+ );
41
+ }
42
+
43
+ public async bloodPressure(
44
+ userId: string,
45
+ startDate: Date,
46
+ endDate?: Date,
47
+ provider?: string,
48
+ ): Promise<TimeseriesBloodPressurePoint[]> {
49
+ return this.timeseriesData<TimeseriesBloodPressurePoint>(
50
+ userId,
51
+ 'blood_pressure',
52
+ startDate,
53
+ endDate,
54
+ provider
55
+ );
56
+ }
57
+
58
+ public async caffeine(
59
+ userId: string,
60
+ startDate: Date,
61
+ endDate?: Date,
62
+ provider?: string
63
+ ): Promise<TimeseriesPoint[]> {
64
+ return this.timeseriesData(
65
+ userId,
66
+ 'caffeine',
67
+ startDate,
68
+ endDate,
69
+ provider
70
+ );
71
+ }
72
+
28
73
  public async cholesterol(
29
74
  type: 'ldl' | 'total' | 'triglycerides' | 'hdl',
30
75
  userId: string,
@@ -56,6 +101,51 @@ export class VitalsApi {
56
101
  );
57
102
  }
58
103
 
104
+ public async heartrate(
105
+ userId: string,
106
+ startDate: Date,
107
+ endDate?: Date,
108
+ provider?: string
109
+ ): Promise<TimeseriesPoint[]> {
110
+ return this.timeseriesData(
111
+ userId,
112
+ 'heartrate',
113
+ startDate,
114
+ endDate,
115
+ provider
116
+ );
117
+ }
118
+
119
+ public async hrv(
120
+ userId: string,
121
+ startDate: Date,
122
+ endDate?: Date,
123
+ provider?: string
124
+ ): Promise<TimeseriesPoint[]> {
125
+ return this.timeseriesData(
126
+ userId,
127
+ 'hrv',
128
+ startDate,
129
+ endDate,
130
+ provider
131
+ );
132
+ }
133
+
134
+ public async hypnogram(
135
+ userId: string,
136
+ startDate: Date,
137
+ endDate?: Date,
138
+ provider?: string
139
+ ): Promise<TimeseriesPoint[]> {
140
+ return this.timeseriesData(
141
+ userId,
142
+ 'hypnogram',
143
+ startDate,
144
+ endDate,
145
+ provider
146
+ );
147
+ }
148
+
59
149
  public async ige(
60
150
  userId: string,
61
151
  startDate: Date,
@@ -74,7 +164,7 @@ export class VitalsApi {
74
164
  return this.timeseriesData(userId, 'igg', startDate, endDate, provider);
75
165
  }
76
166
 
77
- public async heartrate(
167
+ public async mindfulnessMinutes(
78
168
  userId: string,
79
169
  startDate: Date,
80
170
  endDate?: Date,
@@ -82,39 +172,52 @@ export class VitalsApi {
82
172
  ): Promise<TimeseriesPoint[]> {
83
173
  return this.timeseriesData(
84
174
  userId,
85
- 'heartrate',
175
+ 'mindfulness_minutes',
86
176
  startDate,
87
177
  endDate,
88
178
  provider
89
179
  );
90
180
  }
91
181
 
92
- public async bloodOxygen(
182
+ public async respiratoryRate(
93
183
  userId: string,
94
184
  startDate: Date,
95
185
  endDate?: Date,
96
- provider?: string,
97
-
186
+ provider?: string
98
187
  ): Promise<TimeseriesPoint[]> {
99
188
  return this.timeseriesData(
100
189
  userId,
101
- 'blood_oxygen',
190
+ 'respiratory_rate',
102
191
  startDate,
103
192
  endDate,
104
193
  provider
105
194
  );
106
195
  }
107
196
 
108
- public async bloodPressure(
197
+ public async steps(
109
198
  userId: string,
110
199
  startDate: Date,
111
200
  endDate?: Date,
112
- provider?: string,
201
+ provider?: string
202
+ ): Promise<TimeseriesPoint[]> {
203
+ return this.timeseriesData(
204
+ userId,
205
+ 'steps',
206
+ startDate,
207
+ endDate,
208
+ provider
209
+ );
210
+ }
113
211
 
114
- ): Promise<TimeseriesBloodPressurePoint[]> {
115
- return this.timeseriesData<TimeseriesBloodPressurePoint>(
212
+ public async water(
213
+ userId: string,
214
+ startDate: Date,
215
+ endDate?: Date,
216
+ provider?: string
217
+ ): Promise<TimeseriesPoint[]> {
218
+ return this.timeseriesData(
116
219
  userId,
117
- 'blood_pressure',
220
+ 'water',
118
221
  startDate,
119
222
  endDate,
120
223
  provider
package/client/index.ts CHANGED
@@ -5,8 +5,9 @@ export { SleepApi } from './Sleep';
5
5
  export { UserApi } from './User';
6
6
  export { WebhooksApi } from './Webhooks';
7
7
  export { WorkoutsApi } from './Workouts';
8
+ export { AtHomePhlebotomyApi } from './AtHomePhlebotomy';
8
9
  export { LabTestsApi } from './LabTests';
9
10
  export { ProfileApi } from './Profile';
10
11
  export { DevicesAPI } from './Devices';
11
12
  export { MealsApi } from './Meals';
12
- export { TestkitsApi } from "./Testkits";
13
+ export { TestkitsApi } from './Testkits';
@@ -11,8 +11,15 @@ export interface ClientFacingActivity {
11
11
  * Date for specified record
12
12
  * @type {Date}
13
13
  * @memberof ClientFacingActivity
14
+ * @deprecated Use calendar_date instead
14
15
  */
15
16
  date: Date;
17
+ /**
18
+ * Date for specified record (YYYY-MM-DD)
19
+ * @type {String}
20
+ * @memberof ClientFacingActivity
21
+ */
22
+ calendar_date: string;
16
23
  /**
17
24
  * Total energy consumption during the day including Basal Metabolic Rate in kilocalories.::kilocalories
18
25
  * @type {number}
@@ -25,6 +32,12 @@ export interface ClientFacingActivity {
25
32
  * @memberof ClientFacingActivity
26
33
  */
27
34
  calories_active: number;
35
+ /**
36
+ * Number of floors climbed by the user::count
37
+ * @type {number}
38
+ * @memberof ClientFacingActivity
39
+ */
40
+ floors_climbed?: number;
28
41
  /**
29
42
  * Total number of steps registered during the day.::steps
30
43
  * @type {number}
@@ -56,6 +69,12 @@ export interface ClientFacingActivity {
56
69
  */
57
70
  high?: number;
58
71
  /**
72
+ * Timezone offset from UTC as seconds. For example, EEST (Eastern European Summer Time, +3h) is 10800. PST (Pacific Standard Time, -8h) is -28800::seconds
73
+ * @type {number}
74
+ * @memberof ClientFacingActivity
75
+ */
76
+ timezone_offset?: number;
77
+ /**
59
78
  * Source the data has come from.
60
79
  * @type {SourceClientFacing}
61
80
  * @memberof ClientFacingActivity
@@ -0,0 +1,58 @@
1
+ type Type = 'phlebotomy';
2
+ type Provider = 'getlabs';
3
+ type Status =
4
+ | 'confirmed'
5
+ | 'pending'
6
+ | 'in_progress'
7
+ | 'completed'
8
+ | 'cancelled';
9
+
10
+ export interface LngLat {
11
+ lng: number;
12
+ lat: number;
13
+ }
14
+
15
+ export interface Appointment {
16
+ id: string;
17
+ userId: string;
18
+ address: USAddress;
19
+ location: LngLat;
20
+ startAt: string;
21
+ endAt: string;
22
+ ianaTimezone: string;
23
+ type: Type;
24
+ provider: Provider;
25
+ status: Status;
26
+ providerId: string;
27
+ canReschedule: boolean;
28
+ }
29
+
30
+ export interface USAddress {
31
+ firstLine: string;
32
+ secondLine?: string;
33
+ city: string;
34
+ state: string;
35
+ zipCode: string;
36
+ unit?: string;
37
+ }
38
+
39
+ export interface AppointmentAvailability {
40
+ timezone: string;
41
+ slots: AppointmentSlot[];
42
+ }
43
+
44
+ export interface AppointmentSlot {
45
+ bookingKey: string;
46
+ start: string;
47
+ end: string;
48
+ expiresAt: string;
49
+ price: number;
50
+ isPriority: boolean;
51
+ numAppointmentsAvailable: number;
52
+ }
53
+
54
+ export interface CancellationReason {
55
+ id: string;
56
+ name: string;
57
+ isRefundable: boolean;
58
+ }
@@ -17,6 +17,16 @@ export interface PatientDetails {
17
17
  last_name: string;
18
18
  }
19
19
 
20
+ export interface HealthInsurance {
21
+ front_image: Image;
22
+ back_image: Image;
23
+ }
24
+
25
+ export interface Image {
26
+ content: string;
27
+ content_type: 'image/jpeg' | 'image/jpg' | 'image/png';
28
+ }
29
+
20
30
  export interface Physician {
21
31
  first_name: string;
22
32
  last_name: string;
@@ -51,7 +61,7 @@ export interface Order {
51
61
  team_id: string;
52
62
  patient_details: PatientDetails;
53
63
  patient_address: PatientAdress;
54
- physician: Physician
64
+ physician: Physician;
55
65
  lab_test: Testkit;
56
66
  // TODO CHECK WHAT DETAILS IS
57
67
  details: Object;
@@ -125,3 +135,12 @@ export interface LabResultsResponse {
125
135
  metadata: LabResultsMetadata;
126
136
  results: Object;
127
137
  }
138
+
139
+ export interface AreaInfo {
140
+ zip_code: string;
141
+ phlebotomy: PhlebotomyAreaInfo;
142
+ }
143
+
144
+ export interface PhlebotomyAreaInfo {
145
+ is_served: boolean;
146
+ }
@@ -17,8 +17,15 @@ export interface ClientFacingSleep {
17
17
  * Date for specified record
18
18
  * @type {Date}
19
19
  * @memberof ClientFacingSleep
20
+ * @deprecated Use calendar_date instead
20
21
  */
21
22
  date: Date;
23
+ /**
24
+ * Date for specified record (YYYY-MM-DD). This generally matches the sleep end date.
25
+ * @type {String}
26
+ * @memberof ClientFacingSleep
27
+ */
28
+ calendar_date: string;
22
29
  /**
23
30
  * UTC Time when the sleep period started
24
31
  * @type {Date}
@@ -115,6 +122,12 @@ export interface ClientFacingSleep {
115
122
  * @memberof ClientFacingSleep
116
123
  */
117
124
  respiratory_rate?: number;
125
+ /**
126
+ * Average skin temperature.::celcius
127
+ * @type {number}
128
+ * @memberof ClientFacingSleep
129
+ */
130
+ skin_temperature?: number;
118
131
  /**
119
132
  * Source the data has come from.
120
133
  * @type {SourceClientFacing}
@@ -57,6 +57,12 @@ export interface ClientFacingWorkout {
57
57
  * @memberof ClientFacingWorkout
58
58
  */
59
59
  time_end: Date;
60
+ /**
61
+ * Date for specified record (YYYY-MM-DD)
62
+ * @type {String}
63
+ * @memberof ClientFacingWorkout
64
+ */
65
+ calendar_date: string;
60
66
  /**
61
67
  * Calories burned during the workout::kCal
62
68
  * @type {number}
@@ -153,6 +159,12 @@ export interface ClientFacingWorkout {
153
159
  * @memberof ClientFacingWorkout
154
160
  */
155
161
  map?: string;
162
+ /**
163
+ * Timezone offset from UTC as seconds. For example, EEST (Eastern European Summer Time, +3h) is 10800. PST (Pacific Standard Time, -8h) is -28800::seconds
164
+ * @type {number}
165
+ * @memberof ClientFacingActivity
166
+ */
167
+ timezone_offset?: number;
156
168
  }
157
169
 
158
170
  export interface ClientWorkoutResponse {
@@ -0,0 +1,13 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Appointment, AppointmentAvailability, CancellationReason, USAddress } from './models/athome_phlebotomy_models';
3
+ export declare class AtHomePhlebotomyApi {
4
+ baseURL: string;
5
+ client: AxiosInstance;
6
+ constructor(baseURL: string, axios: AxiosInstance);
7
+ appointmentAvailability(orderId: string, address?: USAddress): Promise<AppointmentAvailability>;
8
+ bookAppointment(orderId: string, bookingKey: string): Promise<Appointment>;
9
+ rescheduleAppointment(orderId: string, bookingKey: string): Promise<Appointment>;
10
+ cancelAppointment(orderId: string, cancellationReasonId: string): Promise<Appointment>;
11
+ cancellationReasons(): Promise<CancellationReason[]>;
12
+ getAppointment(orderId: string): Promise<Appointment>;
13
+ }
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.AtHomePhlebotomyApi = void 0;
40
+ var humps_1 = require("humps");
41
+ var AtHomePhlebotomyApi = /** @class */ (function () {
42
+ function AtHomePhlebotomyApi(baseURL, axios) {
43
+ this.baseURL = baseURL;
44
+ this.client = axios;
45
+ }
46
+ AtHomePhlebotomyApi.prototype.appointmentAvailability = function (orderId, address) {
47
+ return __awaiter(this, void 0, void 0, function () {
48
+ var resp;
49
+ return __generator(this, function (_a) {
50
+ switch (_a.label) {
51
+ case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat("/order/" + orderId + "/phlebotomy/appointment/availability"), address
52
+ ? {
53
+ first_line: address.firstLine,
54
+ second_line: address.secondLine,
55
+ city: address.city,
56
+ state: address.state,
57
+ zip_code: address.zipCode,
58
+ unit: address.unit,
59
+ }
60
+ : undefined)];
61
+ case 1:
62
+ resp = _a.sent();
63
+ return [2 /*return*/, humps_1.camelizeKeys(resp.data)];
64
+ }
65
+ });
66
+ });
67
+ };
68
+ AtHomePhlebotomyApi.prototype.bookAppointment = function (orderId, bookingKey) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var resp;
71
+ return __generator(this, function (_a) {
72
+ switch (_a.label) {
73
+ case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat("/order/" + orderId + "/phlebotomy/appointment/book"), {
74
+ booking_key: bookingKey,
75
+ })];
76
+ case 1:
77
+ resp = _a.sent();
78
+ return [2 /*return*/, humps_1.camelizeKeys(resp.data)];
79
+ }
80
+ });
81
+ });
82
+ };
83
+ AtHomePhlebotomyApi.prototype.rescheduleAppointment = function (orderId, bookingKey) {
84
+ return __awaiter(this, void 0, void 0, function () {
85
+ var resp;
86
+ return __generator(this, function (_a) {
87
+ switch (_a.label) {
88
+ case 0: return [4 /*yield*/, this.client.patch(this.baseURL.concat("/order/" + orderId + "/phlebotomy/appointment/reschedule"), {
89
+ booking_key: bookingKey,
90
+ })];
91
+ case 1:
92
+ resp = _a.sent();
93
+ return [2 /*return*/, humps_1.camelizeKeys(resp.data)];
94
+ }
95
+ });
96
+ });
97
+ };
98
+ AtHomePhlebotomyApi.prototype.cancelAppointment = function (orderId, cancellationReasonId) {
99
+ return __awaiter(this, void 0, void 0, function () {
100
+ var resp;
101
+ return __generator(this, function (_a) {
102
+ switch (_a.label) {
103
+ case 0: return [4 /*yield*/, this.client.patch(this.baseURL.concat("/order/" + orderId + "/phlebotomy/appointment/cancel"), {
104
+ cancellation_reason_id: cancellationReasonId,
105
+ })];
106
+ case 1:
107
+ resp = _a.sent();
108
+ return [2 /*return*/, humps_1.camelizeKeys(resp.data)];
109
+ }
110
+ });
111
+ });
112
+ };
113
+ AtHomePhlebotomyApi.prototype.cancellationReasons = function () {
114
+ return __awaiter(this, void 0, void 0, function () {
115
+ var resp, cancellationReasons, _i, _a, reason;
116
+ return __generator(this, function (_b) {
117
+ switch (_b.label) {
118
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/order/phlebotomy/appointment/cancellation-reasons"))];
119
+ case 1:
120
+ resp = _b.sent();
121
+ cancellationReasons = [];
122
+ for (_i = 0, _a = resp.data; _i < _a.length; _i++) {
123
+ reason = _a[_i];
124
+ cancellationReasons.push(humps_1.camelizeKeys(reason));
125
+ }
126
+ return [2 /*return*/, cancellationReasons];
127
+ }
128
+ });
129
+ });
130
+ };
131
+ AtHomePhlebotomyApi.prototype.getAppointment = function (orderId) {
132
+ return __awaiter(this, void 0, void 0, function () {
133
+ var resp;
134
+ return __generator(this, function (_a) {
135
+ switch (_a.label) {
136
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/order/" + orderId + "/phlebotomy/appointment"))];
137
+ case 1:
138
+ resp = _a.sent();
139
+ return [2 /*return*/, humps_1.camelizeKeys(resp.data)];
140
+ }
141
+ });
142
+ });
143
+ };
144
+ return AtHomePhlebotomyApi;
145
+ }());
146
+ exports.AtHomePhlebotomyApi = AtHomePhlebotomyApi;
@@ -1,10 +1,10 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ClientFacingLabTest, LabResultsMetadata, LabResultsResponse, Order, OrderRequestResponse, PatientAdress, PatientDetails, Physician } from './models/lab_tests_model';
2
+ import { AreaInfo, ClientFacingLabTest, HealthInsurance, LabResultsMetadata, LabResultsResponse, Order, OrderRequestResponse, PatientAdress, PatientDetails, Physician } from './models/lab_tests_model';
3
3
  export declare class OrdersApi {
4
4
  baseURL: string;
5
5
  client: AxiosInstance;
6
6
  constructor(baseURL: string, axios: AxiosInstance);
7
- create_order(user_id: string, patient_details: PatientDetails, patient_address: PatientAdress, lab_test_id: string, physician?: Physician): Promise<OrderRequestResponse>;
7
+ create_order(user_id: string, patient_details: PatientDetails, patient_address: PatientAdress, lab_test_id: string, physician?: Physician, health_insurance?: HealthInsurance): Promise<OrderRequestResponse>;
8
8
  getOrder(orderId: string): Promise<Order>;
9
9
  cancelOrder(orderId: string): Promise<OrderRequestResponse>;
10
10
  }
@@ -15,6 +15,7 @@ export declare class ResultsApi {
15
15
  getResults(orderId: string): Promise<LabResultsResponse>;
16
16
  getResultsPdf(orderId: string): Promise<string>;
17
17
  getResultsMetadata(orderId: string): Promise<LabResultsMetadata>;
18
+ getAreaInfo(zip_code: string): Promise<AreaInfo>;
18
19
  }
19
20
  export declare class LabTestsApi {
20
21
  baseURL: string;
@@ -43,7 +43,7 @@ var OrdersApi = /** @class */ (function () {
43
43
  this.client = axios;
44
44
  }
45
45
  // Create new order
46
- OrdersApi.prototype.create_order = function (user_id, patient_details, patient_address, lab_test_id, physician) {
46
+ OrdersApi.prototype.create_order = function (user_id, patient_details, patient_address, lab_test_id, physician, health_insurance) {
47
47
  return __awaiter(this, void 0, void 0, function () {
48
48
  var resp;
49
49
  return __generator(this, function (_a) {
@@ -54,6 +54,7 @@ var OrdersApi = /** @class */ (function () {
54
54
  patient_address: patient_address,
55
55
  lab_test_id: lab_test_id,
56
56
  physician: physician ? physician : null,
57
+ health_insurance: health_insurance ? health_insurance : null,
57
58
  })];
58
59
  case 1:
59
60
  resp = _a.sent();
@@ -142,6 +143,22 @@ var ResultsApi = /** @class */ (function () {
142
143
  });
143
144
  });
144
145
  };
146
+ // GET lab-testing information about a geographical area,
147
+ // such as whether the area is served by our Phlebotomy network.
148
+ ResultsApi.prototype.getAreaInfo = function (zip_code) {
149
+ return __awaiter(this, void 0, void 0, function () {
150
+ var resp;
151
+ return __generator(this, function (_a) {
152
+ switch (_a.label) {
153
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat('/area/info?') +
154
+ new URLSearchParams({ zip_code: zip_code }))];
155
+ case 1:
156
+ resp = _a.sent();
157
+ return [2 /*return*/, resp.data];
158
+ }
159
+ });
160
+ });
161
+ };
145
162
  return ResultsApi;
146
163
  }());
147
164
  exports.ResultsApi = ResultsApi;
@@ -5,11 +5,18 @@ export declare class VitalsApi {
5
5
  client: AxiosInstance;
6
6
  constructor(baseURL: string, axios: AxiosInstance);
7
7
  private timeseriesData;
8
+ bloodOxygen(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
9
+ bloodPressure(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesBloodPressurePoint[]>;
10
+ caffeine(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
8
11
  cholesterol(type: 'ldl' | 'total' | 'triglycerides' | 'hdl', userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
9
12
  glucose(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
13
+ heartrate(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
14
+ hrv(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
15
+ hypnogram(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
10
16
  ige(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
11
17
  igg(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
12
- heartrate(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
13
- bloodOxygen(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
14
- bloodPressure(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesBloodPressurePoint[]>;
18
+ mindfulnessMinutes(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
19
+ respiratoryRate(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
20
+ steps(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
21
+ water(userId: string, startDate: Date, endDate?: Date, provider?: string): Promise<TimeseriesPoint[]>;
15
22
  }
@@ -57,6 +57,27 @@ var VitalsApi = /** @class */ (function () {
57
57
  });
58
58
  });
59
59
  };
60
+ VitalsApi.prototype.bloodOxygen = function (userId, startDate, endDate, provider) {
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ return __generator(this, function (_a) {
63
+ return [2 /*return*/, this.timeseriesData(userId, 'blood_oxygen', startDate, endDate, provider)];
64
+ });
65
+ });
66
+ };
67
+ VitalsApi.prototype.bloodPressure = function (userId, startDate, endDate, provider) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ return __generator(this, function (_a) {
70
+ return [2 /*return*/, this.timeseriesData(userId, 'blood_pressure', startDate, endDate, provider)];
71
+ });
72
+ });
73
+ };
74
+ VitalsApi.prototype.caffeine = function (userId, startDate, endDate, provider) {
75
+ return __awaiter(this, void 0, void 0, function () {
76
+ return __generator(this, function (_a) {
77
+ return [2 /*return*/, this.timeseriesData(userId, 'caffeine', startDate, endDate, provider)];
78
+ });
79
+ });
80
+ };
60
81
  VitalsApi.prototype.cholesterol = function (type, userId, startDate, endDate, provider) {
61
82
  return __awaiter(this, void 0, void 0, function () {
62
83
  return __generator(this, function (_a) {
@@ -71,6 +92,27 @@ var VitalsApi = /** @class */ (function () {
71
92
  });
72
93
  });
73
94
  };
95
+ VitalsApi.prototype.heartrate = function (userId, startDate, endDate, provider) {
96
+ return __awaiter(this, void 0, void 0, function () {
97
+ return __generator(this, function (_a) {
98
+ return [2 /*return*/, this.timeseriesData(userId, 'heartrate', startDate, endDate, provider)];
99
+ });
100
+ });
101
+ };
102
+ VitalsApi.prototype.hrv = function (userId, startDate, endDate, provider) {
103
+ return __awaiter(this, void 0, void 0, function () {
104
+ return __generator(this, function (_a) {
105
+ return [2 /*return*/, this.timeseriesData(userId, 'hrv', startDate, endDate, provider)];
106
+ });
107
+ });
108
+ };
109
+ VitalsApi.prototype.hypnogram = function (userId, startDate, endDate, provider) {
110
+ return __awaiter(this, void 0, void 0, function () {
111
+ return __generator(this, function (_a) {
112
+ return [2 /*return*/, this.timeseriesData(userId, 'hypnogram', startDate, endDate, provider)];
113
+ });
114
+ });
115
+ };
74
116
  VitalsApi.prototype.ige = function (userId, startDate, endDate, provider) {
75
117
  return __awaiter(this, void 0, void 0, function () {
76
118
  return __generator(this, function (_a) {
@@ -85,24 +127,31 @@ var VitalsApi = /** @class */ (function () {
85
127
  });
86
128
  });
87
129
  };
88
- VitalsApi.prototype.heartrate = function (userId, startDate, endDate, provider) {
130
+ VitalsApi.prototype.mindfulnessMinutes = function (userId, startDate, endDate, provider) {
89
131
  return __awaiter(this, void 0, void 0, function () {
90
132
  return __generator(this, function (_a) {
91
- return [2 /*return*/, this.timeseriesData(userId, 'heartrate', startDate, endDate, provider)];
133
+ return [2 /*return*/, this.timeseriesData(userId, 'mindfulness_minutes', startDate, endDate, provider)];
92
134
  });
93
135
  });
94
136
  };
95
- VitalsApi.prototype.bloodOxygen = function (userId, startDate, endDate, provider) {
137
+ VitalsApi.prototype.respiratoryRate = function (userId, startDate, endDate, provider) {
96
138
  return __awaiter(this, void 0, void 0, function () {
97
139
  return __generator(this, function (_a) {
98
- return [2 /*return*/, this.timeseriesData(userId, 'blood_oxygen', startDate, endDate, provider)];
140
+ return [2 /*return*/, this.timeseriesData(userId, 'respiratory_rate', startDate, endDate, provider)];
99
141
  });
100
142
  });
101
143
  };
102
- VitalsApi.prototype.bloodPressure = function (userId, startDate, endDate, provider) {
144
+ VitalsApi.prototype.steps = function (userId, startDate, endDate, provider) {
103
145
  return __awaiter(this, void 0, void 0, function () {
104
146
  return __generator(this, function (_a) {
105
- return [2 /*return*/, this.timeseriesData(userId, 'blood_pressure', startDate, endDate, provider)];
147
+ return [2 /*return*/, this.timeseriesData(userId, 'steps', startDate, endDate, provider)];
148
+ });
149
+ });
150
+ };
151
+ VitalsApi.prototype.water = function (userId, startDate, endDate, provider) {
152
+ return __awaiter(this, void 0, void 0, function () {
153
+ return __generator(this, function (_a) {
154
+ return [2 /*return*/, this.timeseriesData(userId, 'water', startDate, endDate, provider)];
106
155
  });
107
156
  });
108
157
  };
@@ -5,8 +5,9 @@ export { SleepApi } from './Sleep';
5
5
  export { UserApi } from './User';
6
6
  export { WebhooksApi } from './Webhooks';
7
7
  export { WorkoutsApi } from './Workouts';
8
+ export { AtHomePhlebotomyApi } from './AtHomePhlebotomy';
8
9
  export { LabTestsApi } from './LabTests';
9
10
  export { ProfileApi } from './Profile';
10
11
  export { DevicesAPI } from './Devices';
11
12
  export { MealsApi } from './Meals';
12
- export { TestkitsApi } from "./Testkits";
13
+ export { TestkitsApi } from './Testkits';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestkitsApi = exports.MealsApi = exports.DevicesAPI = exports.ProfileApi = exports.LabTestsApi = exports.WorkoutsApi = exports.WebhooksApi = exports.UserApi = exports.SleepApi = exports.LinkApi = exports.BodyApi = exports.ActivityApi = void 0;
3
+ exports.TestkitsApi = exports.MealsApi = exports.DevicesAPI = exports.ProfileApi = exports.LabTestsApi = exports.AtHomePhlebotomyApi = exports.WorkoutsApi = exports.WebhooksApi = exports.UserApi = exports.SleepApi = exports.LinkApi = exports.BodyApi = exports.ActivityApi = void 0;
4
4
  var Activity_1 = require("./Activity");
5
5
  Object.defineProperty(exports, "ActivityApi", { enumerable: true, get: function () { return Activity_1.ActivityApi; } });
6
6
  var Body_1 = require("./Body");
@@ -15,6 +15,8 @@ var Webhooks_1 = require("./Webhooks");
15
15
  Object.defineProperty(exports, "WebhooksApi", { enumerable: true, get: function () { return Webhooks_1.WebhooksApi; } });
16
16
  var Workouts_1 = require("./Workouts");
17
17
  Object.defineProperty(exports, "WorkoutsApi", { enumerable: true, get: function () { return Workouts_1.WorkoutsApi; } });
18
+ var AtHomePhlebotomy_1 = require("./AtHomePhlebotomy");
19
+ Object.defineProperty(exports, "AtHomePhlebotomyApi", { enumerable: true, get: function () { return AtHomePhlebotomy_1.AtHomePhlebotomyApi; } });
18
20
  var LabTests_1 = require("./LabTests");
19
21
  Object.defineProperty(exports, "LabTestsApi", { enumerable: true, get: function () { return LabTests_1.LabTestsApi; } });
20
22
  var Profile_1 = require("./Profile");
@@ -10,8 +10,15 @@ export interface ClientFacingActivity {
10
10
  * Date for specified record
11
11
  * @type {Date}
12
12
  * @memberof ClientFacingActivity
13
+ * @deprecated Use calendar_date instead
13
14
  */
14
15
  date: Date;
16
+ /**
17
+ * Date for specified record (YYYY-MM-DD)
18
+ * @type {String}
19
+ * @memberof ClientFacingActivity
20
+ */
21
+ calendar_date: string;
15
22
  /**
16
23
  * Total energy consumption during the day including Basal Metabolic Rate in kilocalories.::kilocalories
17
24
  * @type {number}
@@ -24,6 +31,12 @@ export interface ClientFacingActivity {
24
31
  * @memberof ClientFacingActivity
25
32
  */
26
33
  calories_active: number;
34
+ /**
35
+ * Number of floors climbed by the user::count
36
+ * @type {number}
37
+ * @memberof ClientFacingActivity
38
+ */
39
+ floors_climbed?: number;
27
40
  /**
28
41
  * Total number of steps registered during the day.::steps
29
42
  * @type {number}
@@ -55,10 +68,16 @@ export interface ClientFacingActivity {
55
68
  */
56
69
  high?: number;
57
70
  /**
58
- * Source the data has come from.
59
- * @type {SourceClientFacing}
71
+ * Timezone offset from UTC as seconds. For example, EEST (Eastern European Summer Time, +3h) is 10800. PST (Pacific Standard Time, -8h) is -28800::seconds
72
+ * @type {number}
60
73
  * @memberof ClientFacingActivity
61
74
  */
75
+ timezone_offset?: number;
76
+ /**
77
+ * Source the data has come from.
78
+ * @type {SourceClientFacing}
79
+ * @memberof ClientFacingActivity
80
+ */
62
81
  source: SourceClientFacing;
63
82
  user_id: string;
64
83
  }
@@ -0,0 +1,48 @@
1
+ declare type Type = 'phlebotomy';
2
+ declare type Provider = 'getlabs';
3
+ declare type Status = 'confirmed' | 'pending' | 'in_progress' | 'completed' | 'cancelled';
4
+ export interface LngLat {
5
+ lng: number;
6
+ lat: number;
7
+ }
8
+ export interface Appointment {
9
+ id: string;
10
+ userId: string;
11
+ address: USAddress;
12
+ location: LngLat;
13
+ startAt: string;
14
+ endAt: string;
15
+ ianaTimezone: string;
16
+ type: Type;
17
+ provider: Provider;
18
+ status: Status;
19
+ providerId: string;
20
+ canReschedule: boolean;
21
+ }
22
+ export interface USAddress {
23
+ firstLine: string;
24
+ secondLine?: string;
25
+ city: string;
26
+ state: string;
27
+ zipCode: string;
28
+ unit?: string;
29
+ }
30
+ export interface AppointmentAvailability {
31
+ timezone: string;
32
+ slots: AppointmentSlot[];
33
+ }
34
+ export interface AppointmentSlot {
35
+ bookingKey: string;
36
+ start: string;
37
+ end: string;
38
+ expiresAt: string;
39
+ price: number;
40
+ isPriority: boolean;
41
+ numAppointmentsAvailable: number;
42
+ }
43
+ export interface CancellationReason {
44
+ id: string;
45
+ name: string;
46
+ isRefundable: boolean;
47
+ }
48
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -15,6 +15,14 @@ export interface PatientDetails {
15
15
  phone_number: string;
16
16
  last_name: string;
17
17
  }
18
+ export interface HealthInsurance {
19
+ front_image: Image;
20
+ back_image: Image;
21
+ }
22
+ export interface Image {
23
+ content: string;
24
+ content_type: 'image/jpeg' | 'image/jpg' | 'image/png';
25
+ }
18
26
  export interface Physician {
19
27
  first_name: string;
20
28
  last_name: string;
@@ -98,3 +106,10 @@ export interface LabResultsResponse {
98
106
  metadata: LabResultsMetadata;
99
107
  results: Object;
100
108
  }
109
+ export interface AreaInfo {
110
+ zip_code: string;
111
+ phlebotomy: PhlebotomyAreaInfo;
112
+ }
113
+ export interface PhlebotomyAreaInfo {
114
+ is_served: boolean;
115
+ }
@@ -16,8 +16,15 @@ export interface ClientFacingSleep {
16
16
  * Date for specified record
17
17
  * @type {Date}
18
18
  * @memberof ClientFacingSleep
19
+ * @deprecated Use calendar_date instead
19
20
  */
20
21
  date: Date;
22
+ /**
23
+ * Date for specified record (YYYY-MM-DD). This generally matches the sleep end date.
24
+ * @type {String}
25
+ * @memberof ClientFacingSleep
26
+ */
27
+ calendar_date: string;
21
28
  /**
22
29
  * UTC Time when the sleep period started
23
30
  * @type {Date}
@@ -114,6 +121,12 @@ export interface ClientFacingSleep {
114
121
  * @memberof ClientFacingSleep
115
122
  */
116
123
  respiratory_rate?: number;
124
+ /**
125
+ * Average skin temperature.::celcius
126
+ * @type {number}
127
+ * @memberof ClientFacingSleep
128
+ */
129
+ skin_temperature?: number;
117
130
  /**
118
131
  * Source the data has come from.
119
132
  * @type {SourceClientFacing}
@@ -55,6 +55,12 @@ export interface ClientFacingWorkout {
55
55
  * @memberof ClientFacingWorkout
56
56
  */
57
57
  time_end: Date;
58
+ /**
59
+ * Date for specified record (YYYY-MM-DD)
60
+ * @type {String}
61
+ * @memberof ClientFacingWorkout
62
+ */
63
+ calendar_date: string;
58
64
  /**
59
65
  * Calories burned during the workout::kCal
60
66
  * @type {number}
@@ -146,6 +152,12 @@ export interface ClientFacingWorkout {
146
152
  * @memberof ClientFacingWorkout
147
153
  */
148
154
  map?: string;
155
+ /**
156
+ * Timezone offset from UTC as seconds. For example, EEST (Eastern European Summer Time, +3h) is 10800. PST (Pacific Standard Time, -8h) is -28800::seconds
157
+ * @type {number}
158
+ * @memberof ClientFacingActivity
159
+ */
160
+ timezone_offset?: number;
149
161
  }
150
162
  export interface ClientWorkoutResponse {
151
163
  /**
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ActivityApi, BodyApi, LinkApi, SleepApi, UserApi, WebhooksApi, WorkoutsApi, ProfileApi, DevicesAPI, MealsApi, LabTestsApi } from './client';
1
+ import { ActivityApi, AtHomePhlebotomyApi, BodyApi, LinkApi, SleepApi, UserApi, WebhooksApi, WorkoutsApi, ProfileApi, DevicesAPI, MealsApi, LabTestsApi } from './client';
2
2
  import { ClientConfig } from './lib/models';
3
3
  import { VitalsApi } from './client/Vitals';
4
4
  import { ProviderApi } from './client/Provider';
@@ -14,6 +14,7 @@ export declare class VitalClient {
14
14
  Webhooks: WebhooksApi;
15
15
  Vitals: VitalsApi;
16
16
  LabTests: LabTestsApi;
17
+ AtHomePhlebotomy: AtHomePhlebotomyApi;
17
18
  Profile: ProfileApi;
18
19
  Providers: ProviderApi;
19
20
  Devices: DevicesAPI;
package/dist/index.js CHANGED
@@ -59,7 +59,7 @@ var VitalClient = /** @class */ (function () {
59
59
  var _this = this;
60
60
  this.config = config;
61
61
  if (!config.api_key) {
62
- throw new Error("You must provide an API key");
62
+ throw new Error('You must provide an API key');
63
63
  }
64
64
  var baseURL;
65
65
  if (this.config.region && this.config.region === 'eu') {
@@ -77,7 +77,7 @@ var VitalClient = /** @class */ (function () {
77
77
  var headers;
78
78
  return __generator(this, function (_a) {
79
79
  headers = config.headers;
80
- headers["x-vital-api-key"] = this.config.api_key;
80
+ headers['x-vital-api-key'] = this.config.api_key;
81
81
  config.headers = __assign({}, headers);
82
82
  return [2 /*return*/, config];
83
83
  });
@@ -94,6 +94,7 @@ var VitalClient = /** @class */ (function () {
94
94
  this.Webhooks = new client_1.WebhooksApi(baseURL.concat('/v2'), axiosApiInstance);
95
95
  this.Vitals = new Vitals_1.VitalsApi(baseURL.concat('/v2'), axiosApiInstance);
96
96
  this.LabTests = new client_1.LabTestsApi(baseURL.concat('/v3'), axiosApiInstance);
97
+ this.AtHomePhlebotomy = new client_1.AtHomePhlebotomyApi(baseURL.concat('/v3'), axiosApiInstance);
97
98
  this.Profile = new client_1.ProfileApi(baseURL.concat('/v2'), axiosApiInstance);
98
99
  this.Providers = new Provider_1.ProviderApi(baseURL.concat('/v2'), axiosApiInstance);
99
100
  this.Devices = new client_1.DevicesAPI(baseURL.concat('/v2'), axiosApiInstance);
package/index.ts CHANGED
@@ -2,6 +2,7 @@ import axios from 'axios';
2
2
  import axiosRetry from 'axios-retry';
3
3
  import {
4
4
  ActivityApi,
5
+ AtHomePhlebotomyApi,
5
6
  BodyApi,
6
7
  LinkApi,
7
8
  SleepApi,
@@ -11,7 +12,7 @@ import {
11
12
  ProfileApi,
12
13
  DevicesAPI,
13
14
  MealsApi,
14
- LabTestsApi
15
+ LabTestsApi,
15
16
  } from './client';
16
17
  import { ClientConfig } from './lib/models';
17
18
  import CONFIG from './lib/config';
@@ -30,14 +31,15 @@ export class VitalClient {
30
31
  Webhooks: WebhooksApi;
31
32
  Vitals: VitalsApi;
32
33
  LabTests: LabTestsApi;
34
+ AtHomePhlebotomy: AtHomePhlebotomyApi;
33
35
  Profile: ProfileApi;
34
36
  Providers: ProviderApi;
35
37
  Devices: DevicesAPI;
36
38
 
37
39
  constructor(config: ClientConfig) {
38
40
  this.config = config;
39
- if(!config.api_key){
40
- throw new Error("You must provide an API key");
41
+ if (!config.api_key) {
42
+ throw new Error('You must provide an API key');
41
43
  }
42
44
  let baseURL;
43
45
  if (this.config.region && this.config.region === 'eu') {
@@ -55,7 +57,7 @@ export class VitalClient {
55
57
  axiosApiInstance.interceptors.request.use(
56
58
  async (config) => {
57
59
  const headers = config.headers;
58
- headers["x-vital-api-key"] = this.config.api_key;
60
+ headers['x-vital-api-key'] = this.config.api_key;
59
61
  config.headers = {
60
62
  ...headers,
61
63
  };
@@ -76,6 +78,10 @@ export class VitalClient {
76
78
  this.Webhooks = new WebhooksApi(baseURL.concat('/v2'), axiosApiInstance);
77
79
  this.Vitals = new VitalsApi(baseURL.concat('/v2'), axiosApiInstance);
78
80
  this.LabTests = new LabTestsApi(baseURL.concat('/v3'), axiosApiInstance);
81
+ this.AtHomePhlebotomy = new AtHomePhlebotomyApi(
82
+ baseURL.concat('/v3'),
83
+ axiosApiInstance
84
+ );
79
85
  this.Profile = new ProfileApi(baseURL.concat('/v2'), axiosApiInstance);
80
86
  this.Providers = new ProviderApi(baseURL.concat('/v2'), axiosApiInstance);
81
87
  this.Devices = new DevicesAPI(baseURL.concat('/v2'), axiosApiInstance);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-node",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "Node client for Vital",
5
5
  "author": "maitham",
6
6
  "keywords": [
@@ -22,9 +22,11 @@
22
22
  "lint": "eslint --ext .js,.jsx,.ts ."
23
23
  },
24
24
  "dependencies": {
25
+ "@types/humps": "^2.0.2",
25
26
  "axios": ">=0.21.2 <1.0.0",
26
27
  "axios-retry": "^3.2.4",
27
28
  "crypto": "^1.0.1",
29
+ "humps": "^2.0.1",
28
30
  "svix": "0.64.2"
29
31
  },
30
32
  "devDependencies": {
@@ -55,4 +57,4 @@
55
57
  "ts-node": "^10.2.0",
56
58
  "typescript": "^4.3.5"
57
59
  }
58
- }
60
+ }