shred-api-client 1.3.5 → 1.3.6

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,6 +5,7 @@ declare class SubscriptionAPI implements SubscriptionAPISchema {
5
5
  private env;
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
8
+ getProduct(id: string): Promise<Product>;
8
9
  getProducts(): Promise<Product[]>;
9
10
  createCheckout(planId: string | null, ctx: Context): Promise<string>;
10
11
  }
@@ -10,6 +10,11 @@ class SubscriptionAPI {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
+ async getProduct(id) {
14
+ const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.GetProduct;
15
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}/${id}`, endpointInfo.method, null);
16
+ return data;
17
+ }
13
18
  async getProducts() {
14
19
  const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.GetProducts;
15
20
  const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null);
@@ -1,9 +1,14 @@
1
1
  import Context from "./Context";
2
2
  interface SubscriptionAPISchema {
3
+ getProduct: (id: string) => Promise<Product>;
3
4
  getProducts: () => Promise<Product[]>;
4
5
  createCheckout: (planId: string | null, ctx: Context) => Promise<string>;
5
6
  }
6
7
  declare const SubscriptionEndpoints: {
8
+ GetProduct: {
9
+ uri: string;
10
+ method: string;
11
+ };
7
12
  GetProducts: {
8
13
  uri: string;
9
14
  method: string;
@@ -2,6 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SubscriptionEndpoints = exports.SubscriptionType = void 0;
4
4
  const SubscriptionEndpoints = {
5
+ GetProduct: {
6
+ uri: "/subscriptions/products",
7
+ method: "GET",
8
+ },
5
9
  GetProducts: {
6
10
  uri: "/subscriptions/products/public/list",
7
11
  method: "GET",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",