shred-api-client 1.9.21 → 1.9.23
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.
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import Context from "../model/Context";
|
|
2
|
-
import { Product, Subscription, SubscriptionAPISchema } from "../model/Subscription.schema";
|
|
2
|
+
import { Charge, Product, Subscription, SubscriptionAPISchema } from "../model/Subscription.schema";
|
|
3
3
|
import Environment from "../model/Env";
|
|
4
4
|
declare class SubscriptionAPI implements SubscriptionAPISchema {
|
|
5
5
|
private env;
|
|
6
6
|
private clientHTTP;
|
|
7
7
|
constructor(env: Environment);
|
|
8
8
|
getProduct(id: string, context?: Context): Promise<Product>;
|
|
9
|
+
getCharges(ctx: Context): Promise<Charge[]>;
|
|
9
10
|
getSubscription(context: Context, userId?: string): Promise<Subscription | null>;
|
|
10
11
|
charge(ctx: Context): Promise<boolean>;
|
|
11
12
|
getProducts(ctx?: Context): Promise<Product[]>;
|
|
@@ -15,6 +15,11 @@ class SubscriptionAPI {
|
|
|
15
15
|
const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}/${id}`, endpointInfo.method, null, context);
|
|
16
16
|
return data;
|
|
17
17
|
}
|
|
18
|
+
async getCharges(ctx) {
|
|
19
|
+
const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.GetCharges;
|
|
20
|
+
const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, null, ctx);
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
18
23
|
async getSubscription(context, userId) {
|
|
19
24
|
const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.GetActiveSubscription;
|
|
20
25
|
let uri = endpointInfo.uri;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Context from "./Context";
|
|
2
2
|
interface SubscriptionAPISchema {
|
|
3
|
+
getCharges: (ctx: Context) => Promise<Charge[]>;
|
|
3
4
|
getSubscription: (context: Context, userId?: string) => Promise<Subscription | null>;
|
|
4
5
|
getProduct: (id: string, context?: Context) => Promise<Product>;
|
|
5
6
|
getProducts: (ctx?: Context) => Promise<Product[]>;
|
|
@@ -15,6 +16,10 @@ declare const SubscriptionEndpoints: {
|
|
|
15
16
|
uri: string;
|
|
16
17
|
method: string;
|
|
17
18
|
};
|
|
19
|
+
GetCharges: {
|
|
20
|
+
uri: string;
|
|
21
|
+
method: string;
|
|
22
|
+
};
|
|
18
23
|
GetUserActiveSubscription: {
|
|
19
24
|
uri: string;
|
|
20
25
|
method: string;
|
|
@@ -10,6 +10,10 @@ const SubscriptionEndpoints = {
|
|
|
10
10
|
uri: "/subscriptions/active/",
|
|
11
11
|
method: "GET",
|
|
12
12
|
},
|
|
13
|
+
GetCharges: {
|
|
14
|
+
uri: "/subscriptions/payment/charge/list/",
|
|
15
|
+
method: "GET",
|
|
16
|
+
},
|
|
13
17
|
GetUserActiveSubscription: {
|
|
14
18
|
uri: "/subscriptions/:userId/find/",
|
|
15
19
|
method: "GET",
|