shred-api-client 1.9.4 → 1.9.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.
@@ -6,9 +6,11 @@ declare class UserAPI implements UserAPISchema {
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
8
8
  sendValidationCode(email: string): Promise<boolean>;
9
+ changeEmail(ctx: Context, email: string, code: number): Promise<boolean>;
9
10
  confirmCode(email: string, code: number): Promise<boolean>;
10
11
  isEmailAvaliable(email: string): Promise<boolean>;
11
12
  update(context: Context, update: Partial<Update>): Promise<boolean>;
13
+ getBindedUsers(context: Context): Promise<User[]>;
12
14
  setup(context: Context): Promise<boolean>;
13
15
  authenticate(context: Context, system: System): Promise<string>;
14
16
  createUser(email: string, name: string, password: string, passwordConfirmation: string, profession: string | null, invitationCode: string | null): Promise<any>;
@@ -15,6 +15,11 @@ class UserAPI {
15
15
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}`, endpointData.method);
16
16
  return data.success;
17
17
  }
18
+ async changeEmail(ctx, email, code) {
19
+ const endpointData = User_schema_1.UserEndpoints.ChangeEmail;
20
+ const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, { email, code }, ctx);
21
+ return data.success;
22
+ }
18
23
  async confirmCode(email, code) {
19
24
  const endpointData = User_schema_1.UserEndpoints.ConfirmCode;
20
25
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}&code=${code}`, endpointData.method);
@@ -30,6 +35,11 @@ class UserAPI {
30
35
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, Object.assign({}, update), context);
31
36
  return data.isValid;
32
37
  }
38
+ async getBindedUsers(context) {
39
+ const endpointData = User_schema_1.UserEndpoints.GetBindedUsers;
40
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, null, context);
41
+ return data.success;
42
+ }
33
43
  async setup(context) {
34
44
  const endpointData = User_schema_1.UserEndpoints.Setup;
35
45
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, null, context);
@@ -5,16 +5,26 @@ interface UserAPISchema {
5
5
  isEmailAvaliable: (email: string) => Promise<boolean>;
6
6
  sendValidationCode: (email: string) => Promise<boolean>;
7
7
  confirmCode: (email: string, code: number) => Promise<boolean>;
8
+ changeEmail: (ctx: Context, email: string, code: number) => Promise<boolean>;
8
9
  authenticate: (context: Context, system: System) => Promise<string>;
9
10
  update: (context: Context, update: Partial<Update>) => Promise<boolean>;
10
11
  setup: (context: Context) => Promise<boolean>;
12
+ getBindedUsers: (ctx: Context) => Promise<User[]>;
11
13
  createUser: (email: string, name: string, password: string, passwordConfirmation: string, profession: string | null, invitationCode: string | null) => Promise<User>;
12
14
  }
13
15
  declare const UserEndpoints: {
16
+ ChangeEmail: {
17
+ uri: string;
18
+ method: string;
19
+ };
14
20
  GetUserInfo: {
15
21
  uri: string;
16
22
  method: string;
17
23
  };
24
+ GetBindedUsers: {
25
+ uri: string;
26
+ method: string;
27
+ };
18
28
  EnableUser: {
19
29
  uri: string;
20
30
  method: string;
@@ -2,10 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.System = exports.Role = exports.UserEndpoints = void 0;
4
4
  const UserEndpoints = {
5
+ ChangeEmail: {
6
+ uri: "/accounts/user/changeEmail",
7
+ method: "PUT",
8
+ },
5
9
  GetUserInfo: {
6
10
  uri: "/accounts/user/info",
7
11
  method: "GET",
8
12
  },
13
+ GetBindedUsers: {
14
+ uri: "/api/binded/list",
15
+ method: "GET",
16
+ },
9
17
  EnableUser: {
10
18
  uri: "/api/user/register",
11
19
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.9.4",
3
+ "version": "1.9.6",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",