shred-api-client 1.7.7 → 1.8.1

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.
@@ -7,6 +7,7 @@ declare class SubscriptionAPI implements SubscriptionAPISchema {
7
7
  constructor(env: Environment);
8
8
  getProduct(id: string, context?: Context): Promise<Product>;
9
9
  getSubscription(context: Context): Promise<Subscription | null>;
10
+ charge(ctx: Context): Promise<boolean>;
10
11
  getProducts(ctx?: Context): Promise<Product[]>;
11
12
  createCheckout(planId: string | null, ctx: Context): Promise<string>;
12
13
  }
@@ -20,6 +20,11 @@ class SubscriptionAPI {
20
20
  const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, context);
21
21
  return data;
22
22
  }
23
+ async charge(ctx) {
24
+ const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.Charge;
25
+ const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, ctx);
26
+ return data.success;
27
+ }
23
28
  async getProducts(ctx) {
24
29
  const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.GetProducts;
25
30
  const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, ctx);
@@ -8,7 +8,8 @@ declare class UserAPI implements UserAPISchema {
8
8
  sendValidationCode(email: string): Promise<boolean>;
9
9
  confirmCode(email: string, code: number): Promise<boolean>;
10
10
  isEmailAvaliable(email: string): Promise<boolean>;
11
- update(context: Context, update: Update): Promise<boolean>;
11
+ update(context: Context, update: Partial<Update>): Promise<boolean>;
12
+ setup(context: Context): Promise<boolean>;
12
13
  authenticate(context: Context, system: System): Promise<string>;
13
14
  createUser(email: string, name: string, password: string, passwordConfirmation: string, profession: string | null, invitationCode: string | null): Promise<any>;
14
15
  getUserInfo(context: Context): Promise<User>;
@@ -30,6 +30,11 @@ class UserAPI {
30
30
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, Object.assign({}, update), context);
31
31
  return data.isValid;
32
32
  }
33
+ async setup(context) {
34
+ const endpointData = User_schema_1.UserEndpoints.Setup;
35
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, null, context);
36
+ return data.success;
37
+ }
33
38
  async authenticate(context, system) {
34
39
  const endpointData = User_schema_1.UserEndpoints.Authenticate;
35
40
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, { system }, context);
@@ -3,6 +3,7 @@ interface SubscriptionAPISchema {
3
3
  getSubscription: (context: Context) => Promise<Subscription | null>;
4
4
  getProduct: (id: string, context?: Context) => Promise<Product>;
5
5
  getProducts: (ctx?: Context) => Promise<Product[]>;
6
+ charge: (ctx: Context) => Promise<boolean>;
6
7
  createCheckout: (planId: string | null, ctx: Context) => Promise<string>;
7
8
  }
8
9
  declare const SubscriptionEndpoints: {
@@ -22,6 +23,10 @@ declare const SubscriptionEndpoints: {
22
23
  uri: string;
23
24
  method: string;
24
25
  };
26
+ Charge: {
27
+ uri: string;
28
+ method: string;
29
+ };
25
30
  UpdateUser: {
26
31
  uri: string;
27
32
  method: string;
@@ -18,6 +18,10 @@ const SubscriptionEndpoints = {
18
18
  uri: "/subscriptions/payment/checkout",
19
19
  method: "POST",
20
20
  },
21
+ Charge: {
22
+ uri: "/subscriptions/payment/charge",
23
+ method: "POST",
24
+ },
21
25
  UpdateUser: {
22
26
  uri: "/api/user/update",
23
27
  method: "PUT",
@@ -6,7 +6,8 @@ interface UserAPISchema {
6
6
  sendValidationCode: (email: string) => Promise<boolean>;
7
7
  confirmCode: (email: string, code: number) => Promise<boolean>;
8
8
  authenticate: (context: Context, system: System) => Promise<string>;
9
- update: (context: Context, update: Update) => Promise<boolean>;
9
+ update: (context: Context, update: Partial<Update>) => Promise<boolean>;
10
+ setup: (context: Context) => Promise<boolean>;
10
11
  createUser: (email: string, name: string, password: string, passwordConfirmation: string, profession: string | null, invitationCode: string | null) => Promise<User>;
11
12
  }
12
13
  declare const UserEndpoints: {
@@ -42,6 +43,10 @@ declare const UserEndpoints: {
42
43
  uri: string;
43
44
  method: string;
44
45
  };
46
+ Setup: {
47
+ uri: string;
48
+ method: string;
49
+ };
45
50
  };
46
51
  declare enum Role {
47
52
  USER = "User",
@@ -74,8 +79,6 @@ type User = {
74
79
  tenantId?: string;
75
80
  editorId?: string;
76
81
  customerId: string;
77
- invitationCode?: string;
78
- canCreateFreeProject?: boolean;
79
82
  role: Role;
80
83
  };
81
84
  export { User, UserAPISchema, UserEndpoints, Role, System };
@@ -34,6 +34,10 @@ const UserEndpoints = {
34
34
  uri: "/accounts/user/update",
35
35
  method: "PUT",
36
36
  },
37
+ Setup: {
38
+ uri: "/accounts/user/setup/",
39
+ method: "POST",
40
+ },
37
41
  };
38
42
  exports.UserEndpoints = UserEndpoints;
39
43
  var Role;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.7.7",
3
+ "version": "1.8.1",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",