@metriport/api-sdk 6.0.3-alpha.1 → 6.0.3-alpha.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 (193) hide show
  1. package/dist/devices/client/metriport.d.ts +155 -0
  2. package/dist/devices/client/metriport.d.ts.map +1 -0
  3. package/dist/devices/client/metriport.js +225 -0
  4. package/dist/devices/client/metriport.js.map +1 -0
  5. package/dist/devices/client/models/get-connect-token-response.d.ts +4 -0
  6. package/dist/devices/client/models/get-connect-token-response.d.ts.map +1 -0
  7. package/dist/devices/client/models/get-connect-token-response.js +3 -0
  8. package/dist/devices/client/models/get-connect-token-response.js.map +1 -0
  9. package/dist/devices/client/models/get-connected-users-response.d.ts +5 -0
  10. package/dist/devices/client/models/get-connected-users-response.d.ts.map +1 -0
  11. package/dist/devices/client/models/get-connected-users-response.js +3 -0
  12. package/dist/devices/client/models/get-connected-users-response.js.map +1 -0
  13. package/dist/devices/client/models/get-metriport-user-id-response.d.ts +4 -0
  14. package/dist/devices/client/models/get-metriport-user-id-response.d.ts.map +1 -0
  15. package/dist/devices/client/models/get-metriport-user-id-response.js +3 -0
  16. package/dist/devices/client/models/get-metriport-user-id-response.js.map +1 -0
  17. package/dist/devices/client/models/settings-response.d.ts +6 -0
  18. package/dist/devices/client/models/settings-response.d.ts.map +1 -0
  19. package/dist/devices/client/models/settings-response.js +3 -0
  20. package/dist/devices/client/models/settings-response.js.map +1 -0
  21. package/dist/devices/client/models/webhook-status-response.d.ts +7 -0
  22. package/dist/devices/client/models/webhook-status-response.d.ts.map +1 -0
  23. package/dist/devices/client/models/webhook-status-response.js +3 -0
  24. package/dist/devices/client/models/webhook-status-response.js.map +1 -0
  25. package/dist/devices/client/util/date-util.d.ts +2 -0
  26. package/dist/devices/client/util/date-util.d.ts.map +1 -0
  27. package/dist/devices/client/util/date-util.js +17 -0
  28. package/dist/devices/client/util/date-util.js.map +1 -0
  29. package/dist/devices/models/activity.d.ts +22 -0
  30. package/dist/devices/models/activity.d.ts.map +1 -0
  31. package/dist/devices/models/activity.js +3 -0
  32. package/dist/devices/models/activity.js.map +1 -0
  33. package/dist/devices/models/biometrics.d.ts +16 -0
  34. package/dist/devices/models/biometrics.d.ts.map +1 -0
  35. package/dist/devices/models/biometrics.js +3 -0
  36. package/dist/devices/models/biometrics.js.map +1 -0
  37. package/dist/devices/models/body.d.ts +13 -0
  38. package/dist/devices/models/body.d.ts.map +1 -0
  39. package/dist/devices/models/body.js +3 -0
  40. package/dist/devices/models/body.js.map +1 -0
  41. package/dist/devices/models/common/activity-durations.d.ts +19 -0
  42. package/dist/devices/models/common/activity-durations.d.ts.map +1 -0
  43. package/dist/devices/models/common/activity-durations.js +3 -0
  44. package/dist/devices/models/common/activity-durations.js.map +1 -0
  45. package/dist/devices/models/common/activity-log.d.ts +32 -0
  46. package/dist/devices/models/common/activity-log.d.ts.map +1 -0
  47. package/dist/devices/models/common/activity-log.js +3 -0
  48. package/dist/devices/models/common/activity-log.js.map +1 -0
  49. package/dist/devices/models/common/activity-movement.d.ts +16 -0
  50. package/dist/devices/models/common/activity-movement.d.ts.map +1 -0
  51. package/dist/devices/models/common/activity-movement.js +3 -0
  52. package/dist/devices/models/common/activity-movement.js.map +1 -0
  53. package/dist/devices/models/common/aminos.d.ts +23 -0
  54. package/dist/devices/models/common/aminos.d.ts.map +1 -0
  55. package/dist/devices/models/common/aminos.js +3 -0
  56. package/dist/devices/models/common/aminos.js.map +1 -0
  57. package/dist/devices/models/common/blood-glucose.d.ts +6 -0
  58. package/dist/devices/models/common/blood-glucose.d.ts.map +1 -0
  59. package/dist/devices/models/common/blood-glucose.js +3 -0
  60. package/dist/devices/models/common/blood-glucose.js.map +1 -0
  61. package/dist/devices/models/common/blood-pressure.d.ts +10 -0
  62. package/dist/devices/models/common/blood-pressure.d.ts.map +1 -0
  63. package/dist/devices/models/common/blood-pressure.js +3 -0
  64. package/dist/devices/models/common/blood-pressure.js.map +1 -0
  65. package/dist/devices/models/common/connected-user-info.d.ts +6 -0
  66. package/dist/devices/models/common/connected-user-info.d.ts.map +1 -0
  67. package/dist/devices/models/common/connected-user-info.js +3 -0
  68. package/dist/devices/models/common/connected-user-info.js.map +1 -0
  69. package/dist/devices/models/common/energy-expenditure.d.ts +7 -0
  70. package/dist/devices/models/common/energy-expenditure.d.ts.map +1 -0
  71. package/dist/devices/models/common/energy-expenditure.js +3 -0
  72. package/dist/devices/models/common/energy-expenditure.js.map +1 -0
  73. package/dist/devices/models/common/food.d.ts +15 -0
  74. package/dist/devices/models/common/food.d.ts.map +1 -0
  75. package/dist/devices/models/common/food.js +3 -0
  76. package/dist/devices/models/common/food.js.map +1 -0
  77. package/dist/devices/models/common/heart-rate-variability.d.ts +12 -0
  78. package/dist/devices/models/common/heart-rate-variability.d.ts.map +1 -0
  79. package/dist/devices/models/common/heart-rate-variability.js +3 -0
  80. package/dist/devices/models/common/heart-rate-variability.js.map +1 -0
  81. package/dist/devices/models/common/heart-rate.d.ts +9 -0
  82. package/dist/devices/models/common/heart-rate.d.ts.map +1 -0
  83. package/dist/devices/models/common/heart-rate.js +3 -0
  84. package/dist/devices/models/common/heart-rate.js.map +1 -0
  85. package/dist/devices/models/common/lat-lon.d.ts +5 -0
  86. package/dist/devices/models/common/lat-lon.d.ts.map +1 -0
  87. package/dist/devices/models/common/lat-lon.js +3 -0
  88. package/dist/devices/models/common/lat-lon.js.map +1 -0
  89. package/dist/devices/models/common/macros.d.ts +14 -0
  90. package/dist/devices/models/common/macros.d.ts.map +1 -0
  91. package/dist/devices/models/common/macros.js +3 -0
  92. package/dist/devices/models/common/macros.js.map +1 -0
  93. package/dist/devices/models/common/metadata.d.ts +10 -0
  94. package/dist/devices/models/common/metadata.d.ts.map +1 -0
  95. package/dist/devices/models/common/metadata.js +3 -0
  96. package/dist/devices/models/common/metadata.js.map +1 -0
  97. package/dist/devices/models/common/micros.d.ts +28 -0
  98. package/dist/devices/models/common/micros.d.ts.map +1 -0
  99. package/dist/devices/models/common/micros.js +3 -0
  100. package/dist/devices/models/common/micros.js.map +1 -0
  101. package/dist/devices/models/common/provider-source.d.ts +12 -0
  102. package/dist/devices/models/common/provider-source.d.ts.map +1 -0
  103. package/dist/devices/models/common/provider-source.js +16 -0
  104. package/dist/devices/models/common/provider-source.js.map +1 -0
  105. package/dist/devices/models/common/respiration.d.ts +15 -0
  106. package/dist/devices/models/common/respiration.d.ts.map +1 -0
  107. package/dist/devices/models/common/respiration.js +3 -0
  108. package/dist/devices/models/common/respiration.js.map +1 -0
  109. package/dist/devices/models/common/sample.d.ts +7 -0
  110. package/dist/devices/models/common/sample.d.ts.map +1 -0
  111. package/dist/devices/models/common/sample.js +3 -0
  112. package/dist/devices/models/common/sample.js.map +1 -0
  113. package/dist/devices/models/common/sex.d.ts +2 -0
  114. package/dist/devices/models/common/sex.d.ts.map +1 -0
  115. package/dist/devices/models/common/sex.js +3 -0
  116. package/dist/devices/models/common/sex.js.map +1 -0
  117. package/dist/devices/models/common/source-info.d.ts +8 -0
  118. package/dist/devices/models/common/source-info.d.ts.map +1 -0
  119. package/dist/devices/models/common/source-info.js +3 -0
  120. package/dist/devices/models/common/source-info.js.map +1 -0
  121. package/dist/devices/models/common/source-type.d.ts +5 -0
  122. package/dist/devices/models/common/source-type.d.ts.map +1 -0
  123. package/dist/devices/models/common/source-type.js +9 -0
  124. package/dist/devices/models/common/source-type.js.map +1 -0
  125. package/dist/devices/models/common/temperature.d.ts +13 -0
  126. package/dist/devices/models/common/temperature.d.ts.map +1 -0
  127. package/dist/devices/models/common/temperature.js +3 -0
  128. package/dist/devices/models/common/temperature.js.map +1 -0
  129. package/dist/devices/models/metriport-data.d.ts +5 -0
  130. package/dist/devices/models/metriport-data.d.ts.map +1 -0
  131. package/dist/devices/models/metriport-data.js +3 -0
  132. package/dist/devices/models/metriport-data.js.map +1 -0
  133. package/dist/devices/models/nutrition.d.ts +14 -0
  134. package/dist/devices/models/nutrition.d.ts.map +1 -0
  135. package/dist/devices/models/nutrition.js +3 -0
  136. package/dist/devices/models/nutrition.js.map +1 -0
  137. package/dist/devices/models/sleep.d.ts +28 -0
  138. package/dist/devices/models/sleep.d.ts.map +1 -0
  139. package/dist/devices/models/sleep.js +3 -0
  140. package/dist/devices/models/sleep.js.map +1 -0
  141. package/dist/devices/models/user.d.ts +14 -0
  142. package/dist/devices/models/user.d.ts.map +1 -0
  143. package/dist/devices/models/user.js +3 -0
  144. package/dist/devices/models/user.js.map +1 -0
  145. package/dist/index.d.ts +22 -0
  146. package/dist/index.d.ts.map +1 -0
  147. package/dist/index.js +47 -0
  148. package/dist/index.js.map +1 -0
  149. package/dist/medical/client/metriport.d.ts +152 -0
  150. package/dist/medical/client/metriport.d.ts.map +1 -0
  151. package/dist/medical/client/metriport.js +290 -0
  152. package/dist/medical/client/metriport.js.map +1 -0
  153. package/dist/medical/models/common/address.d.ts +25 -0
  154. package/dist/medical/models/common/address.d.ts.map +1 -0
  155. package/dist/medical/models/common/address.js +21 -0
  156. package/dist/medical/models/common/address.js.map +1 -0
  157. package/dist/medical/models/common/base-update.d.ts +16 -0
  158. package/dist/medical/models/common/base-update.d.ts.map +1 -0
  159. package/dist/medical/models/common/base-update.js +13 -0
  160. package/dist/medical/models/common/base-update.js.map +1 -0
  161. package/dist/medical/models/common/medical-data-source.d.ts +4 -0
  162. package/dist/medical/models/common/medical-data-source.d.ts.map +1 -0
  163. package/dist/medical/models/common/medical-data-source.js +8 -0
  164. package/dist/medical/models/common/medical-data-source.js.map +1 -0
  165. package/dist/medical/models/common/us-data.d.ts +56 -0
  166. package/dist/medical/models/common/us-data.d.ts.map +1 -0
  167. package/dist/medical/models/common/us-data.js +60 -0
  168. package/dist/medical/models/common/us-data.js.map +1 -0
  169. package/dist/medical/models/demographics.d.ts +317 -0
  170. package/dist/medical/models/demographics.d.ts.map +1 -0
  171. package/dist/medical/models/demographics.js +50 -0
  172. package/dist/medical/models/demographics.js.map +1 -0
  173. package/dist/medical/models/document.d.ts +271 -0
  174. package/dist/medical/models/document.d.ts.map +1 -0
  175. package/dist/medical/models/document.js +41 -0
  176. package/dist/medical/models/document.js.map +1 -0
  177. package/dist/medical/models/facility.d.ts +214 -0
  178. package/dist/medical/models/facility.d.ts.map +1 -0
  179. package/dist/medical/models/facility.js +23 -0
  180. package/dist/medical/models/facility.js.map +1 -0
  181. package/dist/medical/models/organization.d.ts +115 -0
  182. package/dist/medical/models/organization.d.ts.map +1 -0
  183. package/dist/medical/models/organization.js +23 -0
  184. package/dist/medical/models/organization.js.map +1 -0
  185. package/dist/medical/models/patient.d.ts +1097 -0
  186. package/dist/medical/models/patient.d.ts.map +1 -0
  187. package/dist/medical/models/patient.js +15 -0
  188. package/dist/medical/models/patient.js.map +1 -0
  189. package/dist/shared.d.ts +14 -0
  190. package/dist/shared.d.ts.map +1 -0
  191. package/dist/shared.js +28 -0
  192. package/dist/shared.js.map +1 -0
  193. package/package.json +3 -3
@@ -0,0 +1,155 @@
1
+ import { Activity } from "../models/activity";
2
+ import { Biometrics } from "../models/biometrics";
3
+ import { Body } from "../models/body";
4
+ import { ProviderSource } from "../models/common/provider-source";
5
+ import { Nutrition } from "../models/nutrition";
6
+ import { Sleep } from "../models/sleep";
7
+ import { User } from "../models/user";
8
+ import { SettingsResponse } from "./models/settings-response";
9
+ import { WebhookStatusResponse } from "./models/webhook-status-response";
10
+ import { ConnectedUserInfo } from "../models/common/connected-user-info";
11
+ export type Options = {
12
+ sandbox?: boolean;
13
+ timeout?: number;
14
+ };
15
+ export declare class MetriportDevicesApi {
16
+ private api;
17
+ /**
18
+ * Creates a new instance of the Metriport Devices API client.
19
+ *
20
+ * @param apiKey - Your Metriport API key.
21
+ * @param options - Optional parameters
22
+ * @param options.sandbox - Indicates whether to connect to the sandbox, default false.
23
+ * @param options.timeout - Connection timeout in milliseconds, default 20 seconds.
24
+ */
25
+ constructor(apiKey: string, options?: Options);
26
+ /**
27
+ * For your given user ID, returns the Metriport user ID used for identifying
28
+ * the user and making subsequent calls for the user's data.
29
+ *
30
+ * @param {string} appUserId - The unique ID for the user in your app.
31
+ * @returns The userId of the user.
32
+ */
33
+ getMetriportUserId(appUserId: string): Promise<string>;
34
+ /**
35
+ * For your given user ID, returns the user's connected providers
36
+ *
37
+ * @param {string} userId - The unique ID for the user in your app.
38
+ * @returns Object containing array of connected providers.
39
+ */
40
+ getConnectedProviders(userId: string): Promise<{
41
+ connectedProviders: string[];
42
+ }>;
43
+ /**
44
+ * Returns all your users and their connected providers.
45
+ *
46
+ * @returns List of connected users, containing their ids and providers.
47
+ */
48
+ getConnectedUsers(): Promise<{
49
+ connectedUsers: ConnectedUserInfo[];
50
+ }>;
51
+ /**
52
+ * For the given user ID, get a token to be used for a Metriport Connect session.
53
+ *
54
+ * @param {string} userId - The user ID of the user that will be using the Connect widget.
55
+ * @returns The Metriport Connect session token.
56
+ */
57
+ getConnectToken(userId: string): Promise<string>;
58
+ /**
59
+ * For the given user ID, revokes the user's access to the specified provider.
60
+ *
61
+ * @param {string} userId - The user ID of the user for which to revoke access.
62
+ * @param {ProviderSource} provider - The data provider to revoke access to.
63
+ * @returns void.
64
+ */
65
+ revokeUserAccessToProvider(userId: string, provider: ProviderSource): Promise<void>;
66
+ /**
67
+ * For the given user ID, revokes access tokens for all providers and deletes the user.
68
+ *
69
+ * @param {string} userId - The user ID of the user to be deleted.
70
+ * @returns void.
71
+ */
72
+ deleteUser(userId: string): Promise<void>;
73
+ /**
74
+ * Gets the activity info for the specified user ID and date.
75
+ *
76
+ * @param {string} userId - The userId of the user you want to get data for.
77
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
78
+ * @returns An array of activity data from each connected provider.
79
+ */
80
+ getActivityData(userId: string, date: string): Promise<Activity[]>;
81
+ /**
82
+ * Gets the body data for the specified user ID and date.
83
+ *
84
+ * @param {string} userId - The userId of the user you want to get data for.
85
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
86
+ * @returns An array of body data from each connected provider.
87
+ */
88
+ getBodyData(userId: string, date: string): Promise<Body[]>;
89
+ /**
90
+ * Gets the biometrics data for the specified user ID and date.
91
+ *
92
+ * @param {string} userId - The userId of the user you want to get data for.
93
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
94
+ * @returns An array of biometrics data from each connected provider.
95
+ */
96
+ getBiometricsData(userId: string, date: string): Promise<Biometrics[]>;
97
+ /**
98
+ * Gets the nutrition data for the specified user ID and date.
99
+ *
100
+ * @param {string} userId - The userId of the user you want to get data for.
101
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
102
+ * @returns An array of nutrition data from each connected provider.
103
+ */
104
+ getNutritionData(userId: string, date: string): Promise<Nutrition[]>;
105
+ /**
106
+ * Gets the sleep data for the specified user ID and date.
107
+ *
108
+ * @param {string} userId - The userId of the user you want to get data for.
109
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
110
+ * @returns An array of sleep data from each connected provider.
111
+ */
112
+ getSleepData(userId: string, date: string): Promise<Sleep[]>;
113
+ /**
114
+ * Gets the user info for the specified user ID and date.
115
+ *
116
+ * @param {string} userId - The userId of the user you want to get data for.
117
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
118
+ * @returns An array of user data from each connected provider.
119
+ */
120
+ getUserData(userId: string, date: string): Promise<User[]>;
121
+ /**
122
+ * If the userId is empty or the date is not in the correct format, throw an error. Otherwise, return
123
+ * an object with the userId and date.
124
+ *
125
+ * @param {string} userId - The userId of the user you want to get the data for.
126
+ * @param {string} date - The date to get the user's schedule for.
127
+ * @returns an object with the userId and date properties.
128
+ */
129
+ private validateAndBuildParams;
130
+ /**
131
+ * Gets the settings for your account.
132
+ *
133
+ * @returns Your account settings.
134
+ */
135
+ getSettings(): Promise<SettingsResponse>;
136
+ /**
137
+ * Update the settings for your account.
138
+ *
139
+ * @returns Your updated account settings.
140
+ */
141
+ updateSettings(webhookUrl: string): Promise<SettingsResponse>;
142
+ /**
143
+ * Gets the status of communication with your app's webhook.
144
+ *
145
+ * @returns The status of communication with your app's webhook.
146
+ */
147
+ getWebhookStatus(): Promise<WebhookStatusResponse>;
148
+ /**
149
+ * Retries failed webhook requests.
150
+ *
151
+ * @returns void
152
+ */
153
+ retryWebhookRequests(): Promise<void>;
154
+ }
155
+ //# sourceMappingURL=metriport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metriport.d.ts","sourceRoot":"","sources":["../../../src/devices/client/metriport.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAGzE,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,GAAG,CAAgB;IAE3B;;;;;;;OAOG;gBACS,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY;IAUjD;;;;;;OAMG;IACG,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO5D;;;;;OAKG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,kBAAkB,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAQtF;;;;OAIG;IAC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,CAAC;IAOnE;;;;OAIG;IACG,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAKxD;;;;OAIG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5C"}
@@ -0,0 +1,225 @@
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
+ class MetriportDevicesApi {
11
+ /**
12
+ * Creates a new instance of the Metriport Devices API client.
13
+ *
14
+ * @param apiKey - Your Metriport API key.
15
+ * @param options - Optional parameters
16
+ * @param options.sandbox - Indicates whether to connect to the sandbox, default false.
17
+ * @param options.timeout - Connection timeout in milliseconds, default 20 seconds.
18
+ */
19
+ constructor(apiKey, options = {}) {
20
+ const { sandbox, timeout } = options;
21
+ const baseURL = sandbox ? shared_1.BASE_ADDRESS_SANDBOX : shared_1.BASE_ADDRESS;
22
+ this.api = axios_1.default.create({
23
+ timeout: timeout ?? shared_1.DEFAULT_AXIOS_TIMEOUT_MILLIS,
24
+ baseURL,
25
+ headers: { [shared_1.API_KEY_HEADER]: apiKey },
26
+ });
27
+ }
28
+ /**
29
+ * For your given user ID, returns the Metriport user ID used for identifying
30
+ * the user and making subsequent calls for the user's data.
31
+ *
32
+ * @param {string} appUserId - The unique ID for the user in your app.
33
+ * @returns The userId of the user.
34
+ */
35
+ async getMetriportUserId(appUserId) {
36
+ const resp = await this.api.post("/user", null, {
37
+ params: { appUserId: appUserId },
38
+ });
39
+ return resp.data.userId;
40
+ }
41
+ /**
42
+ * For your given user ID, returns the user's connected providers
43
+ *
44
+ * @param {string} userId - The unique ID for the user in your app.
45
+ * @returns Object containing array of connected providers.
46
+ */
47
+ async getConnectedProviders(userId) {
48
+ const resp = await this.api.get(`/user/${userId}/connected-providers`);
49
+ return resp.data;
50
+ }
51
+ /**
52
+ * Returns all your users and their connected providers.
53
+ *
54
+ * @returns List of connected users, containing their ids and providers.
55
+ */
56
+ async getConnectedUsers() {
57
+ const resp = await this.api.get("/user");
58
+ return resp.data;
59
+ }
60
+ /**
61
+ * For the given user ID, get a token to be used for a Metriport Connect session.
62
+ *
63
+ * @param {string} userId - The user ID of the user that will be using the Connect widget.
64
+ * @returns The Metriport Connect session token.
65
+ */
66
+ async getConnectToken(userId) {
67
+ const resp = await this.api.get("/user/connect/token", {
68
+ params: { userId: userId },
69
+ });
70
+ return resp.data.token;
71
+ }
72
+ /**
73
+ * For the given user ID, revokes the user's access to the specified provider.
74
+ *
75
+ * @param {string} userId - The user ID of the user for which to revoke access.
76
+ * @param {ProviderSource} provider - The data provider to revoke access to.
77
+ * @returns void.
78
+ */
79
+ async revokeUserAccessToProvider(userId, provider) {
80
+ await this.api.delete(`/user/${userId}/revoke`, {
81
+ params: { provider: provider.toString() },
82
+ });
83
+ }
84
+ /**
85
+ * For the given user ID, revokes access tokens for all providers and deletes the user.
86
+ *
87
+ * @param {string} userId - The user ID of the user to be deleted.
88
+ * @returns void.
89
+ */
90
+ async deleteUser(userId) {
91
+ await this.api.delete(`/user/${userId}`);
92
+ }
93
+ /**
94
+ * Gets the activity info for the specified user ID and date.
95
+ *
96
+ * @param {string} userId - The userId of the user you want to get data for.
97
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
98
+ * @returns An array of activity data from each connected provider.
99
+ */
100
+ async getActivityData(userId, date) {
101
+ const resp = await this.api.get("/activity", {
102
+ params: this.validateAndBuildParams(userId, date),
103
+ });
104
+ return resp.data;
105
+ }
106
+ /**
107
+ * Gets the body data for the specified user ID and date.
108
+ *
109
+ * @param {string} userId - The userId of the user you want to get data for.
110
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
111
+ * @returns An array of body data from each connected provider.
112
+ */
113
+ async getBodyData(userId, date) {
114
+ const resp = await this.api.get("/body", {
115
+ params: this.validateAndBuildParams(userId, date),
116
+ });
117
+ return resp.data;
118
+ }
119
+ /**
120
+ * Gets the biometrics data for the specified user ID and date.
121
+ *
122
+ * @param {string} userId - The userId of the user you want to get data for.
123
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
124
+ * @returns An array of biometrics data from each connected provider.
125
+ */
126
+ async getBiometricsData(userId, date) {
127
+ const resp = await this.api.get("/biometrics", {
128
+ params: this.validateAndBuildParams(userId, date),
129
+ });
130
+ return resp.data;
131
+ }
132
+ /**
133
+ * Gets the nutrition data for the specified user ID and date.
134
+ *
135
+ * @param {string} userId - The userId of the user you want to get data for.
136
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
137
+ * @returns An array of nutrition data from each connected provider.
138
+ */
139
+ async getNutritionData(userId, date) {
140
+ const resp = await this.api.get("/nutrition", {
141
+ params: this.validateAndBuildParams(userId, date),
142
+ });
143
+ return resp.data;
144
+ }
145
+ /**
146
+ * Gets the sleep data for the specified user ID and date.
147
+ *
148
+ * @param {string} userId - The userId of the user you want to get data for.
149
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
150
+ * @returns An array of sleep data from each connected provider.
151
+ */
152
+ async getSleepData(userId, date) {
153
+ const resp = await this.api.get("/sleep", {
154
+ params: this.validateAndBuildParams(userId, date),
155
+ });
156
+ return resp.data;
157
+ }
158
+ /**
159
+ * Gets the user info for the specified user ID and date.
160
+ *
161
+ * @param {string} userId - The userId of the user you want to get data for.
162
+ * @param {string} date - The date you want to get the data for (YYYY-MM-DD).
163
+ * @returns An array of user data from each connected provider.
164
+ */
165
+ async getUserData(userId, date) {
166
+ const resp = await this.api.get("/user", {
167
+ params: this.validateAndBuildParams(userId, date),
168
+ });
169
+ return resp.data;
170
+ }
171
+ /**
172
+ * If the userId is empty or the date is not in the correct format, throw an error. Otherwise, return
173
+ * an object with the userId and date.
174
+ *
175
+ * @param {string} userId - The userId of the user you want to get the data for.
176
+ * @param {string} date - The date to get the user's schedule for.
177
+ * @returns an object with the userId and date properties.
178
+ */
179
+ validateAndBuildParams(userId, date) {
180
+ if (userId.trim().length < 1)
181
+ throw Error(`userId must not be empty!`);
182
+ if (!(0, date_util_1.dateIsValid)(date))
183
+ throw Error(`date must be in format YYYY-MM-DD!`);
184
+ return { userId, date };
185
+ }
186
+ /**
187
+ * Gets the settings for your account.
188
+ *
189
+ * @returns Your account settings.
190
+ */
191
+ async getSettings() {
192
+ const resp = await this.api.get("/settings");
193
+ return resp.data;
194
+ }
195
+ /**
196
+ * Update the settings for your account.
197
+ *
198
+ * @returns Your updated account settings.
199
+ */
200
+ async updateSettings(webhookUrl) {
201
+ const resp = await this.api.post("/settings", {
202
+ webhookUrl,
203
+ });
204
+ return resp.data;
205
+ }
206
+ /**
207
+ * Gets the status of communication with your app's webhook.
208
+ *
209
+ * @returns The status of communication with your app's webhook.
210
+ */
211
+ async getWebhookStatus() {
212
+ const resp = await this.api.get("/settings/webhook");
213
+ return resp.data;
214
+ }
215
+ /**
216
+ * Retries failed webhook requests.
217
+ *
218
+ * @returns void
219
+ */
220
+ async retryWebhookRequests() {
221
+ await this.api.post("/settings/webhook/retry");
222
+ }
223
+ }
224
+ exports.MetriportDevicesApi = MetriportDevicesApi;
225
+ //# 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;AAO/C,MAAa,mBAAmB;IAG9B;;;;;;;OAOG;IACH,YAAY,MAAc,EAAE,UAAmB,EAAE;QAC/C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QACrC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,6BAAoB,CAAC,CAAC,CAAC,qBAAY,CAAC;QAC9D,IAAI,CAAC,GAAG,GAAG,eAAK,CAAC,MAAM,CAAC;YACt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mB,WAAW,EAAE;YAC9D,UAAU;SACX,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAwB,mBAAmB,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,oBAAoB;QACxB,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACjD,CAAC;CACF;AAzOD,kDAyOC"}
@@ -0,0 +1,4 @@
1
+ export interface GetConnectTokenResponse {
2
+ token: string;
3
+ }
4
+ //# sourceMappingURL=get-connect-token-response.d.ts.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=get-connect-token-response.js.map
@@ -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,5 @@
1
+ import { ConnectedUserInfo } from "../../models/common/connected-user-info";
2
+ export interface GetConnectedUsersResponse {
3
+ connectedUsers: ConnectedUserInfo[];
4
+ }
5
+ //# sourceMappingURL=get-connected-users-response.d.ts.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=get-connected-users-response.js.map
@@ -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,4 @@
1
+ export interface GetMetriportUserIDResponse {
2
+ userId: string;
3
+ }
4
+ //# sourceMappingURL=get-metriport-user-id-response.d.ts.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=get-metriport-user-id-response.js.map
@@ -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,6 @@
1
+ export interface SettingsResponse {
2
+ id: string;
3
+ webhookUrl?: string | null;
4
+ webhookKey?: string | null;
5
+ }
6
+ //# sourceMappingURL=settings-response.d.ts.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=settings-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-response.js","sourceRoot":"","sources":["../../../../src/devices/client/models/settings-response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export interface WebhookStatusResponse {
2
+ webhookEnabled: boolean;
3
+ webhookStatusDetail?: string;
4
+ webhookRequestsProcessing: number;
5
+ webhookRequestsFailed: number;
6
+ }
7
+ //# sourceMappingURL=webhook-status-response.d.ts.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=webhook-status-response.js.map
@@ -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,2 @@
1
+ export declare function dateIsValid(dateStr: string): boolean;
2
+ //# sourceMappingURL=date-util.d.ts.map
@@ -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,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dateIsValid = void 0;
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
+ exports.dateIsValid = dateIsValid;
17
+ //# 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,SAAgB,WAAW,CAAC,OAAe;IACzC,MAAM,KAAK,GAAG,qBAAqB,CAAC;IAEpC,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;QACjC,OAAO,KAAK,CAAC;KACd;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;QAC5D,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC;AAhBD,kCAgBC"}
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.js","sourceRoot":"","sources":["../../../src/devices/models/activity.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
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
+ respiration?: Respiration;
14
+ temperature?: Temperature;
15
+ }
16
+ //# 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,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;CAE3B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=biometrics.js.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=body.js.map
@@ -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"}