@tryvital/vital-node 1.0.9 → 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 (62) 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 +17 -0
  7. package/client/Sleep.ts +8 -5
  8. package/client/Testkits.ts +18 -2
  9. package/client/User.ts +19 -10
  10. package/client/Vitals.ts +10 -10
  11. package/client/Webhooks.ts +1 -1
  12. package/client/Workouts.ts +4 -4
  13. package/client/index.ts +1 -0
  14. package/client/models/body_model.ts +1 -1
  15. package/client/models/profile_model.ts +1 -1
  16. package/client/models/provider_models.ts +19 -0
  17. package/client/models/provider_specific.ts +1 -1
  18. package/client/models/raw_response.ts +14 -1
  19. package/client/models/sleep_models.ts +1 -1
  20. package/client/models/testkit_models.ts +19 -0
  21. package/client/models/user_models.ts +2 -2
  22. package/client/models/workout_models.ts +1 -1
  23. package/dist/client/Activity.d.ts +2 -2
  24. package/dist/client/Activity.js +4 -4
  25. package/dist/client/Body.d.ts +2 -2
  26. package/dist/client/Body.js +4 -4
  27. package/dist/client/Devices.d.ts +8 -0
  28. package/dist/client/Devices.js +62 -0
  29. package/dist/client/Link.d.ts +1 -1
  30. package/dist/client/Link.js +2 -2
  31. package/dist/client/Profile.d.ts +2 -2
  32. package/dist/client/Profile.js +4 -4
  33. package/dist/client/Provider.d.ts +8 -0
  34. package/dist/client/Provider.js +60 -0
  35. package/dist/client/Sleep.d.ts +2 -2
  36. package/dist/client/Sleep.js +4 -4
  37. package/dist/client/Testkits.d.ts +4 -2
  38. package/dist/client/Testkits.js +28 -2
  39. package/dist/client/User.d.ts +7 -6
  40. package/dist/client/User.js +21 -8
  41. package/dist/client/Vitals.d.ts +5 -5
  42. package/dist/client/Vitals.js +10 -10
  43. package/dist/client/Webhooks.d.ts +1 -1
  44. package/dist/client/Webhooks.js +1 -1
  45. package/dist/client/Workouts.d.ts +2 -2
  46. package/dist/client/Workouts.js +4 -4
  47. package/dist/client/index.d.ts +1 -0
  48. package/dist/client/index.js +3 -1
  49. package/dist/client/models/body_model.d.ts +1 -1
  50. package/dist/client/models/profile_model.d.ts +1 -1
  51. package/dist/client/models/provider_models.d.ts +18 -0
  52. package/dist/client/models/provider_models.js +15 -0
  53. package/dist/client/models/provider_specific.d.ts +1 -1
  54. package/dist/client/models/raw_response.d.ts +11 -0
  55. package/dist/client/models/sleep_models.d.ts +1 -1
  56. package/dist/client/models/testkit_models.d.ts +17 -0
  57. package/dist/client/models/user_models.d.ts +2 -2
  58. package/dist/client/models/workout_models.d.ts +1 -1
  59. package/dist/index.d.ts +4 -1
  60. package/dist/index.js +3 -0
  61. package/index.ts +6 -0
  62. package/package.json +3 -3
@@ -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:
@@ -0,0 +1,8 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Provider } from './models/provider_models';
3
+ export declare class ProviderApi {
4
+ baseURL: string;
5
+ client: AxiosInstance;
6
+ constructor(baseURL: string, axios: AxiosInstance);
7
+ getSupportedProviders(): Promise<Provider[]>;
8
+ }
@@ -0,0 +1,60 @@
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.ProviderApi = void 0;
40
+ var ProviderApi = /** @class */ (function () {
41
+ function ProviderApi(baseURL, axios) {
42
+ this.baseURL = baseURL;
43
+ this.client = axios;
44
+ }
45
+ ProviderApi.prototype.getSupportedProviders = function () {
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('/providers/'))];
51
+ case 1:
52
+ resp = _a.sent();
53
+ return [2 /*return*/, resp.data];
54
+ }
55
+ });
56
+ });
57
+ };
58
+ return ProviderApi;
59
+ }());
60
+ exports.ProviderApi = ProviderApi;
@@ -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:
@@ -1,12 +1,14 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { Order, OrderRequestResponse, OrderResponse, PatientAdress, PatientDetails, TestkitResponse } from './models/testkit_models';
2
+ import { LabResultsMetadata, LabResultsRaw, Order, OrderRequestResponse, OrderResponse, PatientAdress, PatientDetails, TestkitResponse } from './models/testkit_models';
3
3
  export declare class TestkitsApi {
4
4
  baseURL: string;
5
5
  client: AxiosInstance;
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
+ getMetadata(orderId: string): Promise<LabResultsMetadata>;
13
+ getRawResults(orderId: string): Promise<LabResultsRaw>;
12
14
  }
@@ -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,
@@ -116,6 +116,32 @@ var TestkitsApi = /** @class */ (function () {
116
116
  });
117
117
  });
118
118
  };
119
+ TestkitsApi.prototype.getMetadata = function (orderId) {
120
+ return __awaiter(this, void 0, void 0, function () {
121
+ var resp;
122
+ return __generator(this, function (_a) {
123
+ switch (_a.label) {
124
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/testkit/orders/" + orderId + "/results/metadata"))];
125
+ case 1:
126
+ resp = _a.sent();
127
+ return [2 /*return*/, resp.data];
128
+ }
129
+ });
130
+ });
131
+ };
132
+ TestkitsApi.prototype.getRawResults = function (orderId) {
133
+ return __awaiter(this, void 0, void 0, function () {
134
+ var resp;
135
+ return __generator(this, function (_a) {
136
+ switch (_a.label) {
137
+ case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat("/testkit/orders/" + orderId + "/results/raw"))];
138
+ case 1:
139
+ resp = _a.sent();
140
+ return [2 /*return*/, resp.data];
141
+ }
142
+ });
143
+ });
144
+ };
119
145
  return TestkitsApi;
120
146
  }());
121
147
  exports.TestkitsApi = TestkitsApi;
@@ -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
  };
@@ -3,5 +3,5 @@ export declare class WebhooksApi {
3
3
  baseURL: string;
4
4
  client: AxiosInstance;
5
5
  constructor(baseURL: string, axios: AxiosInstance);
6
- static constructWebhookEvent(payload: string, headers: Record<string, string>, secret: string): unknown;
6
+ constructWebhookEvent(payload: string, headers: Record<string, string>, secret: string): unknown;
7
7
  }
@@ -7,7 +7,7 @@ var WebhooksApi = /** @class */ (function () {
7
7
  this.baseURL = baseURL;
8
8
  this.client = axios;
9
9
  }
10
- WebhooksApi.constructWebhookEvent = function (payload, headers, secret) {
10
+ WebhooksApi.prototype.constructWebhookEvent = function (payload, headers, secret) {
11
11
  var wh = new svix_1.Webhook(secret);
12
12
  return wh.verify(payload, headers);
13
13
  };
@@ -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
  */
@@ -0,0 +1,18 @@
1
+ export declare enum Resource {
2
+ WORKOUTS = "workouts",
3
+ ACTVITY = "activity",
4
+ SLEEP = "sleep",
5
+ BODY = "body",
6
+ WORKOUTS_STREAM = "workouts/stream",
7
+ SLEEP_STREAM = "sleep/stream",
8
+ HEARTRATE = "heartrate",
9
+ GLUCOSE = "glucose",
10
+ PROFILE = "profile"
11
+ }
12
+ export interface Provider {
13
+ name: string;
14
+ slug: string;
15
+ logo: string;
16
+ auth_type: 'password' | 'email' | 'oauth';
17
+ supported_resources: Resource[];
18
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Resource = void 0;
4
+ var Resource;
5
+ (function (Resource) {
6
+ Resource["WORKOUTS"] = "workouts";
7
+ Resource["ACTVITY"] = "activity";
8
+ Resource["SLEEP"] = "sleep";
9
+ Resource["BODY"] = "body";
10
+ Resource["WORKOUTS_STREAM"] = "workouts/stream";
11
+ Resource["SLEEP_STREAM"] = "sleep/stream";
12
+ Resource["HEARTRATE"] = "heartrate";
13
+ Resource["GLUCOSE"] = "glucose";
14
+ Resource["PROFILE"] = "profile";
15
+ })(Resource = exports.Resource || (exports.Resource = {}));
@@ -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
  */