shred-api-client 1.11.18 → 1.12.0

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.
@@ -5,11 +5,13 @@ declare class SubscriptionAPI implements SubscriptionAPISchema {
5
5
  private env;
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
8
+ updatePlan(ctx: Context, planId: string): Promise<boolean>;
8
9
  getProduct(id: string, context?: Context): Promise<Product>;
9
10
  getCharges(ctx: Context): Promise<Charge[]>;
10
11
  getSubscription(context: Context, userId?: string): Promise<Subscription | null>;
11
12
  charge(ctx: Context): Promise<boolean>;
12
- disableAutomaticRenew(ctx: Context): Promise<boolean>;
13
+ pause(ctx: Context): Promise<boolean>;
14
+ resume(ctx: Context): Promise<boolean>;
13
15
  getProducts(ctx?: Context): Promise<Product[]>;
14
16
  createCheckout(planId: string | null, ctx: Context): Promise<string>;
15
17
  }
@@ -10,6 +10,11 @@ class SubscriptionAPI {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
+ async updatePlan(ctx, planId) {
14
+ const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.UpdatePlan;
15
+ const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, { planId }, ctx);
16
+ return data;
17
+ }
13
18
  async getProduct(id, context) {
14
19
  const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.GetProduct;
15
20
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}/${id}`, endpointInfo.method, null, context);
@@ -38,8 +43,13 @@ class SubscriptionAPI {
38
43
  const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, ctx);
39
44
  return data.success;
40
45
  }
41
- async disableAutomaticRenew(ctx) {
42
- const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.DisableAutomaticRenew;
46
+ async pause(ctx) {
47
+ const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.Pause;
48
+ const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, ctx);
49
+ return data;
50
+ }
51
+ async resume(ctx) {
52
+ const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.Resume;
43
53
  const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, ctx);
44
54
  return data;
45
55
  }
@@ -68,5 +68,5 @@ exports.Styles = [
68
68
  { value: CaptionStyle.ONE_LINE_EMOJIS, label: "One Line + Emojis" },
69
69
  { value: CaptionStyle.TWO_LINES, label: "Two Lines" },
70
70
  { value: CaptionStyle.TWO_LINES_EMOJIS, label: "Two Lines + Emojis" },
71
- { value: CaptionStyle.HOME_HIGHLIGHT, label: "Home Highlight" },
71
+ { value: CaptionStyle.HOME_HIGHLIGHT, label: "Home Tour" },
72
72
  ];
@@ -5,7 +5,9 @@ interface SubscriptionAPISchema {
5
5
  getProduct: (id: string, context?: Context) => Promise<Product>;
6
6
  getProducts: (ctx?: Context) => Promise<Product[]>;
7
7
  charge: (ctx: Context) => Promise<boolean>;
8
- disableAutomaticRenew: (ctx: Context) => Promise<boolean>;
8
+ pause: (ctx: Context) => Promise<boolean>;
9
+ resume: (ctx: Context) => Promise<boolean>;
10
+ updatePlan: (ctx: Context, planId: string) => Promise<boolean>;
9
11
  createCheckout: (planId: string | null, ctx: Context) => Promise<string>;
10
12
  }
11
13
  declare const SubscriptionEndpoints: {
@@ -41,7 +43,15 @@ declare const SubscriptionEndpoints: {
41
43
  uri: string;
42
44
  method: string;
43
45
  };
44
- DisableAutomaticRenew: {
46
+ Pause: {
47
+ uri: string;
48
+ method: string;
49
+ };
50
+ Resume: {
51
+ uri: string;
52
+ method: string;
53
+ };
54
+ UpdatePlan: {
45
55
  uri: string;
46
56
  method: string;
47
57
  };
@@ -34,9 +34,17 @@ const SubscriptionEndpoints = {
34
34
  uri: "/subscriptions/payment/charge/",
35
35
  method: "POST",
36
36
  },
37
- DisableAutomaticRenew: {
38
- uri: "/subscriptions/payment/disableAutomaticRenew",
39
- method: "POST",
37
+ Pause: {
38
+ uri: "/subscriptions/pause/",
39
+ method: "PUT",
40
+ },
41
+ Resume: {
42
+ uri: "/subscriptions/resume/",
43
+ method: "PUT",
44
+ },
45
+ UpdatePlan: {
46
+ uri: "/subscriptions/plan/update/",
47
+ method: "PUT",
40
48
  },
41
49
  };
42
50
  exports.SubscriptionEndpoints = SubscriptionEndpoints;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.11.18",
3
+ "version": "1.12.0",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",