@tryvital/vital-node 1.1.1 → 1.2.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.
Files changed (53) hide show
  1. package/client/Activity.ts +4 -4
  2. package/client/Body.ts +4 -5
  3. package/client/Devices.ts +25 -0
  4. package/client/Link.ts +2 -2
  5. package/client/Profile.ts +5 -5
  6. package/client/Provider.ts +1 -1
  7. package/client/Sleep.ts +8 -5
  8. package/client/Testkits.ts +2 -2
  9. package/client/User.ts +19 -10
  10. package/client/Vitals.ts +10 -10
  11. package/client/Workouts.ts +4 -4
  12. package/client/index.ts +1 -0
  13. package/client/models/body_model.ts +1 -1
  14. package/client/models/profile_model.ts +1 -1
  15. package/client/models/provider_specific.ts +1 -1
  16. package/client/models/raw_response.ts +14 -1
  17. package/client/models/sleep_models.ts +1 -1
  18. package/client/models/user_models.ts +2 -2
  19. package/client/models/workout_models.ts +1 -1
  20. package/dist/client/Activity.d.ts +2 -2
  21. package/dist/client/Activity.js +4 -4
  22. package/dist/client/Body.d.ts +2 -2
  23. package/dist/client/Body.js +4 -4
  24. package/dist/client/Devices.d.ts +8 -0
  25. package/dist/client/Devices.js +62 -0
  26. package/dist/client/Link.d.ts +1 -1
  27. package/dist/client/Link.js +2 -2
  28. package/dist/client/Profile.d.ts +2 -2
  29. package/dist/client/Profile.js +4 -4
  30. package/dist/client/Provider.js +1 -1
  31. package/dist/client/Sleep.d.ts +2 -2
  32. package/dist/client/Sleep.js +4 -4
  33. package/dist/client/Testkits.d.ts +1 -1
  34. package/dist/client/Testkits.js +2 -2
  35. package/dist/client/User.d.ts +7 -6
  36. package/dist/client/User.js +21 -8
  37. package/dist/client/Vitals.d.ts +5 -5
  38. package/dist/client/Vitals.js +10 -10
  39. package/dist/client/Workouts.d.ts +2 -2
  40. package/dist/client/Workouts.js +4 -4
  41. package/dist/client/index.d.ts +1 -0
  42. package/dist/client/index.js +3 -1
  43. package/dist/client/models/body_model.d.ts +1 -1
  44. package/dist/client/models/profile_model.d.ts +1 -1
  45. package/dist/client/models/provider_specific.d.ts +1 -1
  46. package/dist/client/models/raw_response.d.ts +11 -0
  47. package/dist/client/models/sleep_models.d.ts +1 -1
  48. package/dist/client/models/user_models.d.ts +2 -2
  49. package/dist/client/models/workout_models.d.ts +1 -1
  50. package/dist/index.d.ts +2 -1
  51. package/dist/index.js +1 -0
  52. package/index.ts +3 -0
  53. package/package.json +1 -1
@@ -11,13 +11,13 @@ export class ActivityApi {
11
11
  }
12
12
 
13
13
  public async get(
14
- userKey: string,
14
+ userId: string,
15
15
  startDate: Date,
16
16
  endDate: Date,
17
17
  provider?: string
18
18
  ): Promise<ClientActivityResponse> {
19
19
  const resp = await this.client.get(
20
- this.baseURL.concat(`/summary/activity/${userKey}`),
20
+ this.baseURL.concat(`/summary/activity/${userId}`),
21
21
  {
22
22
  params: { start_date: startDate, end_date: endDate, provider },
23
23
  }
@@ -26,13 +26,13 @@ export class ActivityApi {
26
26
  }
27
27
 
28
28
  public async get_raw(
29
- userKey: string,
29
+ userId: string,
30
30
  startDate: Date,
31
31
  endDate: Date,
32
32
  provider?: string
33
33
  ): Promise<ClientActivityRawResponse> {
34
34
  const resp = await this.client.get(
35
- this.baseURL.concat(`/summary/activity/${userKey}/raw`),
35
+ this.baseURL.concat(`/summary/activity/${userId}/raw`),
36
36
  {
37
37
  params: { start_date: startDate, end_date: endDate, provider },
38
38
  }
package/client/Body.ts CHANGED
@@ -12,13 +12,13 @@ export class BodyApi {
12
12
  }
13
13
 
14
14
  public async get(
15
- userKey: string,
15
+ userId: string,
16
16
  startDate: Date,
17
17
  endDate: Date,
18
18
  provider?: string
19
19
  ): Promise<ClientBodyResponse> {
20
20
  const resp = await this.client.get(
21
- this.baseURL.concat(`/summary/body/${userKey}`),
21
+ this.baseURL.concat(`/summary/body/${userId}`),
22
22
  {
23
23
  params: { start_date: startDate, end_date: endDate, provider },
24
24
  }
@@ -26,15 +26,14 @@ export class BodyApi {
26
26
  return resp.data;
27
27
  }
28
28
 
29
-
30
29
  public async get_raw(
31
- userKey: string,
30
+ userId: string,
32
31
  startDate: Date,
33
32
  endDate: Date,
34
33
  provider?: string
35
34
  ): Promise<ClientBodyRawResponse> {
36
35
  const resp = await this.client.get(
37
- this.baseURL.concat(`/summary/body/${userKey}/raw`),
36
+ this.baseURL.concat(`/summary/body/${userId}/raw`),
38
37
  {
39
38
  params: { start_date: startDate, end_date: endDate, provider },
40
39
  }
@@ -0,0 +1,25 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ClientDevicesRawResponse } from './models/raw_response';
3
+
4
+ export class DevicesAPI {
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_raw(
14
+ userId: string,
15
+ provider?: string
16
+ ): Promise<ClientDevicesRawResponse> {
17
+ const resp = await this.client.get(
18
+ this.baseURL.concat(`/summary/devices/${userId}/raw`),
19
+ {
20
+ params: { provider },
21
+ }
22
+ );
23
+ return resp.data;
24
+ }
25
+ }
package/client/Link.ts CHANGED
@@ -17,11 +17,11 @@ export class LinkApi {
17
17
  }
18
18
 
19
19
  public async create(
20
- userKey: string,
20
+ userId: string,
21
21
  provider: string = null
22
22
  ): Promise<LinkTokenExchangeResponse> {
23
23
  const resp = await this.client.post(this.baseURL.concat('/link/token/'), {
24
- user_key: userKey,
24
+ user_key: userId,
25
25
  provider,
26
26
  });
27
27
  return resp.data;
package/client/Profile.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ClientFacingProfile, } from './models/profile_model';
2
+ import { ClientFacingProfile } from './models/profile_model';
3
3
  import { ClientProfileRawResponse } from './models/raw_response';
4
4
 
5
5
  export class ProfileApi {
@@ -12,11 +12,11 @@ export class ProfileApi {
12
12
  }
13
13
 
14
14
  public async get(
15
- userKey: string,
15
+ userId: string,
16
16
  provider?: string
17
17
  ): Promise<ClientFacingProfile> {
18
18
  const resp = await this.client.get(
19
- this.baseURL.concat(`/summary/profile/${userKey}`),
19
+ this.baseURL.concat(`/summary/profile/${userId}`),
20
20
  {
21
21
  params: { provider },
22
22
  }
@@ -25,13 +25,13 @@ export class ProfileApi {
25
25
  }
26
26
 
27
27
  public async get_raw(
28
- userKey: string,
28
+ userId: string,
29
29
  startDate: Date,
30
30
  endDate: Date,
31
31
  provider?: string
32
32
  ): Promise<ClientProfileRawResponse> {
33
33
  const resp = await this.client.get(
34
- this.baseURL.concat(`/summary/profile/${userKey}/raw`),
34
+ this.baseURL.concat(`/summary/profile/${userId}/raw`),
35
35
  {
36
36
  params: { start_date: startDate, end_date: endDate, provider },
37
37
  }
@@ -11,7 +11,7 @@ export class ProviderApi {
11
11
  }
12
12
 
13
13
  public async getSupportedProviders(): Promise<Provider[]> {
14
- const resp = await this.client.get(this.baseURL.concat(`/providers/`));
14
+ const resp = await this.client.get(this.baseURL.concat('/providers/'));
15
15
  return resp.data;
16
16
  }
17
17
  }
package/client/Sleep.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ClientSleepResponse, ClientSleepStreamResponse } from './models/sleep_models';
2
+ import {
3
+ ClientSleepResponse,
4
+ ClientSleepStreamResponse,
5
+ } from './models/sleep_models';
3
6
  import { ClientSleepRawResponse } from './models/raw_response';
4
7
 
5
8
  export class SleepApi {
@@ -11,13 +14,13 @@ export class SleepApi {
11
14
  }
12
15
 
13
16
  public async get(
14
- userKey: string,
17
+ userId: string,
15
18
  startDate: Date,
16
19
  endDate: Date,
17
20
  provider?: string
18
21
  ): Promise<ClientSleepResponse> {
19
22
  const resp = await this.client.get(
20
- this.baseURL.concat(`/summary/sleep/${userKey}`),
23
+ this.baseURL.concat(`/summary/sleep/${userId}`),
21
24
  {
22
25
  params: { start_date: startDate, end_date: endDate, provider },
23
26
  }
@@ -33,13 +36,13 @@ export class SleepApi {
33
36
  }
34
37
 
35
38
  public async get_raw(
36
- userKey: string,
39
+ userId: string,
37
40
  startDate: Date,
38
41
  endDate: Date,
39
42
  provider?: string
40
43
  ): Promise<ClientSleepRawResponse> {
41
44
  const resp = await this.client.get(
42
- this.baseURL.concat(`/summary/sleep/${userKey}/raw`),
45
+ this.baseURL.concat(`/summary/sleep/${userId}/raw`),
43
46
  {
44
47
  params: { start_date: startDate, end_date: endDate, provider },
45
48
  }
@@ -37,7 +37,7 @@ export class TestkitsApi {
37
37
  }
38
38
 
39
39
  public async order(
40
- userKey: string,
40
+ userId: string,
41
41
  testkitId: string,
42
42
  patientAddress: PatientAdress,
43
43
  patientDetails: PatientDetails
@@ -45,7 +45,7 @@ export class TestkitsApi {
45
45
  const resp = await this.client.post(
46
46
  this.baseURL.concat('/testkit/orders'),
47
47
  {
48
- user_key: userKey,
48
+ user_key: userId,
49
49
  testkit_id: testkitId,
50
50
  patient_address: patientAddress,
51
51
  patient_details: patientDetails,
package/client/User.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import {
3
- UserKeyResponse,
3
+ UserIdResponse,
4
4
  SuccessResponse,
5
5
  ClientFacingUser,
6
6
  Providers,
@@ -15,16 +15,16 @@ export class UserApi {
15
15
  this.client = axios;
16
16
  }
17
17
 
18
- public async create(clientUserId: string): Promise<UserKeyResponse> {
18
+ public async create(clientUserId: string): Promise<UserIdResponse> {
19
19
  const resp = await this.client.post(this.baseURL.concat('/user/key'), {
20
20
  client_user_id: clientUserId,
21
21
  });
22
22
  return resp.data;
23
23
  }
24
24
 
25
- public async delete(userKey: string): Promise<SuccessResponse> {
25
+ public async delete(userId: string): Promise<SuccessResponse> {
26
26
  const resp = await this.client.delete(
27
- this.baseURL.concat(`/user/${userKey}`)
27
+ this.baseURL.concat(`/user/${userId}`)
28
28
  );
29
29
  return resp.data;
30
30
  }
@@ -34,8 +34,8 @@ export class UserApi {
34
34
  return resp.data;
35
35
  }
36
36
 
37
- public async get(userKey: string): Promise<ClientFacingUser> {
38
- const resp = await this.client.get(this.baseURL.concat(`/user/${userKey}`));
37
+ public async get(userId: string): Promise<ClientFacingUser> {
38
+ const resp = await this.client.get(this.baseURL.concat(`/user/${userId}`));
39
39
  return resp.data;
40
40
  }
41
41
 
@@ -46,19 +46,28 @@ export class UserApi {
46
46
  return resp.data;
47
47
  }
48
48
 
49
- public async providers(userKey: string): Promise<ProvidersResponse> {
49
+ public async providers(userId: string): Promise<ProvidersResponse> {
50
50
  const resp = await this.client.get(
51
- this.baseURL.concat(`/user/providers/${userKey}`)
51
+ this.baseURL.concat(`/user/providers/${userId}`)
52
52
  );
53
53
  return resp.data;
54
54
  }
55
55
 
56
56
  public async deregisterProvider(
57
- userKey: string,
57
+ userId: string,
58
58
  provider: Providers
59
59
  ): Promise<SuccessResponse> {
60
60
  const resp = await this.client.delete(
61
- this.baseURL.concat(`/user/${userKey}/${provider}`)
61
+ this.baseURL.concat(`/user/${userId}/${provider}`)
62
+ );
63
+ return resp.data;
64
+ }
65
+
66
+ public async refresh(
67
+ userId: string,
68
+ ): Promise<SuccessResponse> {
69
+ const resp = await this.client.post(
70
+ this.baseURL.concat(`/user/refresh/${userId}`)
62
71
  );
63
72
  return resp.data;
64
73
  }
package/client/Vitals.ts CHANGED
@@ -27,13 +27,13 @@ export class VitalsApi {
27
27
 
28
28
  public async cholesterol(
29
29
  type: 'ldl' | 'total' | 'triglycerides' | 'hdl',
30
- userKey: string,
30
+ userId: string,
31
31
  startDate: Date,
32
32
  endDate: Date,
33
33
  provider?: string
34
34
  ): Promise<TimeseriesPoint[]> {
35
35
  return this.timeseriesData(
36
- userKey,
36
+ userId,
37
37
  `cholesterol/${type}`,
38
38
  startDate,
39
39
  endDate,
@@ -42,13 +42,13 @@ export class VitalsApi {
42
42
  }
43
43
 
44
44
  public async glucose(
45
- userKey: string,
45
+ userId: string,
46
46
  startDate: Date,
47
47
  endDate: Date,
48
48
  provider?: string
49
49
  ): Promise<TimeseriesPoint[]> {
50
50
  return this.timeseriesData(
51
- userKey,
51
+ userId,
52
52
  'glucose',
53
53
  startDate,
54
54
  endDate,
@@ -57,31 +57,31 @@ export class VitalsApi {
57
57
  }
58
58
 
59
59
  public async ige(
60
- userKey: string,
60
+ userId: string,
61
61
  startDate: Date,
62
62
  endDate: Date,
63
63
  provider?: string
64
64
  ): Promise<TimeseriesPoint[]> {
65
- return this.timeseriesData(userKey, 'ige', startDate, endDate, provider);
65
+ return this.timeseriesData(userId, 'ige', startDate, endDate, provider);
66
66
  }
67
67
 
68
68
  public async igg(
69
- userKey: string,
69
+ userId: string,
70
70
  startDate: Date,
71
71
  endDate: Date,
72
72
  provider?: string
73
73
  ): Promise<TimeseriesPoint[]> {
74
- return this.timeseriesData(userKey, 'igg', startDate, endDate, provider);
74
+ return this.timeseriesData(userId, 'igg', startDate, endDate, provider);
75
75
  }
76
76
 
77
77
  public async heartrate(
78
- userKey: string,
78
+ userId: string,
79
79
  startDate: Date,
80
80
  endDate: Date,
81
81
  provider?: string
82
82
  ): Promise<TimeseriesPoint[]> {
83
83
  return this.timeseriesData(
84
- userKey,
84
+ userId,
85
85
  'heartrate',
86
86
  startDate,
87
87
  endDate,
@@ -14,13 +14,13 @@ export class WorkoutsApi {
14
14
  }
15
15
 
16
16
  public async get(
17
- userKey: string,
17
+ userId: string,
18
18
  startDate: Date,
19
19
  endDate: Date,
20
20
  provider?: string
21
21
  ): Promise<ClientWorkoutResponse> {
22
22
  const resp = await this.client.get(
23
- this.baseURL.concat(`/summary/workouts/${userKey}`),
23
+ this.baseURL.concat(`/summary/workouts/${userId}`),
24
24
  {
25
25
  params: { start_date: startDate, end_date: endDate, provider },
26
26
  }
@@ -38,13 +38,13 @@ export class WorkoutsApi {
38
38
  }
39
39
 
40
40
  public async get_raw(
41
- userKey: string,
41
+ userId: string,
42
42
  startDate: Date,
43
43
  endDate: Date,
44
44
  provider?: string
45
45
  ): Promise<ClientWorkoutsRawResponse> {
46
46
  const resp = await this.client.get(
47
- this.baseURL.concat(`/summary/workouts/${userKey}/raw`),
47
+ this.baseURL.concat(`/summary/workouts/${userId}/raw`),
48
48
  {
49
49
  params: { start_date: startDate, end_date: endDate, provider },
50
50
  }
package/client/index.ts CHANGED
@@ -7,3 +7,4 @@ export { WebhooksApi } from './Webhooks';
7
7
  export { WorkoutsApi } from './Workouts';
8
8
  export { TestkitsApi } from './Testkits';
9
9
  export { ProfileApi } from './Profile';
10
+ export { DevicesAPI } from './Devices';
@@ -37,7 +37,7 @@ export interface ClientFacingBody {
37
37
  */
38
38
  source: SourceClientFacing;
39
39
  /**
40
- * 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.
40
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
41
41
  * @type {string}
42
42
  * @memberof ClientFacingBody
43
43
  */
@@ -26,7 +26,7 @@ export interface ClientFacingProfile {
26
26
  */
27
27
  source: SourceClientFacing;
28
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.
29
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
30
30
  * @type {string}
31
31
  * @memberof ClientFacingBody
32
32
  */
@@ -29,7 +29,7 @@ export interface ClientFacingSourceSpecific {
29
29
  */
30
30
  data: unknown;
31
31
  /**
32
- * 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.
32
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
33
33
  * @type {string}
34
34
  * @memberof ClientFacingSourceSpecific
35
35
  */
@@ -8,7 +8,16 @@ export interface RawResponse {
8
8
  priority: number;
9
9
  priority_id: number;
10
10
  timestamp: Date;
11
- data: Record<string, string>
11
+ data: Record<string, string>;
12
+ provider_id: string;
13
+ }
14
+
15
+ export interface DeviceRawResponse {
16
+ id: string;
17
+ user_id: string;
18
+ source_id: number;
19
+ source?: SourceClientFacing;
20
+ data: Record<string, string>;
12
21
  provider_id: string;
13
22
  }
14
23
 
@@ -29,3 +38,7 @@ export interface ClientSleepRawResponse {
29
38
  export interface ClientProfileRawResponse {
30
39
  profile: RawResponse[];
31
40
  }
41
+
42
+ export interface ClientDevicesRawResponse {
43
+ devices: DeviceRawResponse[];
44
+ }
@@ -122,7 +122,7 @@ export interface ClientFacingSleep {
122
122
  */
123
123
  source: SourceClientFacing;
124
124
  /**
125
- * 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.
125
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
126
126
  * @type {string}
127
127
  * @memberof ClientFacingSleep
128
128
  */
@@ -1,6 +1,6 @@
1
- export interface UserKeyResponse {
1
+ export interface UserIdResponse {
2
2
  client_user_id: string;
3
- user_key: string;
3
+ user_id: string;
4
4
  }
5
5
 
6
6
  export interface SuccessResponse {
@@ -82,7 +82,7 @@ export interface ClientFacingWorkout {
82
82
  */
83
83
  hr_zones: number[];
84
84
  /**
85
- * 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.
85
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
86
86
  * @type {string}
87
87
  * @memberof ClientFacingWorkout
88
88
  */
@@ -5,6 +5,6 @@ export declare class ActivityApi {
5
5
  baseURL: string;
6
6
  client: AxiosInstance;
7
7
  constructor(baseURL: string, axios: AxiosInstance);
8
- get(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientActivityResponse>;
9
- get_raw(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientActivityRawResponse>;
8
+ get(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientActivityResponse>;
9
+ get_raw(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientActivityRawResponse>;
10
10
  }
@@ -42,12 +42,12 @@ var ActivityApi = /** @class */ (function () {
42
42
  this.baseURL = baseURL;
43
43
  this.client = axios;
44
44
  }
45
- ActivityApi.prototype.get = function (userKey, startDate, endDate, provider) {
45
+ ActivityApi.prototype.get = function (userId, startDate, endDate, 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("/summary/activity/" + userKey), {
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/activity/" + userId), {
51
51
  params: { start_date: startDate, end_date: endDate, provider: provider },
52
52
  })];
53
53
  case 1:
@@ -57,12 +57,12 @@ var ActivityApi = /** @class */ (function () {
57
57
  });
58
58
  });
59
59
  };
60
- ActivityApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
60
+ ActivityApi.prototype.get_raw = function (userId, startDate, endDate, provider) {
61
61
  return __awaiter(this, void 0, void 0, 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("/summary/activity/" + userKey + "/raw"), {
65
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/activity/" + userId + "/raw"), {
66
66
  params: { start_date: startDate, end_date: endDate, provider: provider },
67
67
  })];
68
68
  case 1:
@@ -5,6 +5,6 @@ export declare class BodyApi {
5
5
  baseURL: string;
6
6
  client: AxiosInstance;
7
7
  constructor(baseURL: string, axios: AxiosInstance);
8
- get(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientBodyResponse>;
9
- get_raw(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientBodyRawResponse>;
8
+ get(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientBodyResponse>;
9
+ get_raw(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientBodyRawResponse>;
10
10
  }
@@ -42,12 +42,12 @@ var BodyApi = /** @class */ (function () {
42
42
  this.baseURL = baseURL;
43
43
  this.client = axios;
44
44
  }
45
- BodyApi.prototype.get = function (userKey, startDate, endDate, provider) {
45
+ BodyApi.prototype.get = function (userId, startDate, endDate, 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("/summary/body/" + userKey), {
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/body/" + userId), {
51
51
  params: { start_date: startDate, end_date: endDate, provider: provider },
52
52
  })];
53
53
  case 1:
@@ -57,12 +57,12 @@ var BodyApi = /** @class */ (function () {
57
57
  });
58
58
  });
59
59
  };
60
- BodyApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
60
+ BodyApi.prototype.get_raw = function (userId, startDate, endDate, provider) {
61
61
  return __awaiter(this, void 0, void 0, 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("/summary/body/" + userKey + "/raw"), {
65
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/body/" + userId + "/raw"), {
66
66
  params: { start_date: startDate, end_date: endDate, provider: provider },
67
67
  })];
68
68
  case 1:
@@ -0,0 +1,8 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ClientDevicesRawResponse } from './models/raw_response';
3
+ export declare class DevicesAPI {
4
+ baseURL: string;
5
+ client: AxiosInstance;
6
+ constructor(baseURL: string, axios: AxiosInstance);
7
+ get_raw(userId: string, provider?: string): Promise<ClientDevicesRawResponse>;
8
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.DevicesAPI = void 0;
40
+ var DevicesAPI = /** @class */ (function () {
41
+ function DevicesAPI(baseURL, axios) {
42
+ this.baseURL = baseURL;
43
+ this.client = axios;
44
+ }
45
+ DevicesAPI.prototype.get_raw = function (userId, provider) {
46
+ return __awaiter(this, void 0, void 0, function () {
47
+ var resp;
48
+ return __generator(this, function (_a) {
49
+ switch (_a.label) {
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/devices/" + userId + "/raw"), {
51
+ params: { provider: provider },
52
+ })];
53
+ case 1:
54
+ resp = _a.sent();
55
+ return [2 /*return*/, resp.data];
56
+ }
57
+ });
58
+ });
59
+ };
60
+ return DevicesAPI;
61
+ }());
62
+ exports.DevicesAPI = DevicesAPI;
@@ -5,7 +5,7 @@ export declare class LinkApi {
5
5
  baseURL: string;
6
6
  client: AxiosInstance;
7
7
  constructor(baseURL: string, axios: AxiosInstance);
8
- create(userKey: string, provider?: string): Promise<LinkTokenExchangeResponse>;
8
+ create(userId: string, provider?: string): Promise<LinkTokenExchangeResponse>;
9
9
  connectProvider(linkToken: string, provider: PasswordProviders, username: string, password: string): Promise<ProviderLinkResponse>;
10
10
  connectEmailProvider(linkToken: string, provider: EmailProviders, email: string): Promise<ProviderLinkResponse>;
11
11
  getOAuthLink(linkToken: string, provider: OAuthProviders): Promise<SourceWithLinkInfo>;
@@ -42,14 +42,14 @@ var LinkApi = /** @class */ (function () {
42
42
  this.baseURL = baseURL;
43
43
  this.client = axios;
44
44
  }
45
- LinkApi.prototype.create = function (userKey, provider) {
45
+ LinkApi.prototype.create = function (userId, provider) {
46
46
  if (provider === void 0) { provider = null; }
47
47
  return __awaiter(this, void 0, void 0, function () {
48
48
  var resp;
49
49
  return __generator(this, function (_a) {
50
50
  switch (_a.label) {
51
51
  case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat('/link/token/'), {
52
- user_key: userKey,
52
+ user_key: userId,
53
53
  provider: provider,
54
54
  })];
55
55
  case 1:
@@ -5,6 +5,6 @@ export declare class ProfileApi {
5
5
  baseURL: string;
6
6
  client: AxiosInstance;
7
7
  constructor(baseURL: string, axios: AxiosInstance);
8
- get(userKey: string, provider?: string): Promise<ClientFacingProfile>;
9
- get_raw(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientProfileRawResponse>;
8
+ get(userId: string, provider?: string): Promise<ClientFacingProfile>;
9
+ get_raw(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientProfileRawResponse>;
10
10
  }
@@ -42,12 +42,12 @@ var ProfileApi = /** @class */ (function () {
42
42
  this.baseURL = baseURL;
43
43
  this.client = axios;
44
44
  }
45
- ProfileApi.prototype.get = function (userKey, provider) {
45
+ ProfileApi.prototype.get = function (userId, 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("/summary/profile/" + userKey), {
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/profile/" + userId), {
51
51
  params: { provider: provider },
52
52
  })];
53
53
  case 1:
@@ -57,12 +57,12 @@ var ProfileApi = /** @class */ (function () {
57
57
  });
58
58
  });
59
59
  };
60
- ProfileApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
60
+ ProfileApi.prototype.get_raw = function (userId, startDate, endDate, provider) {
61
61
  return __awaiter(this, void 0, void 0, 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("/summary/profile/" + userKey + "/raw"), {
65
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/profile/" + userId + "/raw"), {
66
66
  params: { start_date: startDate, end_date: endDate, provider: provider },
67
67
  })];
68
68
  case 1:
@@ -47,7 +47,7 @@ var ProviderApi = /** @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("/providers/"))];
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat('/providers/'))];
51
51
  case 1:
52
52
  resp = _a.sent();
53
53
  return [2 /*return*/, resp.data];
@@ -5,7 +5,7 @@ export declare class SleepApi {
5
5
  baseURL: string;
6
6
  client: AxiosInstance;
7
7
  constructor(baseURL: string, axios: AxiosInstance);
8
- get(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientSleepResponse>;
8
+ get(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientSleepResponse>;
9
9
  getStream(sleepId: string): Promise<ClientSleepStreamResponse>;
10
- get_raw(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientSleepRawResponse>;
10
+ get_raw(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientSleepRawResponse>;
11
11
  }
@@ -42,12 +42,12 @@ var SleepApi = /** @class */ (function () {
42
42
  this.baseURL = baseURL;
43
43
  this.client = axios;
44
44
  }
45
- SleepApi.prototype.get = function (userKey, startDate, endDate, provider) {
45
+ SleepApi.prototype.get = function (userId, startDate, endDate, 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("/summary/sleep/" + userKey), {
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/sleep/" + userId), {
51
51
  params: { start_date: startDate, end_date: endDate, provider: provider },
52
52
  })];
53
53
  case 1:
@@ -70,12 +70,12 @@ var SleepApi = /** @class */ (function () {
70
70
  });
71
71
  });
72
72
  };
73
- SleepApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
73
+ SleepApi.prototype.get_raw = function (userId, startDate, endDate, provider) {
74
74
  return __awaiter(this, void 0, void 0, function () {
75
75
  var resp;
76
76
  return __generator(this, function (_a) {
77
77
  switch (_a.label) {
78
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/sleep/" + userKey + "/raw"), {
78
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/sleep/" + userId + "/raw"), {
79
79
  params: { start_date: startDate, end_date: endDate, provider: provider },
80
80
  })];
81
81
  case 1:
@@ -6,7 +6,7 @@ export declare class TestkitsApi {
6
6
  constructor(baseURL: string, axios: AxiosInstance);
7
7
  get(): Promise<TestkitResponse>;
8
8
  get_orders(startDate: Date, endDate: Date): Promise<OrderResponse>;
9
- order(userKey: string, testkitId: string, patientAddress: PatientAdress, patientDetails: PatientDetails): Promise<OrderRequestResponse>;
9
+ order(userId: string, testkitId: string, patientAddress: PatientAdress, patientDetails: PatientDetails): Promise<OrderRequestResponse>;
10
10
  get_order(orderId: string): Promise<Order>;
11
11
  get_results(orderId: string): Promise<string>;
12
12
  getMetadata(orderId: string): Promise<LabResultsMetadata>;
@@ -70,13 +70,13 @@ var TestkitsApi = /** @class */ (function () {
70
70
  });
71
71
  });
72
72
  };
73
- TestkitsApi.prototype.order = function (userKey, testkitId, patientAddress, patientDetails) {
73
+ TestkitsApi.prototype.order = function (userId, testkitId, patientAddress, patientDetails) {
74
74
  return __awaiter(this, void 0, void 0, function () {
75
75
  var resp;
76
76
  return __generator(this, function (_a) {
77
77
  switch (_a.label) {
78
78
  case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat('/testkit/orders'), {
79
- user_key: userKey,
79
+ user_key: userId,
80
80
  testkit_id: testkitId,
81
81
  patient_address: patientAddress,
82
82
  patient_details: patientDetails,
@@ -1,14 +1,15 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { UserKeyResponse, SuccessResponse, ClientFacingUser, Providers, ProvidersResponse } from './models/user_models';
2
+ import { UserIdResponse, SuccessResponse, ClientFacingUser, Providers, ProvidersResponse } from './models/user_models';
3
3
  export declare class UserApi {
4
4
  baseURL: string;
5
5
  client: AxiosInstance;
6
6
  constructor(baseURL: string, axios: AxiosInstance);
7
- create(clientUserId: string): Promise<UserKeyResponse>;
8
- delete(userKey: string): Promise<SuccessResponse>;
7
+ create(clientUserId: string): Promise<UserIdResponse>;
8
+ delete(userId: string): Promise<SuccessResponse>;
9
9
  getAll(): Promise<Array<ClientFacingUser>>;
10
- get(userKey: string): Promise<ClientFacingUser>;
10
+ get(userId: string): Promise<ClientFacingUser>;
11
11
  resolve(clientUserId: string): Promise<ClientFacingUser>;
12
- providers(userKey: string): Promise<ProvidersResponse>;
13
- deregisterProvider(userKey: string, provider: Providers): Promise<SuccessResponse>;
12
+ providers(userId: string): Promise<ProvidersResponse>;
13
+ deregisterProvider(userId: string, provider: Providers): Promise<SuccessResponse>;
14
+ refresh(userId: string): Promise<SuccessResponse>;
14
15
  }
@@ -57,12 +57,12 @@ var UserApi = /** @class */ (function () {
57
57
  });
58
58
  });
59
59
  };
60
- UserApi.prototype.delete = function (userKey) {
60
+ UserApi.prototype.delete = function (userId) {
61
61
  return __awaiter(this, void 0, void 0, 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.delete(this.baseURL.concat("/user/" + userKey))];
65
+ case 0: return [4 /*yield*/, this.client.delete(this.baseURL.concat("/user/" + userId))];
66
66
  case 1:
67
67
  resp = _a.sent();
68
68
  return [2 /*return*/, resp.data];
@@ -83,12 +83,12 @@ var UserApi = /** @class */ (function () {
83
83
  });
84
84
  });
85
85
  };
86
- UserApi.prototype.get = function (userKey) {
86
+ UserApi.prototype.get = function (userId) {
87
87
  return __awaiter(this, void 0, void 0, function () {
88
88
  var resp;
89
89
  return __generator(this, function (_a) {
90
90
  switch (_a.label) {
91
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/user/" + userKey))];
91
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/user/" + userId))];
92
92
  case 1:
93
93
  resp = _a.sent();
94
94
  return [2 /*return*/, resp.data];
@@ -109,12 +109,12 @@ var UserApi = /** @class */ (function () {
109
109
  });
110
110
  });
111
111
  };
112
- UserApi.prototype.providers = function (userKey) {
112
+ UserApi.prototype.providers = function (userId) {
113
113
  return __awaiter(this, void 0, void 0, function () {
114
114
  var resp;
115
115
  return __generator(this, function (_a) {
116
116
  switch (_a.label) {
117
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/user/providers/" + userKey))];
117
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/user/providers/" + userId))];
118
118
  case 1:
119
119
  resp = _a.sent();
120
120
  return [2 /*return*/, resp.data];
@@ -122,12 +122,25 @@ var UserApi = /** @class */ (function () {
122
122
  });
123
123
  });
124
124
  };
125
- UserApi.prototype.deregisterProvider = function (userKey, provider) {
125
+ UserApi.prototype.deregisterProvider = function (userId, provider) {
126
126
  return __awaiter(this, void 0, void 0, function () {
127
127
  var resp;
128
128
  return __generator(this, function (_a) {
129
129
  switch (_a.label) {
130
- case 0: return [4 /*yield*/, this.client.delete(this.baseURL.concat("/user/" + userKey + "/" + provider))];
130
+ case 0: return [4 /*yield*/, this.client.delete(this.baseURL.concat("/user/" + userId + "/" + provider))];
131
+ case 1:
132
+ resp = _a.sent();
133
+ return [2 /*return*/, resp.data];
134
+ }
135
+ });
136
+ });
137
+ };
138
+ UserApi.prototype.refresh = function (userId) {
139
+ return __awaiter(this, void 0, void 0, function () {
140
+ var resp;
141
+ return __generator(this, function (_a) {
142
+ switch (_a.label) {
143
+ case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat("/user/refresh/" + userId))];
131
144
  case 1:
132
145
  resp = _a.sent();
133
146
  return [2 /*return*/, resp.data];
@@ -5,9 +5,9 @@ export declare class VitalsApi {
5
5
  client: AxiosInstance;
6
6
  constructor(baseURL: string, axios: AxiosInstance);
7
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[]>;
8
+ cholesterol(type: 'ldl' | 'total' | 'triglycerides' | 'hdl', userId: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
9
+ glucose(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
10
+ ige(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
11
+ igg(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
12
+ heartrate(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<TimeseriesPoint[]>;
13
13
  }
@@ -57,38 +57,38 @@ var VitalsApi = /** @class */ (function () {
57
57
  });
58
58
  });
59
59
  };
60
- VitalsApi.prototype.cholesterol = function (type, userKey, startDate, endDate, provider) {
60
+ VitalsApi.prototype.cholesterol = function (type, userId, startDate, endDate, provider) {
61
61
  return __awaiter(this, void 0, void 0, function () {
62
62
  return __generator(this, function (_a) {
63
- return [2 /*return*/, this.timeseriesData(userKey, "cholesterol/" + type, startDate, endDate, provider)];
63
+ return [2 /*return*/, this.timeseriesData(userId, "cholesterol/" + type, startDate, endDate, provider)];
64
64
  });
65
65
  });
66
66
  };
67
- VitalsApi.prototype.glucose = function (userKey, startDate, endDate, provider) {
67
+ VitalsApi.prototype.glucose = function (userId, startDate, endDate, provider) {
68
68
  return __awaiter(this, void 0, void 0, function () {
69
69
  return __generator(this, function (_a) {
70
- return [2 /*return*/, this.timeseriesData(userKey, 'glucose', startDate, endDate, provider)];
70
+ return [2 /*return*/, this.timeseriesData(userId, 'glucose', startDate, endDate, provider)];
71
71
  });
72
72
  });
73
73
  };
74
- VitalsApi.prototype.ige = function (userKey, startDate, endDate, provider) {
74
+ VitalsApi.prototype.ige = function (userId, startDate, endDate, provider) {
75
75
  return __awaiter(this, void 0, void 0, function () {
76
76
  return __generator(this, function (_a) {
77
- return [2 /*return*/, this.timeseriesData(userKey, 'ige', startDate, endDate, provider)];
77
+ return [2 /*return*/, this.timeseriesData(userId, 'ige', startDate, endDate, provider)];
78
78
  });
79
79
  });
80
80
  };
81
- VitalsApi.prototype.igg = function (userKey, startDate, endDate, provider) {
81
+ VitalsApi.prototype.igg = function (userId, startDate, endDate, provider) {
82
82
  return __awaiter(this, void 0, void 0, function () {
83
83
  return __generator(this, function (_a) {
84
- return [2 /*return*/, this.timeseriesData(userKey, 'igg', startDate, endDate, provider)];
84
+ return [2 /*return*/, this.timeseriesData(userId, 'igg', startDate, endDate, provider)];
85
85
  });
86
86
  });
87
87
  };
88
- VitalsApi.prototype.heartrate = function (userKey, startDate, endDate, provider) {
88
+ VitalsApi.prototype.heartrate = function (userId, startDate, endDate, provider) {
89
89
  return __awaiter(this, void 0, void 0, function () {
90
90
  return __generator(this, function (_a) {
91
- return [2 /*return*/, this.timeseriesData(userKey, 'heartrate', startDate, endDate, provider)];
91
+ return [2 /*return*/, this.timeseriesData(userId, 'heartrate', startDate, endDate, provider)];
92
92
  });
93
93
  });
94
94
  };
@@ -5,7 +5,7 @@ export declare class WorkoutsApi {
5
5
  baseURL: string;
6
6
  client: AxiosInstance;
7
7
  constructor(baseURL: string, axios: AxiosInstance);
8
- get(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientWorkoutResponse>;
8
+ get(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientWorkoutResponse>;
9
9
  getStream(workoutId: string): Promise<ClientWorkoutStreamResponse>;
10
- get_raw(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientWorkoutsRawResponse>;
10
+ get_raw(userId: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientWorkoutsRawResponse>;
11
11
  }
@@ -42,12 +42,12 @@ var WorkoutsApi = /** @class */ (function () {
42
42
  this.baseURL = baseURL;
43
43
  this.client = axios;
44
44
  }
45
- WorkoutsApi.prototype.get = function (userKey, startDate, endDate, provider) {
45
+ WorkoutsApi.prototype.get = function (userId, startDate, endDate, 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("/summary/workouts/" + userKey), {
50
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/workouts/" + userId), {
51
51
  params: { start_date: startDate, end_date: endDate, provider: provider },
52
52
  })];
53
53
  case 1:
@@ -70,12 +70,12 @@ var WorkoutsApi = /** @class */ (function () {
70
70
  });
71
71
  });
72
72
  };
73
- WorkoutsApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
73
+ WorkoutsApi.prototype.get_raw = function (userId, startDate, endDate, provider) {
74
74
  return __awaiter(this, void 0, void 0, function () {
75
75
  var resp;
76
76
  return __generator(this, function (_a) {
77
77
  switch (_a.label) {
78
- case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/workouts/" + userKey + "/raw"), {
78
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/workouts/" + userId + "/raw"), {
79
79
  params: { start_date: startDate, end_date: endDate, provider: provider },
80
80
  })];
81
81
  case 1:
@@ -7,3 +7,4 @@ export { WebhooksApi } from './Webhooks';
7
7
  export { WorkoutsApi } from './Workouts';
8
8
  export { TestkitsApi } from './Testkits';
9
9
  export { ProfileApi } from './Profile';
10
+ export { DevicesAPI } from './Devices';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProfileApi = exports.TestkitsApi = exports.WorkoutsApi = exports.WebhooksApi = exports.UserApi = exports.SleepApi = exports.LinkApi = exports.BodyApi = exports.ActivityApi = void 0;
3
+ exports.DevicesAPI = exports.ProfileApi = exports.TestkitsApi = exports.WorkoutsApi = exports.WebhooksApi = exports.UserApi = exports.SleepApi = exports.LinkApi = exports.BodyApi = exports.ActivityApi = void 0;
4
4
  var Activity_1 = require("./Activity");
5
5
  Object.defineProperty(exports, "ActivityApi", { enumerable: true, get: function () { return Activity_1.ActivityApi; } });
6
6
  var Body_1 = require("./Body");
@@ -19,3 +19,5 @@ var Testkits_1 = require("./Testkits");
19
19
  Object.defineProperty(exports, "TestkitsApi", { enumerable: true, get: function () { return Testkits_1.TestkitsApi; } });
20
20
  var Profile_1 = require("./Profile");
21
21
  Object.defineProperty(exports, "ProfileApi", { enumerable: true, get: function () { return Profile_1.ProfileApi; } });
22
+ var Devices_1 = require("./Devices");
23
+ Object.defineProperty(exports, "DevicesAPI", { enumerable: true, get: function () { return Devices_1.DevicesAPI; } });
@@ -36,7 +36,7 @@ export interface ClientFacingBody {
36
36
  */
37
37
  source: SourceClientFacing;
38
38
  /**
39
- * 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.
39
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
40
40
  * @type {string}
41
41
  * @memberof ClientFacingBody
42
42
  */
@@ -25,7 +25,7 @@ export interface ClientFacingProfile {
25
25
  */
26
26
  source: SourceClientFacing;
27
27
  /**
28
- * 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.
28
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
29
29
  * @type {string}
30
30
  * @memberof ClientFacingBody
31
31
  */
@@ -29,7 +29,7 @@ export interface ClientFacingSourceSpecific {
29
29
  */
30
30
  data: unknown;
31
31
  /**
32
- * 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.
32
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
33
33
  * @type {string}
34
34
  * @memberof ClientFacingSourceSpecific
35
35
  */
@@ -10,6 +10,14 @@ export interface RawResponse {
10
10
  data: Record<string, string>;
11
11
  provider_id: string;
12
12
  }
13
+ export interface DeviceRawResponse {
14
+ id: string;
15
+ user_id: string;
16
+ source_id: number;
17
+ source?: SourceClientFacing;
18
+ data: Record<string, string>;
19
+ provider_id: string;
20
+ }
13
21
  export interface ClientActivityRawResponse {
14
22
  activity: RawResponse[];
15
23
  }
@@ -25,3 +33,6 @@ export interface ClientSleepRawResponse {
25
33
  export interface ClientProfileRawResponse {
26
34
  profile: RawResponse[];
27
35
  }
36
+ export interface ClientDevicesRawResponse {
37
+ devices: DeviceRawResponse[];
38
+ }
@@ -121,7 +121,7 @@ export interface ClientFacingSleep {
121
121
  */
122
122
  source: SourceClientFacing;
123
123
  /**
124
- * 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.
124
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
125
125
  * @type {string}
126
126
  * @memberof ClientFacingSleep
127
127
  */
@@ -1,6 +1,6 @@
1
- export interface UserKeyResponse {
1
+ export interface UserIdResponse {
2
2
  client_user_id: string;
3
- user_key: string;
3
+ user_id: string;
4
4
  }
5
5
  export interface SuccessResponse {
6
6
  success: boolean;
@@ -80,7 +80,7 @@ export interface ClientFacingWorkout {
80
80
  */
81
81
  hr_zones: number[];
82
82
  /**
83
- * 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.
83
+ * User id returned by vital create user id request. This id should be stored in your database against the user and used for all interactions with the vital api.
84
84
  * @type {string}
85
85
  * @memberof ClientFacingWorkout
86
86
  */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ActivityApi, BodyApi, LinkApi, SleepApi, TestkitsApi, UserApi, WebhooksApi, WorkoutsApi, ProfileApi } from './client';
1
+ import { ActivityApi, BodyApi, LinkApi, SleepApi, TestkitsApi, UserApi, WebhooksApi, WorkoutsApi, ProfileApi, DevicesAPI } from './client';
2
2
  import { ClientConfig } from './lib/models';
3
3
  import { ClientCredentials } from './lib/credentials';
4
4
  import { VitalsApi } from './client/Vitals';
@@ -17,5 +17,6 @@ export declare class VitalClient {
17
17
  Testkits: TestkitsApi;
18
18
  Profile: ProfileApi;
19
19
  Providers: ProviderApi;
20
+ Devices: DevicesAPI;
20
21
  constructor(config: ClientConfig);
21
22
  }
package/dist/index.js CHANGED
@@ -92,6 +92,7 @@ var VitalClient = /** @class */ (function () {
92
92
  this.Testkits = new client_1.TestkitsApi(baseURL.concat('/v2'), axiosApiInstance);
93
93
  this.Profile = new client_1.ProfileApi(baseURL.concat('/v2'), axiosApiInstance);
94
94
  this.Providers = new Provider_1.ProviderApi(baseURL.concat('/v2'), axiosApiInstance);
95
+ this.Devices = new client_1.DevicesAPI(baseURL.concat('/v2'), axiosApiInstance);
95
96
  }
96
97
  return VitalClient;
97
98
  }());
package/index.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  WebhooksApi,
11
11
  WorkoutsApi,
12
12
  ProfileApi,
13
+ DevicesAPI,
13
14
  } from './client';
14
15
  import { ClientConfig } from './lib/models';
15
16
  import CONFIG from './lib/config';
@@ -31,6 +32,7 @@ export class VitalClient {
31
32
  Testkits: TestkitsApi;
32
33
  Profile: ProfileApi;
33
34
  Providers: ProviderApi;
35
+ Devices: DevicesAPI;
34
36
 
35
37
  constructor(config: ClientConfig) {
36
38
  this.config = config;
@@ -70,5 +72,6 @@ export class VitalClient {
70
72
  this.Testkits = new TestkitsApi(baseURL.concat('/v2'), axiosApiInstance);
71
73
  this.Profile = new ProfileApi(baseURL.concat('/v2'), axiosApiInstance);
72
74
  this.Providers = new ProviderApi(baseURL.concat('/v2'), axiosApiInstance);
75
+ this.Devices = new DevicesAPI(baseURL.concat('/v2'), axiosApiInstance);
73
76
  }
74
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-node",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Node client for Vital",
5
5
  "author": "maitham",
6
6
  "keywords": [