shred-api-client 1.3.5 → 1.3.7
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;
|
|
@@ -53,6 +58,7 @@ type Subscription = {
|
|
|
53
58
|
currentPeriodEnd?: number;
|
|
54
59
|
paymentMethodId?: string;
|
|
55
60
|
productName: string;
|
|
61
|
+
product: Product;
|
|
56
62
|
type?: SubscriptionType;
|
|
57
63
|
plan?: Plan;
|
|
58
64
|
};
|
|
@@ -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/dist/namespace.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Product as TProduct, Subscription as TSubscription } from "./model/Subscription.schema";
|
|
1
|
+
import { Product as TProduct, SubscriptionType as TSubscriptionType, Subscription as TSubscription } from "./model/Subscription.schema";
|
|
2
2
|
import { System as TSystem, User as TUser, Role as TRole } from "./model/User.schema";
|
|
3
3
|
import { Email as TEmail } from "./model/Email.schema";
|
|
4
4
|
import { Tenant as TTenant } from "./model/Tenant.schema";
|
|
@@ -10,6 +10,7 @@ export declare namespace Shred {
|
|
|
10
10
|
type Tenant = TTenant;
|
|
11
11
|
type Product = TProduct;
|
|
12
12
|
type Subscription = TSubscription;
|
|
13
|
+
type SubscriptionType = TSubscriptionType;
|
|
13
14
|
type User = TUser;
|
|
14
15
|
type Email = TEmail;
|
|
15
16
|
type System = TSystem;
|