@tryvital/vital-node 1.1.1 → 1.3.1

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 (74) hide show
  1. package/.github/workflows/deploy.yaml +11 -50
  2. package/.vscode/settings.json +3 -0
  3. package/__tests__/activity.test.ts +18 -0
  4. package/__tests__/arrange.ts +36 -0
  5. package/__tests__/body.test.ts +17 -0
  6. package/__tests__/devices.test.ts +15 -0
  7. package/__tests__/link.test.ts +15 -0
  8. package/__tests__/profile.test.ts +15 -0
  9. package/__tests__/sleep.test.ts +17 -0
  10. package/__tests__/user.test.ts +37 -0
  11. package/__tests__/vitals.test.ts +17 -0
  12. package/__tests__/workouts.test.ts +17 -0
  13. package/client/Activity.ts +6 -6
  14. package/client/Body.ts +6 -7
  15. package/client/Devices.ts +25 -0
  16. package/client/Link.ts +2 -2
  17. package/client/Profile.ts +5 -5
  18. package/client/Provider.ts +1 -1
  19. package/client/Sleep.ts +13 -9
  20. package/client/Testkits.ts +12 -4
  21. package/client/User.ts +19 -10
  22. package/client/Vitals.ts +16 -16
  23. package/client/Workouts.ts +6 -6
  24. package/client/index.ts +1 -0
  25. package/client/models/body_model.ts +1 -1
  26. package/client/models/profile_model.ts +1 -1
  27. package/client/models/provider_specific.ts +1 -1
  28. package/client/models/raw_response.ts +14 -1
  29. package/client/models/sleep_models.ts +1 -1
  30. package/client/models/testkit_models.ts +13 -11
  31. package/client/models/user_models.ts +3 -2
  32. package/client/models/workout_models.ts +1 -1
  33. package/dist/client/Activity.d.ts +2 -2
  34. package/dist/client/Activity.js +4 -4
  35. package/dist/client/Body.d.ts +2 -2
  36. package/dist/client/Body.js +4 -4
  37. package/dist/client/Devices.d.ts +8 -0
  38. package/dist/client/Devices.js +62 -0
  39. package/dist/client/Link.d.ts +1 -1
  40. package/dist/client/Link.js +2 -2
  41. package/dist/client/Profile.d.ts +2 -2
  42. package/dist/client/Profile.js +4 -4
  43. package/dist/client/Provider.js +1 -1
  44. package/dist/client/Sleep.d.ts +2 -2
  45. package/dist/client/Sleep.js +6 -5
  46. package/dist/client/Testkits.d.ts +3 -2
  47. package/dist/client/Testkits.js +17 -4
  48. package/dist/client/User.d.ts +7 -6
  49. package/dist/client/User.js +21 -8
  50. package/dist/client/Vitals.d.ts +5 -5
  51. package/dist/client/Vitals.js +10 -10
  52. package/dist/client/Workouts.d.ts +2 -2
  53. package/dist/client/Workouts.js +4 -4
  54. package/dist/client/index.d.ts +1 -0
  55. package/dist/client/index.js +3 -1
  56. package/dist/client/models/body_model.d.ts +1 -1
  57. package/dist/client/models/profile_model.d.ts +1 -1
  58. package/dist/client/models/provider_specific.d.ts +1 -1
  59. package/dist/client/models/raw_response.d.ts +11 -0
  60. package/dist/client/models/sleep_models.d.ts +1 -1
  61. package/dist/client/models/testkit_models.d.ts +1 -1
  62. package/dist/client/models/user_models.d.ts +3 -2
  63. package/dist/client/models/workout_models.d.ts +1 -1
  64. package/dist/index.d.ts +2 -1
  65. package/dist/index.js +8 -1
  66. package/dist/lib/config.d.ts +9 -0
  67. package/dist/lib/config.js +9 -0
  68. package/dist/lib/models.d.ts +2 -1
  69. package/index.ts +9 -1
  70. package/jest.config.js +6 -0
  71. package/lib/config.ts +9 -0
  72. package/lib/models.ts +2 -1
  73. package/package.json +7 -1
  74. package/tsconfig.json +14 -5
@@ -1,57 +1,18 @@
1
- name: CI
1
+ name: Publish Package to npmjs
2
2
  on:
3
- push:
4
- branches:
5
- - "main"
3
+ release:
4
+ types: [published]
6
5
  jobs:
7
6
  build:
8
- name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
9
- runs-on: ${{ matrix.os }}
10
- strategy:
11
- matrix:
12
- node: ['10.x', '12.x', '14.x']
13
- os: [ubuntu-latest, windows-latest, macOS-latest]
14
-
15
- steps:
16
- - name: Checkout repo
17
- uses: actions/checkout@v2
18
-
19
- - name: Use Node ${{ matrix.node }}
20
- uses: actions/setup-node@v1
21
- with:
22
- node-version: ${{ matrix.node }}
23
-
24
- - name: Install deps and build (with cache)
25
- uses: bahmutov/npm-install@v1
26
-
27
- - name: Lint
28
- run: yarn lint
29
-
30
- - name: Build
31
- run: yarn build
32
- publish:
33
- needs: build
34
- name: Build, lint, and test on Node 10
35
7
  runs-on: ubuntu-latest
36
8
  steps:
37
- - name: Checkout repo
38
- uses: actions/checkout@v2
39
- - name: Use Node 10
40
- uses: actions/setup-node@v1
9
+ - uses: actions/checkout@v2
10
+ # Setup .npmrc file to publish to npm
11
+ - uses: actions/setup-node@v2
41
12
  with:
42
- node-version: 10
43
- - name: Install deps and build (with cache)
44
- uses: bahmutov/npm-install@v1
45
- - name: Build
46
- run: yarn build
47
- - name: 'Automated Version Bump'
48
- uses: 'phips28/gh-action-bump-version@master'
13
+ node-version: '16.x'
14
+ registry-url: 'https://registry.npmjs.org'
15
+ - run: npm ci
16
+ - run: npm publish
49
17
  env:
50
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
- with:
52
- target-branch: 'main'
53
- - uses: JS-DevTools/npm-publish@v1
54
- with:
55
- token: ${{ secrets.NPM_TOKEN }}
56
- access: public
57
-
18
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
@@ -0,0 +1,3 @@
1
+ {
2
+ "jest.autoEnable": false
3
+ }
@@ -0,0 +1,18 @@
1
+ import { VitalClient } from "..";
2
+ import { testClient, testEuClient, getUserId } from "./arrange";
3
+
4
+
5
+ describe('Activity', () => {
6
+ it.each([
7
+ ["us", testClient],
8
+ ["eu", testEuClient]
9
+ ])('should return activity data %p', async (region: string, client: VitalClient) => {
10
+ const userId = await getUserId(client)
11
+ const data = await client.Activity.get(
12
+ userId,
13
+ new Date("2020-01-01"),
14
+ new Date("2022-01-02"),
15
+ )
16
+ expect(data.activity.length).toBeGreaterThan(0)
17
+ });
18
+ })
@@ -0,0 +1,36 @@
1
+ import { VitalClient } from "..";
2
+ require('dotenv').config({
3
+ path: '.env'
4
+ })
5
+
6
+ export const testClient = new VitalClient({
7
+ client_id: process.env.TEST_CLIENT_ID,
8
+ client_secret: process.env.TEST_CLIENT_SECRET,
9
+ environment: process.env.TEST_ENVIRONMENT as any,
10
+ region: "us",
11
+ });
12
+
13
+ export const testEuClient = new VitalClient({
14
+ client_id: process.env.TEST_EU_CLIENT_ID,
15
+ client_secret: process.env.TEST_EU_CLIENT_SECRET,
16
+ environment: "development",
17
+ region: "eu",
18
+ });
19
+
20
+ export const test_user_id = "test_user_1234";
21
+
22
+ export const getUserId = async (client: VitalClient, user_id: string = test_user_id) => {
23
+ const data = await client.User.resolve(user_id);
24
+ return data.user_id;
25
+ }
26
+
27
+ export function randomString(length: number): string {
28
+ var result = '';
29
+ var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
30
+ var charactersLength = characters.length;
31
+ for (var i = 0; i < length; i++) {
32
+ result += characters.charAt(Math.floor(Math.random() *
33
+ charactersLength));
34
+ }
35
+ return result;
36
+ }
@@ -0,0 +1,17 @@
1
+ import { VitalClient } from "..";
2
+ import { getUserId, testClient, testEuClient } from "./arrange";
3
+
4
+ describe('Body', () => {
5
+ it.each([
6
+ ["us", testClient],
7
+ ["eu", testEuClient]
8
+ ])('should return body data %p', async (region: string, client: VitalClient) => {
9
+ const userId = await getUserId(client)
10
+ const data = await client.Body.get(
11
+ userId,
12
+ new Date("2021-01-01"),
13
+ new Date("2022-01-02"),
14
+ )
15
+ expect(data.body.length).toBeGreaterThan(0)
16
+ });
17
+ })
@@ -0,0 +1,15 @@
1
+ import { VitalClient } from "..";
2
+ import { testClient, testEuClient, getUserId } from "./arrange";
3
+
4
+ describe('Devices', () => {
5
+ it.each([
6
+ ["us", testClient],
7
+ ["eu", testEuClient]
8
+ ])('should return device data %p', async (region: string, client: VitalClient) => {
9
+ const userId = await getUserId(client)
10
+ const data = await client.Devices.get_raw(
11
+ userId,
12
+ )
13
+ expect(data.devices.length).toBeGreaterThan(0)
14
+ });
15
+ })
@@ -0,0 +1,15 @@
1
+ import { VitalClient } from "..";
2
+ import { getUserId, testClient, testEuClient } from "./arrange";
3
+
4
+ describe('Link', () => {
5
+ it.each([
6
+ ["us", testClient],
7
+ ["eu", testEuClient]
8
+ ])('should create a link token %p', async (region: string, client: VitalClient) => {
9
+ const userId = await getUserId(client)
10
+ const data = await client.Link.create(
11
+ userId,
12
+ )
13
+ expect(data.link_token).toBeDefined()
14
+ });
15
+ })
@@ -0,0 +1,15 @@
1
+ import { VitalClient } from "..";
2
+ import { testClient, testEuClient, getUserId } from "./arrange";
3
+
4
+ describe('Profile', () => {
5
+ it.each([
6
+ ["us", testClient],
7
+ ["eu", testEuClient]
8
+ ])('should return profile data %p', async (region: string, client: VitalClient) => {
9
+ const userId = await getUserId(client)
10
+ const data = await client.Profile.get(
11
+ userId,
12
+ )
13
+ expect(data.user_id).toBe(userId)
14
+ });
15
+ })
@@ -0,0 +1,17 @@
1
+ import { VitalClient } from "..";
2
+ import { testClient, testEuClient, getUserId } from "./arrange";
3
+
4
+ describe('Sleep', () => {
5
+ it.each([
6
+ ["us", testClient],
7
+ ["eu", testEuClient]
8
+ ])('should return sleep data %p', async (region: string, client: VitalClient) => {
9
+ const userId = await getUserId(client)
10
+ const data = await client.Sleep.get(
11
+ userId,
12
+ new Date("2021-01-01"),
13
+ new Date("2022-01-02"),
14
+ )
15
+ expect(data.sleep.length).toBeGreaterThan(0)
16
+ });
17
+ })
@@ -0,0 +1,37 @@
1
+ import { VitalClient } from "..";
2
+ import { getUserId, randomString, testClient, testEuClient, test_user_id } from "./arrange";
3
+
4
+ describe('User', () => {
5
+ const user_id = randomString(10);
6
+ it.each([
7
+ ["us", testClient],
8
+ ["eu", testEuClient]
9
+ ])('should create a user %p', async (region: string, client: VitalClient) => {
10
+ const user = await client.User.create(
11
+ user_id,
12
+ )
13
+ expect(user.client_user_id).toBe(user_id)
14
+ });
15
+
16
+ it.each([
17
+ testClient,
18
+ testEuClient
19
+ ])('should find a user', async (client: VitalClient) => {
20
+ const user = await client.User.resolve(
21
+ test_user_id,
22
+ )
23
+ expect(user.client_user_id).toBe(test_user_id)
24
+ });
25
+
26
+ it.each([
27
+ testClient,
28
+ testEuClient
29
+ ])('should delete a user', async (client: VitalClient) => {
30
+ const userToDelete = await getUserId(client, user_id);
31
+ const user = await client.User.delete(
32
+ userToDelete,
33
+ )
34
+ expect(user.success).toBe(true)
35
+ });
36
+
37
+ })
@@ -0,0 +1,17 @@
1
+ import { VitalClient } from "..";
2
+ import { testClient, testEuClient, getUserId } from "./arrange";
3
+
4
+ describe('Vitals', () => {
5
+ it.each([
6
+ ["us", testClient],
7
+ ["eu", testEuClient]
8
+ ])('should return glucose data %p', async (region: string, client: VitalClient) => {
9
+ const userId = await getUserId(client)
10
+ const data = await client.Vitals.glucose(
11
+ userId,
12
+ new Date("2021-01-01"),
13
+ new Date("2022-01-02"),
14
+ )
15
+ expect(data.length).toBeGreaterThan(0)
16
+ });
17
+ })
@@ -0,0 +1,17 @@
1
+ import { VitalClient } from "..";
2
+ import { testClient, testEuClient, getUserId } from "./arrange";
3
+
4
+ describe('Workouts', () => {
5
+ it.each([
6
+ ["us", testClient],
7
+ ["eu", testEuClient]
8
+ ])('should return workout data %p', async (region: string, client: VitalClient) => {
9
+ const userId = await getUserId(client)
10
+ const data = await client.Workouts.get(
11
+ userId,
12
+ new Date("2021-01-01"),
13
+ new Date("2022-01-02"),
14
+ )
15
+ expect(data.workouts.length).toBeGreaterThan(0)
16
+ });
17
+ })
@@ -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
- endDate: Date,
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
- endDate: Date,
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
- endDate: Date,
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
- endDate: Date,
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,15 +14,16 @@ export class SleepApi {
11
14
  }
12
15
 
13
16
  public async get(
14
- userKey: string,
17
+ userId: string,
15
18
  startDate: Date,
16
- endDate: Date,
17
- provider?: string
19
+ endDate?: Date,
20
+ provider?: string,
21
+ with_stream: boolean = false
18
22
  ): Promise<ClientSleepResponse> {
19
23
  const resp = await this.client.get(
20
- this.baseURL.concat(`/summary/sleep/${userKey}`),
24
+ this.baseURL.concat(`/summary/sleep/${userId}`),
21
25
  {
22
- params: { start_date: startDate, end_date: endDate, provider },
26
+ params: { start_date: startDate, end_date: endDate, provider, with_stream },
23
27
  }
24
28
  );
25
29
  return resp.data;
@@ -33,13 +37,13 @@ export class SleepApi {
33
37
  }
34
38
 
35
39
  public async get_raw(
36
- userKey: string,
40
+ userId: string,
37
41
  startDate: Date,
38
- endDate: Date,
42
+ endDate?: Date,
39
43
  provider?: string
40
44
  ): Promise<ClientSleepRawResponse> {
41
45
  const resp = await this.client.get(
42
- this.baseURL.concat(`/summary/sleep/${userKey}/raw`),
46
+ this.baseURL.concat(`/summary/sleep/${userId}/raw`),
43
47
  {
44
48
  params: { start_date: startDate, end_date: endDate, provider },
45
49
  }
@@ -25,19 +25,20 @@ export class TestkitsApi {
25
25
 
26
26
  public async get_orders(
27
27
  startDate: Date,
28
- endDate: Date
28
+ endDate: Date,
29
+ status?: string[],
29
30
  ): Promise<OrderResponse> {
30
31
  const resp = await this.client.get(
31
32
  this.baseURL.concat('/testkit/orders/'),
32
33
  {
33
- params: { start_date: startDate, end_date: endDate },
34
+ params: { start_date: startDate, end_date: endDate, status: status ? status : null},
34
35
  }
35
36
  );
36
37
  return resp.data;
37
38
  }
38
39
 
39
40
  public async order(
40
- userKey: string,
41
+ userId: string,
41
42
  testkitId: string,
42
43
  patientAddress: PatientAdress,
43
44
  patientDetails: PatientDetails
@@ -45,7 +46,7 @@ export class TestkitsApi {
45
46
  const resp = await this.client.post(
46
47
  this.baseURL.concat('/testkit/orders'),
47
48
  {
48
- user_key: userKey,
49
+ user_key: userId,
49
50
  testkit_id: testkitId,
50
51
  patient_address: patientAddress,
51
52
  patient_details: patientDetails,
@@ -61,6 +62,13 @@ export class TestkitsApi {
61
62
  return resp.data;
62
63
  }
63
64
 
65
+ public async cancel_order(orderId: string): Promise<OrderRequestResponse> {
66
+ const resp = await this.client.post(
67
+ this.baseURL.concat(`/testkit/orders/${orderId}/cancel`)
68
+ );
69
+ return resp.data;
70
+ }
71
+
64
72
  public async get_results(orderId: string): Promise<string> {
65
73
  const resp = await this.client.get(
66
74
  this.baseURL.concat(`/testkit/orders/${orderId}/results`),
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
  }