@tryvital/vital-node 1.0.8 → 1.0.9

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.
@@ -1,5 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ClientActivityResponse } from './models/activity';
3
+ import { ClientActivityRawResponse } from './models/raw_response';
3
4
 
4
5
  export class ActivityApi {
5
6
  baseURL: string;
@@ -23,4 +24,19 @@ export class ActivityApi {
23
24
  );
24
25
  return resp.data;
25
26
  }
27
+
28
+ public async get_raw(
29
+ userKey: string,
30
+ startDate: Date,
31
+ endDate: Date,
32
+ provider?: string
33
+ ): Promise<ClientActivityRawResponse> {
34
+ const resp = await this.client.get(
35
+ this.baseURL.concat(`/summary/activity/${userKey}/raw`),
36
+ {
37
+ params: { start_date: startDate, end_date: endDate, provider },
38
+ }
39
+ );
40
+ return resp.data;
41
+ }
26
42
  }
package/client/Body.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ClientBodyResponse } from './models/body_model';
3
+ import { ClientBodyRawResponse } from './models/raw_response';
3
4
 
4
5
  export class BodyApi {
5
6
  baseURL: string;
@@ -24,4 +25,20 @@ export class BodyApi {
24
25
  );
25
26
  return resp.data;
26
27
  }
28
+
29
+
30
+ public async get_raw(
31
+ userKey: string,
32
+ startDate: Date,
33
+ endDate: Date,
34
+ provider?: string
35
+ ): Promise<ClientBodyRawResponse> {
36
+ const resp = await this.client.get(
37
+ this.baseURL.concat(`/summary/body/${userKey}/raw`),
38
+ {
39
+ params: { start_date: startDate, end_date: endDate, provider },
40
+ }
41
+ );
42
+ return resp.data;
43
+ }
27
44
  }
package/client/Profile.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ClientFacingProfile } from './models/profile_model';
2
+ import { ClientFacingProfile, } from './models/profile_model';
3
+ import { ClientProfileRawResponse } from './models/raw_response';
3
4
 
4
5
  export class ProfileApi {
5
6
  baseURL: string;
@@ -22,4 +23,19 @@ export class ProfileApi {
22
23
  );
23
24
  return resp.data;
24
25
  }
26
+
27
+ public async get_raw(
28
+ userKey: string,
29
+ startDate: Date,
30
+ endDate: Date,
31
+ provider?: string
32
+ ): Promise<ClientProfileRawResponse> {
33
+ const resp = await this.client.get(
34
+ this.baseURL.concat(`/summary/profile/${userKey}/raw`),
35
+ {
36
+ params: { start_date: startDate, end_date: endDate, provider },
37
+ }
38
+ );
39
+ return resp.data;
40
+ }
25
41
  }
package/client/Sleep.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ClientSleepResponse, ClientSleepStreamResponse } from './models/sleep_models';
2
+ import { ClientSleepResponse, ClientSleepStreamResponse } from './models/sleep_models';
3
+ import { ClientSleepRawResponse } from './models/raw_response';
3
4
 
4
5
  export class SleepApi {
5
6
  baseURL: string;
@@ -30,4 +31,19 @@ export class SleepApi {
30
31
  );
31
32
  return resp.data;
32
33
  }
34
+
35
+ public async get_raw(
36
+ userKey: string,
37
+ startDate: Date,
38
+ endDate: Date,
39
+ provider?: string
40
+ ): Promise<ClientSleepRawResponse> {
41
+ const resp = await this.client.get(
42
+ this.baseURL.concat(`/summary/sleep/${userKey}/raw`),
43
+ {
44
+ params: { start_date: startDate, end_date: endDate, provider },
45
+ }
46
+ );
47
+ return resp.data;
48
+ }
33
49
  }
@@ -1,4 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
+ import { ClientWorkoutsRawResponse } from './models/raw_response';
2
3
  import {
3
4
  ClientWorkoutResponse,
4
5
  ClientWorkoutStreamResponse,
@@ -35,4 +36,19 @@ export class WorkoutsApi {
35
36
  );
36
37
  return resp.data;
37
38
  }
39
+
40
+ public async get_raw(
41
+ userKey: string,
42
+ startDate: Date,
43
+ endDate: Date,
44
+ provider?: string
45
+ ): Promise<ClientWorkoutsRawResponse> {
46
+ const resp = await this.client.get(
47
+ this.baseURL.concat(`/summary/workouts/${userKey}/raw`),
48
+ {
49
+ params: { start_date: startDate, end_date: endDate, provider },
50
+ }
51
+ );
52
+ return resp.data;
53
+ }
38
54
  }
@@ -0,0 +1,31 @@
1
+ import { SourceClientFacing } from './user_models';
2
+
3
+ export interface RawResponse {
4
+ id: string;
5
+ user_id: string;
6
+ source_id: number;
7
+ source?: SourceClientFacing;
8
+ priority: number;
9
+ priority_id: number;
10
+ timestamp: Date;
11
+ data: Record<string, string>
12
+ provider_id: string;
13
+ }
14
+
15
+ export interface ClientActivityRawResponse {
16
+ activity: RawResponse[];
17
+ }
18
+ export interface ClientWorkoutsRawResponse {
19
+ workouts: RawResponse[];
20
+ }
21
+ export interface ClientBodyRawResponse {
22
+ body: RawResponse[];
23
+ }
24
+
25
+ export interface ClientSleepRawResponse {
26
+ sleep: RawResponse[];
27
+ }
28
+
29
+ export interface ClientProfileRawResponse {
30
+ profile: RawResponse[];
31
+ }
@@ -1,8 +1,10 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ClientActivityResponse } from './models/activity';
3
+ import { ClientActivityRawResponse } from './models/raw_response';
3
4
  export declare class ActivityApi {
4
5
  baseURL: string;
5
6
  client: AxiosInstance;
6
7
  constructor(baseURL: string, axios: AxiosInstance);
7
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
10
  }
@@ -57,6 +57,21 @@ var ActivityApi = /** @class */ (function () {
57
57
  });
58
58
  });
59
59
  };
60
+ ActivityApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ var resp;
63
+ return __generator(this, function (_a) {
64
+ switch (_a.label) {
65
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/activity/" + userKey + "/raw"), {
66
+ params: { start_date: startDate, end_date: endDate, provider: provider },
67
+ })];
68
+ case 1:
69
+ resp = _a.sent();
70
+ return [2 /*return*/, resp.data];
71
+ }
72
+ });
73
+ });
74
+ };
60
75
  return ActivityApi;
61
76
  }());
62
77
  exports.ActivityApi = ActivityApi;
@@ -1,8 +1,10 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ClientBodyResponse } from './models/body_model';
3
+ import { ClientBodyRawResponse } from './models/raw_response';
3
4
  export declare class BodyApi {
4
5
  baseURL: string;
5
6
  client: AxiosInstance;
6
7
  constructor(baseURL: string, axios: AxiosInstance);
7
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
10
  }
@@ -57,6 +57,21 @@ var BodyApi = /** @class */ (function () {
57
57
  });
58
58
  });
59
59
  };
60
+ BodyApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ var resp;
63
+ return __generator(this, function (_a) {
64
+ switch (_a.label) {
65
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/body/" + userKey + "/raw"), {
66
+ params: { start_date: startDate, end_date: endDate, provider: provider },
67
+ })];
68
+ case 1:
69
+ resp = _a.sent();
70
+ return [2 /*return*/, resp.data];
71
+ }
72
+ });
73
+ });
74
+ };
60
75
  return BodyApi;
61
76
  }());
62
77
  exports.BodyApi = BodyApi;
@@ -1,8 +1,10 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ClientFacingProfile } from './models/profile_model';
3
+ import { ClientProfileRawResponse } from './models/raw_response';
3
4
  export declare class ProfileApi {
4
5
  baseURL: string;
5
6
  client: AxiosInstance;
6
7
  constructor(baseURL: string, axios: AxiosInstance);
7
8
  get(userKey: string, provider?: string): Promise<ClientFacingProfile>;
9
+ get_raw(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientProfileRawResponse>;
8
10
  }
@@ -57,6 +57,21 @@ var ProfileApi = /** @class */ (function () {
57
57
  });
58
58
  });
59
59
  };
60
+ ProfileApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ var resp;
63
+ return __generator(this, function (_a) {
64
+ switch (_a.label) {
65
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/profile/" + userKey + "/raw"), {
66
+ params: { start_date: startDate, end_date: endDate, provider: provider },
67
+ })];
68
+ case 1:
69
+ resp = _a.sent();
70
+ return [2 /*return*/, resp.data];
71
+ }
72
+ });
73
+ });
74
+ };
60
75
  return ProfileApi;
61
76
  }());
62
77
  exports.ProfileApi = ProfileApi;
@@ -1,9 +1,11 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ClientSleepResponse, ClientSleepStreamResponse } from './models/sleep_models';
3
+ import { ClientSleepRawResponse } from './models/raw_response';
3
4
  export declare class SleepApi {
4
5
  baseURL: string;
5
6
  client: AxiosInstance;
6
7
  constructor(baseURL: string, axios: AxiosInstance);
7
8
  get(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientSleepResponse>;
8
9
  getStream(sleepId: string): Promise<ClientSleepStreamResponse>;
10
+ get_raw(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientSleepRawResponse>;
9
11
  }
@@ -70,6 +70,21 @@ var SleepApi = /** @class */ (function () {
70
70
  });
71
71
  });
72
72
  };
73
+ SleepApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
74
+ return __awaiter(this, void 0, void 0, function () {
75
+ var resp;
76
+ return __generator(this, function (_a) {
77
+ switch (_a.label) {
78
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/sleep/" + userKey + "/raw"), {
79
+ params: { start_date: startDate, end_date: endDate, provider: provider },
80
+ })];
81
+ case 1:
82
+ resp = _a.sent();
83
+ return [2 /*return*/, resp.data];
84
+ }
85
+ });
86
+ });
87
+ };
73
88
  return SleepApi;
74
89
  }());
75
90
  exports.SleepApi = SleepApi;
@@ -1,4 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
+ import { ClientWorkoutsRawResponse } from './models/raw_response';
2
3
  import { ClientWorkoutResponse, ClientWorkoutStreamResponse } from './models/workout_models';
3
4
  export declare class WorkoutsApi {
4
5
  baseURL: string;
@@ -6,4 +7,5 @@ export declare class WorkoutsApi {
6
7
  constructor(baseURL: string, axios: AxiosInstance);
7
8
  get(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientWorkoutResponse>;
8
9
  getStream(workoutId: string): Promise<ClientWorkoutStreamResponse>;
10
+ get_raw(userKey: string, startDate: Date, endDate: Date, provider?: string): Promise<ClientWorkoutsRawResponse>;
9
11
  }
@@ -70,6 +70,21 @@ var WorkoutsApi = /** @class */ (function () {
70
70
  });
71
71
  });
72
72
  };
73
+ WorkoutsApi.prototype.get_raw = function (userKey, startDate, endDate, provider) {
74
+ return __awaiter(this, void 0, void 0, function () {
75
+ var resp;
76
+ return __generator(this, function (_a) {
77
+ switch (_a.label) {
78
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/summary/workouts/" + userKey + "/raw"), {
79
+ params: { start_date: startDate, end_date: endDate, provider: provider },
80
+ })];
81
+ case 1:
82
+ resp = _a.sent();
83
+ return [2 /*return*/, resp.data];
84
+ }
85
+ });
86
+ });
87
+ };
73
88
  return WorkoutsApi;
74
89
  }());
75
90
  exports.WorkoutsApi = WorkoutsApi;
@@ -0,0 +1,27 @@
1
+ import { SourceClientFacing } from './user_models';
2
+ export interface RawResponse {
3
+ id: string;
4
+ user_id: string;
5
+ source_id: number;
6
+ source?: SourceClientFacing;
7
+ priority: number;
8
+ priority_id: number;
9
+ timestamp: Date;
10
+ data: Record<string, string>;
11
+ provider_id: string;
12
+ }
13
+ export interface ClientActivityRawResponse {
14
+ activity: RawResponse[];
15
+ }
16
+ export interface ClientWorkoutsRawResponse {
17
+ workouts: RawResponse[];
18
+ }
19
+ export interface ClientBodyRawResponse {
20
+ body: RawResponse[];
21
+ }
22
+ export interface ClientSleepRawResponse {
23
+ sleep: RawResponse[];
24
+ }
25
+ export interface ClientProfileRawResponse {
26
+ profile: RawResponse[];
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.js CHANGED
@@ -81,14 +81,14 @@ var VitalClient = /** @class */ (function () {
81
81
  });
82
82
  // Hook APIS
83
83
  this.Activity = new client_1.ActivityApi(baseURL.concat('/v2'), axiosApiInstance);
84
- this.Link = new client_1.LinkApi(baseURL.concat('/v1'), axiosApiInstance);
84
+ this.Link = new client_1.LinkApi(baseURL.concat('/v2'), axiosApiInstance);
85
85
  this.Body = new client_1.BodyApi(baseURL.concat('/v2'), axiosApiInstance);
86
86
  this.Sleep = new client_1.SleepApi(baseURL.concat('/v2'), axiosApiInstance);
87
- this.User = new client_1.UserApi(baseURL.concat('/v1'), axiosApiInstance);
87
+ this.User = new client_1.UserApi(baseURL.concat('/v2'), axiosApiInstance);
88
88
  this.Workouts = new client_1.WorkoutsApi(baseURL.concat('/v2'), axiosApiInstance);
89
89
  this.Webhooks = new client_1.WebhooksApi(baseURL.concat('/v2'), axiosApiInstance);
90
90
  this.Vitals = new Vitals_1.VitalsApi(baseURL.concat('/v2'), axiosApiInstance);
91
- this.Testkits = new client_1.TestkitsApi(baseURL.concat('/v1'), axiosApiInstance);
91
+ this.Testkits = new client_1.TestkitsApi(baseURL.concat('/v2'), axiosApiInstance);
92
92
  this.Profile = new client_1.ProfileApi(baseURL.concat('/v2'), axiosApiInstance);
93
93
  }
94
94
  return VitalClient;
package/index.ts CHANGED
@@ -58,14 +58,14 @@ export class VitalClient {
58
58
 
59
59
  // Hook APIS
60
60
  this.Activity = new ActivityApi(baseURL.concat('/v2'), axiosApiInstance);
61
- this.Link = new LinkApi(baseURL.concat('/v1'), axiosApiInstance);
61
+ this.Link = new LinkApi(baseURL.concat('/v2'), axiosApiInstance);
62
62
  this.Body = new BodyApi(baseURL.concat('/v2'), axiosApiInstance);
63
63
  this.Sleep = new SleepApi(baseURL.concat('/v2'), axiosApiInstance);
64
- this.User = new UserApi(baseURL.concat('/v1'), axiosApiInstance);
64
+ this.User = new UserApi(baseURL.concat('/v2'), axiosApiInstance);
65
65
  this.Workouts = new WorkoutsApi(baseURL.concat('/v2'), axiosApiInstance);
66
66
  this.Webhooks = new WebhooksApi(baseURL.concat('/v2'), axiosApiInstance);
67
67
  this.Vitals = new VitalsApi(baseURL.concat('/v2'), axiosApiInstance);
68
- this.Testkits = new TestkitsApi(baseURL.concat('/v1'), axiosApiInstance);
68
+ this.Testkits = new TestkitsApi(baseURL.concat('/v2'), axiosApiInstance);
69
69
  this.Profile = new ProfileApi(baseURL.concat('/v2'), axiosApiInstance);
70
70
  }
71
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-node",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Node client for Vital",
5
5
  "author": "maitham",
6
6
  "keywords": [