web3-banking-system-sdk 1.0.2 → 1.0.5
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/service/baseService.d.ts +1 -0
- package/dist/api/service/baseService.js +8 -3
- package/dist/api/service/promotionService.d.ts +1 -0
- package/dist/api/service/promotionService.js +3 -0
- package/dist/constant/constant.d.ts +1 -1
- package/dist/constant/constant.js +1 -1
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ declare abstract class BaseService {
|
|
|
18
18
|
protected PUT<T extends BaseResult>(url: string, data: object | string, options?: ServiceRequestOptions): Promise<ApiResponse<T>>;
|
|
19
19
|
protected DELETE<T extends BaseResult>(url: string, options?: ServiceRequestOptions): Promise<ApiResponse<T>>;
|
|
20
20
|
protected resolveURL(path?: string | number): string;
|
|
21
|
+
protected getBaseURL(): string | undefined;
|
|
21
22
|
private buildConfig;
|
|
22
23
|
private buildFlagHeaders;
|
|
23
24
|
}
|
|
@@ -53,12 +53,17 @@ class BaseService {
|
|
|
53
53
|
const normalized = p && !p.startsWith("/") ? `/${p}` : p;
|
|
54
54
|
return `${this.endpoint}${normalized}`;
|
|
55
55
|
}
|
|
56
|
+
// Override in a subclass to route all its requests to a different host.
|
|
57
|
+
// Returning undefined falls back to context.getBaseUrl() in the interceptor.
|
|
58
|
+
getBaseURL() {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
56
61
|
// Precedence: caller `headers` > flag-derived headers; interceptor wins over both.
|
|
62
|
+
// Caller `baseURL` > service `getBaseURL()` > context base URL.
|
|
57
63
|
buildConfig(options) {
|
|
58
|
-
|
|
59
|
-
return {};
|
|
60
|
-
const { flags, headers, ...rest } = options;
|
|
64
|
+
const { flags, headers, ...rest } = options ?? {};
|
|
61
65
|
return {
|
|
66
|
+
baseURL: this.getBaseURL(),
|
|
62
67
|
...rest,
|
|
63
68
|
headers: { ...this.buildFlagHeaders(flags), ...headers },
|
|
64
69
|
};
|
|
@@ -3,6 +3,7 @@ import type { GGEZGiftRewards, PromotionDetails, PromotionIncrementResult, Promo
|
|
|
3
3
|
declare class PromotionService extends BaseService {
|
|
4
4
|
protected endpoint: string;
|
|
5
5
|
constructor(data: PromotionServiceParameters);
|
|
6
|
+
protected getBaseURL(): string;
|
|
6
7
|
getPromotionByCode(promotionCode: string): Promise<import("../..").ApiResponse<PromotionDetails>>;
|
|
7
8
|
getTwitterSpotlightPostIds(): Promise<import("../..").ApiResponse<TwitterSpotlightPostIdsResult>>;
|
|
8
9
|
incrementPromotionParticipants(data: GGEZGiftRewards): Promise<import("../..").ApiResponse<PromotionIncrementResult>>;
|
|
@@ -7,7 +7,7 @@ declare const Endpoints: {
|
|
|
7
7
|
readonly Order: "v1/order";
|
|
8
8
|
readonly OpenPayd: "api/v1/openpayd";
|
|
9
9
|
readonly Organization: "v1/organization";
|
|
10
|
-
readonly Promotion: "
|
|
10
|
+
readonly Promotion: "promotion";
|
|
11
11
|
readonly Transaction: "v1/transaction";
|
|
12
12
|
readonly User: "v1/user";
|
|
13
13
|
readonly Program: "v1/program";
|
package/package.json
CHANGED