shred-api-client 1.9.14 → 1.9.16

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.
@@ -0,0 +1,9 @@
1
+ import Environment from "../model/Env";
2
+ import { APPConfigSchema } from "../model/AppConfig.schema";
3
+ declare class AppConfigAPI implements APPConfigSchema {
4
+ private env;
5
+ private clientHTTP;
6
+ constructor(env: Environment);
7
+ version(): Promise<string>;
8
+ }
9
+ export default AppConfigAPI;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const HTTPClient_1 = __importDefault(require("../util/HTTPClient"));
7
+ const AppConfig_schema_1 = require("../model/AppConfig.schema");
8
+ class AppConfigAPI {
9
+ constructor(env) {
10
+ this.env = env;
11
+ this.clientHTTP = new HTTPClient_1.default();
12
+ }
13
+ async version() {
14
+ const endpointInfo = AppConfig_schema_1.AppConfigEndpoints.Version;
15
+ const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method);
16
+ return data.version;
17
+ }
18
+ }
19
+ exports.default = AppConfigAPI;
@@ -1,6 +1,6 @@
1
1
  import Environment from "../model/Env";
2
2
  import { PushNotificationSchema, PushNotification } from "../model/PushNotification.schema";
3
- import Context from "../src/model/Context";
3
+ import Context from "../model/Context";
4
4
  declare class PushNotificationAPI implements PushNotificationSchema {
5
5
  private env;
6
6
  private clientHTTP;
@@ -5,6 +5,7 @@ declare class UserAPI implements UserAPISchema {
5
5
  private env;
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
8
+ deleteAccount(ctx: Context): Promise<boolean>;
8
9
  sendValidationCode(email: string): Promise<boolean>;
9
10
  changePassword(email: string, pass: string, passConfirm: string, code: number): Promise<boolean>;
10
11
  changeEmail(ctx: Context, email: string, code: number): Promise<boolean>;
@@ -10,6 +10,11 @@ class UserAPI {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
+ async deleteAccount(ctx) {
14
+ const endpointData = User_schema_1.UserEndpoints.DeleteAccount;
15
+ const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, null, ctx);
16
+ return data.success;
17
+ }
13
18
  async sendValidationCode(email) {
14
19
  const endpointData = User_schema_1.UserEndpoints.SendValidationCode;
15
20
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}`, endpointData.method);
@@ -6,6 +6,7 @@ import { UserAPISchema } from "./User.schema";
6
6
  import { EmailAPISchema } from "./Email.schema";
7
7
  import { TenantAPISchema } from "./Tenant.schema";
8
8
  import { ProjectAPISchema } from "./Project.schema";
9
+ import { APPConfigSchema } from "./AppConfig.schema";
9
10
  export declare class ShredAPI {
10
11
  user: UserAPISchema;
11
12
  subscription: SubscriptionAPISchema;
@@ -13,6 +14,7 @@ export declare class ShredAPI {
13
14
  pushNotification: PushNotificationSchema;
14
15
  email: EmailAPISchema;
15
16
  tenant: TenantAPISchema;
17
+ app: APPConfigSchema;
16
18
  project: ProjectAPISchema;
17
19
  constructor(env: Environment);
18
20
  }
package/dist/model/Api.js CHANGED
@@ -11,6 +11,7 @@ const Tenant_api_1 = __importDefault(require("../api/Tenant.api"));
11
11
  const User_api_1 = __importDefault(require("../api/User.api"));
12
12
  const Email_api_1 = __importDefault(require("../api/Email.api"));
13
13
  const Project_api_1 = __importDefault(require("../api/Project.api"));
14
+ const AppConfig_api_1 = __importDefault(require("../api/AppConfig.api"));
14
15
  class ShredAPI {
15
16
  constructor(env) {
16
17
  this.user = new User_api_1.default(env);
@@ -20,6 +21,7 @@ class ShredAPI {
20
21
  this.email = new Email_api_1.default(env);
21
22
  this.tenant = new Tenant_api_1.default(env);
22
23
  this.project = new Project_api_1.default(env);
24
+ this.app = new AppConfig_api_1.default(env);
23
25
  }
24
26
  }
25
27
  exports.ShredAPI = ShredAPI;
@@ -0,0 +1,10 @@
1
+ interface APPConfigSchema {
2
+ version: () => Promise<string>;
3
+ }
4
+ declare const AppConfigEndpoints: {
5
+ Version: {
6
+ uri: string;
7
+ method: string;
8
+ };
9
+ };
10
+ export { AppConfigEndpoints, APPConfigSchema };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppConfigEndpoints = void 0;
4
+ const AppConfigEndpoints = {
5
+ Version: {
6
+ uri: "/app-config/public/version/latest",
7
+ method: "GET",
8
+ },
9
+ };
10
+ exports.AppConfigEndpoints = AppConfigEndpoints;
@@ -75,4 +75,4 @@ type Subscription = {
75
75
  type?: SubscriptionType;
76
76
  plan?: Plan;
77
77
  };
78
- export { SubscriptionAPISchema, Product, Subscription, SubscriptionEndpoints };
78
+ export { SubscriptionAPISchema, Product, Subscription, SubscriptionEndpoints, Plan, };
@@ -11,6 +11,7 @@ interface UserAPISchema {
11
11
  update: (context: Context, update: Partial<Update>) => Promise<boolean>;
12
12
  setup: (context: Context) => Promise<boolean>;
13
13
  getBindedUsers: (ctx: Context) => Promise<User[]>;
14
+ deleteAccount: (ctx: Context) => Promise<boolean>;
14
15
  createUser: (email: string, name: string, password: string, passwordConfirmation: string, profession: string | null, invitationCode: string | null) => Promise<User>;
15
16
  }
16
17
  declare const UserEndpoints: {
@@ -42,6 +43,10 @@ declare const UserEndpoints: {
42
43
  uri: string;
43
44
  method: string;
44
45
  };
46
+ DeleteAccount: {
47
+ uri: string;
48
+ method: string;
49
+ };
45
50
  SendValidationCode: {
46
51
  uri: string;
47
52
  method: string;
@@ -30,6 +30,10 @@ const UserEndpoints = {
30
30
  uri: "/accounts/public/email/validate",
31
31
  method: "POST",
32
32
  },
33
+ DeleteAccount: {
34
+ uri: "/accounts/user/delete/",
35
+ method: "DELETE",
36
+ },
33
37
  SendValidationCode: {
34
38
  uri: "/accounts/public/email/send",
35
39
  method: "POST",
@@ -1,4 +1,4 @@
1
- import Environment from "../src/model/Env";
1
+ import Environment from "../model/Env";
2
2
  import Context from "./../model/Context";
3
3
  export default class HTTPClient {
4
4
  makeRequest(env: Environment, uri: string, method: string, data?: any, context?: Context | null, useLegacyApi?: boolean): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.9.14",
3
+ "version": "1.9.16",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",