shred-api-client 1.5.0 → 1.5.2

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.
@@ -1,10 +1,9 @@
1
- import Context from "../model/Context";
2
1
  import Environment from "../model/Env";
3
2
  import { EmailAPISchema, Email } from "../model/Email.schema";
4
3
  declare class EmailAPI implements EmailAPISchema {
5
4
  private env;
6
5
  private clientHTTP;
7
6
  constructor(env: Environment);
8
- send(email: Email, context: Context): Promise<boolean>;
7
+ send(email: Email): Promise<boolean>;
9
8
  }
10
9
  export default EmailAPI;
@@ -10,9 +10,9 @@ class EmailAPI {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
- async send(email, context) {
13
+ async send(email) {
14
14
  const endpointInfo = Email_schema_1.EmailEndpoints.SendEmail;
15
- const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, email, context);
15
+ const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, email);
16
16
  return data.result;
17
17
  }
18
18
  }
@@ -5,6 +5,8 @@ declare class UserAPI implements UserAPISchema {
5
5
  private env;
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
8
+ sendValidationCode(email: string): Promise<boolean>;
9
+ confirmCode(email: string, code: number): Promise<boolean>;
8
10
  isEmailAvaliable(email: string): Promise<boolean>;
9
11
  authenticate(context: Context, system: System): Promise<string>;
10
12
  createUser(email: string, name: string, newPassword: string, newPasswordConfirmation: string, profession: string | null, invitationCode: string | null): Promise<any>;
@@ -10,6 +10,16 @@ class UserAPI {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
+ async sendValidationCode(email) {
14
+ const endpointData = User_schema_1.UserEndpoints.SendValidationCode;
15
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}`, endpointData.method);
16
+ return data.success;
17
+ }
18
+ async confirmCode(email, code) {
19
+ const endpointData = User_schema_1.UserEndpoints.ConfirmCode;
20
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}&code=${code}`, endpointData.method);
21
+ return data.success;
22
+ }
13
23
  async isEmailAvaliable(email) {
14
24
  const endpointData = User_schema_1.UserEndpoints.IsEmailAvaliable;
15
25
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}`, endpointData.method);
@@ -1,6 +1,5 @@
1
- import Context from "./Context";
2
1
  interface EmailAPISchema {
3
- send: (email: Email, c: Context) => Promise<boolean>;
2
+ send: (email: Email) => Promise<boolean>;
4
3
  }
5
4
  declare const EmailEndpoints: {
6
5
  SendEmail: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EmailEndpoints = void 0;
4
4
  const EmailEndpoints = {
5
5
  SendEmail: {
6
- uri: "/emails/send",
6
+ uri: "/emails/public/send",
7
7
  method: "POST",
8
8
  },
9
9
  };
@@ -4,6 +4,8 @@ import { Tenant } from "./Tenant.schema";
4
4
  interface UserAPISchema {
5
5
  getUserInfo: (context: Context) => Promise<User>;
6
6
  isEmailAvaliable: (email: string) => Promise<boolean>;
7
+ sendValidationCode: (email: string) => Promise<boolean>;
8
+ confirmCode: (email: string, code: number) => Promise<boolean>;
7
9
  authenticate: (context: Context, system: System) => Promise<string>;
8
10
  createUser: (email: string, name: string, newPassword: string, newPasswordConfirmation: string, profession: string | null, invitationCode: string | null) => Promise<User>;
9
11
  }
@@ -20,6 +22,14 @@ declare const UserEndpoints: {
20
22
  uri: string;
21
23
  method: string;
22
24
  };
25
+ ConfirmCode: {
26
+ uri: string;
27
+ method: string;
28
+ };
29
+ SendValidationCode: {
30
+ uri: string;
31
+ method: string;
32
+ };
23
33
  Authenticate: {
24
34
  uri: string;
25
35
  method: string;
@@ -14,6 +14,14 @@ const UserEndpoints = {
14
14
  uri: "/accounts/public/email/avaliable",
15
15
  method: "GET",
16
16
  },
17
+ ConfirmCode: {
18
+ uri: "/accounts/public/email/validate",
19
+ method: "POST",
20
+ },
21
+ SendValidationCode: {
22
+ uri: "/accounts/public/email/send",
23
+ method: "POST",
24
+ },
17
25
  Authenticate: {
18
26
  uri: "/accounts/authenticate",
19
27
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",