shred-api-client 1.0.7 → 1.0.9
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 +8 -0
- package/dist/api/Subscription.api.js +18 -0
- package/dist/api/User.api.js +2 -1
- package/dist/model/Api.d.ts +2 -0
- package/dist/model/Api.js +2 -0
- package/dist/model/Email.schema.d.ts +22 -0
- package/dist/model/Email.schema.js +2 -0
- package/dist/model/Subscription.schema.d.ts +33 -0
- package/dist/model/Subscription.schema.js +18 -0
- package/dist/model/Tenant.schema.d.ts +18 -0
- package/dist/model/Tenant.schema.js +5 -0
- package/dist/model/User.schema.d.ts +6 -1
- package/dist/model/User.schema.js +4 -1
- package/dist/util/HTTPClient.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Product, SubscriptionAPISchema } from "../model/Subscription.schema";
|
|
2
|
+
import Context from "../model/Context";
|
|
3
|
+
declare class SubscriptionAPI implements SubscriptionAPISchema {
|
|
4
|
+
private clientHTTP;
|
|
5
|
+
constructor();
|
|
6
|
+
getProducts(context: Context): Promise<Product[]>;
|
|
7
|
+
}
|
|
8
|
+
export default SubscriptionAPI;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Subscription_schema_1 = require("../model/Subscription.schema");
|
|
7
|
+
const HTTPClient_1 = __importDefault(require("../util/HTTPClient"));
|
|
8
|
+
class SubscriptionAPI {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.clientHTTP = new HTTPClient_1.default();
|
|
11
|
+
}
|
|
12
|
+
async getProducts(context) {
|
|
13
|
+
const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.GetProducts;
|
|
14
|
+
const data = await this.clientHTTP.makeRequest(endpointInfo.uri, endpointInfo.method, null, context);
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = SubscriptionAPI;
|
package/dist/api/User.api.js
CHANGED
|
@@ -10,7 +10,8 @@ class UserAPI {
|
|
|
10
10
|
this.clientHTTP = new HTTPClient_1.default();
|
|
11
11
|
}
|
|
12
12
|
async getUserInfo(context) {
|
|
13
|
-
const
|
|
13
|
+
const endpointData = User_schema_1.UserEndpoints.GetUserInfo;
|
|
14
|
+
const data = await this.clientHTTP.makeRequest(endpointData.uri, endpointData.method, null, context);
|
|
14
15
|
return data;
|
|
15
16
|
}
|
|
16
17
|
}
|
package/dist/model/Api.d.ts
CHANGED
package/dist/model/Api.js
CHANGED
|
@@ -4,9 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ShredAPI = void 0;
|
|
7
|
+
const Subscription_api_1 = __importDefault(require("../api/Subscription.api"));
|
|
7
8
|
const User_api_1 = __importDefault(require("../api/User.api"));
|
|
8
9
|
class ShredAPI {
|
|
9
10
|
constructor() {
|
|
11
|
+
this.subscription = new Subscription_api_1.default();
|
|
10
12
|
this.user = new User_api_1.default();
|
|
11
13
|
}
|
|
12
14
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type Preferences = {
|
|
2
|
+
primaryColor?: string;
|
|
3
|
+
secondaryColor?: string;
|
|
4
|
+
facebookLink?: string;
|
|
5
|
+
instagramLink?: string;
|
|
6
|
+
bRoll?: boolean;
|
|
7
|
+
logo?: string;
|
|
8
|
+
};
|
|
9
|
+
type User = {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
email: string;
|
|
13
|
+
customerId: string;
|
|
14
|
+
registered: boolean;
|
|
15
|
+
profession?: string;
|
|
16
|
+
registeredAt: number;
|
|
17
|
+
fcmToken?: string;
|
|
18
|
+
photoUrl?: string;
|
|
19
|
+
preferences?: Preferences;
|
|
20
|
+
invitationCode?: string;
|
|
21
|
+
};
|
|
22
|
+
export { User };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Context from "./Context";
|
|
2
|
+
interface SubscriptionAPISchema {
|
|
3
|
+
getProducts: (context: Context) => Promise<Product[]>;
|
|
4
|
+
}
|
|
5
|
+
declare const SubscriptionEndpoints: {
|
|
6
|
+
GetProducts: {
|
|
7
|
+
uri: string;
|
|
8
|
+
method: string;
|
|
9
|
+
};
|
|
10
|
+
UpdateUser: {
|
|
11
|
+
uri: string;
|
|
12
|
+
method: string;
|
|
13
|
+
};
|
|
14
|
+
CreateUser: {
|
|
15
|
+
uri: string;
|
|
16
|
+
method: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type Plan = {
|
|
20
|
+
id: string;
|
|
21
|
+
currency: string;
|
|
22
|
+
price: number;
|
|
23
|
+
interval: string;
|
|
24
|
+
metadata: any;
|
|
25
|
+
};
|
|
26
|
+
type Product = {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
metadata: any;
|
|
31
|
+
plans: Plan[];
|
|
32
|
+
};
|
|
33
|
+
export { SubscriptionAPISchema, Product, SubscriptionEndpoints };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionEndpoints = void 0;
|
|
4
|
+
const SubscriptionEndpoints = {
|
|
5
|
+
GetProducts: {
|
|
6
|
+
uri: "/api/subscription/products",
|
|
7
|
+
method: "GET",
|
|
8
|
+
},
|
|
9
|
+
UpdateUser: {
|
|
10
|
+
uri: "/api/user/update",
|
|
11
|
+
method: "PUT",
|
|
12
|
+
},
|
|
13
|
+
CreateUser: {
|
|
14
|
+
uri: "/api/user/public/createAccount",
|
|
15
|
+
method: "POST",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
exports.SubscriptionEndpoints = SubscriptionEndpoints;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type Preferences = {
|
|
2
|
+
iconUrl: string;
|
|
3
|
+
logoUrl: string;
|
|
4
|
+
primaryColor: string;
|
|
5
|
+
secondaryColor: string;
|
|
6
|
+
};
|
|
7
|
+
type Tenant = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
isSubscriptionActive: boolean;
|
|
12
|
+
preferences: Preferences;
|
|
13
|
+
inviteCode?: string;
|
|
14
|
+
totalUsersAllowed: number;
|
|
15
|
+
currentUsersSize?: number;
|
|
16
|
+
allowedProducts?: string[];
|
|
17
|
+
};
|
|
18
|
+
export { Tenant };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import Context from "./Context";
|
|
2
|
+
import { Tenant } from "./Tenant.schema";
|
|
2
3
|
interface UserAPISchema {
|
|
3
4
|
getUserInfo: (context: Context) => Promise<User>;
|
|
4
5
|
}
|
|
5
6
|
declare const UserEndpoints: {
|
|
6
|
-
GetUserInfo:
|
|
7
|
+
GetUserInfo: {
|
|
8
|
+
uri: string;
|
|
9
|
+
method: string;
|
|
10
|
+
};
|
|
7
11
|
};
|
|
8
12
|
type Preferences = {
|
|
9
13
|
primaryColor?: string;
|
|
@@ -25,5 +29,6 @@ type User = {
|
|
|
25
29
|
photoUrl?: string;
|
|
26
30
|
preferences?: Preferences;
|
|
27
31
|
invitationCode?: string;
|
|
32
|
+
tenant?: Tenant;
|
|
28
33
|
};
|
|
29
34
|
export { User, UserAPISchema, UserEndpoints };
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserEndpoints = void 0;
|
|
4
4
|
const UserEndpoints = {
|
|
5
|
-
GetUserInfo:
|
|
5
|
+
GetUserInfo: {
|
|
6
|
+
uri: "/api/user/info",
|
|
7
|
+
method: "GET",
|
|
8
|
+
},
|
|
6
9
|
};
|
|
7
10
|
exports.UserEndpoints = UserEndpoints;
|
|
@@ -2,5 +2,5 @@ import Context from "./../model/Context";
|
|
|
2
2
|
export default class HTTPClient {
|
|
3
3
|
private host;
|
|
4
4
|
constructor();
|
|
5
|
-
makeRequest(uri: string, method:
|
|
5
|
+
makeRequest(uri: string, method: string, data: any, context: Context): Promise<any>;
|
|
6
6
|
}
|