shred-api-client 1.11.0 → 1.11.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 { Track, TrackAPISchema } from "../model/Track.schema";
4
3
  declare class TrackAPI implements TrackAPISchema {
5
4
  private env;
6
5
  private clientHTTP;
7
6
  constructor(env: Environment);
8
- send(t: Track, context: Context): Promise<boolean>;
7
+ send(t: Track): Promise<boolean>;
9
8
  }
10
9
  export default TrackAPI;
@@ -10,9 +10,9 @@ class TrackAPI {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
- async send(t, context) {
13
+ async send(t) {
14
14
  const endpointInfo = Track_schema_1.TrackEndpoints.Track;
15
- const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, t, context);
15
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, t);
16
16
  return data;
17
17
  }
18
18
  }
@@ -6,6 +6,8 @@ declare class UserAPI implements UserAPISchema {
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
8
8
  deleteAccount(ctx: Context): Promise<boolean>;
9
+ createIntegrationToken(ctx: Context): Promise<string>;
10
+ getIntegrationToken(ctx: Context): Promise<string | null>;
9
11
  sendValidationCode(email: string): Promise<boolean>;
10
12
  changePassword(email: string, pass: string, passConfirm: string, code: number): Promise<boolean>;
11
13
  changeEmail(ctx: Context, email: string, code: number): Promise<boolean>;
@@ -15,6 +15,16 @@ class UserAPI {
15
15
  const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, null, ctx);
16
16
  return data.success;
17
17
  }
18
+ async createIntegrationToken(ctx) {
19
+ const endpointData = User_schema_1.UserEndpoints.CreateToken;
20
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, ctx);
21
+ return data.token;
22
+ }
23
+ async getIntegrationToken(ctx) {
24
+ const endpointData = User_schema_1.UserEndpoints.GetIntegrationToken;
25
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, ctx);
26
+ return data.token;
27
+ }
18
28
  async sendValidationCode(email) {
19
29
  const endpointData = User_schema_1.UserEndpoints.SendValidationCode;
20
30
  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 TrackAPISchema {
3
- send: (t: Track, context: Context) => Promise<boolean>;
2
+ send: (t: Track) => Promise<boolean>;
4
3
  }
5
4
  declare const TrackEndpoints: {
6
5
  Track: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TrackEndpoints = void 0;
4
4
  const TrackEndpoints = {
5
5
  Track: {
6
- uri: "/track/send/",
6
+ uri: "/track/public/send/",
7
7
  method: "POST",
8
8
  },
9
9
  };
@@ -12,6 +12,8 @@ interface UserAPISchema {
12
12
  setup: (context: Context) => Promise<boolean>;
13
13
  getBindedUsers: (ctx: Context) => Promise<User[]>;
14
14
  deleteAccount: (ctx: Context) => Promise<boolean>;
15
+ getIntegrationToken: (ctx: Context) => Promise<string | null>;
16
+ createIntegrationToken: (ctx: Context) => Promise<string>;
15
17
  createUser: (email: string, name: string, password: string, passwordConfirmation: string, profession: string | null, invitationCode: string | null) => Promise<User>;
16
18
  }
17
19
  declare const UserEndpoints: {
@@ -39,6 +41,14 @@ declare const UserEndpoints: {
39
41
  uri: string;
40
42
  method: string;
41
43
  };
44
+ GetIntegrationToken: {
45
+ uri: string;
46
+ method: string;
47
+ };
48
+ CreateToken: {
49
+ uri: string;
50
+ method: string;
51
+ };
42
52
  ConfirmCode: {
43
53
  uri: string;
44
54
  method: string;
@@ -26,6 +26,14 @@ const UserEndpoints = {
26
26
  uri: "/accounts/public/email/avaliable",
27
27
  method: "GET",
28
28
  },
29
+ GetIntegrationToken: {
30
+ uri: "/accounts/user/getToken/",
31
+ method: "GET",
32
+ },
33
+ CreateToken: {
34
+ uri: "/accounts/user/createToken/",
35
+ method: "POST",
36
+ },
29
37
  ConfirmCode: {
30
38
  uri: "/accounts/public/email/validate",
31
39
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",