@metriport/api-sdk 18.10.1 → 18.12.0-alpha.0
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/dist/medical/client/metriport.d.ts +3 -2
- package/dist/medical/client/metriport.d.ts.map +1 -1
- package/dist/medical/client/metriport.js +5 -2
- package/dist/medical/client/metriport.js.map +1 -1
- package/dist/medical/models/document.d.ts +1 -0
- package/dist/medical/models/document.d.ts.map +1 -1
- package/dist/src/devices/client/metriport.d.ts +181 -0
- package/dist/src/devices/client/metriport.d.ts.map +1 -0
- package/dist/src/devices/client/metriport.js +263 -0
- package/dist/src/devices/client/metriport.js.map +1 -0
- package/dist/src/devices/client/models/get-connect-token-response.d.ts +4 -0
- package/dist/src/devices/client/models/get-connect-token-response.d.ts.map +1 -0
- package/dist/src/devices/client/models/get-connect-token-response.js +3 -0
- package/dist/src/devices/client/models/get-connect-token-response.js.map +1 -0
- package/dist/src/devices/client/models/get-connected-users-response.d.ts +5 -0
- package/dist/src/devices/client/models/get-connected-users-response.d.ts.map +1 -0
- package/dist/src/devices/client/models/get-connected-users-response.js +3 -0
- package/dist/src/devices/client/models/get-connected-users-response.js.map +1 -0
- package/dist/src/devices/client/models/get-metriport-user-id-response.d.ts +4 -0
- package/dist/src/devices/client/models/get-metriport-user-id-response.d.ts.map +1 -0
- package/dist/src/devices/client/models/get-metriport-user-id-response.js +3 -0
- package/dist/src/devices/client/models/get-metriport-user-id-response.js.map +1 -0
- package/dist/src/devices/client/models/settings-response.d.ts +6 -0
- package/dist/src/devices/client/models/settings-response.d.ts.map +1 -0
- package/dist/src/devices/client/models/settings-response.js +3 -0
- package/dist/src/devices/client/models/settings-response.js.map +1 -0
- package/dist/src/devices/client/models/webhook-status-response.d.ts +7 -0
- package/dist/src/devices/client/models/webhook-status-response.d.ts.map +1 -0
- package/dist/src/devices/client/models/webhook-status-response.js +3 -0
- package/dist/src/devices/client/models/webhook-status-response.js.map +1 -0
- package/dist/src/devices/client/util/date-util.d.ts +2 -0
- package/dist/src/devices/client/util/date-util.d.ts.map +1 -0
- package/dist/src/devices/client/util/date-util.js +16 -0
- package/dist/src/devices/client/util/date-util.js.map +1 -0
- package/dist/src/devices/client/util/timezone-util.d.ts +2 -0
- package/dist/src/devices/client/util/timezone-util.d.ts.map +1 -0
- package/dist/src/devices/client/util/timezone-util.js +20 -0
- package/dist/src/devices/client/util/timezone-util.js.map +1 -0
- package/dist/src/devices/models/activity.d.ts +22 -0
- package/dist/src/devices/models/activity.d.ts.map +1 -0
- package/dist/src/devices/models/activity.js +3 -0
- package/dist/src/devices/models/activity.js.map +1 -0
- package/dist/src/devices/models/biometrics.d.ts +17 -0
- package/dist/src/devices/models/biometrics.d.ts.map +1 -0
- package/dist/src/devices/models/biometrics.js +3 -0
- package/dist/src/devices/models/biometrics.js.map +1 -0
- package/dist/src/devices/models/body.d.ts +13 -0
- package/dist/src/devices/models/body.d.ts.map +1 -0
- package/dist/src/devices/models/body.js +3 -0
- package/dist/src/devices/models/body.js.map +1 -0
- package/dist/src/devices/models/common/activity-durations.d.ts +19 -0
- package/dist/src/devices/models/common/activity-durations.d.ts.map +1 -0
- package/dist/src/devices/models/common/activity-durations.js +3 -0
- package/dist/src/devices/models/common/activity-durations.js.map +1 -0
- package/dist/src/devices/models/common/activity-log.d.ts +32 -0
- package/dist/src/devices/models/common/activity-log.d.ts.map +1 -0
- package/dist/src/devices/models/common/activity-log.js +3 -0
- package/dist/src/devices/models/common/activity-log.js.map +1 -0
- package/dist/src/devices/models/common/activity-movement.d.ts +16 -0
- package/dist/src/devices/models/common/activity-movement.d.ts.map +1 -0
- package/dist/src/devices/models/common/activity-movement.js +3 -0
- package/dist/src/devices/models/common/activity-movement.js.map +1 -0
- package/dist/src/devices/models/common/aminos.d.ts +23 -0
- package/dist/src/devices/models/common/aminos.d.ts.map +1 -0
- package/dist/src/devices/models/common/aminos.js +3 -0
- package/dist/src/devices/models/common/aminos.js.map +1 -0
- package/dist/src/devices/models/common/blood-glucose.d.ts +6 -0
- package/dist/src/devices/models/common/blood-glucose.d.ts.map +1 -0
- package/dist/src/devices/models/common/blood-glucose.js +3 -0
- package/dist/src/devices/models/common/blood-glucose.js.map +1 -0
- package/dist/src/devices/models/common/blood-pressure.d.ts +10 -0
- package/dist/src/devices/models/common/blood-pressure.d.ts.map +1 -0
- package/dist/src/devices/models/common/blood-pressure.js +3 -0
- package/dist/src/devices/models/common/blood-pressure.js.map +1 -0
- package/dist/src/devices/models/common/connected-user-info.d.ts +6 -0
- package/dist/src/devices/models/common/connected-user-info.d.ts.map +1 -0
- package/dist/src/devices/models/common/connected-user-info.js +3 -0
- package/dist/src/devices/models/common/connected-user-info.js.map +1 -0
- package/dist/src/devices/models/common/energy-expenditure.d.ts +7 -0
- package/dist/src/devices/models/common/energy-expenditure.d.ts.map +1 -0
- package/dist/src/devices/models/common/energy-expenditure.js +3 -0
- package/dist/src/devices/models/common/energy-expenditure.js.map +1 -0
- package/dist/src/devices/models/common/food.d.ts +15 -0
- package/dist/src/devices/models/common/food.d.ts.map +1 -0
- package/dist/src/devices/models/common/food.js +3 -0
- package/dist/src/devices/models/common/food.js.map +1 -0
- package/dist/src/devices/models/common/heart-rate-variability.d.ts +12 -0
- package/dist/src/devices/models/common/heart-rate-variability.d.ts.map +1 -0
- package/dist/src/devices/models/common/heart-rate-variability.js +3 -0
- package/dist/src/devices/models/common/heart-rate-variability.js.map +1 -0
- package/dist/src/devices/models/common/heart-rate.d.ts +9 -0
- package/dist/src/devices/models/common/heart-rate.d.ts.map +1 -0
- package/dist/src/devices/models/common/heart-rate.js +3 -0
- package/dist/src/devices/models/common/heart-rate.js.map +1 -0
- package/dist/src/devices/models/common/lat-lon.d.ts +5 -0
- package/dist/src/devices/models/common/lat-lon.d.ts.map +1 -0
- package/dist/src/devices/models/common/lat-lon.js +3 -0
- package/dist/src/devices/models/common/lat-lon.js.map +1 -0
- package/dist/src/devices/models/common/macros.d.ts +14 -0
- package/dist/src/devices/models/common/macros.d.ts.map +1 -0
- package/dist/src/devices/models/common/macros.js +3 -0
- package/dist/src/devices/models/common/macros.js.map +1 -0
- package/dist/src/devices/models/common/metadata.d.ts +10 -0
- package/dist/src/devices/models/common/metadata.d.ts.map +1 -0
- package/dist/src/devices/models/common/metadata.js +3 -0
- package/dist/src/devices/models/common/metadata.js.map +1 -0
- package/dist/src/devices/models/common/micros.d.ts +28 -0
- package/dist/src/devices/models/common/micros.d.ts.map +1 -0
- package/dist/src/devices/models/common/micros.js +3 -0
- package/dist/src/devices/models/common/micros.js.map +1 -0
- package/dist/src/devices/models/common/provider-source.d.ts +13 -0
- package/dist/src/devices/models/common/provider-source.d.ts.map +1 -0
- package/dist/src/devices/models/common/provider-source.js +17 -0
- package/dist/src/devices/models/common/provider-source.js.map +1 -0
- package/dist/src/devices/models/common/respiration.d.ts +18 -0
- package/dist/src/devices/models/common/respiration.d.ts.map +1 -0
- package/dist/src/devices/models/common/respiration.js +3 -0
- package/dist/src/devices/models/common/respiration.js.map +1 -0
- package/dist/src/devices/models/common/sample.d.ts +8 -0
- package/dist/src/devices/models/common/sample.d.ts.map +1 -0
- package/dist/src/devices/models/common/sample.js +3 -0
- package/dist/src/devices/models/common/sample.js.map +1 -0
- package/dist/src/devices/models/common/sex.d.ts +2 -0
- package/dist/src/devices/models/common/sex.d.ts.map +1 -0
- package/dist/src/devices/models/common/sex.js +3 -0
- package/dist/src/devices/models/common/sex.js.map +1 -0
- package/dist/src/devices/models/common/source-info.d.ts +8 -0
- package/dist/src/devices/models/common/source-info.d.ts.map +1 -0
- package/dist/src/devices/models/common/source-info.js +3 -0
- package/dist/src/devices/models/common/source-info.js.map +1 -0
- package/dist/src/devices/models/common/source-type.d.ts +5 -0
- package/dist/src/devices/models/common/source-type.d.ts.map +1 -0
- package/dist/src/devices/models/common/source-type.js +9 -0
- package/dist/src/devices/models/common/source-type.js.map +1 -0
- package/dist/src/devices/models/common/temperature.d.ts +13 -0
- package/dist/src/devices/models/common/temperature.d.ts.map +1 -0
- package/dist/src/devices/models/common/temperature.js +3 -0
- package/dist/src/devices/models/common/temperature.js.map +1 -0
- package/dist/src/devices/models/metriport-data.d.ts +5 -0
- package/dist/src/devices/models/metriport-data.d.ts.map +1 -0
- package/dist/src/devices/models/metriport-data.js +3 -0
- package/dist/src/devices/models/metriport-data.js.map +1 -0
- package/dist/src/devices/models/nutrition.d.ts +14 -0
- package/dist/src/devices/models/nutrition.d.ts.map +1 -0
- package/dist/src/devices/models/nutrition.js +3 -0
- package/dist/src/devices/models/nutrition.js.map +1 -0
- package/dist/src/devices/models/sleep.d.ts +29 -0
- package/dist/src/devices/models/sleep.d.ts.map +1 -0
- package/dist/src/devices/models/sleep.js +3 -0
- package/dist/src/devices/models/sleep.js.map +1 -0
- package/dist/src/devices/models/user.d.ts +14 -0
- package/dist/src/devices/models/user.d.ts.map +1 -0
- package/dist/src/devices/models/user.js +3 -0
- package/dist/src/devices/models/user.js.map +1 -0
- package/dist/src/index.d.ts +30 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +76 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/medical/client/metriport.d.ts +598 -0
- package/dist/src/medical/client/metriport.d.ts.map +1 -0
- package/dist/src/medical/client/metriport.js +956 -0
- package/dist/src/medical/client/metriport.js.map +1 -0
- package/dist/src/medical/models/common/address.d.ts +158 -0
- package/dist/src/medical/models/common/address.d.ts.map +1 -0
- package/dist/src/medical/models/common/address.js +29 -0
- package/dist/src/medical/models/common/address.js.map +1 -0
- package/dist/src/medical/models/common/base-update.d.ts +16 -0
- package/dist/src/medical/models/common/base-update.d.ts.map +1 -0
- package/dist/src/medical/models/common/base-update.js +13 -0
- package/dist/src/medical/models/common/base-update.js.map +1 -0
- package/dist/src/medical/models/common/medical-data-source.d.ts +5 -0
- package/dist/src/medical/models/common/medical-data-source.d.ts.map +1 -0
- package/dist/src/medical/models/common/medical-data-source.js +9 -0
- package/dist/src/medical/models/common/medical-data-source.js.map +1 -0
- package/dist/src/medical/models/common/us-data.d.ts +111 -0
- package/dist/src/medical/models/common/us-data.d.ts.map +1 -0
- package/dist/src/medical/models/common/us-data.js +12 -0
- package/dist/src/medical/models/common/us-data.js.map +1 -0
- package/dist/src/medical/models/demographics.d.ts +903 -0
- package/dist/src/medical/models/demographics.d.ts.map +1 -0
- package/dist/src/medical/models/demographics.js +60 -0
- package/dist/src/medical/models/demographics.js.map +1 -0
- package/dist/src/medical/models/document.d.ts +290 -0
- package/dist/src/medical/models/document.d.ts.map +1 -0
- package/dist/src/medical/models/document.js +45 -0
- package/dist/src/medical/models/document.js.map +1 -0
- package/dist/src/medical/models/embed-token.d.ts +7 -0
- package/dist/src/medical/models/embed-token.d.ts.map +1 -0
- package/dist/src/medical/models/embed-token.js +3 -0
- package/dist/src/medical/models/embed-token.js.map +1 -0
- package/dist/src/medical/models/facility.d.ts +458 -0
- package/dist/src/medical/models/facility.d.ts.map +1 -0
- package/dist/src/medical/models/facility.js +22 -0
- package/dist/src/medical/models/facility.js.map +1 -0
- package/dist/src/medical/models/fhir.d.ts +109 -0
- package/dist/src/medical/models/fhir.d.ts.map +1 -0
- package/dist/src/medical/models/fhir.js +33 -0
- package/dist/src/medical/models/fhir.js.map +1 -0
- package/dist/src/medical/models/medicalRecordStatus.d.ts +5 -0
- package/dist/src/medical/models/medicalRecordStatus.d.ts.map +1 -0
- package/dist/src/medical/models/medicalRecordStatus.js +3 -0
- package/dist/src/medical/models/medicalRecordStatus.js.map +1 -0
- package/dist/src/medical/models/network-entry.d.ts +11 -0
- package/dist/src/medical/models/network-entry.d.ts.map +1 -0
- package/dist/src/medical/models/network-entry.js +3 -0
- package/dist/src/medical/models/network-entry.js.map +1 -0
- package/dist/src/medical/models/organization.d.ts +269 -0
- package/dist/src/medical/models/organization.d.ts.map +1 -0
- package/dist/src/medical/models/organization.js +20 -0
- package/dist/src/medical/models/organization.js.map +1 -0
- package/dist/src/medical/models/patient.d.ts +2406 -0
- package/dist/src/medical/models/patient.d.ts.map +1 -0
- package/dist/src/medical/models/patient.js +25 -0
- package/dist/src/medical/models/patient.js.map +1 -0
- package/dist/src/medical/models/patientDTO.d.ts +56 -0
- package/dist/src/medical/models/patientDTO.d.ts.map +1 -0
- package/dist/src/medical/models/patientDTO.js +3 -0
- package/dist/src/medical/models/patientDTO.js.map +1 -0
- package/dist/src/medical/models/settings-response.d.ts +6 -0
- package/dist/src/medical/models/settings-response.d.ts.map +1 -0
- package/dist/src/medical/models/settings-response.js +3 -0
- package/dist/src/medical/models/settings-response.js.map +1 -0
- package/dist/src/shared.d.ts +7 -0
- package/dist/src/shared.d.ts.map +1 -0
- package/dist/src/shared.js +19 -0
- package/dist/src/shared.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MetriportDevicesApi = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const shared_1 = require("../../shared");
|
|
9
|
+
const date_util_1 = require("./util/date-util");
|
|
10
|
+
const timezone_util_1 = require("./util/timezone-util");
|
|
11
|
+
class MetriportDevicesApi {
|
|
12
|
+
api;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new instance of the Metriport Devices API client.
|
|
15
|
+
*
|
|
16
|
+
* @param apiKey - Your Metriport API key.
|
|
17
|
+
* @param options - Optional parameters
|
|
18
|
+
* @param options.sandbox - Indicates whether to connect to the sandbox, default false.
|
|
19
|
+
* @param options.timeout - Connection timeout in milliseconds, default 20 seconds.
|
|
20
|
+
*/
|
|
21
|
+
constructor(apiKey, options = {}) {
|
|
22
|
+
const { sandbox, timeout } = options;
|
|
23
|
+
const baseURL = options.baseAddress || (sandbox ? shared_1.BASE_ADDRESS_SANDBOX : shared_1.BASE_ADDRESS);
|
|
24
|
+
this.api = axios_1.default.create({
|
|
25
|
+
timeout: timeout ?? shared_1.DEFAULT_AXIOS_TIMEOUT_MILLIS,
|
|
26
|
+
baseURL,
|
|
27
|
+
headers: { [shared_1.API_KEY_HEADER]: apiKey },
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* For your given user ID, returns the Metriport user ID used for identifying
|
|
32
|
+
* the user and making subsequent calls for the user's data.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} appUserId - The unique ID for the user in your app.
|
|
35
|
+
* @returns The userId of the user.
|
|
36
|
+
*/
|
|
37
|
+
async getMetriportUserId(appUserId) {
|
|
38
|
+
const resp = await this.api.post("/user", null, {
|
|
39
|
+
params: { appUserId: appUserId },
|
|
40
|
+
});
|
|
41
|
+
return resp.data.userId;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* For your given user ID, returns the user's connected providers
|
|
45
|
+
*
|
|
46
|
+
* @param {string} userId - The unique ID for the user in your app.
|
|
47
|
+
* @returns Object containing array of connected providers.
|
|
48
|
+
*/
|
|
49
|
+
async getConnectedProviders(userId) {
|
|
50
|
+
const resp = await this.api.get(`/user/${userId}/connected-providers`);
|
|
51
|
+
return resp.data;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns all your users and their connected providers.
|
|
55
|
+
*
|
|
56
|
+
* @returns List of connected users, containing their ids and providers.
|
|
57
|
+
*/
|
|
58
|
+
async getConnectedUsers() {
|
|
59
|
+
const resp = await this.api.get("/user");
|
|
60
|
+
return resp.data;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* For the given user ID, get a token to be used for a Metriport Connect session.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} userId - The user ID of the user that will be using the Connect widget.
|
|
66
|
+
* @returns The Metriport Connect session token.
|
|
67
|
+
*/
|
|
68
|
+
async getConnectToken(userId) {
|
|
69
|
+
const resp = await this.api.get("/user/connect/token", {
|
|
70
|
+
params: { userId: userId },
|
|
71
|
+
});
|
|
72
|
+
return resp.data.token;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* For the given user ID, revokes the user's access to the specified provider.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} userId - The user ID of the user for which to revoke access.
|
|
78
|
+
* @param {ProviderSource} provider - The data provider to revoke access to.
|
|
79
|
+
* @returns void.
|
|
80
|
+
*/
|
|
81
|
+
async revokeUserAccessToProvider(userId, provider) {
|
|
82
|
+
await this.api.delete(`/user/${userId}/revoke`, {
|
|
83
|
+
params: { provider: provider.toString() },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* For the given user ID, revokes access tokens for all providers and deletes the user.
|
|
88
|
+
*
|
|
89
|
+
* @param {string} userId - The user ID of the user to be deleted.
|
|
90
|
+
* @returns void.
|
|
91
|
+
*/
|
|
92
|
+
async deleteUser(userId) {
|
|
93
|
+
await this.api.delete(`/user/${userId}`);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Connects the user to a remote patient monitoring (RPM) device provider.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} provider - A healthcare data provider (currently only includes `tenovi`).
|
|
99
|
+
* @param {string} token - The connect token that was generated by the getConnectToken method.
|
|
100
|
+
* @param {string[]} deviceIds - A list of device IDs to connect to the user.
|
|
101
|
+
* @param {string} deviceUserId - The user ID (patient ID, for Tenovi) of the user that is connected to the device.
|
|
102
|
+
*/
|
|
103
|
+
async connectRpmProvider(provider, token, deviceIds, deviceUserId) {
|
|
104
|
+
await this.api.post(`/connect/rpm/${provider}/?token=${token}&deviceIds=${deviceIds.join(",")}&deviceUserId=${deviceUserId}`);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Disconnects a single RPM device from the user.
|
|
108
|
+
* @param userId - The Metriport user ID of the user to disconnect the given device from.
|
|
109
|
+
* @param provider - The RPM device provider (currently only includes `tenovi`).
|
|
110
|
+
* @param deviceId - The HWI ID of the device to be disconnected.
|
|
111
|
+
* @param x_tenovi_api_key - Your Tenovi API key.
|
|
112
|
+
* @param x_tenovi_client_name - Your Tenovi Client name.
|
|
113
|
+
*/
|
|
114
|
+
async disconnectDevice(userId, provider, deviceId, x_tenovi_api_key, x_tenovi_client_name) {
|
|
115
|
+
await this.api.delete(`/user/${userId}/device/?provider=${provider}&deviceId=${deviceId}`, {
|
|
116
|
+
headers: {
|
|
117
|
+
"x-tenovi-api-key": x_tenovi_api_key,
|
|
118
|
+
"x-tenovi-client-name": x_tenovi_client_name,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Gets the activity info for the specified user ID and date.
|
|
124
|
+
*
|
|
125
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
126
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
127
|
+
* @param {string} timezoneId - The timezoneId to get the user's data for (for example: America/Los_Angeles).
|
|
128
|
+
* @returns An array of activity data from each connected provider.
|
|
129
|
+
*/
|
|
130
|
+
async getActivityData(userId, date, timezoneId) {
|
|
131
|
+
const resp = await this.api.get("/activity", {
|
|
132
|
+
params: this.validateAndBuildParams(userId, date, timezoneId),
|
|
133
|
+
});
|
|
134
|
+
return resp.data;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Gets the body data for the specified user ID and date.
|
|
138
|
+
*
|
|
139
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
140
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
141
|
+
* @param {string} timezoneId - The timezoneId to get the user's data for (for example: America/Los_Angeles).
|
|
142
|
+
* @returns An array of body data from each connected provider.
|
|
143
|
+
*/
|
|
144
|
+
async getBodyData(userId, date, timezoneId) {
|
|
145
|
+
const resp = await this.api.get("/body", {
|
|
146
|
+
params: this.validateAndBuildParams(userId, date, timezoneId),
|
|
147
|
+
});
|
|
148
|
+
return resp.data;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Gets the biometrics data for the specified user ID and date.
|
|
152
|
+
*
|
|
153
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
154
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
155
|
+
* @param {string} timezoneId - The timezoneId to get the user's data for (for example: America/Los_Angeles).
|
|
156
|
+
* @returns An array of biometrics data from each connected provider.
|
|
157
|
+
*/
|
|
158
|
+
async getBiometricsData(userId, date, timezoneId) {
|
|
159
|
+
const resp = await this.api.get("/biometrics", {
|
|
160
|
+
params: this.validateAndBuildParams(userId, date, timezoneId),
|
|
161
|
+
});
|
|
162
|
+
return resp.data;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Gets the nutrition data for the specified user ID and date.
|
|
166
|
+
*
|
|
167
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
168
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
169
|
+
* @param {string} timezoneId - The timezoneId to get the user's data for (for example: America/Los_Angeles).
|
|
170
|
+
* @returns An array of nutrition data from each connected provider.
|
|
171
|
+
*/
|
|
172
|
+
async getNutritionData(userId, date, timezoneId) {
|
|
173
|
+
const resp = await this.api.get("/nutrition", {
|
|
174
|
+
params: this.validateAndBuildParams(userId, date, timezoneId),
|
|
175
|
+
});
|
|
176
|
+
return resp.data;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Gets the sleep data for the specified user ID and date.
|
|
180
|
+
*
|
|
181
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
182
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
183
|
+
* @param {string} timezoneId - The timezoneId to get the user's data for (for example: America/Los_Angeles).
|
|
184
|
+
* @returns An array of sleep data from each connected provider.
|
|
185
|
+
*/
|
|
186
|
+
async getSleepData(userId, date, timezoneId) {
|
|
187
|
+
const resp = await this.api.get("/sleep", {
|
|
188
|
+
params: this.validateAndBuildParams(userId, date, timezoneId),
|
|
189
|
+
});
|
|
190
|
+
return resp.data;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Gets the user info for the specified user ID and date.
|
|
194
|
+
*
|
|
195
|
+
* @param {string} userId - The userId of the user you want to get data for.
|
|
196
|
+
* @param {string} date - The date you want to get the data for (YYYY-MM-DD).
|
|
197
|
+
* @param {string} timezoneId - The timezoneId to get the user's data for (for example: America/Los_Angeles).
|
|
198
|
+
* @returns An array of user data from each connected provider.
|
|
199
|
+
*/
|
|
200
|
+
async getUserData(userId, date, timezoneId) {
|
|
201
|
+
const resp = await this.api.get("/user", {
|
|
202
|
+
params: this.validateAndBuildParams(userId, date, timezoneId),
|
|
203
|
+
});
|
|
204
|
+
return resp.data;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* If the userId is empty or the date is not in the correct format, throw an error. Otherwise, return
|
|
208
|
+
* an object with the userId and date.
|
|
209
|
+
*
|
|
210
|
+
* @param {string} userId - The userId of the user you want to get the data for.
|
|
211
|
+
* @param {string} date - The date to get the user's data for.
|
|
212
|
+
* @param {string} timezoneId - The timezoneId to get the user's data for (for example: America/Los_Angeles).
|
|
213
|
+
* @returns an object with the userId and date properties.
|
|
214
|
+
*/
|
|
215
|
+
validateAndBuildParams(userId, date, timezoneId) {
|
|
216
|
+
if (userId.trim().length < 1)
|
|
217
|
+
throw Error(`userId must not be empty!`);
|
|
218
|
+
if (!(0, date_util_1.dateIsValid)(date))
|
|
219
|
+
throw Error(`date must be in format YYYY-MM-DD!`);
|
|
220
|
+
if (timezoneId && !(0, timezone_util_1.isValidTimezone)(timezoneId))
|
|
221
|
+
throw Error(`timezoneId must be a valid timezoneId!`);
|
|
222
|
+
return { userId, date, timezoneId };
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Gets the settings for your account.
|
|
226
|
+
*
|
|
227
|
+
* @returns Your account settings.
|
|
228
|
+
*/
|
|
229
|
+
async getSettings() {
|
|
230
|
+
const resp = await this.api.get("/settings");
|
|
231
|
+
return resp.data;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Update the settings for your account.
|
|
235
|
+
*
|
|
236
|
+
* @returns Your updated account settings.
|
|
237
|
+
*/
|
|
238
|
+
async updateSettings(webhookUrl) {
|
|
239
|
+
const resp = await this.api.post("/settings", {
|
|
240
|
+
webhookUrl,
|
|
241
|
+
});
|
|
242
|
+
return resp.data;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Gets the status of communication with your app's webhook.
|
|
246
|
+
*
|
|
247
|
+
* @returns The status of communication with your app's webhook.
|
|
248
|
+
*/
|
|
249
|
+
async getWebhookStatus() {
|
|
250
|
+
const resp = await this.api.get("/settings/webhook");
|
|
251
|
+
return resp.data;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Retries failed webhook requests.
|
|
255
|
+
*
|
|
256
|
+
* @returns void
|
|
257
|
+
*/
|
|
258
|
+
async retryWebhookRequests() {
|
|
259
|
+
await this.api.post("/settings/webhook/retry");
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
exports.MetriportDevicesApi = MetriportDevicesApi;
|
|
263
|
+
//# sourceMappingURL=metriport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metriport.js","sourceRoot":"","sources":["../../../../src/devices/client/metriport.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAC7C,yCAKsB;AActB,gDAA+C;AAC/C,wDAAuD;AAQvD,MAAa,mBAAmB;IACtB,GAAG,CAAgB;IAE3B;;;;;;;OAOG;IACH,YAAY,MAAc,EAAE,UAAmB,EAAE;QAC/C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QACrC,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,6BAAoB,CAAC,CAAC,CAAC,qBAAY,CAAC,CAAC;QACvF,IAAI,CAAC,GAAG,GAAG,eA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CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACjD,CAAC;CACF;AAlSD,kDAkSC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-connect-token-response.d.ts","sourceRoot":"","sources":["../../../../../src/devices/client/models/get-connect-token-response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-connect-token-response.js","sourceRoot":"","sources":["../../../../../src/devices/client/models/get-connect-token-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-connected-users-response.d.ts","sourceRoot":"","sources":["../../../../../src/devices/client/models/get-connected-users-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,iBAAiB,EAAE,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-connected-users-response.js","sourceRoot":"","sources":["../../../../../src/devices/client/models/get-connected-users-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-metriport-user-id-response.d.ts","sourceRoot":"","sources":["../../../../../src/devices/client/models/get-metriport-user-id-response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-metriport-user-id-response.js","sourceRoot":"","sources":["../../../../../src/devices/client/models/get-metriport-user-id-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-response.d.ts","sourceRoot":"","sources":["../../../../../src/devices/client/models/settings-response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-response.js","sourceRoot":"","sources":["../../../../../src/devices/client/models/settings-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-status-response.d.ts","sourceRoot":"","sources":["../../../../../src/devices/client/models/webhook-status-response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-status-response.js","sourceRoot":"","sources":["../../../../../src/devices/client/models/webhook-status-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-util.d.ts","sourceRoot":"","sources":["../../../../../src/devices/client/util/date-util.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAgBpD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateIsValid = dateIsValid;
|
|
4
|
+
function dateIsValid(dateStr) {
|
|
5
|
+
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
6
|
+
if (dateStr.match(regex) === null) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const date = new Date(dateStr);
|
|
10
|
+
const timestamp = date.getTime();
|
|
11
|
+
if (typeof timestamp !== "number" || Number.isNaN(timestamp)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return date.toISOString().startsWith(dateStr);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=date-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-util.js","sourceRoot":"","sources":["../../../../../src/devices/client/util/date-util.ts"],"names":[],"mappings":";;AAAA,kCAgBC;AAhBD,SAAgB,WAAW,CAAC,OAAe;IACzC,MAAM,KAAK,GAAG,qBAAqB,CAAC;IAEpC,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAE/B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAEjC,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timezone-util.d.ts","sourceRoot":"","sources":["../../../../../src/devices/client/util/timezone-util.ts"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAQzD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidTimezone = isValidTimezone;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
9
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
10
|
+
function isValidTimezone(timezone) {
|
|
11
|
+
try {
|
|
12
|
+
const sampleDate = "1945-05-09";
|
|
13
|
+
dayjs_1.default.tz(sampleDate, timezone);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=timezone-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timezone-util.js","sourceRoot":"","sources":["../../../../../src/devices/client/util/timezone-util.ts"],"names":[],"mappings":";;;;;AAKA,0CAQC;AAbD,kDAA0B;AAC1B,qEAA6C;AAE7C,eAAK,CAAC,MAAM,CAAC,kBAAQ,CAAC,CAAC;AAEvB,SAAgB,eAAe,CAAC,QAAgB;IAC9C,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,YAAY,CAAC;QAChC,eAAK,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ActivityDurations } from "./common/activity-durations";
|
|
2
|
+
import { ActivityLog } from "./common/activity-log";
|
|
3
|
+
import { ActivityMovement } from "./common/activity-movement";
|
|
4
|
+
import { EnergyExpenditure } from "./common/energy-expenditure";
|
|
5
|
+
import { HeartRate } from "./common/heart-rate";
|
|
6
|
+
import { HeartRateVariability } from "./common/heart-rate-variability";
|
|
7
|
+
import { Respiration } from "./common/respiration";
|
|
8
|
+
import { MetriportData } from "./metriport-data";
|
|
9
|
+
export interface Activity extends MetriportData {
|
|
10
|
+
summary?: {
|
|
11
|
+
durations?: ActivityDurations;
|
|
12
|
+
energy_expenditure?: EnergyExpenditure;
|
|
13
|
+
movement?: ActivityMovement;
|
|
14
|
+
biometrics?: {
|
|
15
|
+
heart_rate?: HeartRate;
|
|
16
|
+
hrv?: HeartRateVariability;
|
|
17
|
+
respiration?: Respiration;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
activity_logs?: ActivityLog[];
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../../src/devices/models/activity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,QAAS,SAAQ,aAAa;IAC7C,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,iBAAiB,CAAC;QAC9B,kBAAkB,CAAC,EAAE,iBAAiB,CAAC;QACvC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;QAC5B,UAAU,CAAC,EAAE;YACX,UAAU,CAAC,EAAE,SAAS,CAAC;YACvB,GAAG,CAAC,EAAE,oBAAoB,CAAC;YAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;SAC3B,CAAC;KACH,CAAC;IACF,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../../../../src/devices/models/activity.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BloodGlucose } from "./common/blood-glucose";
|
|
2
|
+
import { BloodPressure } from "./common/blood-pressure";
|
|
3
|
+
import { HeartRate } from "./common/heart-rate";
|
|
4
|
+
import { HeartRateVariability } from "./common/heart-rate-variability";
|
|
5
|
+
import { Respiration } from "./common/respiration";
|
|
6
|
+
import { Temperature } from "./common/temperature";
|
|
7
|
+
import { MetriportData } from "./metriport-data";
|
|
8
|
+
export interface Biometrics extends MetriportData {
|
|
9
|
+
blood_glucose?: BloodGlucose;
|
|
10
|
+
blood_pressure?: BloodPressure;
|
|
11
|
+
heart_rate?: HeartRate;
|
|
12
|
+
hrv?: HeartRateVariability;
|
|
13
|
+
perfusion_index_pct?: number;
|
|
14
|
+
respiration?: Respiration;
|
|
15
|
+
temperature?: Temperature;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=biometrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biometrics.d.ts","sourceRoot":"","sources":["../../../../src/devices/models/biometrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,GAAG,CAAC,EAAE,oBAAoB,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;CAE3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biometrics.js","sourceRoot":"","sources":["../../../../src/devices/models/biometrics.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MetriportData } from "./metriport-data";
|
|
2
|
+
import { Sample } from "./common/sample";
|
|
3
|
+
export interface Body extends MetriportData {
|
|
4
|
+
body_fat_pct?: number;
|
|
5
|
+
height_cm?: number;
|
|
6
|
+
weight_kg?: number;
|
|
7
|
+
bone_mass_kg?: number;
|
|
8
|
+
muscle_mass_kg?: number;
|
|
9
|
+
lean_mass_kg?: number;
|
|
10
|
+
max_possible_heart_rate_bpm?: number;
|
|
11
|
+
weight_samples_kg?: Sample[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../../src/devices/models/body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,MAAM,WAAW,IAAK,SAAQ,aAAa;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../../../src/devices/models/body.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ActivityDurations {
|
|
2
|
+
active_seconds?: number;
|
|
3
|
+
intensity?: {
|
|
4
|
+
rest_seconds?: number;
|
|
5
|
+
very_low_seconds?: number;
|
|
6
|
+
low_seconds?: number;
|
|
7
|
+
med_seconds?: number;
|
|
8
|
+
high_seconds?: number;
|
|
9
|
+
};
|
|
10
|
+
strain?: {
|
|
11
|
+
rest_seconds?: number;
|
|
12
|
+
very_low_seconds?: number;
|
|
13
|
+
low_seconds?: number;
|
|
14
|
+
med_seconds?: number;
|
|
15
|
+
high_seconds?: number;
|
|
16
|
+
very_high_seconds?: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=activity-durations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-durations.d.ts","sourceRoot":"","sources":["../../../../../src/devices/models/common/activity-durations.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,SAAS,CAAC,EAAE;QACV,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IAEF,MAAM,CAAC,EAAE;QACP,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-durations.js","sourceRoot":"","sources":["../../../../../src/devices/models/common/activity-durations.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ActivityDurations } from "./activity-durations";
|
|
2
|
+
import { ActivityMovement } from "./activity-movement";
|
|
3
|
+
import { EnergyExpenditure } from "./energy-expenditure";
|
|
4
|
+
import { HeartRate } from "./heart-rate";
|
|
5
|
+
import { HeartRateVariability } from "./heart-rate-variability";
|
|
6
|
+
import { LatLon } from "./lat-lon";
|
|
7
|
+
import { Metadata } from "./metadata";
|
|
8
|
+
import { Respiration } from "./respiration";
|
|
9
|
+
export interface ActivityLog {
|
|
10
|
+
metadata: Metadata;
|
|
11
|
+
name?: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
start_time?: string;
|
|
14
|
+
end_time?: string;
|
|
15
|
+
durations?: ActivityDurations;
|
|
16
|
+
energy_expenditure?: EnergyExpenditure;
|
|
17
|
+
movement?: ActivityMovement;
|
|
18
|
+
location?: {
|
|
19
|
+
start_lat_lon_deg?: LatLon;
|
|
20
|
+
end_lat_lon_deg?: LatLon;
|
|
21
|
+
polystring?: string;
|
|
22
|
+
city?: string;
|
|
23
|
+
country?: string;
|
|
24
|
+
region?: string;
|
|
25
|
+
};
|
|
26
|
+
biometrics?: {
|
|
27
|
+
heart_rate?: HeartRate;
|
|
28
|
+
hrv?: HeartRateVariability;
|
|
29
|
+
respiration?: Respiration;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=activity-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-log.d.ts","sourceRoot":"","sources":["../../../../../src/devices/models/common/activity-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,kBAAkB,CAAC,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE;QACT,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,UAAU,CAAC,EAAE,SAAS,CAAC;QACvB,GAAG,CAAC,EAAE,oBAAoB,CAAC;QAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,CAAC;CAEH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-log.js","sourceRoot":"","sources":["../../../../../src/devices/models/common/activity-log.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ActivityMovement {
|
|
2
|
+
steps_count?: number;
|
|
3
|
+
floors_count?: number;
|
|
4
|
+
elevation?: {
|
|
5
|
+
gain_meters?: number;
|
|
6
|
+
min_meters?: number;
|
|
7
|
+
max_meters?: number;
|
|
8
|
+
};
|
|
9
|
+
speed?: {
|
|
10
|
+
max_km_h?: number;
|
|
11
|
+
avg_km_h?: number;
|
|
12
|
+
};
|
|
13
|
+
avg_cadence?: number;
|
|
14
|
+
distance_meters?: number;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=activity-movement.d.ts.map
|