shred-api-client 1.0.20 → 1.0.22
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/User.api.js
CHANGED
|
@@ -11,7 +11,8 @@ class UserAPI {
|
|
|
11
11
|
}
|
|
12
12
|
async getUserInfo(context) {
|
|
13
13
|
const endpointData = User_schema_1.UserEndpoints.GetUserInfo;
|
|
14
|
-
const data = await this.clientHTTP.makeRequest(endpointData.uri, endpointData.method, null, context)
|
|
14
|
+
const data = await this.clientHTTP.makeRequest(endpointData.uri, endpointData.method, null, context, true //Use legacy api (old endpoints)
|
|
15
|
+
);
|
|
15
16
|
return data;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Context from "./Context";
|
|
2
|
+
import { Subscription } from "./Subscription.schema";
|
|
2
3
|
import { Tenant } from "./Tenant.schema";
|
|
3
4
|
interface UserAPISchema {
|
|
4
5
|
getUserInfo: (context: Context) => Promise<User>;
|
|
@@ -28,6 +29,7 @@ type User = {
|
|
|
28
29
|
fcmToken?: string;
|
|
29
30
|
photoUrl?: string;
|
|
30
31
|
preferences?: Preferences;
|
|
32
|
+
subscription?: Subscription;
|
|
31
33
|
invitationCode?: string;
|
|
32
34
|
tenant?: Tenant;
|
|
33
35
|
};
|
package/dist/namespace.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Product as TProduct, Subscription as TSubscription } from "./model/Subscription.schema";
|
|
2
|
+
import { User as TUser } from "./model/User.schema";
|
|
2
3
|
export declare namespace Shred {
|
|
3
4
|
type Product = TProduct;
|
|
4
5
|
type Subscription = TSubscription;
|
|
6
|
+
type User = TUser;
|
|
5
7
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import Context from "./../model/Context";
|
|
2
2
|
export default class HTTPClient {
|
|
3
|
-
|
|
4
|
-
constructor();
|
|
5
|
-
makeRequest(uri: string, method: string, data: any, context?: Context): Promise<any>;
|
|
3
|
+
makeRequest(uri: string, method: string, data: any, context?: Context, useLegacyApi?: boolean): Promise<any>;
|
|
6
4
|
}
|
package/dist/util/HTTPClient.js
CHANGED
|
@@ -8,15 +8,18 @@ const HOSTS = {
|
|
|
8
8
|
prod: "https://api.shredmedia.co",
|
|
9
9
|
staging: "https://api.staging.shreditapp.com",
|
|
10
10
|
};
|
|
11
|
+
const OLD_HOSTS = {
|
|
12
|
+
prod: "https://api.shredmedia.co",
|
|
13
|
+
staging: "https://api.staging.shredmedia.co",
|
|
14
|
+
};
|
|
11
15
|
class HTTPClient {
|
|
12
|
-
|
|
16
|
+
async makeRequest(uri, method, data, context, useLegacyApi) {
|
|
13
17
|
const env = process.env.ENV;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
async makeRequest(uri, method, data, context) {
|
|
18
|
+
const hostDict = useLegacyApi ? OLD_HOSTS : HOSTS;
|
|
19
|
+
const host = hostDict[env] || hostDict.staging;
|
|
17
20
|
const config = {
|
|
18
21
|
method: method,
|
|
19
|
-
url:
|
|
22
|
+
url: host + uri,
|
|
20
23
|
headers: {
|
|
21
24
|
Authorization: (context === null || context === void 0 ? void 0 : context.token) && `Bearer ${context.token}`,
|
|
22
25
|
"X-Request-ID": (context === null || context === void 0 ? void 0 : context.requestId) && context.requestId,
|