shred-api-client 1.9.10 → 1.9.12
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.
- package/dist/api/Subscription.api.d.ts +1 -1
- package/dist/api/Subscription.api.js +10 -2
- package/dist/api/User.api.d.ts +1 -0
- package/dist/api/User.api.js +5 -0
- package/dist/model/Subscription.schema.d.ts +5 -1
- package/dist/model/Subscription.schema.js +11 -7
- package/dist/model/Tenant.schema.d.ts +1 -1
- package/dist/model/User.schema.d.ts +5 -0
- package/dist/model/User.schema.js +4 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ declare class SubscriptionAPI implements SubscriptionAPISchema {
|
|
|
6
6
|
private clientHTTP;
|
|
7
7
|
constructor(env: Environment);
|
|
8
8
|
getProduct(id: string, context?: Context): Promise<Product>;
|
|
9
|
-
getSubscription(context: Context): Promise<Subscription | null>;
|
|
9
|
+
getSubscription(context: Context, userId?: string): Promise<Subscription | null>;
|
|
10
10
|
charge(ctx: Context): Promise<boolean>;
|
|
11
11
|
getProducts(ctx?: Context): Promise<Product[]>;
|
|
12
12
|
createCheckout(planId: string | null, ctx: Context): Promise<string>;
|
|
@@ -15,9 +15,17 @@ 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 getSubscription(context) {
|
|
18
|
+
async getSubscription(context, userId) {
|
|
19
19
|
const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.GetActiveSubscription;
|
|
20
|
-
|
|
20
|
+
let uri = endpointInfo.uri;
|
|
21
|
+
let method = endpointInfo.method;
|
|
22
|
+
if (userId) {
|
|
23
|
+
const endpointData = Subscription_schema_1.SubscriptionEndpoints.GetUserActiveSubscription;
|
|
24
|
+
const endpoint = endpointData.uri.replace(":userId", userId);
|
|
25
|
+
uri = endpoint;
|
|
26
|
+
method = endpointData.method;
|
|
27
|
+
}
|
|
28
|
+
const data = await this.clientHTTP.makeRequest(this.env, uri, method, null, context);
|
|
21
29
|
return data;
|
|
22
30
|
}
|
|
23
31
|
async charge(ctx) {
|
package/dist/api/User.api.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ declare class UserAPI implements UserAPISchema {
|
|
|
6
6
|
private clientHTTP;
|
|
7
7
|
constructor(env: Environment);
|
|
8
8
|
sendValidationCode(email: string): Promise<boolean>;
|
|
9
|
+
changePassword(email: string, pass: string, passConfirm: string, code: number): Promise<boolean>;
|
|
9
10
|
changeEmail(ctx: Context, email: string, code: number): Promise<boolean>;
|
|
10
11
|
confirmCode(email: string, code: number): Promise<boolean>;
|
|
11
12
|
isEmailAvaliable(email: string): Promise<boolean>;
|
package/dist/api/User.api.js
CHANGED
|
@@ -15,6 +15,11 @@ class UserAPI {
|
|
|
15
15
|
const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}?email=${email}`, endpointData.method);
|
|
16
16
|
return data.success;
|
|
17
17
|
}
|
|
18
|
+
async changePassword(email, pass, passConfirm, code) {
|
|
19
|
+
const endpointData = User_schema_1.UserEndpoints.ChangePassword;
|
|
20
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, { email, pass, passConfirm, code });
|
|
21
|
+
return data.success;
|
|
22
|
+
}
|
|
18
23
|
async changeEmail(ctx, email, code) {
|
|
19
24
|
const endpointData = User_schema_1.UserEndpoints.ChangeEmail;
|
|
20
25
|
const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, { email, code }, ctx);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Context from "./Context";
|
|
2
2
|
interface SubscriptionAPISchema {
|
|
3
|
-
getSubscription: (context: Context) => Promise<Subscription | null>;
|
|
3
|
+
getSubscription: (context: Context, userId?: string) => Promise<Subscription | null>;
|
|
4
4
|
getProduct: (id: string, context?: Context) => Promise<Product>;
|
|
5
5
|
getProducts: (ctx?: Context) => Promise<Product[]>;
|
|
6
6
|
charge: (ctx: Context) => Promise<boolean>;
|
|
@@ -15,6 +15,10 @@ declare const SubscriptionEndpoints: {
|
|
|
15
15
|
uri: string;
|
|
16
16
|
method: string;
|
|
17
17
|
};
|
|
18
|
+
GetUserActiveSubscription: {
|
|
19
|
+
uri: string;
|
|
20
|
+
method: string;
|
|
21
|
+
};
|
|
18
22
|
GetProducts: {
|
|
19
23
|
uri: string;
|
|
20
24
|
method: string;
|
|
@@ -3,31 +3,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SubscriptionEndpoints = exports.SubscriptionType = void 0;
|
|
4
4
|
const SubscriptionEndpoints = {
|
|
5
5
|
GetProduct: {
|
|
6
|
-
uri: "/subscriptions/products/public/retrieve",
|
|
6
|
+
uri: "/subscriptions/products/public/retrieve/",
|
|
7
7
|
method: "GET",
|
|
8
8
|
},
|
|
9
9
|
GetActiveSubscription: {
|
|
10
|
-
uri: "/subscriptions/active",
|
|
10
|
+
uri: "/subscriptions/active/",
|
|
11
|
+
method: "GET",
|
|
12
|
+
},
|
|
13
|
+
GetUserActiveSubscription: {
|
|
14
|
+
uri: "/subscriptions/:userId/find/",
|
|
11
15
|
method: "GET",
|
|
12
16
|
},
|
|
13
17
|
GetProducts: {
|
|
14
|
-
uri: "/subscriptions/products/public/list",
|
|
18
|
+
uri: "/subscriptions/products/public/list/",
|
|
15
19
|
method: "GET",
|
|
16
20
|
},
|
|
17
21
|
Checkout: {
|
|
18
|
-
uri: "/subscriptions/payment/checkout",
|
|
22
|
+
uri: "/subscriptions/payment/checkout/",
|
|
19
23
|
method: "POST",
|
|
20
24
|
},
|
|
21
25
|
Charge: {
|
|
22
|
-
uri: "/subscriptions/payment/charge",
|
|
26
|
+
uri: "/subscriptions/payment/charge/",
|
|
23
27
|
method: "POST",
|
|
24
28
|
},
|
|
25
29
|
UpdateUser: {
|
|
26
|
-
uri: "/api/user/update",
|
|
30
|
+
uri: "/api/user/update/",
|
|
27
31
|
method: "PUT",
|
|
28
32
|
},
|
|
29
33
|
CreateUser: {
|
|
30
|
-
uri: "/api/user/public/createAccount",
|
|
34
|
+
uri: "/api/user/public/createAccount/",
|
|
31
35
|
method: "POST",
|
|
32
36
|
},
|
|
33
37
|
};
|
|
@@ -4,7 +4,7 @@ interface TenantAPISchema {
|
|
|
4
4
|
getByInviteCode: (code: string, context?: Context) => Promise<Tenant | null>;
|
|
5
5
|
create: (tenant: Tenant, context: Context) => Promise<boolean>;
|
|
6
6
|
list: (context: Context) => Promise<Tenant[]>;
|
|
7
|
-
getTenant: (context: Context) => Promise<Tenant | null>;
|
|
7
|
+
getTenant: (context: Context, tenantId?: string) => Promise<Tenant | null>;
|
|
8
8
|
update: (tenantId: string, data: Pick<Tenant, "preferences">, context: Context) => Promise<boolean>;
|
|
9
9
|
}
|
|
10
10
|
declare const TenantEndpoints: {
|
|
@@ -5,6 +5,7 @@ interface UserAPISchema {
|
|
|
5
5
|
isEmailAvaliable: (email: string) => Promise<boolean>;
|
|
6
6
|
sendValidationCode: (email: string) => Promise<boolean>;
|
|
7
7
|
confirmCode: (email: string, code: number) => Promise<boolean>;
|
|
8
|
+
changePassword: (email: string, pass: string, passConfirm: string, code: number) => Promise<boolean>;
|
|
8
9
|
changeEmail: (ctx: Context, email: string, code: number) => Promise<boolean>;
|
|
9
10
|
authenticate: (context: Context, system: System) => Promise<string>;
|
|
10
11
|
update: (context: Context, update: Partial<Update>) => Promise<boolean>;
|
|
@@ -29,6 +30,10 @@ declare const UserEndpoints: {
|
|
|
29
30
|
uri: string;
|
|
30
31
|
method: string;
|
|
31
32
|
};
|
|
33
|
+
ChangePassword: {
|
|
34
|
+
uri: string;
|
|
35
|
+
method: string;
|
|
36
|
+
};
|
|
32
37
|
IsEmailAvaliable: {
|
|
33
38
|
uri: string;
|
|
34
39
|
method: string;
|