jd_platform_sdk 0.0.4 → 0.0.6
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/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/sdk/configs/jdConfig.d.ts.map +1 -1
- package/dist/sdk/configs/jdConfig.js +0 -2
- package/dist/sdk/jdConnector.js +1 -1
- package/dist/sdk/models/jdApplication.d.ts +4 -4
- package/dist/sdk/models/jdApplication.d.ts.map +1 -1
- package/dist/sdk/models/jdApplication.js +8 -8
- package/dist/sdk/models/jdResource.d.ts +16 -10
- package/dist/sdk/models/jdResource.d.ts.map +1 -1
- package/dist/sdk/models/jdResource.js +43 -33
- package/dist/sdk/models/modules/geolocation/jdCity.d.ts +6 -6
- package/dist/sdk/models/modules/geolocation/jdCity.d.ts.map +1 -1
- package/dist/sdk/models/modules/geolocation/jdCity.js +14 -14
- package/dist/sdk/models/modules/geolocation/jdCountry.d.ts +6 -6
- package/dist/sdk/models/modules/geolocation/jdCountry.d.ts.map +1 -1
- package/dist/sdk/models/modules/geolocation/jdCountry.js +14 -14
- package/dist/sdk/models/modules/geolocation/jdDistrict.d.ts +5 -5
- package/dist/sdk/models/modules/geolocation/jdDistrict.d.ts.map +1 -1
- package/dist/sdk/models/modules/geolocation/jdDistrict.js +11 -11
- package/dist/sdk/models/modules/geolocation/jdState.d.ts +6 -6
- package/dist/sdk/models/modules/geolocation/jdState.d.ts.map +1 -1
- package/dist/sdk/models/modules/geolocation/jdState.js +14 -14
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts +5 -4
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts.map +1 -1
- package/dist/sdk/models/modules/karaoke/jdKtvShop.js +13 -8
- package/dist/sdk/models/modules/music/jdSong.d.ts +85 -0
- package/dist/sdk/models/modules/music/jdSong.d.ts.map +1 -0
- package/dist/sdk/models/modules/music/jdSong.js +140 -0
- package/dist/sdk/models/modules/user/jdPermission.d.ts +35 -0
- package/dist/sdk/models/modules/user/jdPermission.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdPermission.js +73 -0
- package/dist/sdk/models/modules/user/jdSessionUser.d.ts +7 -7
- package/dist/sdk/models/modules/user/jdSessionUser.d.ts.map +1 -1
- package/dist/sdk/models/modules/user/jdSessionUser.js +14 -14
- package/dist/sdk/models/modules/user/jdUser.d.ts +8 -7
- package/dist/sdk/models/modules/user/jdUser.d.ts.map +1 -1
- package/dist/sdk/models/modules/user/jdUser.js +22 -23
- package/dist/sdk/utilities/browserUtils.d.ts +10 -1
- package/dist/sdk/utilities/browserUtils.d.ts.map +1 -1
- package/dist/sdk/utilities/browserUtils.js +80 -1
- package/dist/sdk/utilities/utils.d.ts +20 -10
- package/dist/sdk/utilities/utils.d.ts.map +1 -1
- package/dist/sdk/utilities/utils.js +71 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ export * from "./sdk/utilities/utils";
|
|
|
10
10
|
export * from "./sdk/models/jdResource";
|
|
11
11
|
export * from "./sdk/models/jdApplication";
|
|
12
12
|
export * from "./sdk/models/modules/user/jdUser";
|
|
13
|
+
export * from "./sdk/models/modules/user/jdSessionUser";
|
|
14
|
+
export * from "./sdk/models/modules/user/jdPermission";
|
|
13
15
|
export * from "./sdk/models/modules/karaoke/jdKtvShop";
|
|
16
|
+
export * from "./sdk/models/modules/music/jdSong";
|
|
14
17
|
export * from "./sdk/models/modules/geolocation/jdCountry";
|
|
15
18
|
export * from "./sdk/models/modules/geolocation/jdState";
|
|
16
19
|
export * from "./sdk/models/modules/geolocation/jdCity";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AAGvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AAGtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AAGvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AAGtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AAGvD,cAAc,wCAAwC,CAAC;AAGvD,cAAc,mCAAmC,CAAC;AAGlD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -13,8 +13,12 @@ export * from "./sdk/models/jdResource";
|
|
|
13
13
|
export * from "./sdk/models/jdApplication";
|
|
14
14
|
//User
|
|
15
15
|
export * from "./sdk/models/modules/user/jdUser";
|
|
16
|
+
export * from "./sdk/models/modules/user/jdSessionUser";
|
|
17
|
+
export * from "./sdk/models/modules/user/jdPermission";
|
|
16
18
|
//Karaoke
|
|
17
19
|
export * from "./sdk/models/modules/karaoke/jdKtvShop";
|
|
20
|
+
//Music
|
|
21
|
+
export * from "./sdk/models/modules/music/jdSong";
|
|
18
22
|
//Geolocation
|
|
19
23
|
export * from "./sdk/models/modules/geolocation/jdCountry";
|
|
20
24
|
export * from "./sdk/models/modules/geolocation/jdState";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdConfig.d.ts","sourceRoot":"","sources":["../../../src/sdk/configs/jdConfig.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC5B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAW;IAGnC,OAAO;IAEP,WAAkB,QAAQ,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"jdConfig.d.ts","sourceRoot":"","sources":["../../../src/sdk/configs/jdConfig.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC5B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAW;IAGnC,OAAO;IAEP,WAAkB,QAAQ,IAAI,QAAQ,CAKrC;IAED,MAAM,CAAC,UAAU;IAajB,MAAM,CAAC,cAAc;CAYrB"}
|
|
@@ -4,13 +4,11 @@ export default class JDConfig {
|
|
|
4
4
|
constructor() { }
|
|
5
5
|
static get instance() {
|
|
6
6
|
if (!JDConfig._instance) {
|
|
7
|
-
console.log('JDConfig: No instance found and creating new one');
|
|
8
7
|
JDConfig._instance = new JDConfig();
|
|
9
8
|
}
|
|
10
9
|
return JDConfig._instance;
|
|
11
10
|
}
|
|
12
11
|
static getAPIHost() {
|
|
13
|
-
const prConfig = JDConfig.instance;
|
|
14
12
|
if (globalThis.bLocalHost) {
|
|
15
13
|
return globalThis.apiEndPointLocalhost + "/" + globalThis.apiVersion;
|
|
16
14
|
}
|
package/dist/sdk/jdConnector.js
CHANGED
|
@@ -44,7 +44,7 @@ export class JDConnector {
|
|
|
44
44
|
return __awaiter(this, arguments, void 0, function* (httpType, url, params, headers, body, bShowErrorMessage, bBuildParams, bRelativeURL = true, bForceRefresh = true, bAutoHideBusyIndicator = true, overrideVersion = '') {
|
|
45
45
|
const finalURL = this.buildURL(httpType, url, params, true, bRelativeURL);
|
|
46
46
|
// console.log(bRelativeURL);
|
|
47
|
-
// console.log(finalURL);
|
|
47
|
+
// console.log(`Final URL: ${finalURL}`);
|
|
48
48
|
//Only for debugging purposes only
|
|
49
49
|
if (globalThis.bForceRefreshGetRequests) {
|
|
50
50
|
bForceRefresh = true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import JDResource from "./jdResource";
|
|
1
|
+
import JDResource, { ConnectorInfo } from "./jdResource";
|
|
2
2
|
export declare class JDApplication extends JDResource {
|
|
3
3
|
appId: string;
|
|
4
4
|
appKey: string;
|
|
@@ -10,12 +10,12 @@ export declare class JDApplication extends JDResource {
|
|
|
10
10
|
versionCode: number;
|
|
11
11
|
bundleCodeAndroid: number;
|
|
12
12
|
bundleCodeIos: number;
|
|
13
|
-
constructor(data
|
|
13
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
14
14
|
setData(data: Record<string, any>): void;
|
|
15
|
-
|
|
15
|
+
getApplications(orderBy: string | undefined, order: string | undefined, pageIndex: number | undefined, countPerPage: number | undefined, fields: string | undefined, { isSandbox, isFeatured, }: {
|
|
16
16
|
isSandbox?: boolean | undefined;
|
|
17
17
|
isFeatured?: boolean | undefined;
|
|
18
18
|
}): Promise<import("../jdConnector").SimpleResponse>;
|
|
19
|
-
|
|
19
|
+
getInfo(id: string): Promise<import("../jdConnector").SimpleResponse>;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=jdApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdApplication.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdApplication.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"jdApplication.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdApplication.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAEvD,qBAAa,aAAc,SAAQ,UAAU;IAC5C,KAAK,SAAM;IACX,MAAM,SAAM;IACZ,SAAS,SAAM;IACf,UAAU,EAAE,MAAM,CAAM;IACxB,IAAI,EAAE,MAAM,CAAM;IAClB,WAAW,SAAM;IACjB,OAAO,SAAM;IACb,WAAW,SAAK;IAChB,iBAAiB,SAAK;IACtB,aAAa,SAAK;gBAEN,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAe1B,eAAe,CAAC,OAAO,oBAAe,EAAE,KAAK,oBAAS,EAAE,SAAS,oBAAI,EAAE,YAAY,oBAAK,EAAE,MAAM,oBAAK,EAAE,EAAC,SAAiB,EAAE,UAAkB,GAAE;;;KAAA;IAc/I,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|
|
@@ -8,10 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { Utils } from "../utilities/utils";
|
|
11
|
-
import JDResource from "./jdResource";
|
|
11
|
+
import JDResource, { ConnectorInfo } from "./jdResource";
|
|
12
12
|
export class JDApplication extends JDResource {
|
|
13
|
-
constructor(data) {
|
|
14
|
-
super(
|
|
13
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
14
|
+
super(connectorInfo);
|
|
15
15
|
this.appId = '';
|
|
16
16
|
this.appKey = '';
|
|
17
17
|
this.appSecret = '';
|
|
@@ -37,9 +37,9 @@ export class JDApplication extends JDResource {
|
|
|
37
37
|
this.bundleCodeAndroid = Utils.getInteger(data, 'bundle_code_android');
|
|
38
38
|
this.bundleCodeIos = Utils.getInteger(data, 'bundle_code_ios');
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
getApplications() {
|
|
41
41
|
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '', { isSandbox = false, isFeatured = false, }) {
|
|
42
|
-
const params =
|
|
42
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
43
43
|
if (Utils.isset(isSandbox)) {
|
|
44
44
|
params['sandbox'] = isSandbox ? 'true' : 'false';
|
|
45
45
|
}
|
|
@@ -47,12 +47,12 @@ export class JDApplication extends JDResource {
|
|
|
47
47
|
params['featured'] = isFeatured ? 'true' : 'false';
|
|
48
48
|
}
|
|
49
49
|
// console.log(params);
|
|
50
|
-
return yield
|
|
50
|
+
return yield this.getRelative('/applications', params);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
getInfo(id) {
|
|
54
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
return yield
|
|
55
|
+
return yield this.getRelative(`/applications/${id}`, {});
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { SimpleResponse } from "../jdConnector";
|
|
2
|
+
export declare class ConnectorInfo {
|
|
3
|
+
appId: string;
|
|
4
|
+
token: string;
|
|
5
|
+
constructor(appId: string, token: string);
|
|
6
|
+
}
|
|
2
7
|
export default class JDResource {
|
|
3
8
|
myId: string;
|
|
4
9
|
slug: string;
|
|
@@ -9,6 +14,7 @@ export default class JDResource {
|
|
|
9
14
|
createdAt: Date;
|
|
10
15
|
updatedAt: Date;
|
|
11
16
|
placeholderIconURL: string;
|
|
17
|
+
connectorInfo: ConnectorInfo;
|
|
12
18
|
get localisedTitle(): string;
|
|
13
19
|
get localisedDescription(): string;
|
|
14
20
|
get titleEN(): string;
|
|
@@ -28,17 +34,17 @@ export default class JDResource {
|
|
|
28
34
|
get cdnBannerURL500(): string;
|
|
29
35
|
get cdnBannerURL800(): string;
|
|
30
36
|
getFacebookIconURL(fbId: string): string;
|
|
31
|
-
constructor(
|
|
37
|
+
constructor(connectorInfo: ConnectorInfo);
|
|
32
38
|
setData(data: Record<string, any>): void;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
getHashBody(remark?: string): Record<string, any>;
|
|
40
|
+
getDefaultHeaders(): Record<string, any>;
|
|
41
|
+
addDefaultParams(params: Record<string, any>): void;
|
|
42
|
+
getSortParameters(orderBy: string, order: string, pageIndex: number, countPerPage: number, fields: string): Record<string, any>;
|
|
37
43
|
static getFieldParameters(fields: string): Record<string, any>;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
getRelative(relativeUrl: string, params: Record<string, any>, bShowErrorToast?: boolean, bForceRefresh?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
45
|
+
postRelative(relativeUrl: string, body: Record<string, any>, bShowErrorToast?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
46
|
+
getDirect(directUrl: string, params: Record<string, any>, bShowErrorToast?: boolean, bForceRefresh?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
47
|
+
postDirect(directUrl: string, body: Record<string, any>, bShowErrorToast?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
48
|
+
checkUser(response: SimpleResponse): Promise<void>;
|
|
43
49
|
}
|
|
44
50
|
//# sourceMappingURL=jdResource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdResource.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdResource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAI3D,MAAM,CAAC,OAAO,OAAO,UAAU;IAC9B,IAAI,SAAM;IACP,IAAI,SAAM;IACV,KAAK,SAAK;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACjC,SAAS,EAAC,IAAI,CAAc;IAC5B,SAAS,EAAC,IAAI,CAAc;IAC5B,kBAAkB,
|
|
1
|
+
{"version":3,"file":"jdResource.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdResource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAI3D,qBAAa,aAAa;IACzB,KAAK,SAAM;IACX,KAAK,SAAM;gBACC,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM;CAItC;AAED,MAAM,CAAC,OAAO,OAAO,UAAU;IAC9B,IAAI,SAAM;IACP,IAAI,SAAM;IACV,KAAK,SAAK;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACjC,SAAS,EAAC,IAAI,CAAc;IAC5B,SAAS,EAAC,IAAI,CAAc;IAC5B,kBAAkB,SAAM;IAC3B,aAAa,EAAC,aAAa,CAA6B;IAQxD,IAAI,cAAc,IAAG,MAAM,CAAsE;IACjG,IAAI,oBAAoB,IAAG,MAAM,CAAkF;IACnH,IAAI,OAAO,IAAG,MAAM,CAA8C;IAClE,IAAI,OAAO,IAAG,MAAM,CAA6C;IACjE,IAAI,aAAa,IAAG,MAAM,CAAmD;IAC7E,IAAI,aAAa,IAAG,MAAM,CAAmD;IAE7E,OAAO,KAAK,OAAO,GAA6D;IAChF,OAAO,KAAK,UAAU,GAAiE;IACvF,OAAO,KAAK,UAAU,GAAiE;IAEvF,IAAI,UAAU,IAAG,MAAM,CAA4F;IACnH,IAAI,aAAa,IAAG,MAAM,CAAqG;IAC/H,IAAI,aAAa,IAAG,MAAM,CAAgG;IAE1H,OAAO,KAAK,SAAS,GAA+D;IACpF,OAAO,KAAK,YAAY,GAAmE;IAC3F,OAAO,KAAK,YAAY,GAAmE;IAE3F,IAAI,YAAY,IAAG,MAAM,CAAkG;IAC3H,IAAI,eAAe,IAAG,MAAM,CAA2G;IACvI,IAAI,eAAe,IAAG,MAAM,CAA2G;IACvI,kBAAkB,CAAC,IAAI,EAAC,MAAM;gBAElB,aAAa,EAAC,aAAa;IAIvC,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAiBhC,WAAW,CAAC,MAAM,SAAK;IAWvB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAWxC,gBAAgB,CAAC,MAAM,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAI,IAAI;IAMnD,iBAAiB,CAAC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM;IA0BpG,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAC,MAAM;IAOjC,WAAW,CAAC,WAAW,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,eAAe,UAAO,EAAE,aAAa,UAAQ,EAAE,eAAe,SAAK;IAO/H,YAAY,CAAC,WAAW,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAG,eAAe,UAAO,EAAE,eAAe,SAAK;IAQxG,SAAS,CAAC,SAAS,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAG,eAAe,UAAO,EAAE,aAAa,UAAQ,EAAE,eAAe,SAAK;IAK5H,UAAU,CAAC,SAAS,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,eAAe,UAAO,EAAG,eAAe,SAAK;IAOpG,SAAS,CAAC,QAAQ,EAAC,cAAc;CAcvC"}
|
|
@@ -11,8 +11,14 @@ import { Utils } from "../utilities/utils";
|
|
|
11
11
|
import { DateUtils } from "../utilities/dateUtils";
|
|
12
12
|
import { CryptoUtils } from "../utilities/cryptoUtils";
|
|
13
13
|
import { JDConnector, SimpleResponse } from "../jdConnector";
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
export class ConnectorInfo {
|
|
15
|
+
constructor(appId, token) {
|
|
16
|
+
this.appId = '';
|
|
17
|
+
this.token = '';
|
|
18
|
+
this.appId = appId;
|
|
19
|
+
this.token = token;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
16
22
|
export default class JDResource {
|
|
17
23
|
// Properties
|
|
18
24
|
// localisedTitle:string = DPUtility.getStringFromField(this.title, 'en');
|
|
@@ -38,7 +44,7 @@ export default class JDResource {
|
|
|
38
44
|
get cdnBannerURL500() { return this.bannerURL800.includes('http') ? this.bannerURL500 : globalThis.cdnHost + this.bannerURL500; }
|
|
39
45
|
get cdnBannerURL800() { return this.bannerURL800.includes('http') ? this.bannerURL800 : globalThis.cdnHost + this.bannerURL800; }
|
|
40
46
|
getFacebookIconURL(fbId) { return 'https://graph.facebook.com/' + fbId + '/picture?type=square'; }
|
|
41
|
-
constructor(
|
|
47
|
+
constructor(connectorInfo) {
|
|
42
48
|
this.myId = '';
|
|
43
49
|
this.slug = '';
|
|
44
50
|
this.index = 0;
|
|
@@ -47,8 +53,9 @@ export default class JDResource {
|
|
|
47
53
|
this.images = {};
|
|
48
54
|
this.createdAt = new Date();
|
|
49
55
|
this.updatedAt = new Date();
|
|
50
|
-
this.placeholderIconURL = 'https://joydash-downloads.b-cdn.net/misc/banner-male-profile-x300.png';
|
|
51
56
|
this.placeholderIconURL = '';
|
|
57
|
+
this.connectorInfo = new ConnectorInfo("", "");
|
|
58
|
+
this.connectorInfo = connectorInfo;
|
|
52
59
|
}
|
|
53
60
|
setData(data) {
|
|
54
61
|
// console.log('Setting super constructor');
|
|
@@ -64,7 +71,7 @@ export default class JDResource {
|
|
|
64
71
|
// console.log(this.createdAt);
|
|
65
72
|
}
|
|
66
73
|
//Get default hash string with remark
|
|
67
|
-
|
|
74
|
+
getHashBody(remark = '') {
|
|
68
75
|
const body = {};
|
|
69
76
|
//Calculate hashes
|
|
70
77
|
const timestamp = DateUtils.getTimeStamp();
|
|
@@ -73,33 +80,38 @@ export default class JDResource {
|
|
|
73
80
|
return body;
|
|
74
81
|
}
|
|
75
82
|
// Other Utilities
|
|
76
|
-
|
|
77
|
-
// console.log(DPProfile.getAccessToken());
|
|
78
|
-
// console.log('Token:' + authToken.get());
|
|
83
|
+
getDefaultHeaders() {
|
|
79
84
|
const finalHeaders = {};
|
|
80
85
|
finalHeaders["Content-Type"] = 'application/json';
|
|
81
|
-
finalHeaders["app_id"] =
|
|
82
|
-
finalHeaders["
|
|
83
|
-
finalHeaders["x-auth-token"] = globalThis.xAuthToken;
|
|
86
|
+
finalHeaders["app_id"] = this.connectorInfo.appId;
|
|
87
|
+
finalHeaders["x-auth-token"] = this.connectorInfo.token;
|
|
84
88
|
finalHeaders["random_seed"] = DateUtils.getTimeStamp();
|
|
85
89
|
return finalHeaders;
|
|
86
90
|
}
|
|
87
91
|
//This is used to make a direct call supported on some APIs
|
|
88
|
-
|
|
89
|
-
params["app_id"] =
|
|
90
|
-
params["token"] =
|
|
92
|
+
addDefaultParams(params) {
|
|
93
|
+
params["app_id"] = this.connectorInfo.appId;
|
|
94
|
+
params["token"] = this.connectorInfo.token;
|
|
91
95
|
params["random_seed"] = Date.now();
|
|
92
96
|
}
|
|
93
|
-
|
|
97
|
+
getSortParameters(orderBy, order, pageIndex, countPerPage, fields) {
|
|
94
98
|
const params = { 'page_index': pageIndex, 'count_per_page': countPerPage, 'fields': fields };
|
|
95
99
|
if (Utils.isset(orderBy) && Utils.isset(order)) {
|
|
96
100
|
params['order_by'] = orderBy;
|
|
97
101
|
params['order'] = order;
|
|
98
102
|
}
|
|
99
|
-
if (pageIndex >= 0
|
|
103
|
+
if (pageIndex >= 0) {
|
|
100
104
|
params["page_index"] = pageIndex;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
params["page_index"] = 0;
|
|
108
|
+
}
|
|
109
|
+
if (countPerPage > 0) {
|
|
101
110
|
params["count_per_page"] = countPerPage;
|
|
102
111
|
}
|
|
112
|
+
else {
|
|
113
|
+
params["count_per_page"] = 10;
|
|
114
|
+
}
|
|
103
115
|
if (Utils.isset(fields)) {
|
|
104
116
|
params["fields"] = fields;
|
|
105
117
|
}
|
|
@@ -111,15 +123,15 @@ export default class JDResource {
|
|
|
111
123
|
return params;
|
|
112
124
|
}
|
|
113
125
|
// HTTP Calls Utilities
|
|
114
|
-
|
|
115
|
-
return __awaiter(this, arguments, void 0, function* (relativeUrl, params, bShowErrorToast = true, bForceRefresh = false, overrideVersion = ''
|
|
116
|
-
const finalHeaders = this.getDefaultHeaders(
|
|
126
|
+
getRelative(relativeUrl_1, params_1) {
|
|
127
|
+
return __awaiter(this, arguments, void 0, function* (relativeUrl, params, bShowErrorToast = true, bForceRefresh = false, overrideVersion = '') {
|
|
128
|
+
const finalHeaders = this.getDefaultHeaders();
|
|
117
129
|
const connector = new JDConnector();
|
|
118
130
|
const response = yield connector.httpGetRelativeAsync(relativeUrl, finalHeaders, params, bShowErrorToast, bForceRefresh, true, overrideVersion);
|
|
119
131
|
return new SimpleResponse(response.body, response.statusCode);
|
|
120
132
|
});
|
|
121
133
|
}
|
|
122
|
-
|
|
134
|
+
postRelative(relativeUrl_1, body_1) {
|
|
123
135
|
return __awaiter(this, arguments, void 0, function* (relativeUrl, body, bShowErrorToast = true, overrideVersion = '') {
|
|
124
136
|
const headers = this.getDefaultHeaders();
|
|
125
137
|
const connector = new JDConnector();
|
|
@@ -128,33 +140,31 @@ export default class JDResource {
|
|
|
128
140
|
});
|
|
129
141
|
}
|
|
130
142
|
// Direct Calls to the URL without using SDK
|
|
131
|
-
|
|
143
|
+
getDirect(directUrl_1, params_1) {
|
|
132
144
|
return __awaiter(this, arguments, void 0, function* (directUrl, params, bShowErrorToast = true, bForceRefresh = false, overrideVersion = '') {
|
|
133
145
|
const response = yield new JDConnector().httpGetDirectAsync(directUrl, {}, params, bShowErrorToast, true, bForceRefresh, overrideVersion);
|
|
134
146
|
return new SimpleResponse(response.body, response.statusCode);
|
|
135
147
|
});
|
|
136
148
|
}
|
|
137
|
-
|
|
149
|
+
postDirect(directUrl_1, body_1) {
|
|
138
150
|
return __awaiter(this, arguments, void 0, function* (directUrl, body, bShowErrorToast = true, overrideVersion = '') {
|
|
139
151
|
const response = yield new JDConnector().httpPostDirectAsync(directUrl, { 'Content-Type': 'application/json' }, body, bShowErrorToast, false, overrideVersion);
|
|
140
152
|
return new SimpleResponse(response.body, response.statusCode);
|
|
141
153
|
});
|
|
142
154
|
}
|
|
143
155
|
// Save the token and user information to globals if successful
|
|
144
|
-
|
|
156
|
+
// Since this is called from server-side, saving to global doesn't really matter
|
|
157
|
+
checkUser(response) {
|
|
145
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
146
159
|
if (response.statusCode == 200) {
|
|
147
|
-
const dataRaw = Utils.stringToObject(response.body);
|
|
148
|
-
const token = Utils.getString(dataRaw, "token");
|
|
149
|
-
const dataUser = Utils.getObject(dataRaw, "user");
|
|
160
|
+
// const dataRaw = Utils.stringToObject(response.body);
|
|
161
|
+
// const token = Utils.getString(dataRaw, "token");
|
|
162
|
+
// const dataUser = Utils.getObject(dataRaw, "user");
|
|
150
163
|
// Save to global variables and also in the session so that the user can keep the log in status
|
|
151
|
-
|
|
152
|
-
globalThis.xAuthToken = token;
|
|
153
|
-
globalThis.
|
|
154
|
-
globalThis.
|
|
155
|
-
//Also save in the session
|
|
156
|
-
BrowserUtils.setSessionItem("token", token);
|
|
157
|
-
BrowserUtils.setSessionItem("user", Utils.objectToString(dataUser));
|
|
164
|
+
// Note: Do not set the JDUser info as it may lead to circular dependency
|
|
165
|
+
// globalThis.xAuthToken = token;
|
|
166
|
+
// globalThis.userData = dataUser;
|
|
167
|
+
// globalThis.userId = Utils.getString(dataUser, "_id");
|
|
158
168
|
}
|
|
159
169
|
});
|
|
160
170
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import JDResource from "../../jdResource";
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
2
|
export declare class JDCity extends JDResource {
|
|
3
3
|
stateId: string;
|
|
4
4
|
state: Record<string, any>;
|
|
5
5
|
get localisedStateTitle(): string;
|
|
6
6
|
get stateTitleEN(): string;
|
|
7
7
|
get stateTitleMM(): string;
|
|
8
|
-
constructor(data
|
|
8
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
9
9
|
setData(data: Record<string, any>): void;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
getCities(orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
11
|
+
findCities(title: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
getDistricts(stateId: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=jdCity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdCity.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdCity.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"jdCity.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdCity.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,MAAO,SAAQ,UAAU;IACrC,OAAO,EAAC,MAAM,CAAM;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAEhC,IAAI,mBAAmB,IAAG,MAAM,CAAgF;IAChH,IAAI,YAAY,IAAG,MAAM,CAAuE;IAChG,IAAI,YAAY,IAAG,MAAM,CAAuE;gBAEpF,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAM1B,SAAS,CAAC,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAK/F,UAAU,CAAC,KAAK,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAK9G,YAAY,CAAC,OAAO,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKlH,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|
|
@@ -7,14 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import JDResource from "../../jdResource";
|
|
10
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
11
11
|
import { Utils } from "../../../utilities/utils";
|
|
12
12
|
export class JDCity extends JDResource {
|
|
13
13
|
get localisedStateTitle() { return globalThis.language == 'en' ? this.stateTitleEN : this.stateTitleMM; }
|
|
14
14
|
get stateTitleEN() { return Utils.getString(Utils.getObject(this.state, 'title'), 'en'); }
|
|
15
15
|
get stateTitleMM() { return Utils.getString(Utils.getObject(this.state, 'title'), 'mm'); }
|
|
16
|
-
constructor(data) {
|
|
17
|
-
super(
|
|
16
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
17
|
+
super(connectorInfo);
|
|
18
18
|
this.stateId = "";
|
|
19
19
|
this.state = {};
|
|
20
20
|
this.setData(data);
|
|
@@ -24,27 +24,27 @@ export class JDCity extends JDResource {
|
|
|
24
24
|
this.stateId = Utils.getString(data, "state_id");
|
|
25
25
|
this.state = Utils.getObject(data, "state");
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
getCities() {
|
|
28
28
|
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
29
|
-
const params =
|
|
30
|
-
return yield
|
|
29
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
30
|
+
return yield this.getRelative('/modules/geolocation/cities', params);
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
findCities(title_1) {
|
|
34
34
|
return __awaiter(this, arguments, void 0, function* (title, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
35
|
-
const params =
|
|
36
|
-
return yield
|
|
35
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
36
|
+
return yield this.getRelative('/modules/geolocation/cities/find', params);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
getDistricts(stateId_1) {
|
|
40
40
|
return __awaiter(this, arguments, void 0, function* (stateId, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
41
|
-
const params =
|
|
42
|
-
return yield
|
|
41
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
42
|
+
return yield this.getRelative(`/modules/geolocation/cities/${stateId}/districts`, params);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
getInfo(id) {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
return yield
|
|
47
|
+
return yield this.getRelative(`/modules/geolocation/states/${id}`, {});
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import JDResource from "../../jdResource";
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
2
|
export declare class JDCountry extends JDResource {
|
|
3
|
-
constructor(data
|
|
3
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
4
4
|
setData(data: Record<string, any>): void;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
getCountries(orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
6
|
+
findCountries(title: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
7
|
+
getStates(countryId: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
8
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=jdCountry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdCountry.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdCountry.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"jdCountry.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdCountry.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,SAAU,SAAQ,UAAU;gBAC5B,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI1B,YAAY,CAAC,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKlG,aAAa,CAAC,KAAK,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKjH,SAAS,CAAC,SAAS,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKjH,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|
|
@@ -7,36 +7,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import JDResource from "../../jdResource";
|
|
10
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
11
11
|
export class JDCountry extends JDResource {
|
|
12
|
-
constructor(data) {
|
|
13
|
-
super(
|
|
12
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
13
|
+
super(connectorInfo);
|
|
14
14
|
this.setData(data);
|
|
15
15
|
}
|
|
16
16
|
setData(data) {
|
|
17
17
|
super.setData(data);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
getCountries() {
|
|
20
20
|
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
21
|
-
const params =
|
|
22
|
-
return yield
|
|
21
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
22
|
+
return yield this.getRelative('/modules/geolocation/countries', params);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
findCountries(title_1) {
|
|
26
26
|
return __awaiter(this, arguments, void 0, function* (title, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
27
|
-
const params =
|
|
28
|
-
return yield
|
|
27
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
28
|
+
return yield this.getRelative('/modules/geolocation/countries/find', params);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
getStates(countryId_1) {
|
|
32
32
|
return __awaiter(this, arguments, void 0, function* (countryId, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
33
|
-
const params =
|
|
34
|
-
return yield
|
|
33
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
34
|
+
return yield this.getRelative(`/modules/geolocation/countries/${countryId}/states`, params);
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
getInfo(id) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
return yield
|
|
39
|
+
return yield this.getRelative(`/modules/geolocation/countries/${id}`, {});
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import JDResource from "../../jdResource";
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
2
|
export declare class JDDistrict extends JDResource {
|
|
3
3
|
cityId: string;
|
|
4
4
|
city: Record<string, any>;
|
|
5
5
|
get localisedCityTitle(): string;
|
|
6
6
|
get cityTitleEN(): string;
|
|
7
7
|
get cityTitleMM(): string;
|
|
8
|
-
constructor(data
|
|
8
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
9
9
|
setData(data: Record<string, any>): void;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
getDistricts(orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
11
|
+
findDistricts(title: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=jdDistrict.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdDistrict.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdDistrict.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"jdDistrict.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdDistrict.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,UAAW,SAAQ,UAAU;IACzC,MAAM,EAAC,MAAM,CAAM;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAE/B,IAAI,kBAAkB,IAAG,MAAM,CAA8E;IAC7G,IAAI,WAAW,IAAG,MAAM,CAAsE;IAC9F,IAAI,WAAW,IAAG,MAAM,CAAsE;gBAElF,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAInG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAM3B,YAAY,CAAC,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKlG,aAAa,CAAC,KAAK,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKjH,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|
|
@@ -7,14 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import JDResource from "../../jdResource";
|
|
10
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
11
11
|
import { Utils } from "../../../utilities/utils";
|
|
12
12
|
export class JDDistrict extends JDResource {
|
|
13
13
|
get localisedCityTitle() { return globalThis.language == 'en' ? this.cityTitleEN : this.cityTitleMM; }
|
|
14
14
|
get cityTitleEN() { return Utils.getString(Utils.getObject(this.city, 'title'), 'en'); }
|
|
15
15
|
get cityTitleMM() { return Utils.getString(Utils.getObject(this.city, 'title'), 'mm'); }
|
|
16
|
-
constructor(data) {
|
|
17
|
-
super(
|
|
16
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
17
|
+
super(connectorInfo);
|
|
18
18
|
this.cityId = "";
|
|
19
19
|
this.city = {};
|
|
20
20
|
this.setData(data);
|
|
@@ -24,21 +24,21 @@ export class JDDistrict extends JDResource {
|
|
|
24
24
|
this.cityId = Utils.getString(data, "city_id");
|
|
25
25
|
this.city = Utils.getObject(data, "city");
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
getDistricts() {
|
|
28
28
|
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
29
|
-
const params =
|
|
30
|
-
return yield
|
|
29
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
30
|
+
return yield this.getRelative('/modules/geolocation/districts', params);
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
findDistricts(title_1) {
|
|
34
34
|
return __awaiter(this, arguments, void 0, function* (title, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
35
|
-
const params =
|
|
36
|
-
return yield
|
|
35
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
36
|
+
return yield this.getRelative('/modules/geolocation/districts/find', params);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
getInfo(id) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
return yield
|
|
41
|
+
return yield this.getRelative(`/modules/geolocation/districts/${id}`, {});
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
}
|