@smartico/public-api 0.0.50 → 0.0.52
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/MiniGames/SAWTemplateUI.d.ts +2 -0
- package/dist/SmarticoAPI.d.ts +8 -5
- package/dist/Store/StoreItem.d.ts +2 -0
- package/dist/Tournaments/GetTournamentInfoResponse.d.ts +2 -0
- package/dist/Tournaments/Tournament.d.ts +6 -0
- package/dist/Tournaments/TournamentRegistrationStatus.d.ts +4 -0
- package/dist/Tournaments/TournamentRegistrationType.d.ts +4 -0
- package/dist/WSAPI/WSAPI.d.ts +7 -1
- package/dist/WSAPI/WSAPITypes.d.ts +129 -0
- package/dist/index.js +300 -146
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +251 -124
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +15 -0
- package/docs/classes/WSAPI.md +42 -0
- package/docs/interfaces/TStoreItem.md +102 -0
- package/docs/interfaces/TTournament.md +234 -0
- package/docs/interfaces/TTournamentDetailed.md +375 -0
- package/package.json +1 -1
- package/src/MiniGames/SAWTemplateUI.ts +2 -0
- package/src/SmarticoAPI.ts +19 -7
- package/src/Store/StoreItem.ts +29 -0
- package/src/Tournaments/GetTournamentInfoResponse.ts +26 -1
- package/src/Tournaments/GetTournamentsResponse.ts +9 -0
- package/src/Tournaments/Tournament.ts +55 -2
- package/src/Tournaments/TournamentRegistrationStatus.ts +16 -0
- package/src/Tournaments/TournamentRegistrationType.ts +14 -0
- package/src/WSAPI/WSAPI.ts +17 -3
- package/src/WSAPI/WSAPITypes.ts +147 -0
- package/tsconfig.json +5 -1
package/src/SmarticoAPI.ts
CHANGED
|
@@ -11,13 +11,13 @@ import { CoreUtils, GetTranslationsRequest, GetTranslationsResponse, ResponseIde
|
|
|
11
11
|
import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
|
|
12
12
|
import { GetLabelInfoRequest } from './Core/GetLabelInfoRequest';
|
|
13
13
|
import { GetInboxMessagesRequest, GetInboxMessagesResponse } from './Inbox';
|
|
14
|
-
import { GetStoreItemsResponse } from './Store';
|
|
14
|
+
import { GetStoreItemsResponse, StoreItemTransform } from './Store';
|
|
15
15
|
import { AchievementType, GetAchievementMapRequest, GetAchievementMapResponse, UserAchievementTransform } from './Missions';
|
|
16
|
-
import { GetTournamentInfoRequest, GetTournamentInfoResponse, GetTournamentsRequest, GetTournamentsResponse } from './Tournaments';
|
|
16
|
+
import { GetTournamentInfoRequest, GetTournamentInfoResponse, GetTournamentsRequest, GetTournamentsResponse, TournamentItemsTransform, tournamentInfoItemTransform } from './Tournaments';
|
|
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 { TLevel, TMissionOrBadge } from "./WSAPI/WSAPITypes";
|
|
20
|
+
import { TLevel, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed } from "./WSAPI/WSAPITypes";
|
|
21
21
|
|
|
22
22
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
23
23
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
@@ -333,6 +333,10 @@ class SmarticoAPI {
|
|
|
333
333
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
public async storeGetItemsT(user_ext_id: string): Promise<TStoreItem[]> {
|
|
337
|
+
return StoreItemTransform((await this.storeGetItems(user_ext_id)).items);
|
|
338
|
+
}
|
|
339
|
+
|
|
336
340
|
public async missionsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse> {
|
|
337
341
|
|
|
338
342
|
const message = this.buildMessage<GetAchievementMapRequest, GetAchievementMapResponse>(user_ext_id, ClassId.GET_ACHIEVEMENT_MAP_REQUEST);
|
|
@@ -343,7 +347,7 @@ class SmarticoAPI {
|
|
|
343
347
|
return response;
|
|
344
348
|
}
|
|
345
349
|
|
|
346
|
-
public async missionsGetItemsT(user_ext_id
|
|
350
|
+
public async missionsGetItemsT(user_ext_id: string): Promise<TMissionOrBadge[]> {
|
|
347
351
|
return UserAchievementTransform((await this.missionsGetItems(user_ext_id)).achievements);
|
|
348
352
|
}
|
|
349
353
|
|
|
@@ -357,7 +361,7 @@ class SmarticoAPI {
|
|
|
357
361
|
return response;
|
|
358
362
|
}
|
|
359
363
|
|
|
360
|
-
public async badgetsGetItemsT(user_ext_id
|
|
364
|
+
public async badgetsGetItemsT(user_ext_id: string): Promise<TMissionOrBadge[]> {
|
|
361
365
|
return UserAchievementTransform((await this.badgetsGetItems(user_ext_id)).achievements);
|
|
362
366
|
}
|
|
363
367
|
|
|
@@ -369,6 +373,10 @@ class SmarticoAPI {
|
|
|
369
373
|
|
|
370
374
|
}
|
|
371
375
|
|
|
376
|
+
public async tournamentsGetLobbyT(user_ext_id: string): Promise<TTournament[]> {
|
|
377
|
+
return TournamentItemsTransform((await this.tournamentsGetLobby(user_ext_id)).tournaments);
|
|
378
|
+
}
|
|
379
|
+
|
|
372
380
|
public async tournamentsGetInfo(user_ext_id: string, tournamentInstanceId: number): Promise<GetTournamentInfoResponse> {
|
|
373
381
|
|
|
374
382
|
const message = this.buildMessage<GetTournamentInfoRequest, GetTournamentInfoResponse>(user_ext_id, ClassId.GET_TOURNAMENT_INFO_REQUEST,
|
|
@@ -392,6 +400,10 @@ class SmarticoAPI {
|
|
|
392
400
|
|
|
393
401
|
}
|
|
394
402
|
|
|
403
|
+
public async tournamentsGetInfoT(user_ext_id: string, tournamentInstanceId: number): Promise<TTournamentDetailed> {
|
|
404
|
+
return tournamentInfoItemTransform((await this.tournamentsGetInfo(user_ext_id, tournamentInstanceId)));
|
|
405
|
+
}
|
|
406
|
+
|
|
395
407
|
public async leaderboardGet(user_ext_id: string, period_type_id?: LeaderBoardPeriodType, prevPeriod: boolean = false): Promise<LeaderBoardDetails> {
|
|
396
408
|
|
|
397
409
|
const message = this.buildMessage<GetLeaderBoardsRequest, GetLeaderBoardsResponse>(user_ext_id, ClassId.GET_LEADERS_BOARD_REQUEST,
|
|
@@ -425,12 +437,12 @@ class SmarticoAPI {
|
|
|
425
437
|
|
|
426
438
|
}
|
|
427
439
|
|
|
428
|
-
public async levelsGet(user_ext_id
|
|
440
|
+
public async levelsGet(user_ext_id: string): Promise<GetLevelMapResponse> {
|
|
429
441
|
const message = this.buildMessage<any, GetLevelMapResponse>(user_ext_id, ClassId.GET_LEVEL_MAP_REQUEST);
|
|
430
442
|
return await this.send<GetLevelMapResponse>(message, ClassId.GET_LEVEL_MAP_RESPONSE);
|
|
431
443
|
}
|
|
432
444
|
|
|
433
|
-
public async levelsGetT(user_ext_id
|
|
445
|
+
public async levelsGetT(user_ext_id: string): Promise<TLevel[]> {
|
|
434
446
|
return GetLevelMapResponseTransform(await this.levelsGet(user_ext_id));
|
|
435
447
|
}
|
|
436
448
|
|
package/src/Store/StoreItem.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TStoreItem } from "../WSAPI/WSAPITypes";
|
|
1
2
|
import { StoreItemPublicMeta } from "./StoreItemPublicMeta";
|
|
2
3
|
import { StoreItemType } from "./StoreItemType";
|
|
3
4
|
|
|
@@ -8,3 +9,31 @@ export interface StoreItem {
|
|
|
8
9
|
categoryIds?: number[];
|
|
9
10
|
canBuy?: boolean;
|
|
10
11
|
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export const StoreItemTransform = (items: StoreItem[]): TStoreItem[] => {
|
|
15
|
+
return items.filter( r => r.id >= 1).map( r => {
|
|
16
|
+
const x: TStoreItem =
|
|
17
|
+
{
|
|
18
|
+
id: r.id,
|
|
19
|
+
name: r.itemPublicMeta.name,
|
|
20
|
+
price: r.itemPublicMeta.price as any as number, // AA: strange why it's string
|
|
21
|
+
image: r.itemPublicMeta.image_url,
|
|
22
|
+
description: r.itemPublicMeta.description,
|
|
23
|
+
ribbon: r.itemPublicMeta.custom_label_tag || r.itemPublicMeta.label_tag,
|
|
24
|
+
limit_message: r.itemPublicMeta.limit_message,
|
|
25
|
+
priority: r.itemPublicMeta.priority,
|
|
26
|
+
related_item_ids: r.itemPublicMeta.related_items,
|
|
27
|
+
|
|
28
|
+
type: {
|
|
29
|
+
[StoreItemType.Bonus]: 'bonus',
|
|
30
|
+
[StoreItemType.Manual]: 'manual'
|
|
31
|
+
}[r.itemTypeId] as 'bonus' | 'manual',
|
|
32
|
+
|
|
33
|
+
can_buy: r.canBuy,
|
|
34
|
+
category_ids: r.categoryIds ?? []
|
|
35
|
+
}
|
|
36
|
+
return x;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {Tournament} from "./Tournament";
|
|
1
|
+
import {Tournament, TournamentItemsTransform} from "./Tournament";
|
|
2
2
|
import {TournamentPlayer} from "./TournamentPlayer";
|
|
3
3
|
import { ProtocolResponse } from "../Base/ProtocolResponse";
|
|
4
4
|
import { TournamentPrize } from "./TournamentPrize";
|
|
5
|
+
import { TTournamentDetailed } from "../WSAPI/WSAPITypes";
|
|
5
6
|
|
|
6
7
|
export interface GetTournamentInfoResponse extends ProtocolResponse {
|
|
7
8
|
|
|
@@ -22,4 +23,28 @@ export interface GetTournamentInfoResponse extends ProtocolResponse {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
|
|
26
|
+
export const tournamentInfoItemTransform = (t: GetTournamentInfoResponse): TTournamentDetailed => {
|
|
27
|
+
const response: TTournamentDetailed = {
|
|
28
|
+
...TournamentItemsTransform([t.tournamentInfo.tournamentLobbyInfo])[0],
|
|
29
|
+
players: t.tournamentInfo.players.map( p => ({
|
|
30
|
+
public_username: p.userAltName,
|
|
31
|
+
avatar_url: p.avatar_url,
|
|
32
|
+
position: p.position,
|
|
33
|
+
scores: p.scores,
|
|
34
|
+
is_me: p.isMe,
|
|
35
|
+
})),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
if (t.userPosition) {
|
|
39
|
+
response.me = {
|
|
40
|
+
public_username: t.userPosition.userAltName,
|
|
41
|
+
avatar_url: t.userPosition.avatar_url,
|
|
42
|
+
position: t.userPosition.position,
|
|
43
|
+
scores: t.userPosition.scores,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
|
|
25
50
|
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { ProtocolResponse } from "../Base/ProtocolResponse";
|
|
2
2
|
import {Tournament} from "./Tournament";
|
|
3
|
+
import { TournamentRegistrationStatus } from "./TournamentRegistrationStatus";
|
|
4
|
+
import { TournamentRegistrationType } from "./TournamentRegistrationType";
|
|
5
|
+
import { TournamentUtils } from "./TournamentUtils";
|
|
3
6
|
|
|
4
7
|
export interface GetTournamentsResponse extends ProtocolResponse {
|
|
5
8
|
|
|
6
9
|
/** array of the tournaments */
|
|
7
10
|
tournaments?: Tournament[];
|
|
8
11
|
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {TournamentRegistrationType} from "./TournamentRegistrationType";
|
|
1
|
+
import {TournamentRegistrationType, TournamentRegistrationTypeGetName} from "./TournamentRegistrationType";
|
|
2
2
|
import {TournamentInstanceStatus} from "./TournamentInstanceStatus";
|
|
3
|
-
import { TournamentRegistrationStatus } from "./TournamentRegistrationStatus";
|
|
3
|
+
import { TournamentRegistrationStatus, TournamentRegistrationStatusName } from "./TournamentRegistrationStatus";
|
|
4
4
|
import { TournamentType } from "./TournamentType";
|
|
5
5
|
import { TournamentPublicMeta } from "./TournamentPublicMeta";
|
|
6
|
+
import { TTournament } from "../WSAPI/WSAPITypes";
|
|
7
|
+
import { TournamentUtils } from ".";
|
|
8
|
+
import { IntUtils } from "../IntUtils";
|
|
6
9
|
|
|
7
10
|
export interface Tournament {
|
|
8
11
|
|
|
@@ -22,6 +25,10 @@ export interface Tournament {
|
|
|
22
25
|
startTime?: string;
|
|
23
26
|
/** The time when tournament is going to finish */
|
|
24
27
|
endTime?: string;
|
|
28
|
+
/** The time when tournament is going to start, epoch */
|
|
29
|
+
startTimeTs?: number;
|
|
30
|
+
/** The time when tournament is going to finish, epoch */
|
|
31
|
+
endTimeTs?: number;
|
|
25
32
|
/** Number of users registered in the tournament */
|
|
26
33
|
registrationCount?: number;
|
|
27
34
|
/** Not in use */
|
|
@@ -45,3 +52,49 @@ export interface Tournament {
|
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
|
|
55
|
+
export const TournamentItemsTransform = (items: Tournament[]): TTournament[] => {
|
|
56
|
+
|
|
57
|
+
return items.filter( r => r.tournamentId >= 1).map( r => {
|
|
58
|
+
|
|
59
|
+
const x: TTournament = {
|
|
60
|
+
instance_id: r.tournamentInstanceId,
|
|
61
|
+
tournament_id: r.tournamentId,
|
|
62
|
+
name: r.publicMeta.name,
|
|
63
|
+
description: r.publicMeta.description,
|
|
64
|
+
segment_dont_match_message: r.publicMeta.segment_dont_match_message,
|
|
65
|
+
image1: r.publicMeta.image_url,
|
|
66
|
+
image2: r.publicMeta.image_url2,
|
|
67
|
+
prize_pool_short: r.publicMeta.prize_pool_short,
|
|
68
|
+
custom_price_text: r.publicMeta.custom_price_text,
|
|
69
|
+
custom_section_id: r.publicMeta.custom_section_id,
|
|
70
|
+
custom_data: IntUtils.JsonOrText(r.publicMeta.custom_data),
|
|
71
|
+
is_featured: r.publicMeta.featured,
|
|
72
|
+
ribbon: r.publicMeta.label_tag,
|
|
73
|
+
|
|
74
|
+
start_time: r.startTimeTs,
|
|
75
|
+
end_time: r.endTimeTs,
|
|
76
|
+
registration_count: r.registrationCount,
|
|
77
|
+
is_user_registered: r.isUserRegistered,
|
|
78
|
+
players_min_count: r.playersMinCount,
|
|
79
|
+
players_max_count: r.playersMaxCount,
|
|
80
|
+
registration_status: TournamentRegistrationStatusName(r.tournamentRegistrationStatus),
|
|
81
|
+
|
|
82
|
+
registration_type: TournamentRegistrationTypeGetName(r.registrationType),
|
|
83
|
+
registration_cost_points: r.buyInAmount,
|
|
84
|
+
duration_ms: r.durationMs,
|
|
85
|
+
|
|
86
|
+
is_active: TournamentUtils.isActive(r),
|
|
87
|
+
is_can_register: TournamentUtils.isCanRegister(r),
|
|
88
|
+
is_cancelled: TournamentUtils.isCancelled(r),
|
|
89
|
+
is_finished: TournamentUtils.isFinished(r),
|
|
90
|
+
is_in_progress: TournamentUtils.isInProgress(r),
|
|
91
|
+
is_upcoming: TournamentUtils.isUpcoming(r),
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return x;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @hidden */
|
|
1
2
|
export enum TournamentRegistrationStatus {
|
|
2
3
|
|
|
3
4
|
NOT_REGISTERED = 0,
|
|
@@ -9,3 +10,18 @@ export enum TournamentRegistrationStatus {
|
|
|
9
10
|
QUALIFIED_PENDING_REGISTRATION = 6
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
export type TournamentRegistrationStatusName = 'NOT_REGISTERED' | 'REGISTERED' | 'FINISHED' | 'PENDING' | 'CANCELLED' | 'REGISTERED_PENDING_QUALIFICATION' | 'QUALIFIED_PENDING_REGISTRATION';
|
|
14
|
+
|
|
15
|
+
/** @hidden */
|
|
16
|
+
export const TournamentRegistrationStatusName = (type: TournamentRegistrationStatus): TournamentRegistrationStatusName => {
|
|
17
|
+
return ({
|
|
18
|
+
[TournamentRegistrationStatus.CANCELLED]: 'CANCELLED',
|
|
19
|
+
[TournamentRegistrationStatus.FINISHED]: 'FINISHED',
|
|
20
|
+
[TournamentRegistrationStatus.NOT_REGISTERED]: 'NOT_REGISTERED',
|
|
21
|
+
[TournamentRegistrationStatus.PENDING]: 'PENDING',
|
|
22
|
+
[TournamentRegistrationStatus.QUALIFIED_PENDING_REGISTRATION]: 'QUALIFIED_PENDING_REGISTRATION',
|
|
23
|
+
[TournamentRegistrationStatus.REGISTERED]: 'REGISTERED',
|
|
24
|
+
[TournamentRegistrationStatus.REGISTERED_PENDING_QUALIFICATION]: 'REGISTERED_PENDING_QUALIFICATION',
|
|
25
|
+
}[type] || 'UNKNOWN') as TournamentRegistrationStatusName;
|
|
26
|
+
}
|
|
27
|
+
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @hidden */
|
|
1
2
|
export enum TournamentRegistrationType {
|
|
2
3
|
|
|
3
4
|
AUTO = 1,
|
|
@@ -7,3 +8,16 @@ export enum TournamentRegistrationType {
|
|
|
7
8
|
REQUIRES_QUALIFICATION = 5
|
|
8
9
|
// BUY_IN_CASH = 5???,
|
|
9
10
|
}
|
|
11
|
+
|
|
12
|
+
export type TournamentRegistrationTypeName = 'AUTO' | 'OPT_IN' | 'BUY_IN_POINTS' | 'MANUAL_APPROVAL' | 'REQUIRES_QUALIFICATION' | 'UNKNOWN';
|
|
13
|
+
|
|
14
|
+
/** @hidden */
|
|
15
|
+
export const TournamentRegistrationTypeGetName = (type: TournamentRegistrationType): TournamentRegistrationTypeName => {
|
|
16
|
+
return ({
|
|
17
|
+
[TournamentRegistrationType.AUTO]: 'AUTO',
|
|
18
|
+
[TournamentRegistrationType.BUY_IN_POINTS]: 'BUY_IN_POINTS',
|
|
19
|
+
[TournamentRegistrationType.MANUAL_APPROVAL]: 'MANUAL_APPROVAL',
|
|
20
|
+
[TournamentRegistrationType.OPT_IN]: 'OPT_IN',
|
|
21
|
+
[TournamentRegistrationType.REQUIRES_QUALIFICATION]: 'REQUIRES_QUALIFICATION',
|
|
22
|
+
}[type] || 'UNKNOWN') as any as TournamentRegistrationTypeName;
|
|
23
|
+
}
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CoreUtils } from "../Core";
|
|
2
2
|
import { SmarticoAPI } from "../SmarticoAPI";
|
|
3
3
|
|
|
4
|
-
import { TLevel, TMissionOrBadge, TUserProfile } from "./WSAPITypes";
|
|
4
|
+
import { TLevel, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
|
|
5
5
|
|
|
6
6
|
/** @group General API */
|
|
7
7
|
export class WSAPI {
|
|
@@ -33,8 +33,22 @@ export class WSAPI {
|
|
|
33
33
|
|
|
34
34
|
/** Returns all the badges available the current user */
|
|
35
35
|
public async getBadges(): Promise<TMissionOrBadge[]> {
|
|
36
|
-
return this.api.
|
|
37
|
-
}
|
|
36
|
+
return this.api.badgetsGetItemsT(null);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Returns all the store items available the current user */
|
|
40
|
+
public async getStoreItems(): Promise<TStoreItem[]> {
|
|
41
|
+
return this.api.storeGetItemsT(null);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Returns all the active instances of tournaments */
|
|
45
|
+
public async getTournamentsList(): Promise<TTournament[]> {
|
|
46
|
+
return this.api.tournamentsGetLobbyT(null);
|
|
47
|
+
}
|
|
38
48
|
|
|
49
|
+
/** Returns details information of specific tournament instance, the response will includ tournamnet info and the leaderboard of players */
|
|
50
|
+
public async getTournamentInstanceInfo(tournamentInstanceId: number): Promise<TTournamentDetailed> {
|
|
51
|
+
return this.api.tournamentsGetInfoT(null, tournamentInstanceId);
|
|
52
|
+
}
|
|
39
53
|
|
|
40
54
|
}
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationType, TournamentRegistrationTypeName } from "../Tournaments";
|
|
2
|
+
|
|
3
|
+
type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string
|
|
1
4
|
|
|
2
5
|
/**
|
|
3
6
|
* TUser interface describes the information of the user
|
|
@@ -68,6 +71,150 @@ export interface TLevel {
|
|
|
68
71
|
required_level_counter_2: number,
|
|
69
72
|
}
|
|
70
73
|
|
|
74
|
+
/**
|
|
75
|
+
* TTournament interface describes the general information of the tournament item
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
export interface TTournament {
|
|
79
|
+
/** ID of tournament instance. Generated every time when tournament based on specific template is scheduled for run */
|
|
80
|
+
instance_id: number;
|
|
81
|
+
/** ID of tournament template */
|
|
82
|
+
tournament_id: number;
|
|
83
|
+
/** Name of the tournament, translated to the user language */
|
|
84
|
+
name: string;
|
|
85
|
+
/** Description of the tournament, translated to the user language */
|
|
86
|
+
description: string;
|
|
87
|
+
/* 1st image URL representing the tournament */
|
|
88
|
+
image1: string;
|
|
89
|
+
/* 2nd image URL representing the tournament */
|
|
90
|
+
image2: string;
|
|
91
|
+
/* The message indicating the prize pool of the tournament */
|
|
92
|
+
prize_pool_short: string;
|
|
93
|
+
/* The message indicating the price to register in the tournament */
|
|
94
|
+
custom_price_text: string;
|
|
95
|
+
|
|
96
|
+
/** The message that should be shown to the user when the user cannot register in tournament with error code TOURNAMENT_USER_DONT_MATCH_CONDITIONS */
|
|
97
|
+
segment_dont_match_message: string;
|
|
98
|
+
/**
|
|
99
|
+
* The ID of the custom section where the tournament is assigned
|
|
100
|
+
* The list of custom sections can be retrieved using _smartico.api.getCustomSections() method (TODO-API)
|
|
101
|
+
*/
|
|
102
|
+
custom_section_id: number;
|
|
103
|
+
/** The custom data of the tournament defined by operator. Can be a JSON object, string or number */
|
|
104
|
+
custom_data: any;
|
|
105
|
+
|
|
106
|
+
/** The indicator if the tournament is 'Featured' */
|
|
107
|
+
is_featured: boolean;
|
|
108
|
+
|
|
109
|
+
/** The ribbon of the tournament item. Can be 'sale', 'hot', 'new', 'vip' or URL to the image in case of custom ribbon */
|
|
110
|
+
ribbon: TRibbon;
|
|
111
|
+
|
|
112
|
+
/** The time when tournament is going to start, epoch with milliseconds */
|
|
113
|
+
start_time: number;
|
|
114
|
+
/** The time when tournament is going to finish, epoch with milliseconds */
|
|
115
|
+
end_time: number;
|
|
116
|
+
/** Type of registration in the tournament */
|
|
117
|
+
registration_type: TournamentRegistrationTypeName,
|
|
118
|
+
/** Number of users registered in the tournament */
|
|
119
|
+
registration_count: number;
|
|
120
|
+
/** flag indicating if current user is registered in the tournament */
|
|
121
|
+
is_user_registered: boolean;
|
|
122
|
+
/** Minimum number of participant for this tournament. If tournament doesnt have enough registrations, it will not start */
|
|
123
|
+
players_min_count: number;
|
|
124
|
+
/** Maximum number of participant for this tournament. When reached, new users won't be able to register */
|
|
125
|
+
players_max_count: number;
|
|
126
|
+
/** Status of registration in the tournament for current user */
|
|
127
|
+
registration_status: TournamentRegistrationStatusName,
|
|
128
|
+
/** Tournament duration in millisecnnds */
|
|
129
|
+
duration_ms: number;
|
|
130
|
+
|
|
131
|
+
/** Cost of registration in the tournament in gamification points */
|
|
132
|
+
registration_cost_points: number;
|
|
133
|
+
|
|
134
|
+
/** Indicator if tournament instance is active, means in one of the statues - PUBLISHED, REGISTED, STARTED */
|
|
135
|
+
is_active: boolean;
|
|
136
|
+
|
|
137
|
+
/** Indicator if user can register in this tournament instance, e.g tournament is active, max users is not reached, user is not registered yet */
|
|
138
|
+
is_can_register: boolean;
|
|
139
|
+
/** Indicator if tournament instance is cancelled (status CANCELLED) */
|
|
140
|
+
is_cancelled: boolean;
|
|
141
|
+
/** Indicator if tournament instance is finished (status FINISHED, CANCELLED OR FINIALIZING) */
|
|
142
|
+
is_finished: boolean;
|
|
143
|
+
/** Indicator if tournament instance is running (status STARTED) */
|
|
144
|
+
is_in_progress: boolean;
|
|
145
|
+
/** Indicator if tournament instance is upcoming (status PUBLISHED or REGISTER) */
|
|
146
|
+
is_upcoming: boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* TTournamentDetailed interface describes the information of the tournament item and includes list of participants, their scores and position in the tournament leaderboard
|
|
151
|
+
*/
|
|
152
|
+
export interface TTournamentDetailed extends TTournament {
|
|
153
|
+
|
|
154
|
+
/** The list of the tournament participants */
|
|
155
|
+
players?: {
|
|
156
|
+
/** The username of the participant */
|
|
157
|
+
public_username: string;
|
|
158
|
+
/** The URL to the avatar of the participant */
|
|
159
|
+
avatar_url: string;
|
|
160
|
+
/** The position of the participant in the tournament */
|
|
161
|
+
position: number;
|
|
162
|
+
/** The scores of the participant in the tournament */
|
|
163
|
+
scores: number;
|
|
164
|
+
/** The indicator if the participant is current user */
|
|
165
|
+
is_me: boolean;
|
|
166
|
+
}[],
|
|
167
|
+
/** The information about current user in the tournament if he is registered in the tournamnet */
|
|
168
|
+
me?: {
|
|
169
|
+
/** The username of the current user */
|
|
170
|
+
public_username: string;
|
|
171
|
+
/** The URL to the avatar of the current user */
|
|
172
|
+
avatar_url: string;
|
|
173
|
+
/** The position of the current user in the tournament */
|
|
174
|
+
position: number;
|
|
175
|
+
/** The scores of the current user in the tournament */
|
|
176
|
+
scores: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* TStoreItem interface describes the information of the store item defined in the system
|
|
184
|
+
*/
|
|
185
|
+
export interface TStoreItem {
|
|
186
|
+
/** ID of the store item */
|
|
187
|
+
id: number;
|
|
188
|
+
/** Name of the store item, translated to the user language */
|
|
189
|
+
name: string;
|
|
190
|
+
/** Description of the store item, translated to the user language */
|
|
191
|
+
description: string;
|
|
192
|
+
/** URL of the image of the store item */
|
|
193
|
+
image: string;
|
|
194
|
+
/** Type of the store item. Can be 'bonus' or 'manual'. Manual, means it's tangible item, e.g. iPhone */
|
|
195
|
+
type: 'bonus' | 'manual';
|
|
196
|
+
/** The price of the store item in the gamification points */
|
|
197
|
+
price: number;
|
|
198
|
+
/** The ribbon of the store item. Can be 'sale', 'hot', 'new', 'vip' or URL to the image in case of custom ribbon */
|
|
199
|
+
ribbon: TRibbon;
|
|
200
|
+
/**
|
|
201
|
+
* The message that should be shown to the user if he is not eligible to buy it. this message can be used to explain the reason why user cannot buy the item, e.g. 'You should be VIP to buy this item' and can be used in case can_buy property is false.
|
|
202
|
+
The message is translated to the user language.
|
|
203
|
+
**Note**: when user is trying to buy the item, the response from server can return custom error messages that can be shown to the user as well
|
|
204
|
+
*/
|
|
205
|
+
limit_message: string;
|
|
206
|
+
/** The priority of the store item. Can be used to sort the items in the store */
|
|
207
|
+
priority: number;
|
|
208
|
+
/** The list of IDs of the related items. Can be used to show the related items in the store */
|
|
209
|
+
related_item_ids: number[];
|
|
210
|
+
/** The indicator if the user can buy the item
|
|
211
|
+
* This indicator is taking into account the segment conditions for the store item, the price of item towards users balance,
|
|
212
|
+
*/
|
|
213
|
+
can_buy: boolean;
|
|
214
|
+
/** The list of IDs of the categories where the store item is assigned, information about categories can be retrievend with getStoreCategories method */
|
|
215
|
+
category_ids: number[];
|
|
216
|
+
}
|
|
217
|
+
|
|
71
218
|
/**
|
|
72
219
|
* TMissionOrBadge interface describes the information of mission or badge defined in the system
|
|
73
220
|
*/
|
package/tsconfig.json
CHANGED
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
],
|
|
16
16
|
"typedocOptions": {
|
|
17
17
|
"name": "Smartico API documentation",
|
|
18
|
-
"entryPoints": [
|
|
18
|
+
"entryPoints": [
|
|
19
|
+
"src/WSAPI/WSAPI.ts", "src/WSAPI/WSAPITypes.ts",
|
|
20
|
+
"src/Tournaments/TournamentRegistrationStatus.ts",
|
|
21
|
+
"src/Tournaments/TournamentRegistrationType.ts"
|
|
22
|
+
],
|
|
19
23
|
"out": "docs",
|
|
20
24
|
"plugin": ["typedoc-plugin-markdown", "typedoc-plugin-merge-modules"],
|
|
21
25
|
"entryDocument": "README.md",
|