@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.
- package/client/Activity.ts +1 -1
- package/client/Body.ts +1 -1
- package/client/Profile.ts +25 -0
- package/client/Sleep.ts +2 -2
- package/client/Testkits.ts +11 -1
- package/client/Vitals.ts +45 -45
- package/client/Webhooks.ts +7 -58
- package/client/Workouts.ts +3 -3
- package/client/index.ts +1 -1
- package/client/models/activity.ts +7 -0
- package/client/models/body_model.ts +0 -18
- package/client/models/profile_model.ts +34 -0
- package/client/models/testkit_models.ts +9 -0
- package/dist/client/Activity.js +1 -1
- package/dist/client/Body.js +1 -1
- package/dist/client/Profile.d.ts +8 -0
- package/dist/client/{ProviderSpecific.js → Profile.js} +8 -12
- package/dist/client/Sleep.js +2 -2
- package/dist/client/Testkits.d.ts +1 -0
- package/dist/client/Testkits.js +16 -0
- package/dist/client/Vitals.d.ts +7 -6
- package/dist/client/Vitals.js +16 -41
- package/dist/client/Webhooks.d.ts +1 -7
- package/dist/client/Webhooks.js +4 -102
- package/dist/client/Workouts.d.ts +1 -1
- package/dist/client/Workouts.js +3 -3
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +3 -3
- package/dist/client/models/activity.d.ts +6 -0
- package/dist/client/models/body_model.d.ts +0 -18
- package/dist/client/models/profile_model.d.ts +33 -0
- package/dist/{swagger_client/models/client-activity-response.js → client/models/profile_model.js} +0 -0
- package/dist/client/models/testkit_models.d.ts +9 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -11
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/config.js +0 -1
- package/index.ts +14 -14
- package/lib/config.ts +0 -1
- package/package.json +3 -2
- package/client/ProviderSpecific.ts +0 -31
- package/dist/client/ProviderSpecific.d.ts +0 -8
- package/dist/swagger_client/api.d.ts +0 -18
- package/dist/swagger_client/api.js +0 -32
- package/dist/swagger_client/apis/activity-api.d.ts +0 -86
- package/dist/swagger_client/apis/activity-api.js +0 -241
- package/dist/swagger_client/apis/body-api.d.ts +0 -86
- package/dist/swagger_client/apis/body-api.js +0 -241
- package/dist/swagger_client/apis/link-api.d.ts +0 -115
- package/dist/swagger_client/apis/link-api.js +0 -310
- package/dist/swagger_client/apis/provider-specific-api.d.ts +0 -90
- package/dist/swagger_client/apis/provider-specific-api.js +0 -250
- package/dist/swagger_client/apis/sleep-api.d.ts +0 -120
- package/dist/swagger_client/apis/sleep-api.js +0 -330
- package/dist/swagger_client/apis/user-api.d.ts +0 -243
- package/dist/swagger_client/apis/user-api.js +0 -657
- package/dist/swagger_client/apis/webhooks-api.d.ts +0 -138
- package/dist/swagger_client/apis/webhooks-api.js +0 -379
- package/dist/swagger_client/apis/workouts-api.d.ts +0 -120
- package/dist/swagger_client/apis/workouts-api.js +0 -330
- package/dist/swagger_client/base.d.ts +0 -55
- package/dist/swagger_client/base.js +0 -67
- package/dist/swagger_client/configuration.d.ts +0 -63
- package/dist/swagger_client/configuration.js +0 -16
- package/dist/swagger_client/index.d.ts +0 -13
- package/dist/swagger_client/index.js +0 -27
- package/dist/swagger_client/models/client-activity-response.d.ts +0 -24
- package/dist/swagger_client/models/client-body-response.d.ts +0 -24
- package/dist/swagger_client/models/client-body-response.js +0 -2
- package/dist/swagger_client/models/client-facing-activity.d.ts +0 -84
- package/dist/swagger_client/models/client-facing-activity.js +0 -2
- package/dist/swagger_client/models/client-facing-body.d.ts +0 -72
- package/dist/swagger_client/models/client-facing-body.js +0 -2
- package/dist/swagger_client/models/client-facing-sleep-stream.d.ts +0 -48
- package/dist/swagger_client/models/client-facing-sleep-stream.js +0 -2
- package/dist/swagger_client/models/client-facing-sleep.d.ts +0 -138
- package/dist/swagger_client/models/client-facing-sleep.js +0 -2
- package/dist/swagger_client/models/client-facing-source-specific.d.ts +0 -48
- package/dist/swagger_client/models/client-facing-source-specific.js +0 -2
- package/dist/swagger_client/models/client-facing-sport.d.ts +0 -30
- package/dist/swagger_client/models/client-facing-sport.js +0 -2
- package/dist/swagger_client/models/client-facing-stream.d.ts +0 -84
- package/dist/swagger_client/models/client-facing-stream.js +0 -2
- package/dist/swagger_client/models/client-facing-user.d.ts +0 -48
- package/dist/swagger_client/models/client-facing-user.js +0 -2
- package/dist/swagger_client/models/client-facing-webhook.d.ts +0 -42
- package/dist/swagger_client/models/client-facing-webhook.js +0 -2
- package/dist/swagger_client/models/client-facing-workout.d.ts +0 -150
- package/dist/swagger_client/models/client-facing-workout.js +0 -2
- package/dist/swagger_client/models/client-sleep-response.d.ts +0 -24
- package/dist/swagger_client/models/client-sleep-response.js +0 -2
- package/dist/swagger_client/models/client-source-specific-response.d.ts +0 -24
- package/dist/swagger_client/models/client-source-specific-response.js +0 -2
- package/dist/swagger_client/models/client-webhook-response.d.ts +0 -24
- package/dist/swagger_client/models/client-webhook-response.js +0 -2
- package/dist/swagger_client/models/client-workout-response.d.ts +0 -24
- package/dist/swagger_client/models/client-workout-response.js +0 -2
- package/dist/swagger_client/models/connected-source-client-facing.d.ts +0 -24
- package/dist/swagger_client/models/connected-source-client-facing.js +0 -2
- package/dist/swagger_client/models/httpvalidation-error.d.ts +0 -24
- package/dist/swagger_client/models/httpvalidation-error.js +0 -2
- package/dist/swagger_client/models/index.d.ts +0 -32
- package/dist/swagger_client/models/index.js +0 -44
- package/dist/swagger_client/models/individual-provider-data.d.ts +0 -30
- package/dist/swagger_client/models/individual-provider-data.js +0 -2
- package/dist/swagger_client/models/link-token-exchange-response.d.ts +0 -24
- package/dist/swagger_client/models/link-token-exchange-response.js +0 -2
- package/dist/swagger_client/models/link-token-exchange.d.ts +0 -30
- package/dist/swagger_client/models/link-token-exchange.js +0 -2
- package/dist/swagger_client/models/password-providers.d.ts +0 -22
- package/dist/swagger_client/models/password-providers.js +0 -28
- package/dist/swagger_client/models/provider-link-response.d.ts +0 -30
- package/dist/swagger_client/models/provider-link-response.js +0 -2
- package/dist/swagger_client/models/providers-that-require-password-auth-whoop-renpho-peloton-zwift.d.ts +0 -18
- package/dist/swagger_client/models/providers-that-require-password-auth-whoop-renpho-peloton-zwift.js +0 -2
- package/dist/swagger_client/models/providers.d.ts +0 -27
- package/dist/swagger_client/models/providers.js +0 -33
- package/dist/swagger_client/models/source-client-facing.d.ts +0 -36
- package/dist/swagger_client/models/source-client-facing.js +0 -2
- package/dist/swagger_client/models/user-create.d.ts +0 -24
- package/dist/swagger_client/models/user-create.js +0 -2
- package/dist/swagger_client/models/user-key-response.d.ts +0 -30
- package/dist/swagger_client/models/user-key-response.js +0 -2
- package/dist/swagger_client/models/user-success-response.d.ts +0 -24
- package/dist/swagger_client/models/user-success-response.js +0 -2
- package/dist/swagger_client/models/validation-error.d.ts +0 -36
- package/dist/swagger_client/models/validation-error.js +0 -2
- package/dist/swagger_client/models/webhook-register.d.ts +0 -36
- package/dist/swagger_client/models/webhook-register.js +0 -2
- package/dist/swagger_client/models/webhook-type.d.ts +0 -24
- package/dist/swagger_client/models/webhook-type.js +0 -30
- package/dist/test/data/mock_webhook.d.ts +0 -49
- package/dist/test/data/mock_webhook.js +0 -170
- package/dist/test/webhook.spec.d.ts +0 -1
- package/dist/test/webhook.spec.js +0 -160
- package/test/data/mock_webhook.ts +0 -167
- package/test/webhook.spec.ts +0 -254
package/client/Activity.ts
CHANGED
@@ -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
|
29
|
+
this.baseURL.concat(`/timeseries/sleep/${sleepId}/stream`)
|
30
30
|
);
|
31
31
|
return resp.data;
|
32
32
|
}
|
package/client/Testkits.ts
CHANGED
@@ -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
|
-
|
19
|
-
|
20
|
-
|
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<
|
18
|
+
): Promise<TimeseriesPoint[]> {
|
25
19
|
const resp = await this.client.get(
|
26
|
-
this.baseURL.concat(`/
|
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
|
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<
|
40
|
-
|
41
|
-
|
42
|
-
{
|
43
|
-
|
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
|
44
|
+
public async glucose(
|
50
45
|
userKey: string,
|
51
46
|
startDate: Date,
|
52
47
|
endDate: Date,
|
53
48
|
provider?: string
|
54
|
-
): Promise<
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
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
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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
|
}
|
package/client/Webhooks.ts
CHANGED
@@ -1,71 +1,20 @@
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
2
|
-
import {
|
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
|
-
|
59
|
-
secret: string
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
}
|
package/client/Workouts.ts
CHANGED
@@ -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
|
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
|
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 {
|
package/dist/client/Activity.js
CHANGED
@@ -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:
|
package/dist/client/Body.js
CHANGED
@@ -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.
|
40
|
-
var
|
41
|
-
function
|
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
|
-
|
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("/
|
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
|
60
|
+
return ProfileApi;
|
65
61
|
}());
|
66
|
-
exports.
|
62
|
+
exports.ProfileApi = ProfileApi;
|
package/dist/client/Sleep.js
CHANGED
@@ -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
|
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
|
}
|
package/dist/client/Testkits.js
CHANGED
@@ -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;
|
package/dist/client/Vitals.d.ts
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
2
|
-
import {
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
ige(userKey: string, startDate: Date, endDate: Date): Promise<
|
11
|
-
igg(userKey: string, startDate: Date, endDate: Date): Promise<
|
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
|
}
|