shred-api-client 1.2.4 → 1.2.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.
@@ -5,6 +5,7 @@ declare class UserAPI implements UserAPISchema {
5
5
  private env;
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
8
+ isEmailAvaliable(email: string): Promise<boolean>;
8
9
  createUser(email: string, name: string, newPassword: string, newPasswordConfirmation: string, profession: string | null, invitationCode: string | null): Promise<any>;
9
10
  getUserInfo(context: Context): Promise<User>;
10
11
  }
@@ -10,6 +10,11 @@ class UserAPI {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
+ async isEmailAvaliable(email) {
14
+ const endpointData = User_schema_1.UserEndpoints.IsEmailAvaliable;
15
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}`, endpointData.method);
16
+ return data.isValid;
17
+ }
13
18
  async createUser(email, name, newPassword, newPasswordConfirmation, profession, invitationCode) {
14
19
  const endpointData = User_schema_1.UserEndpoints.CreateUser;
15
20
  const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, {
@@ -3,6 +3,7 @@ import { Subscription } from "./Subscription.schema";
3
3
  import { Tenant } from "./Tenant.schema";
4
4
  interface UserAPISchema {
5
5
  getUserInfo: (context: Context) => Promise<User>;
6
+ isEmailAvaliable: (email: string) => Promise<boolean>;
6
7
  createUser: (email: string, name: string, newPassword: string, newPasswordConfirmation: string, profession: string | null, invitationCode: string | null) => Promise<User>;
7
8
  }
8
9
  declare const UserEndpoints: {
@@ -14,6 +15,10 @@ declare const UserEndpoints: {
14
15
  uri: string;
15
16
  method: string;
16
17
  };
18
+ IsEmailAvaliable: {
19
+ uri: string;
20
+ method: string;
21
+ };
17
22
  CreateUser: {
18
23
  uri: string;
19
24
  method: string;
@@ -36,16 +41,17 @@ type User = {
36
41
  id: string;
37
42
  name: string;
38
43
  email: string;
39
- customerId: string;
40
- registered: boolean;
41
- profession?: string;
42
- registeredAt: number;
43
44
  fcmToken?: string;
45
+ registeredAt: number;
46
+ profession?: string;
44
47
  photoUrl?: string;
45
48
  preferences?: Preferences;
49
+ tenant?: Tenant;
50
+ customerId: string;
51
+ registered: boolean;
46
52
  subscription?: Subscription;
47
53
  invitationCode?: string;
48
- tenant?: Tenant;
54
+ canCreateFreeProject: boolean;
49
55
  role?: Role;
50
56
  bindedAccounts?: string[];
51
57
  isEnabled?: boolean;
@@ -10,6 +10,10 @@ const UserEndpoints = {
10
10
  uri: "/api/user/register",
11
11
  method: "POST",
12
12
  },
13
+ IsEmailAvaliable: {
14
+ uri: "/accounts/public/email/avaliable",
15
+ method: "GET",
16
+ },
13
17
  CreateUser: {
14
18
  uri: "/api/user/public/createAccount",
15
19
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",