@tryvital/vital-node 1.4.3 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/Link.ts CHANGED
@@ -2,9 +2,11 @@ import { AxiosInstance } from 'axios';
2
2
  import {
3
3
  ProviderLinkResponse,
4
4
  LinkTokenExchangeResponse,
5
+ DemoConnectionResponse,
5
6
  PasswordProviders,
6
7
  OAuthProviders,
7
8
  EmailProviders,
9
+ DemoProviders,
8
10
  } from './models/link_models';
9
11
  import { SourceWithLinkInfo } from './models/user_models';
10
12
 
@@ -80,4 +82,12 @@ export class LinkApi {
80
82
  );
81
83
  return resp.data;
82
84
  }
85
+
86
+ public async connectDemoProvider(userId: string, provider: DemoProviders): Promise<DemoConnectionResponse> {
87
+ const resp = await this.client.post(
88
+ this.baseURL.concat(`/link/connect/demo`),
89
+ { user_id: userId, provider: provider },
90
+ );
91
+ return resp.data;
92
+ }
83
93
  }
@@ -27,11 +27,19 @@ export class TestkitsApi {
27
27
  startDate: Date,
28
28
  endDate: Date,
29
29
  status?: string[],
30
+ userId?: string,
31
+ patientName?: string
30
32
  ): Promise<OrderResponse> {
31
33
  const resp = await this.client.get(
32
34
  this.baseURL.concat('/testkit/orders/'),
33
35
  {
34
- params: { start_date: startDate, end_date: endDate, status: status ? status : null},
36
+ params: {
37
+ start_date: startDate,
38
+ end_date: endDate,
39
+ status: status ? status : null,
40
+ user_id: userId ? userId : null,
41
+ patient_name: patientName ? patientName : null,
42
+ },
35
43
  }
36
44
  );
37
45
  return resp.data;
@@ -13,7 +13,7 @@ export class WebhooksApi {
13
13
  payload: string,
14
14
  headers: Record<string, string>,
15
15
  secret: string
16
- ): unknown {
16
+ ): Record<string, any> | Record<string, any>[] {
17
17
  const wh = new Webhook(secret);
18
18
  return wh.verify(payload, headers);
19
19
  }
@@ -1,4 +1,4 @@
1
- export type PasswordProviders = 'whoop' | 'renpho' | 'peloton' | 'zwift';
1
+ export type PasswordProviders = 'whoop' | 'renpho' | 'peloton' | 'zwift' | 'hammerhead';
2
2
  export type OAuthProviders =
3
3
  | 'oura'
4
4
  | 'fitbit'
@@ -8,6 +8,7 @@ export type OAuthProviders =
8
8
  | 'wahoo';
9
9
 
10
10
  export type EmailProviders = 'freestyle_libre';
11
+ export type DemoProviders = 'apple_health_kit' | 'fitbit' | 'oura' | 'whoop';
11
12
 
12
13
  export interface ProviderLinkResponse {
13
14
  provider: PasswordProviders;
@@ -18,3 +19,8 @@ export interface ProviderLinkResponse {
18
19
  export interface LinkTokenExchangeResponse {
19
20
  link_token: string;
20
21
  }
22
+
23
+ export interface DemoConnectionResponse {
24
+ success: boolean;
25
+ redirect_url?: string;
26
+ }
@@ -49,4 +49,5 @@ export enum Providers {
49
49
  Peloton = 'peloton',
50
50
  Wahoo = 'wahoo',
51
51
  Zwift = 'zwift',
52
+ Hammerhead = 'hammerhead',
52
53
  }
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ProviderLinkResponse, LinkTokenExchangeResponse, PasswordProviders, OAuthProviders, EmailProviders } from './models/link_models';
2
+ import { ProviderLinkResponse, LinkTokenExchangeResponse, DemoConnectionResponse, PasswordProviders, OAuthProviders, EmailProviders, DemoProviders } from './models/link_models';
3
3
  import { SourceWithLinkInfo } from './models/user_models';
4
4
  export declare class LinkApi {
5
5
  baseURL: string;
@@ -9,4 +9,5 @@ export declare class LinkApi {
9
9
  connectProvider(linkToken: string, provider: PasswordProviders, username: string, password: string): Promise<ProviderLinkResponse>;
10
10
  connectEmailProvider(linkToken: string, provider: EmailProviders, email: string, region?: string): Promise<ProviderLinkResponse>;
11
11
  getOAuthLink(linkToken: string, provider: OAuthProviders): Promise<SourceWithLinkInfo>;
12
+ connectDemoProvider(userId: string, provider: DemoProviders): Promise<DemoConnectionResponse>;
12
13
  }
@@ -112,6 +112,19 @@ var LinkApi = /** @class */ (function () {
112
112
  });
113
113
  });
114
114
  };
115
+ LinkApi.prototype.connectDemoProvider = function (userId, provider) {
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var resp;
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat("/link/connect/demo"), { user_id: userId, provider: provider })];
121
+ case 1:
122
+ resp = _a.sent();
123
+ return [2 /*return*/, resp.data];
124
+ }
125
+ });
126
+ });
127
+ };
115
128
  return LinkApi;
116
129
  }());
117
130
  exports.LinkApi = LinkApi;
@@ -5,7 +5,7 @@ export declare class TestkitsApi {
5
5
  client: AxiosInstance;
6
6
  constructor(baseURL: string, axios: AxiosInstance);
7
7
  get(): Promise<TestkitResponse>;
8
- get_orders(startDate: Date, endDate: Date, status?: string[]): Promise<OrderResponse>;
8
+ get_orders(startDate: Date, endDate: Date, status?: string[], userId?: string, patientName?: string): Promise<OrderResponse>;
9
9
  order(userId: string, testkitId: string, patientAddress: PatientAdress, patientDetails: PatientDetails): Promise<OrderRequestResponse>;
10
10
  get_order(orderId: string): Promise<Order>;
11
11
  cancel_order(orderId: string): Promise<OrderRequestResponse>;
@@ -55,13 +55,19 @@ var TestkitsApi = /** @class */ (function () {
55
55
  });
56
56
  });
57
57
  };
58
- TestkitsApi.prototype.get_orders = function (startDate, endDate, status) {
58
+ TestkitsApi.prototype.get_orders = function (startDate, endDate, status, userId, patientName) {
59
59
  return __awaiter(this, void 0, void 0, function () {
60
60
  var resp;
61
61
  return __generator(this, function (_a) {
62
62
  switch (_a.label) {
63
63
  case 0: return [4 /*yield*/, this.client.get(this.baseURL.concat('/testkit/orders/'), {
64
- params: { start_date: startDate, end_date: endDate, status: status ? status : null },
64
+ params: {
65
+ start_date: startDate,
66
+ end_date: endDate,
67
+ status: status ? status : null,
68
+ user_id: userId ? userId : null,
69
+ patient_name: patientName ? patientName : null,
70
+ },
65
71
  })];
66
72
  case 1:
67
73
  resp = _a.sent();
@@ -3,5 +3,5 @@ export declare class WebhooksApi {
3
3
  baseURL: string;
4
4
  client: AxiosInstance;
5
5
  constructor(baseURL: string, axios: AxiosInstance);
6
- constructWebhookEvent(payload: string, headers: Record<string, string>, secret: string): unknown;
6
+ constructWebhookEvent(payload: string, headers: Record<string, string>, secret: string): Record<string, any> | Record<string, any>[];
7
7
  }
@@ -1,6 +1,7 @@
1
- export declare type PasswordProviders = 'whoop' | 'renpho' | 'peloton' | 'zwift';
1
+ export declare type PasswordProviders = 'whoop' | 'renpho' | 'peloton' | 'zwift' | 'hammerhead';
2
2
  export declare type OAuthProviders = 'oura' | 'fitbit' | 'garmin' | 'whoop' | 'strava' | 'wahoo';
3
3
  export declare type EmailProviders = 'freestyle_libre';
4
+ export declare type DemoProviders = 'apple_health_kit' | 'fitbit' | 'oura' | 'whoop';
4
5
  export interface ProviderLinkResponse {
5
6
  provider: PasswordProviders;
6
7
  connected: boolean;
@@ -9,3 +10,7 @@ export interface ProviderLinkResponse {
9
10
  export interface LinkTokenExchangeResponse {
10
11
  link_token: string;
11
12
  }
13
+ export interface DemoConnectionResponse {
14
+ success: boolean;
15
+ redirect_url?: string;
16
+ }
@@ -41,5 +41,6 @@ export declare enum Providers {
41
41
  Renpho = "renpho",
42
42
  Peloton = "peloton",
43
43
  Wahoo = "wahoo",
44
- Zwift = "zwift"
44
+ Zwift = "zwift",
45
+ Hammerhead = "hammerhead"
45
46
  }
@@ -12,4 +12,5 @@ var Providers;
12
12
  Providers["Peloton"] = "peloton";
13
13
  Providers["Wahoo"] = "wahoo";
14
14
  Providers["Zwift"] = "zwift";
15
+ Providers["Hammerhead"] = "hammerhead";
15
16
  })(Providers = exports.Providers || (exports.Providers = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-node",
3
- "version": "1.4.3",
3
+ "version": "1.4.6",
4
4
  "description": "Node client for Vital",
5
5
  "author": "maitham",
6
6
  "keywords": [
@@ -56,4 +56,4 @@
56
56
  "ts-node": "^10.2.0",
57
57
  "typescript": "^4.3.5"
58
58
  }
59
- }
59
+ }