@tryvital/vital-node 2.1.21 → 2.1.22

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
@@ -7,6 +7,7 @@ import {
7
7
  OAuthProviders,
8
8
  EmailProviders,
9
9
  DemoProviders,
10
+ VitalCodeCreatedResponse,
10
11
  } from './models/link_models';
11
12
  import { SourceWithLinkInfo } from './models/user_models';
12
13
 
@@ -90,4 +91,16 @@ export class LinkApi {
90
91
  );
91
92
  return resp.data;
92
93
  }
94
+
95
+ public async codeCreate(userId: string, expiresAt: string = ""): Promise<VitalCodeCreatedResponse> {
96
+ const paramsObject = expiresAt ? {user_id: userId, expires_at: expiresAt} : {user_id: userId};
97
+ const resp = await this.client.post(
98
+ this.baseURL.concat(`/link/code/create`),
99
+ null,
100
+ {
101
+ params: paramsObject
102
+ }
103
+ );
104
+ return resp.data;
105
+ }
93
106
  }
@@ -39,3 +39,8 @@ export interface DemoConnectionResponse {
39
39
  success: boolean;
40
40
  redirect_url?: string;
41
41
  }
42
+
43
+ export interface VitalCodeCreatedResponse {
44
+ code: string;
45
+ exchange_url: string;
46
+ }
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ProviderLinkResponse, LinkTokenExchangeResponse, DemoConnectionResponse, PasswordProviders, OAuthProviders, EmailProviders, DemoProviders } from './models/link_models';
2
+ import { ProviderLinkResponse, LinkTokenExchangeResponse, DemoConnectionResponse, PasswordProviders, OAuthProviders, EmailProviders, DemoProviders, VitalCodeCreatedResponse } from './models/link_models';
3
3
  import { SourceWithLinkInfo } from './models/user_models';
4
4
  export declare class LinkApi {
5
5
  baseURL: string;
@@ -10,4 +10,5 @@ export declare class LinkApi {
10
10
  connectEmailProvider(linkToken: string, provider: EmailProviders, email: string, region?: string): Promise<ProviderLinkResponse>;
11
11
  getOAuthLink(linkToken: string, provider: OAuthProviders): Promise<SourceWithLinkInfo>;
12
12
  connectDemoProvider(userId: string, provider: DemoProviders): Promise<DemoConnectionResponse>;
13
+ codeCreate(userId: string, expiresAt?: string): Promise<VitalCodeCreatedResponse>;
13
14
  }
@@ -125,6 +125,24 @@ var LinkApi = /** @class */ (function () {
125
125
  });
126
126
  });
127
127
  };
128
+ LinkApi.prototype.codeCreate = function (userId, expiresAt) {
129
+ if (expiresAt === void 0) { expiresAt = ""; }
130
+ return __awaiter(this, void 0, void 0, function () {
131
+ var paramsObject, resp;
132
+ return __generator(this, function (_a) {
133
+ switch (_a.label) {
134
+ case 0:
135
+ paramsObject = expiresAt ? { user_id: userId, expires_at: expiresAt } : { user_id: userId };
136
+ return [4 /*yield*/, this.client.post(this.baseURL.concat("/link/code/create"), null, {
137
+ params: paramsObject
138
+ })];
139
+ case 1:
140
+ resp = _a.sent();
141
+ return [2 /*return*/, resp.data];
142
+ }
143
+ });
144
+ });
145
+ };
128
146
  return LinkApi;
129
147
  }());
130
148
  exports.LinkApi = LinkApi;
@@ -14,3 +14,7 @@ export interface DemoConnectionResponse {
14
14
  success: boolean;
15
15
  redirect_url?: string;
16
16
  }
17
+ export interface VitalCodeCreatedResponse {
18
+ code: string;
19
+ exchange_url: string;
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-node",
3
- "version": "2.1.21",
3
+ "version": "2.1.22",
4
4
  "description": "Node client for Vital",
5
5
  "author": "maitham",
6
6
  "keywords": [