@smartico/public-api 0.0.141 → 0.0.143
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/README.md +14 -1
- package/dist/CustomSections/AchCustomSection.d.ts +27 -0
- package/dist/CustomSections/GetCustomSectionsRequest.d.ts +3 -0
- package/dist/CustomSections/GetCustomSectionsResponse.d.ts +7 -0
- package/dist/CustomSections/UICustomSection.d.ts +15 -0
- package/dist/CustomSections/index.d.ts +4 -0
- package/dist/Missions/AchievementPublicMeta.d.ts +1 -0
- package/dist/Missions/UserAchievement.d.ts +1 -0
- package/dist/OCache.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +17 -14
- package/dist/WSAPI/WSAPI.d.ts +270 -48
- package/dist/WSAPI/WSAPITypes.d.ts +25 -0
- package/dist/index.js +559 -214
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +382 -95
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +234 -27
- package/docs/enums/AchCustomLayoutTheme.md +27 -0
- package/docs/enums/AchCustomSectionType.md +43 -0
- package/docs/enums/AchMissionsTabsOptions.md +21 -0
- package/docs/enums/AchOverviewMissionsFilter.md +33 -0
- package/docs/interfaces/TUICustomSection.md +85 -0
- package/package.json +1 -1
- package/src/CustomSections/AchCustomSection.ts +30 -0
- package/src/CustomSections/GetCustomSectionsRequest.ts +5 -0
- package/src/CustomSections/GetCustomSectionsResponse.ts +7 -0
- package/src/CustomSections/UICustomSection.ts +34 -0
- package/src/CustomSections/index.ts +4 -0
- package/src/Level/GetLevelMapResponse.ts +1 -1
- package/src/Missions/AchievementPublicMeta.ts +1 -0
- package/src/Missions/UserAchievement.ts +3 -1
- package/src/OCache.ts +5 -0
- package/src/SmarticoAPI.ts +42 -34
- package/src/WSAPI/WSAPI.ts +296 -64
- package/src/WSAPI/WSAPITypes.ts +27 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Interface: TUICustomSection
|
|
2
|
+
|
|
3
|
+
TUICustomSection describes the information of the custom sections defined in the system
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### body
|
|
8
|
+
|
|
9
|
+
• **body**: `string`
|
|
10
|
+
|
|
11
|
+
The body of the custom section
|
|
12
|
+
|
|
13
|
+
___
|
|
14
|
+
|
|
15
|
+
### menu_img
|
|
16
|
+
|
|
17
|
+
• **menu_img**: `string`
|
|
18
|
+
|
|
19
|
+
The image of the custom section
|
|
20
|
+
|
|
21
|
+
___
|
|
22
|
+
|
|
23
|
+
### menu_name
|
|
24
|
+
|
|
25
|
+
• **menu_name**: `string`
|
|
26
|
+
|
|
27
|
+
The name of the custom section
|
|
28
|
+
|
|
29
|
+
___
|
|
30
|
+
|
|
31
|
+
### custom_skin_images
|
|
32
|
+
|
|
33
|
+
• **custom_skin_images**: `string`
|
|
34
|
+
|
|
35
|
+
Custom images for custom section
|
|
36
|
+
|
|
37
|
+
___
|
|
38
|
+
|
|
39
|
+
### section_type_id
|
|
40
|
+
|
|
41
|
+
• **section_type_id**: [`AchCustomSectionType`](../enums/AchCustomSectionType.md)
|
|
42
|
+
|
|
43
|
+
The particular type of custom section, can be Missions, Tournaments, Lootbox and etc
|
|
44
|
+
|
|
45
|
+
___
|
|
46
|
+
|
|
47
|
+
### theme
|
|
48
|
+
|
|
49
|
+
• **theme**: [`AchCustomLayoutTheme`](../enums/AchCustomLayoutTheme.md)
|
|
50
|
+
|
|
51
|
+
Theme of the custom section
|
|
52
|
+
|
|
53
|
+
___
|
|
54
|
+
|
|
55
|
+
### generic_custom_css
|
|
56
|
+
|
|
57
|
+
• **generic_custom_css**: `string`
|
|
58
|
+
|
|
59
|
+
Custom css for the custom section
|
|
60
|
+
|
|
61
|
+
___
|
|
62
|
+
|
|
63
|
+
### mission\_tabs\_options
|
|
64
|
+
|
|
65
|
+
• **mission\_tabs\_options**: [`AchMissionsTabsOptions`](../enums/AchMissionsTabsOptions.md)
|
|
66
|
+
|
|
67
|
+
Tabs that can be shown in custom section, e.g Overview, No Overview, All tabs
|
|
68
|
+
|
|
69
|
+
___
|
|
70
|
+
|
|
71
|
+
### overview\_missions\_filter
|
|
72
|
+
|
|
73
|
+
• **overview\_missions\_filter**: [`AchOverviewMissionsFilter`](../enums/AchOverviewMissionsFilter.md)
|
|
74
|
+
|
|
75
|
+
Filter that allow to show missions by criteria
|
|
76
|
+
|
|
77
|
+
___
|
|
78
|
+
|
|
79
|
+
### overview\_missions\_count
|
|
80
|
+
|
|
81
|
+
• **overview\_missions\_count**: `number`
|
|
82
|
+
|
|
83
|
+
Quantity of missions to be shown in overview
|
|
84
|
+
|
|
85
|
+
___
|
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export enum AchCustomSectionType {
|
|
2
|
+
HTML_PAGE = 1,
|
|
3
|
+
MISSIONS_CATEGORY = 2,
|
|
4
|
+
TOURNAMENTS_CATEGORY = 3,
|
|
5
|
+
LEVELS = 4,
|
|
6
|
+
MINI_GAMES = 5,
|
|
7
|
+
MISSION_CUSTOM_LAYOUT = 6,
|
|
8
|
+
MATCH_X = 7,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum AchCustomLayoutTheme {
|
|
12
|
+
VALENTINES_LIGHT = 'valentines-light',
|
|
13
|
+
VALENTINES_DARK = 'valentines-dark',
|
|
14
|
+
EURO_2024 = 'euro-2024',
|
|
15
|
+
GENERIC = 'generic',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum AchMissionsTabsOptions {
|
|
19
|
+
ONLY_OVERVIEW = 1,
|
|
20
|
+
NO_OVERVIEW = 2,
|
|
21
|
+
ALL = 3,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export enum AchOverviewMissionsFilter {
|
|
25
|
+
ANY = 1,
|
|
26
|
+
ALL_MISSIONS = 2,
|
|
27
|
+
ALL_EXCEPT_COMPLETED = 3,
|
|
28
|
+
ALL_EXCEPT_LOCKED = 4,
|
|
29
|
+
ALL_EXCEPT_COMPLETED_AND_LOCKED = 5,
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TUICustomSection } from "../WSAPI/WSAPITypes";
|
|
2
|
+
import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter } from "./AchCustomSection";
|
|
3
|
+
|
|
4
|
+
export interface UICustomSection {
|
|
5
|
+
|
|
6
|
+
body?: string;
|
|
7
|
+
menu_img?: string;
|
|
8
|
+
menu_name?: string;
|
|
9
|
+
custom_skin_images?: string;
|
|
10
|
+
section_type_id?: AchCustomSectionType;
|
|
11
|
+
theme?: AchCustomLayoutTheme;
|
|
12
|
+
generic_custom_css?: string;
|
|
13
|
+
mission_tabs_options?: AchMissionsTabsOptions;
|
|
14
|
+
overview_missions_filter?: AchOverviewMissionsFilter;
|
|
15
|
+
overview_missions_count?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const UICustomSectionTransform = (items: UICustomSection[]): TUICustomSection[] => {
|
|
19
|
+
return items.filter(r => r.section_type_id !== undefined && r.section_type_id >= 1).map( r => {
|
|
20
|
+
const x: TUICustomSection = {
|
|
21
|
+
body: r.body,
|
|
22
|
+
menu_img: r.menu_img,
|
|
23
|
+
menu_name: r.menu_name,
|
|
24
|
+
section_type_id: r.section_type_id,
|
|
25
|
+
custom_skin_images: r.custom_skin_images,
|
|
26
|
+
generic_custom_css: r.generic_custom_css,
|
|
27
|
+
mission_tabs_options: r.mission_tabs_options,
|
|
28
|
+
overview_missions_count: r.overview_missions_count,
|
|
29
|
+
overview_missions_filter: r.overview_missions_filter,
|
|
30
|
+
theme: r.theme
|
|
31
|
+
}
|
|
32
|
+
return x;
|
|
33
|
+
})
|
|
34
|
+
}
|
|
@@ -17,7 +17,7 @@ export const GetLevelMapResponseTransform = (levels: GetLevelMapResponse): TLeve
|
|
|
17
17
|
description: l.level_public_meta.description,
|
|
18
18
|
image: l.level_public_meta.image_url,
|
|
19
19
|
required_points: l.required_points,
|
|
20
|
-
visibility_points: parseInt(l.level_public_meta.visibility_points as any),
|
|
20
|
+
visibility_points: l.level_public_meta.visibility_points ? parseInt(l.level_public_meta.visibility_points as any) : null,
|
|
21
21
|
required_level_counter_1: l.required_level_counter_1,
|
|
22
22
|
required_level_counter_2: l.required_level_counter_2,
|
|
23
23
|
custom_data: IntUtils.JsonOrText(l.level_public_meta?.custom_data),
|
|
@@ -41,6 +41,7 @@ export interface UserAchievement {
|
|
|
41
41
|
completed_today?: boolean;
|
|
42
42
|
completed_this_week?: boolean;
|
|
43
43
|
completed_this_month?: boolean;
|
|
44
|
+
custom_section_type_id?: number;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
|
|
@@ -103,7 +104,8 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
|
|
|
103
104
|
complete_date_ts: r.complete_date_ts,
|
|
104
105
|
completed_today: completedToday,
|
|
105
106
|
completed_this_week: completedThisWeek,
|
|
106
|
-
completed_this_month: completedThisMonth
|
|
107
|
+
completed_this_month: completedThisMonth,
|
|
108
|
+
custom_section_type_id: r.ach_public_meta.custom_section_type_id,
|
|
107
109
|
}
|
|
108
110
|
return x;
|
|
109
111
|
});
|
package/src/OCache.ts
CHANGED
package/src/SmarticoAPI.ts
CHANGED
|
@@ -17,12 +17,13 @@ import { GetTournamentInfoRequest, GetTournamentInfoResponse, GetTournamentsRequ
|
|
|
17
17
|
import { GetLeaderBoardsRequest, GetLeaderBoardsResponse, LeaderBoardDetails, LeaderBoardPeriodType } from "./Leaderboard";
|
|
18
18
|
import { GetLevelMapResponse, GetLevelMapResponseTransform } from "./Level";
|
|
19
19
|
import { WSAPI } from "./WSAPI/WSAPI";
|
|
20
|
-
import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult } from "./WSAPI/WSAPITypes";
|
|
20
|
+
import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection } from "./WSAPI/WSAPITypes";
|
|
21
21
|
import { getLeaderBoardTransform } from "./Leaderboard/LeaderBoards";
|
|
22
22
|
import { GetAchievementsUserInfoResponse } from "./Core/GetAchievementsUserInfoResponse";
|
|
23
23
|
import { CheckSegmentMatchResponse } from "./Core/CheckSegmentMatchResponse";
|
|
24
24
|
import { CheckSegmentMatchRequest } from "./Core/CheckSegmentMatchRequest";
|
|
25
25
|
import { GetJackpotsPotsRequest, GetJackpotsPotsResponse, GetJackpotsRequest, GetJackpotsResponse, JackpotDetails, JackpotPot, JackpotsOptinRequest, JackpotsOptinResponse, JackpotsOptoutRequest, JackpotsOptoutResponse } from "./Jackpots";
|
|
26
|
+
import { GetCustomSectionsRequest, GetCustomSectionsResponse, UICustomSectionTransform } from "./CustomSections";
|
|
26
27
|
|
|
27
28
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
28
29
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
@@ -111,13 +112,16 @@ class SmarticoAPI {
|
|
|
111
112
|
return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
private async send<T>(message: any, expectCID?: ClassId): Promise<T> {
|
|
115
|
+
private async send<T>(message: any, expectCID?: ClassId, force_language?: string): Promise<T> {
|
|
115
116
|
|
|
116
117
|
|
|
117
118
|
if (this.logCIDs.includes(message.cid)) {
|
|
118
119
|
this.logger.info('REQ', message)
|
|
119
120
|
}
|
|
120
121
|
|
|
122
|
+
if (force_language) {
|
|
123
|
+
message.force_language = force_language;
|
|
124
|
+
}
|
|
121
125
|
|
|
122
126
|
let result: any;
|
|
123
127
|
|
|
@@ -287,18 +291,15 @@ class SmarticoAPI {
|
|
|
287
291
|
return results.segments || [];
|
|
288
292
|
}
|
|
289
293
|
|
|
290
|
-
public async jackpotGet(user_ext_id: string, filter?: { related_game_id?: string, jp_template_id?: number }): Promise<
|
|
291
|
-
const message = this.buildMessage<GetJackpotsRequest, GetJackpotsResponse>(user_ext_id, ClassId.JP_GET_JACKPOTS_REQUEST, filter);
|
|
292
|
-
const response = await this.send<GetJackpotsResponse>(message, ClassId.JP_GET_JACKPOTS_RESPONSE);
|
|
294
|
+
public async jackpotGet(user_ext_id: string, filter?: { related_game_id?: string, jp_template_id?: number }, force_language?: string ): Promise<GetJackpotsResponse> {
|
|
293
295
|
|
|
294
|
-
|
|
296
|
+
const message = this.buildMessage<GetJackpotsRequest, GetJackpotsResponse>(user_ext_id, ClassId.JP_GET_JACKPOTS_REQUEST, filter);
|
|
297
|
+
return await this.send<GetJackpotsResponse>(message, ClassId.JP_GET_JACKPOTS_RESPONSE, force_language);
|
|
295
298
|
}
|
|
296
299
|
|
|
297
|
-
public async potGet(user_ext_id: string, filter: { jp_template_ids: number[] }): Promise<
|
|
300
|
+
public async potGet(user_ext_id: string, filter: { jp_template_ids: number[] }): Promise<GetJackpotsPotsResponse> {
|
|
298
301
|
const message = this.buildMessage<GetJackpotsPotsRequest, GetJackpotsPotsResponse>(user_ext_id, ClassId.JP_GET_LATEST_POTS_REQUEST, filter);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return response?.items || [];
|
|
302
|
+
return await this.send<GetJackpotsPotsResponse>(message, ClassId.JP_GET_LATEST_POTS_RESPONSE);
|
|
302
303
|
}
|
|
303
304
|
|
|
304
305
|
public async jackpotOptIn(user_ext_id: string, payload: { jp_template_id: number }): Promise<JackpotsOptinResponse> {
|
|
@@ -311,11 +312,11 @@ class SmarticoAPI {
|
|
|
311
312
|
return await this.send<JackpotsOptoutResponse>(message, ClassId.JP_OPTOUT_RESPONSE);
|
|
312
313
|
}
|
|
313
314
|
|
|
314
|
-
public async sawGetTemplates(user_ext_id: string,
|
|
315
|
+
public async sawGetTemplates(user_ext_id: string, force_language?: string, is_visitor_mode: boolean = false): Promise<SAWGetTemplatesResponse> {
|
|
315
316
|
|
|
316
|
-
const message = this.buildMessage<SAWGetTemplatesRequest, SAWGetTemplatesResponse>(user_ext_id, ClassId.SAW_GET_SPINS_REQUEST,
|
|
317
|
+
const message = this.buildMessage<SAWGetTemplatesRequest, SAWGetTemplatesResponse>(user_ext_id, ClassId.SAW_GET_SPINS_REQUEST, { is_visitor_mode });
|
|
317
318
|
|
|
318
|
-
const response = await this.send<SAWGetTemplatesResponse>(message, ClassId.SAW_GET_SPINS_RESPONSE);
|
|
319
|
+
const response = await this.send<SAWGetTemplatesResponse>(message, ClassId.SAW_GET_SPINS_RESPONSE, force_language);
|
|
319
320
|
|
|
320
321
|
if (response && response.templates) {
|
|
321
322
|
response.templates.forEach(t => {
|
|
@@ -447,20 +448,18 @@ class SmarticoAPI {
|
|
|
447
448
|
|
|
448
449
|
}
|
|
449
450
|
|
|
450
|
-
public async storeGetItems(user_ext_id: string): Promise<GetStoreItemsResponse> {
|
|
451
|
-
|
|
451
|
+
public async storeGetItems(user_ext_id: string, force_language?: string): Promise<GetStoreItemsResponse> {
|
|
452
452
|
const message = this.buildMessage<any, GetStoreItemsResponse>(user_ext_id, ClassId.GET_SHOP_ITEMS_REQUEST);
|
|
453
|
-
return await this.send<GetStoreItemsResponse>(message, ClassId.GET_SHOP_ITEMS_RESPONSE);
|
|
453
|
+
return await this.send<GetStoreItemsResponse>(message, ClassId.GET_SHOP_ITEMS_RESPONSE, force_language);
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
public async storeGetItemsT(user_ext_id: string): Promise<TStoreItem[]> {
|
|
457
457
|
return StoreItemTransform((await this.storeGetItems(user_ext_id)).items);
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
public async storeGetCategories(user_ext_id: string): Promise<GetCategoriesStoreResponse> {
|
|
461
|
-
|
|
460
|
+
public async storeGetCategories(user_ext_id: string, force_language?: string): Promise<GetCategoriesStoreResponse> {
|
|
462
461
|
const message = this.buildMessage<any, GetCategoriesStoreResponse>(user_ext_id, ClassId.GET_SHOP_CATEGORIES_REQUEST);
|
|
463
|
-
return await this.send<GetCategoriesStoreResponse>(message, ClassId.GET_SHOP_CATEGORIES_RESPONSE);
|
|
462
|
+
return await this.send<GetCategoriesStoreResponse>(message, ClassId.GET_SHOP_CATEGORIES_RESPONSE, force_language);
|
|
464
463
|
}
|
|
465
464
|
|
|
466
465
|
public async storeGetCategoriesT(user_ext_id: string): Promise<TStoreCategory[]> {
|
|
@@ -481,10 +480,10 @@ class SmarticoAPI {
|
|
|
481
480
|
return StoreItemPurchasedTransform((await this.storeGetPurchasedItems(user_ext_id, limit, offset)).items);
|
|
482
481
|
}
|
|
483
482
|
|
|
484
|
-
public async missionsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse> {
|
|
483
|
+
public async missionsGetItems(user_ext_id: string, force_language?: string): Promise<GetAchievementMapResponse> {
|
|
485
484
|
|
|
486
485
|
const message = this.buildMessage<GetAchievementMapRequest, GetAchievementMapResponse>(user_ext_id, ClassId.GET_ACHIEVEMENT_MAP_REQUEST);
|
|
487
|
-
const response = await this.send<GetAchievementMapResponse>(message, ClassId.GET_ACHIEVEMENT_MAP_RESPONSE);
|
|
486
|
+
const response = await this.send<GetAchievementMapResponse>(message, ClassId.GET_ACHIEVEMENT_MAP_RESPONSE, force_language);
|
|
488
487
|
// we need to clone response to avoid changing original object,for cases when its called together with badgesGetItems (e.g. in Promise.all)
|
|
489
488
|
const responseClone = { ...response };
|
|
490
489
|
|
|
@@ -513,20 +512,20 @@ class SmarticoAPI {
|
|
|
513
512
|
}
|
|
514
513
|
}
|
|
515
514
|
|
|
516
|
-
public async achGetCategories(user_ext_id: string): Promise<GetAchCategoriesResponse> {
|
|
515
|
+
public async achGetCategories(user_ext_id: string, force_language?: string): Promise<GetAchCategoriesResponse> {
|
|
517
516
|
|
|
518
517
|
const message = this.buildMessage<any, GetAchCategoriesResponse>(user_ext_id, ClassId.GET_ACH_CATEGORIES_REQUEST);
|
|
519
|
-
return await this.send<GetAchCategoriesResponse>(message, ClassId.GET_ACH_CATEGORIES_RESPONSE);
|
|
518
|
+
return await this.send<GetAchCategoriesResponse>(message, ClassId.GET_ACH_CATEGORIES_RESPONSE, force_language);
|
|
520
519
|
}
|
|
521
520
|
|
|
522
521
|
public async achGetCategoriesT(user_ext_id: string): Promise<TAchCategory[]> {
|
|
523
522
|
return AchCategoryTransform((await this.achGetCategories(user_ext_id)).categories);
|
|
524
523
|
}
|
|
525
524
|
|
|
526
|
-
public async badgetsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse> {
|
|
525
|
+
public async badgetsGetItems(user_ext_id: string, force_language?: string): Promise<GetAchievementMapResponse> {
|
|
527
526
|
|
|
528
527
|
const message = this.buildMessage<GetAchievementMapRequest, GetAchievementMapResponse>(user_ext_id, ClassId.GET_ACHIEVEMENT_MAP_REQUEST);
|
|
529
|
-
const response = await this.send<GetAchievementMapResponse>(message, ClassId.GET_ACHIEVEMENT_MAP_RESPONSE);
|
|
528
|
+
const response = await this.send<GetAchievementMapResponse>(message, ClassId.GET_ACHIEVEMENT_MAP_RESPONSE, force_language);
|
|
530
529
|
// we need to clone response to avoid changing original object,for cases when its called together with missionsGetItems (e.g. in Promise.all)
|
|
531
530
|
const responseClone = { ...response };
|
|
532
531
|
|
|
@@ -541,10 +540,10 @@ class SmarticoAPI {
|
|
|
541
540
|
}
|
|
542
541
|
|
|
543
542
|
|
|
544
|
-
public async tournamentsGetLobby(user_ext_id: string): Promise<GetTournamentsResponse> {
|
|
543
|
+
public async tournamentsGetLobby(user_ext_id: string, force_language?: string): Promise<GetTournamentsResponse> {
|
|
545
544
|
|
|
546
545
|
const message = this.buildMessage<GetTournamentsRequest, GetTournamentsResponse>(user_ext_id, ClassId.GET_TOURNAMENT_LOBBY_REQUEST);
|
|
547
|
-
return await this.send<GetTournamentsResponse>(message, ClassId.GET_TOURNAMENT_LOBBY_RESPONSE);
|
|
546
|
+
return await this.send<GetTournamentsResponse>(message, ClassId.GET_TOURNAMENT_LOBBY_RESPONSE, force_language);
|
|
548
547
|
|
|
549
548
|
}
|
|
550
549
|
|
|
@@ -552,14 +551,14 @@ class SmarticoAPI {
|
|
|
552
551
|
return TournamentItemsTransform((await this.tournamentsGetLobby(user_ext_id)).tournaments);
|
|
553
552
|
}
|
|
554
553
|
|
|
555
|
-
public async tournamentsGetInfo(user_ext_id: string, tournamentInstanceId: number): Promise<GetTournamentInfoResponse> {
|
|
554
|
+
public async tournamentsGetInfo(user_ext_id: string, tournamentInstanceId: number, force_language?: string): Promise<GetTournamentInfoResponse> {
|
|
556
555
|
|
|
557
556
|
const message = this.buildMessage<GetTournamentInfoRequest, GetTournamentInfoResponse>(user_ext_id, ClassId.GET_TOURNAMENT_INFO_REQUEST,
|
|
558
557
|
{
|
|
559
558
|
tournamentInstanceId
|
|
560
559
|
}
|
|
561
560
|
);
|
|
562
|
-
const response = await this.send<GetTournamentInfoResponse>(message, ClassId.GET_TOURNAMENT_INFO_RESPONSE);
|
|
561
|
+
const response = await this.send<GetTournamentInfoResponse>(message, ClassId.GET_TOURNAMENT_INFO_RESPONSE, force_language);
|
|
563
562
|
|
|
564
563
|
if (response.userPosition?.avatar_id) {
|
|
565
564
|
response.userPosition.avatar_url = CoreUtils.avatarUrl(response.userPosition.avatar_id, this.avatarDomain);
|
|
@@ -583,7 +582,7 @@ class SmarticoAPI {
|
|
|
583
582
|
return tournamentInfoItemTransform(response);
|
|
584
583
|
}
|
|
585
584
|
|
|
586
|
-
public async leaderboardGet(user_ext_id: string, period_type_id?: LeaderBoardPeriodType, prevPeriod: boolean = false): Promise<LeaderBoardDetails> {
|
|
585
|
+
public async leaderboardGet(user_ext_id: string, period_type_id?: LeaderBoardPeriodType, prevPeriod: boolean = false, force_language?: string): Promise<LeaderBoardDetails> {
|
|
587
586
|
|
|
588
587
|
const message = this.buildMessage<GetLeaderBoardsRequest, GetLeaderBoardsResponse>(user_ext_id, ClassId.GET_LEADERS_BOARD_REQUEST,
|
|
589
588
|
{
|
|
@@ -593,7 +592,7 @@ class SmarticoAPI {
|
|
|
593
592
|
}
|
|
594
593
|
);
|
|
595
594
|
|
|
596
|
-
const response = await this.send<GetLeaderBoardsResponse>(message, ClassId.GET_LEADERS_BOARD_RESPONSE);
|
|
595
|
+
const response = await this.send<GetLeaderBoardsResponse>(message, ClassId.GET_LEADERS_BOARD_RESPONSE, force_language);
|
|
597
596
|
|
|
598
597
|
const boardKey = Object.keys(response.map).find( k => period_type_id === undefined || k === period_type_id?.toString());
|
|
599
598
|
|
|
@@ -620,15 +619,24 @@ class SmarticoAPI {
|
|
|
620
619
|
return getLeaderBoardTransform(await this.leaderboardGet(user_ext_id, period_type_id, prevPeriod));
|
|
621
620
|
}
|
|
622
621
|
|
|
623
|
-
public async levelsGet(user_ext_id: string): Promise<GetLevelMapResponse> {
|
|
622
|
+
public async levelsGet(user_ext_id: string, force_language?: string): Promise<GetLevelMapResponse> {
|
|
624
623
|
const message = this.buildMessage<any, GetLevelMapResponse>(user_ext_id, ClassId.GET_LEVEL_MAP_REQUEST);
|
|
625
|
-
return await this.send<GetLevelMapResponse>(message, ClassId.GET_LEVEL_MAP_RESPONSE);
|
|
624
|
+
return await this.send<GetLevelMapResponse>(message, ClassId.GET_LEVEL_MAP_RESPONSE, force_language);
|
|
626
625
|
}
|
|
627
626
|
|
|
628
627
|
public async levelsGetT(user_ext_id: string): Promise<TLevel[]> {
|
|
629
628
|
return GetLevelMapResponseTransform(await this.levelsGet(user_ext_id));
|
|
630
629
|
}
|
|
631
630
|
|
|
631
|
+
public async getCustomSections(user_ext_id: string): Promise<GetCustomSectionsResponse> {
|
|
632
|
+
const message = this.buildMessage<GetCustomSectionsRequest, GetCustomSectionsResponse>(user_ext_id, ClassId.GET_CUSTOM_SECTIONS_REQUEST);
|
|
633
|
+
return await this.send<GetCustomSectionsResponse>(message, ClassId.GET_CUSTOM_SECTIONS_RESPONSE);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
public async getCustomSectionsT(user_ext_id: string): Promise<TUICustomSection[]> {
|
|
637
|
+
return UICustomSectionTransform(Object.values((await this.getCustomSections(user_ext_id)).customSections));
|
|
638
|
+
}
|
|
639
|
+
|
|
632
640
|
public async getTranslationsT(user_ext_id: string, lang_code: string, areas: TranslationArea[], cacheSec: number = 60): Promise<GetTranslationsResponse> {
|
|
633
641
|
return await this.coreGetTranslations(user_ext_id, lang_code, areas, 30);
|
|
634
642
|
}
|
|
@@ -722,7 +730,7 @@ class SmarticoAPI {
|
|
|
722
730
|
return await this.send<MarkInboxMessageDeletedResponse>(message, ClassId.MARK_INBOX_DELETED_RESPONSE);
|
|
723
731
|
}
|
|
724
732
|
|
|
725
|
-
|
|
733
|
+
|
|
726
734
|
public getWSCalls(): WSAPI {
|
|
727
735
|
return new WSAPI(this);
|
|
728
736
|
}
|