@tryvital/vital-node 0.3.8 → 1.0.2

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.
Files changed (137) hide show
  1. package/client/Activity.ts +1 -1
  2. package/client/Body.ts +1 -1
  3. package/client/Profile.ts +25 -0
  4. package/client/Sleep.ts +2 -2
  5. package/client/Testkits.ts +11 -1
  6. package/client/Vitals.ts +45 -45
  7. package/client/Webhooks.ts +7 -58
  8. package/client/Workouts.ts +3 -3
  9. package/client/index.ts +1 -1
  10. package/client/models/activity.ts +7 -0
  11. package/client/models/body_model.ts +0 -18
  12. package/client/models/profile_model.ts +34 -0
  13. package/client/models/testkit_models.ts +9 -0
  14. package/dist/client/Activity.js +1 -1
  15. package/dist/client/Body.js +1 -1
  16. package/dist/client/Profile.d.ts +8 -0
  17. package/dist/client/{ProviderSpecific.js → Profile.js} +8 -12
  18. package/dist/client/Sleep.js +2 -2
  19. package/dist/client/Testkits.d.ts +1 -0
  20. package/dist/client/Testkits.js +16 -0
  21. package/dist/client/Vitals.d.ts +7 -6
  22. package/dist/client/Vitals.js +16 -41
  23. package/dist/client/Webhooks.d.ts +1 -7
  24. package/dist/client/Webhooks.js +4 -102
  25. package/dist/client/Workouts.d.ts +1 -1
  26. package/dist/client/Workouts.js +3 -3
  27. package/dist/client/index.d.ts +1 -1
  28. package/dist/client/index.js +3 -3
  29. package/dist/client/models/activity.d.ts +6 -0
  30. package/dist/client/models/body_model.d.ts +0 -18
  31. package/dist/client/models/profile_model.d.ts +33 -0
  32. package/dist/{swagger_client/models/client-activity-response.js → client/models/profile_model.js} +0 -0
  33. package/dist/client/models/testkit_models.d.ts +9 -0
  34. package/dist/index.d.ts +2 -2
  35. package/dist/index.js +11 -11
  36. package/dist/lib/config.d.ts +0 -1
  37. package/dist/lib/config.js +0 -1
  38. package/index.ts +14 -14
  39. package/lib/config.ts +0 -1
  40. package/package.json +3 -2
  41. package/client/ProviderSpecific.ts +0 -31
  42. package/dist/client/ProviderSpecific.d.ts +0 -8
  43. package/dist/swagger_client/api.d.ts +0 -18
  44. package/dist/swagger_client/api.js +0 -32
  45. package/dist/swagger_client/apis/activity-api.d.ts +0 -86
  46. package/dist/swagger_client/apis/activity-api.js +0 -241
  47. package/dist/swagger_client/apis/body-api.d.ts +0 -86
  48. package/dist/swagger_client/apis/body-api.js +0 -241
  49. package/dist/swagger_client/apis/link-api.d.ts +0 -115
  50. package/dist/swagger_client/apis/link-api.js +0 -310
  51. package/dist/swagger_client/apis/provider-specific-api.d.ts +0 -90
  52. package/dist/swagger_client/apis/provider-specific-api.js +0 -250
  53. package/dist/swagger_client/apis/sleep-api.d.ts +0 -120
  54. package/dist/swagger_client/apis/sleep-api.js +0 -330
  55. package/dist/swagger_client/apis/user-api.d.ts +0 -243
  56. package/dist/swagger_client/apis/user-api.js +0 -657
  57. package/dist/swagger_client/apis/webhooks-api.d.ts +0 -138
  58. package/dist/swagger_client/apis/webhooks-api.js +0 -379
  59. package/dist/swagger_client/apis/workouts-api.d.ts +0 -120
  60. package/dist/swagger_client/apis/workouts-api.js +0 -330
  61. package/dist/swagger_client/base.d.ts +0 -55
  62. package/dist/swagger_client/base.js +0 -67
  63. package/dist/swagger_client/configuration.d.ts +0 -63
  64. package/dist/swagger_client/configuration.js +0 -16
  65. package/dist/swagger_client/index.d.ts +0 -13
  66. package/dist/swagger_client/index.js +0 -27
  67. package/dist/swagger_client/models/client-activity-response.d.ts +0 -24
  68. package/dist/swagger_client/models/client-body-response.d.ts +0 -24
  69. package/dist/swagger_client/models/client-body-response.js +0 -2
  70. package/dist/swagger_client/models/client-facing-activity.d.ts +0 -84
  71. package/dist/swagger_client/models/client-facing-activity.js +0 -2
  72. package/dist/swagger_client/models/client-facing-body.d.ts +0 -72
  73. package/dist/swagger_client/models/client-facing-body.js +0 -2
  74. package/dist/swagger_client/models/client-facing-sleep-stream.d.ts +0 -48
  75. package/dist/swagger_client/models/client-facing-sleep-stream.js +0 -2
  76. package/dist/swagger_client/models/client-facing-sleep.d.ts +0 -138
  77. package/dist/swagger_client/models/client-facing-sleep.js +0 -2
  78. package/dist/swagger_client/models/client-facing-source-specific.d.ts +0 -48
  79. package/dist/swagger_client/models/client-facing-source-specific.js +0 -2
  80. package/dist/swagger_client/models/client-facing-sport.d.ts +0 -30
  81. package/dist/swagger_client/models/client-facing-sport.js +0 -2
  82. package/dist/swagger_client/models/client-facing-stream.d.ts +0 -84
  83. package/dist/swagger_client/models/client-facing-stream.js +0 -2
  84. package/dist/swagger_client/models/client-facing-user.d.ts +0 -48
  85. package/dist/swagger_client/models/client-facing-user.js +0 -2
  86. package/dist/swagger_client/models/client-facing-webhook.d.ts +0 -42
  87. package/dist/swagger_client/models/client-facing-webhook.js +0 -2
  88. package/dist/swagger_client/models/client-facing-workout.d.ts +0 -150
  89. package/dist/swagger_client/models/client-facing-workout.js +0 -2
  90. package/dist/swagger_client/models/client-sleep-response.d.ts +0 -24
  91. package/dist/swagger_client/models/client-sleep-response.js +0 -2
  92. package/dist/swagger_client/models/client-source-specific-response.d.ts +0 -24
  93. package/dist/swagger_client/models/client-source-specific-response.js +0 -2
  94. package/dist/swagger_client/models/client-webhook-response.d.ts +0 -24
  95. package/dist/swagger_client/models/client-webhook-response.js +0 -2
  96. package/dist/swagger_client/models/client-workout-response.d.ts +0 -24
  97. package/dist/swagger_client/models/client-workout-response.js +0 -2
  98. package/dist/swagger_client/models/connected-source-client-facing.d.ts +0 -24
  99. package/dist/swagger_client/models/connected-source-client-facing.js +0 -2
  100. package/dist/swagger_client/models/httpvalidation-error.d.ts +0 -24
  101. package/dist/swagger_client/models/httpvalidation-error.js +0 -2
  102. package/dist/swagger_client/models/index.d.ts +0 -32
  103. package/dist/swagger_client/models/index.js +0 -44
  104. package/dist/swagger_client/models/individual-provider-data.d.ts +0 -30
  105. package/dist/swagger_client/models/individual-provider-data.js +0 -2
  106. package/dist/swagger_client/models/link-token-exchange-response.d.ts +0 -24
  107. package/dist/swagger_client/models/link-token-exchange-response.js +0 -2
  108. package/dist/swagger_client/models/link-token-exchange.d.ts +0 -30
  109. package/dist/swagger_client/models/link-token-exchange.js +0 -2
  110. package/dist/swagger_client/models/password-providers.d.ts +0 -22
  111. package/dist/swagger_client/models/password-providers.js +0 -28
  112. package/dist/swagger_client/models/provider-link-response.d.ts +0 -30
  113. package/dist/swagger_client/models/provider-link-response.js +0 -2
  114. package/dist/swagger_client/models/providers-that-require-password-auth-whoop-renpho-peloton-zwift.d.ts +0 -18
  115. package/dist/swagger_client/models/providers-that-require-password-auth-whoop-renpho-peloton-zwift.js +0 -2
  116. package/dist/swagger_client/models/providers.d.ts +0 -27
  117. package/dist/swagger_client/models/providers.js +0 -33
  118. package/dist/swagger_client/models/source-client-facing.d.ts +0 -36
  119. package/dist/swagger_client/models/source-client-facing.js +0 -2
  120. package/dist/swagger_client/models/user-create.d.ts +0 -24
  121. package/dist/swagger_client/models/user-create.js +0 -2
  122. package/dist/swagger_client/models/user-key-response.d.ts +0 -30
  123. package/dist/swagger_client/models/user-key-response.js +0 -2
  124. package/dist/swagger_client/models/user-success-response.d.ts +0 -24
  125. package/dist/swagger_client/models/user-success-response.js +0 -2
  126. package/dist/swagger_client/models/validation-error.d.ts +0 -36
  127. package/dist/swagger_client/models/validation-error.js +0 -2
  128. package/dist/swagger_client/models/webhook-register.d.ts +0 -36
  129. package/dist/swagger_client/models/webhook-register.js +0 -2
  130. package/dist/swagger_client/models/webhook-type.d.ts +0 -24
  131. package/dist/swagger_client/models/webhook-type.js +0 -30
  132. package/dist/test/data/mock_webhook.d.ts +0 -49
  133. package/dist/test/data/mock_webhook.js +0 -170
  134. package/dist/test/webhook.spec.d.ts +0 -1
  135. package/dist/test/webhook.spec.js +0 -160
  136. package/test/data/mock_webhook.ts +0 -167
  137. package/test/webhook.spec.ts +0 -254
@@ -16,7 +16,7 @@ export class ActivityApi {
16
16
  provider?: string
17
17
  ): Promise<ClientActivityResponse> {
18
18
  const resp = await this.client.get(
19
- this.baseURL.concat(`/activity/${userKey}`),
19
+ this.baseURL.concat(`/summary/activity/${userKey}`),
20
20
  {
21
21
  params: { start_date: startDate, end_date: endDate, provider },
22
22
  }
package/client/Body.ts CHANGED
@@ -17,7 +17,7 @@ export class BodyApi {
17
17
  provider?: string
18
18
  ): Promise<ClientBodyResponse> {
19
19
  const resp = await this.client.get(
20
- this.baseURL.concat(`/body/${userKey}`),
20
+ this.baseURL.concat(`/summary/body/${userKey}`),
21
21
  {
22
22
  params: { start_date: startDate, end_date: endDate, provider },
23
23
  }
@@ -0,0 +1,25 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ClientFacingProfile } from './models/profile_model';
3
+
4
+ export class ProfileApi {
5
+ baseURL: string;
6
+ client: AxiosInstance;
7
+
8
+ constructor(baseURL: string, axios: AxiosInstance) {
9
+ this.baseURL = baseURL;
10
+ this.client = axios;
11
+ }
12
+
13
+ public async get(
14
+ userKey: string,
15
+ provider?: string
16
+ ): Promise<ClientFacingProfile> {
17
+ const resp = await this.client.get(
18
+ this.baseURL.concat(`/summary/profile/${userKey}`),
19
+ {
20
+ params: { provider },
21
+ }
22
+ );
23
+ return resp.data;
24
+ }
25
+ }
package/client/Sleep.ts CHANGED
@@ -16,7 +16,7 @@ export class SleepApi {
16
16
  provider?: string
17
17
  ): Promise<ClientSleepResponse> {
18
18
  const resp = await this.client.get(
19
- this.baseURL.concat(`/sleep/${userKey}`),
19
+ this.baseURL.concat(`/summary/sleep/${userKey}`),
20
20
  {
21
21
  params: { start_date: startDate, end_date: endDate, provider },
22
22
  }
@@ -26,7 +26,7 @@ export class SleepApi {
26
26
 
27
27
  public async getStream(sleepId: string): Promise<ClientSleepResponse> {
28
28
  const resp = await this.client.get(
29
- this.baseURL.concat(`/sleep/${sleepId}/stream/data`)
29
+ this.baseURL.concat(`/timeseries/sleep/${sleepId}/stream`)
30
30
  );
31
31
  return resp.data;
32
32
  }
@@ -1,5 +1,4 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { signature } from './lib/WebhookVerification';
3
2
  import {
4
3
  Order,
5
4
  OrderRequestResponse,
@@ -47,6 +46,7 @@ export class TestkitsApi {
47
46
  user_key: userKey,
48
47
  testkit_id: testkitId,
49
48
  patient_address: patientAddress,
49
+ patient_details: patientDetails,
50
50
  }
51
51
  );
52
52
  return resp.data;
@@ -58,4 +58,14 @@ export class TestkitsApi {
58
58
  );
59
59
  return resp.data;
60
60
  }
61
+
62
+ public async get_results(orderId: string): Promise<string> {
63
+ const resp = await this.client.get(
64
+ this.baseURL.concat(`/testkit/orders/${orderId}/results`),
65
+ {
66
+ responseType: 'arraybuffer',
67
+ }
68
+ );
69
+ return resp.data;
70
+ }
61
71
  }
package/client/Vitals.ts CHANGED
@@ -1,11 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import {
3
- ClientCholesterolResponse,
4
- ClientGlucoseResponse,
5
- ClientHba1cResponse,
6
- ClientIgeResponse,
7
- ClientIggResponse,
8
- } from './models/activity';
2
+ import { TimeseriesPoint } from './models/activity';
9
3
 
10
4
  export class VitalsApi {
11
5
  baseURL: string;
@@ -15,15 +9,15 @@ export class VitalsApi {
15
9
  this.client = axios;
16
10
  }
17
11
 
18
- public async cholesterol(
19
- type: 'ldl' | 'total_cholesterol' | 'triglycerides' | 'hdl',
20
- userKey: string,
12
+ private async timeseriesData(
13
+ user_key: string,
14
+ resource: string,
21
15
  startDate: Date,
22
16
  endDate: Date,
23
17
  provider?: string
24
- ): Promise<ClientCholesterolResponse> {
18
+ ): Promise<TimeseriesPoint[]> {
25
19
  const resp = await this.client.get(
26
- this.baseURL.concat(`/vitals/cholesterol/${type}/${userKey}`),
20
+ this.baseURL.concat(`/timeseries/${user_key}/${resource}`),
27
21
  {
28
22
  params: { start_date: startDate, end_date: endDate, provider },
29
23
  }
@@ -31,61 +25,67 @@ export class VitalsApi {
31
25
  return resp.data;
32
26
  }
33
27
 
34
- public async glucose(
28
+ public async cholesterol(
29
+ type: 'ldl' | 'total' | 'triglycerides' | 'hdl',
35
30
  userKey: string,
36
31
  startDate: Date,
37
32
  endDate: Date,
38
33
  provider?: string
39
- ): Promise<ClientGlucoseResponse> {
40
- const resp = await this.client.get(
41
- this.baseURL.concat(`/vitals/glucose/${userKey}`),
42
- {
43
- params: { start_date: startDate, end_date: endDate, provider },
44
- }
34
+ ): Promise<TimeseriesPoint[]> {
35
+ return this.timeseriesData(
36
+ userKey,
37
+ `cholesterol/${type}`,
38
+ startDate,
39
+ endDate,
40
+ provider
45
41
  );
46
- return resp.data;
47
42
  }
48
43
 
49
- public async hba1c(
44
+ public async glucose(
50
45
  userKey: string,
51
46
  startDate: Date,
52
47
  endDate: Date,
53
48
  provider?: string
54
- ): Promise<ClientHba1cResponse> {
55
- const resp = await this.client.get(
56
- this.baseURL.concat(`/vitals/hba1c/${userKey}`),
57
- {
58
- params: { start_date: startDate, end_date: endDate, provider },
59
- }
49
+ ): Promise<TimeseriesPoint[]> {
50
+ return this.timeseriesData(
51
+ userKey,
52
+ 'glucose',
53
+ startDate,
54
+ endDate,
55
+ provider
60
56
  );
61
- return resp.data;
62
57
  }
63
58
 
64
59
  public async ige(
65
60
  userKey: string,
66
61
  startDate: Date,
67
- endDate: Date
68
- ): Promise<ClientIgeResponse> {
69
- const resp = await this.client.get(
70
- this.baseURL.concat(`/vitals/ige/${userKey}`),
71
- {
72
- params: { start_date: startDate, end_date: endDate },
73
- }
74
- );
75
- return resp.data;
62
+ endDate: Date,
63
+ provider?: string
64
+ ): Promise<TimeseriesPoint[]> {
65
+ return this.timeseriesData(userKey, 'ige', startDate, endDate, provider);
76
66
  }
77
67
 
78
68
  public async igg(
79
69
  userKey: string,
80
70
  startDate: Date,
81
- endDate: Date
82
- ): Promise<ClientIggResponse> {
83
- const resp = await this.client.get(
84
- this.baseURL.concat(`/vitals/igg/${userKey}`),
85
- {
86
- params: { start_date: startDate, end_date: endDate },
87
- }
71
+ endDate: Date,
72
+ provider?: string
73
+ ): Promise<TimeseriesPoint[]> {
74
+ return this.timeseriesData(userKey, 'igg', startDate, endDate, provider);
75
+ }
76
+
77
+ public async heartrate(
78
+ userKey: string,
79
+ startDate: Date,
80
+ endDate: Date,
81
+ provider?: string
82
+ ): Promise<TimeseriesPoint[]> {
83
+ return this.timeseriesData(
84
+ userKey,
85
+ 'heartrate',
86
+ startDate,
87
+ endDate,
88
+ provider
88
89
  );
89
- return resp.data;
90
90
  }
91
91
  }
@@ -1,71 +1,20 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { signature } from './lib/WebhookVerification';
3
- import {
4
- ClientWebhookResponse,
5
- WebhookEventTypes,
6
- ClientFacingWebhook,
7
- } from './models/webhook_models';
2
+ import { Webhook } from 'svix';
8
3
 
9
4
  export class WebhooksApi {
10
- DEFAULT_TOLERANCE: number;
11
-
12
5
  baseURL: string;
13
6
  client: AxiosInstance;
14
7
  constructor(baseURL: string, axios: AxiosInstance) {
15
8
  this.baseURL = baseURL;
16
9
  this.client = axios;
17
- this.DEFAULT_TOLERANCE = 300; // 5 minutes
18
- }
19
-
20
- public async getAll(): Promise<ClientWebhookResponse> {
21
- const resp = await this.client.get(this.baseURL.concat('/webhooks/'));
22
- return resp.data;
23
- }
24
-
25
- public async register(
26
- callbackUrl: string,
27
- verifyToken: string,
28
- eventType: WebhookEventTypes
29
- ): Promise<ClientFacingWebhook> {
30
- const resp = await this.client.post(this.baseURL.concat('/webhooks/'), {
31
- callback_url: callbackUrl,
32
- verify_token: verifyToken,
33
- event_type: eventType,
34
- });
35
- return resp.data;
36
- }
37
-
38
- public async deregister(webhookId: string): Promise<ClientFacingWebhook> {
39
- const resp = await this.client.delete(
40
- this.baseURL.concat(`/webhooks/${webhookId}`)
41
- );
42
- return resp.data;
43
- }
44
-
45
- public async test(
46
- event_code: 'HISTORICAL_DATA_UPDATE' | 'CREATED',
47
- webhook_type: 'activity' | 'body' | 'sleep' | 'workouts'
48
- ): Promise<ClientFacingWebhook> {
49
- const resp = await this.client.post(this.baseURL.concat('/webhooks/test'), {
50
- event_code,
51
- webhook_type,
52
- });
53
- return resp.data;
54
10
  }
55
11
 
56
- public constructWebhookEvent(
12
+ public static constructWebhookEvent(
57
13
  payload: string,
58
- header: string,
59
- secret: string,
60
- tolerance: number = undefined
61
- ): Record<string, unknown> {
62
- signature.verifyHeader(
63
- payload,
64
- header,
65
- secret,
66
- tolerance || this.DEFAULT_TOLERANCE
67
- );
68
- const jsonPayload = JSON.parse(payload);
69
- return jsonPayload;
14
+ headers: Record<string, string>,
15
+ secret: string
16
+ ): unknown {
17
+ const wh = new Webhook(secret);
18
+ return wh.verify(payload, headers);
70
19
  }
71
20
  }
@@ -19,7 +19,7 @@ export class WorkoutsApi {
19
19
  provider?: string
20
20
  ): Promise<ClientWorkoutResponse> {
21
21
  const resp = await this.client.get(
22
- this.baseURL.concat(`/workouts/${userKey}`),
22
+ this.baseURL.concat(`/summary/workouts/${userKey}`),
23
23
  {
24
24
  params: { start_date: startDate, end_date: endDate, provider },
25
25
  }
@@ -27,11 +27,11 @@ export class WorkoutsApi {
27
27
  return resp.data;
28
28
  }
29
29
 
30
- public async get_stream(
30
+ public async getStream(
31
31
  workoutId: string
32
32
  ): Promise<ClientWorkoutStreamResponse> {
33
33
  const resp = await this.client.get(
34
- this.baseURL.concat(`/workouts/${workoutId}/stream/data`)
34
+ this.baseURL.concat(`/timeseries/workouts/${workoutId}/stream`)
35
35
  );
36
36
  return resp.data;
37
37
  }
package/client/index.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { ActivityApi } from './Activity';
2
2
  export { BodyApi } from './Body';
3
3
  export { LinkApi } from './Link';
4
- export { ProviderSpecificApi } from './ProviderSpecific';
5
4
  export { SleepApi } from './Sleep';
6
5
  export { UserApi } from './User';
7
6
  export { WebhooksApi } from './Webhooks';
8
7
  export { WorkoutsApi } from './Workouts';
9
8
  export { TestkitsApi } from './Testkits';
9
+ export { ProfileApi } from './Profile';
@@ -94,6 +94,13 @@ export interface ClientCholesterolResponse {
94
94
  cholesterol: ClientFacingCholesterol[];
95
95
  }
96
96
 
97
+ export interface TimeseriesPoint {
98
+ timestamp: Date;
99
+ value: number;
100
+ type: string;
101
+ unit: string;
102
+ }
103
+
97
104
  enum RespiratoryAllergen {
98
105
  D_PTERONYSSINUS = 'd_pteronyssinus',
99
106
  D_FARINAE = 'd_farinae',
@@ -30,24 +30,6 @@ export interface ClientFacingBody {
30
30
  * @memberof ClientFacingBody
31
31
  */
32
32
  fat?: number;
33
- /**
34
- * Age of user.::years
35
- * @type {number}
36
- * @memberof ClientFacingBody
37
- */
38
- age?: number;
39
- /**
40
- * Height in cm.::cm
41
- * @type {number}
42
- * @memberof ClientFacingBody
43
- */
44
- height?: number;
45
- /**
46
- * Gender of user.
47
- * @type {string}
48
- * @memberof ClientFacingBody
49
- */
50
- gender?: string;
51
33
  /**
52
34
  * Source the data has come from.
53
35
  * @type {SourceClientFacing}
@@ -0,0 +1,34 @@
1
+ import { SourceClientFacing } from './user_models';
2
+
3
+ export interface ClientFacingProfile {
4
+ /**
5
+ * Age of user.::years
6
+ * @type {number}
7
+ * @memberof ClientFacingBody
8
+ */
9
+ dob?: string;
10
+ /**
11
+ * Height in cm.::cm
12
+ * @type {number}
13
+ * @memberof ClientFacingBody
14
+ */
15
+ height?: number;
16
+ /**
17
+ * Gender of user.
18
+ * @type {string}
19
+ * @memberof ClientFacingBody
20
+ */
21
+ gender?: string;
22
+ /**
23
+ * Source the data has come from.
24
+ * @type {SourceClientFacing}
25
+ * @memberof ClientFacingBody
26
+ */
27
+ source: SourceClientFacing;
28
+ /**
29
+ * User key returned by vital create user key request. This key should be stored in your database against the user and used for all interactions with the vital api.
30
+ * @type {string}
31
+ * @memberof ClientFacingBody
32
+ */
33
+ user_id: string;
34
+ }
@@ -13,11 +13,20 @@ export interface PatientDetails {
13
13
  dob: string;
14
14
  gender: string;
15
15
  }
16
+ export interface Marker {
17
+ name: string;
18
+ slug: string;
19
+ description?: string;
20
+ }
16
21
 
17
22
  export interface Testkit {
18
23
  id: string;
19
24
  name: string;
20
25
  description: string;
26
+ markers: Marker[];
27
+ turnaround_time_lower: number;
28
+ turnaround_time_upper: number;
29
+ price: number;
21
30
  }
22
31
 
23
32
  export interface Order {
@@ -47,7 +47,7 @@ var ActivityApi = /** @class */ (function () {
47
47
  var resp;
48
48
  return __generator(this, function (_a) {
49
49
  switch (_a.label) {
50
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/activity/" + userKey), {
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/activity/" + userKey), {
51
51
  params: { start_date: startDate, end_date: endDate, provider: provider },
52
52
  })];
53
53
  case 1:
@@ -47,7 +47,7 @@ var BodyApi = /** @class */ (function () {
47
47
  var resp;
48
48
  return __generator(this, function (_a) {
49
49
  switch (_a.label) {
50
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/body/" + userKey), {
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/body/" + userKey), {
51
51
  params: { start_date: startDate, end_date: endDate, provider: provider },
52
52
  })];
53
53
  case 1:
@@ -0,0 +1,8 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ClientFacingProfile } from './models/profile_model';
3
+ export declare class ProfileApi {
4
+ baseURL: string;
5
+ client: AxiosInstance;
6
+ constructor(baseURL: string, axios: AxiosInstance);
7
+ get(userKey: string, provider?: string): Promise<ClientFacingProfile>;
8
+ }
@@ -36,23 +36,19 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.ProviderSpecificApi = void 0;
40
- var ProviderSpecificApi = /** @class */ (function () {
41
- function ProviderSpecificApi(baseURL, axios) {
39
+ exports.ProfileApi = void 0;
40
+ var ProfileApi = /** @class */ (function () {
41
+ function ProfileApi(baseURL, axios) {
42
42
  this.baseURL = baseURL;
43
43
  this.client = axios;
44
44
  }
45
- ProviderSpecificApi.prototype.get = function (userKey, startDate, endDate, provider, dataType) {
45
+ ProfileApi.prototype.get = function (userKey, provider) {
46
46
  return __awaiter(this, void 0, void 0, function () {
47
47
  var resp;
48
48
  return __generator(this, function (_a) {
49
49
  switch (_a.label) {
50
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/provider-specific/" + userKey + "/" + provider), {
51
- params: {
52
- start_date: startDate,
53
- end_date: endDate,
54
- data_type: dataType,
55
- },
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/profile/" + userKey), {
51
+ params: { provider: provider },
56
52
  })];
57
53
  case 1:
58
54
  resp = _a.sent();
@@ -61,6 +57,6 @@ var ProviderSpecificApi = /** @class */ (function () {
61
57
  });
62
58
  });
63
59
  };
64
- return ProviderSpecificApi;
60
+ return ProfileApi;
65
61
  }());
66
- exports.ProviderSpecificApi = ProviderSpecificApi;
62
+ exports.ProfileApi = ProfileApi;
@@ -47,7 +47,7 @@ var SleepApi = /** @class */ (function () {
47
47
  var resp;
48
48
  return __generator(this, function (_a) {
49
49
  switch (_a.label) {
50
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/sleep/" + userKey), {
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/sleep/" + userKey), {
51
51
  params: { start_date: startDate, end_date: endDate, provider: provider },
52
52
  })];
53
53
  case 1:
@@ -62,7 +62,7 @@ var SleepApi = /** @class */ (function () {
62
62
  var resp;
63
63
  return __generator(this, function (_a) {
64
64
  switch (_a.label) {
65
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/sleep/" + sleepId + "/stream/data"))];
65
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/timeseries/sleep/" + sleepId + "/stream"))];
66
66
  case 1:
67
67
  resp = _a.sent();
68
68
  return [2 /*return*/, resp.data];
@@ -8,4 +8,5 @@ export declare class TestkitsApi {
8
8
  get_orders(startDate: Date, endDate: Date): Promise<OrderResponse>;
9
9
  order(userKey: string, testkitId: string, patientAddress: PatientAdress, patientDetails: PatientDetails): Promise<OrderRequestResponse>;
10
10
  get_order(orderId: string): Promise<Order>;
11
+ get_results(orderId: string): Promise<string>;
11
12
  }
@@ -79,6 +79,7 @@ var TestkitsApi = /** @class */ (function () {
79
79
  user_key: userKey,
80
80
  testkit_id: testkitId,
81
81
  patient_address: patientAddress,
82
+ patient_details: patientDetails,
82
83
  })];
83
84
  case 1:
84
85
  resp = _a.sent();
@@ -100,6 +101,21 @@ var TestkitsApi = /** @class */ (function () {
100
101
  });
101
102
  });
102
103
  };
104
+ TestkitsApi.prototype.get_results = function (orderId) {
105
+ return __awaiter(this, void 0, void 0, function () {
106
+ var resp;
107
+ return __generator(this, function (_a) {
108
+ switch (_a.label) {
109
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/testkit/orders/" + orderId + "/results"), {
110
+ responseType: 'arraybuffer',
111
+ })];
112
+ case 1:
113
+ resp = _a.sent();
114
+ return [2 /*return*/, resp.data];
115
+ }
116
+ });
117
+ });
118
+ };
103
119
  return TestkitsApi;
104
120
  }());
105
121
  exports.TestkitsApi = TestkitsApi;
@@ -1,12 +1,13 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ClientCholesterolResponse, ClientGlucoseResponse, ClientHba1cResponse, ClientIgeResponse, ClientIggResponse } from './models/activity';
2
+ import { TimeseriesPoint } from './models/activity';
3
3
  export declare class VitalsApi {
4
4
  baseURL: string;
5
5
  client: AxiosInstance;
6
6
  constructor(baseURL: string, axios: AxiosInstance);
7
- cholesterol(type: 'ldl' | 'total_cholesterol' | 'triglycerides' | 'hdl', userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientCholesterolResponse>;
8
- glucose(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientGlucoseResponse>;
9
- hba1c(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientHba1cResponse>;
10
- ige(userKey: string, startDate: Date, endDate: Date): Promise<ClientIgeResponse>;
11
- igg(userKey: string, startDate: Date, endDate: Date): Promise<ClientIggResponse>;
7
+ private timeseriesData;
8
+ cholesterol(type: 'ldl' | 'total' | 'triglycerides' | 'hdl', userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
9
+ glucose(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
10
+ ige(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
11
+ igg(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
12
+ heartrate(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
12
13
  }