@smartico/public-api 0.0.8 → 0.0.10
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/Core/ActivityTypeLimited.d.ts +7 -0
- package/dist/Core/index.d.ts +2 -1
- package/dist/SmarticoAPI.d.ts +11 -4
- package/dist/Store/BuyStoreItemErrorCode.d.ts +10 -0
- package/dist/Store/BuyStoreItemRequest.d.ts +4 -0
- package/dist/Store/BuyStoreItemResponse.d.ts +4 -0
- package/dist/Store/GetCategoriesStoreResponse.d.ts +5 -0
- package/dist/Store/GetStoreItemsResponse.d.ts +5 -0
- package/dist/Store/StoreCategory.d.ts +5 -0
- package/dist/Store/StoreCategoryPublicMeta.d.ts +4 -0
- package/dist/Store/StoreItem.d.ts +9 -0
- package/dist/Store/StoreItemPublicMeta.d.ts +10 -0
- package/dist/Store/StoreItemType.d.ts +4 -0
- package/dist/Store/index.d.ts +11 -11
- package/dist/Tournaments/GetTournamentInfoRequest.d.ts +4 -0
- package/dist/Tournaments/GetTournamentInfoResponse.d.ts +20 -0
- package/dist/Tournaments/GetTournamentsRequest.d.ts +3 -0
- package/dist/Tournaments/GetTournamentsResponse.d.ts +6 -0
- package/dist/Tournaments/Tournament.d.ts +43 -0
- package/dist/Tournaments/TournamentInstanceStatus.d.ts +10 -0
- package/dist/Tournaments/TournamentPlayer.d.ts +9 -0
- package/dist/Tournaments/TournamentPrize.d.ts +10 -0
- package/dist/Tournaments/TournamentPublicMeta.d.ts +22 -0
- package/dist/Tournaments/TournamentRegisterRequest.d.ts +4 -0
- package/dist/Tournaments/TournamentRegisterResponse.d.ts +5 -0
- package/dist/Tournaments/TournamentRegistrationError.d.ts +11 -0
- package/dist/Tournaments/TournamentRegistrationStatus.d.ts +9 -0
- package/dist/Tournaments/TournamentRegistrationType.d.ts +7 -0
- package/dist/Tournaments/TournamentType.d.ts +5 -0
- package/dist/Tournaments/index.d.ts +16 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +121 -66
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +102 -43
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +2 -2
- package/src/Core/ActivityTypeLimited.ts +8 -0
- package/src/Core/index.ts +3 -1
- package/src/SmarticoAPI.ts +47 -37
- package/src/Store/{BuyShopItemErrorCode.ts → BuyStoreItemErrorCode.ts} +1 -1
- package/src/Store/{BuyShopItemRequest.ts → BuyStoreItemRequest.ts} +1 -1
- package/src/Store/{BuyShopItemResponse.ts → BuyStoreItemResponse.ts} +1 -1
- package/src/Store/GetCategoriesStoreResponse.ts +11 -0
- package/src/Store/GetStoreItemsResponse.ts +7 -0
- package/src/Store/StoreCategory.ts +7 -0
- package/src/Store/StoreCategoryPublicMeta.ts +5 -0
- package/src/Store/StoreItem.ts +10 -0
- package/src/Store/{ShopItemPublicMeta.ts → StoreItemPublicMeta.ts} +1 -1
- package/src/Store/{ShopItemType.ts → StoreItemType.ts} +1 -1
- package/src/Store/index.ts +20 -20
- package/src/Tournaments/GetTournamentInfoRequest.ts +6 -0
- package/src/Tournaments/GetTournamentInfoResponse.ts +25 -0
- package/src/Tournaments/GetTournamentsRequest.ts +5 -0
- package/src/Tournaments/GetTournamentsResponse.ts +8 -0
- package/src/Tournaments/Tournament.ts +47 -0
- package/src/Tournaments/TournamentInstanceStatus.ts +22 -0
- package/src/Tournaments/TournamentPlayer.ts +11 -0
- package/src/Tournaments/TournamentPrize.ts +12 -0
- package/src/Tournaments/TournamentPublicMeta.ts +26 -0
- package/src/Tournaments/TournamentRegisterRequest.ts +6 -0
- package/src/Tournaments/TournamentRegisterResponse.ts +10 -0
- package/src/Tournaments/TournamentRegistrationError.ts +11 -0
- package/src/Tournaments/TournamentRegistrationStatus.ts +11 -0
- package/src/Tournaments/TournamentRegistrationType.ts +9 -0
- package/src/Tournaments/TournamentType.ts +6 -0
- package/src/Tournaments/index.ts +33 -0
- package/src/index.ts +3 -1
- package/src/Store/GetCategoriesShopResponse.ts +0 -11
- package/src/Store/GetShopItemsResponse.ts +0 -7
- package/src/Store/ShopCategory.ts +0 -7
- package/src/Store/ShopCategoryPublicMeta.ts +0 -5
- package/src/Store/ShopItem.ts +0 -10
package/src/SmarticoAPI.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import * as superagent from 'superagent';
|
|
2
1
|
import { ClassId } from "./Base/ClassId";
|
|
3
2
|
import { ProtocolRequest } from './Base/ProtocolRequest';
|
|
4
3
|
import { ProtocolResponse } from './Base/ProtocolResponse';
|
|
5
4
|
import { SAWGetTemplatesResponse } from './MiniGames/SAWGetTemplatesResponse';
|
|
6
5
|
import { SAWGetTemplatesRequest } from './MiniGames/SAWGetTemplatesRequest';
|
|
7
|
-
import { SAWTemplate } from './MiniGames/SAWTemplate';
|
|
8
6
|
import { IntUtils } from './IntUtils';
|
|
9
7
|
import { ILogger } from './ILogger';
|
|
10
|
-
import {
|
|
8
|
+
import { SAWDoSpinRequest, SAWDoSpinResponse, SAWSpinErrorCode } from './MiniGames';
|
|
11
9
|
import { ECacheContext, OCache } from './OCache';
|
|
12
10
|
import { GetTranslationsRequest, GetTranslationsResponse, ResponseIdentify, TranslationArea } from './Core';
|
|
13
11
|
import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
|
|
14
12
|
import { GetLabelInfoRequest } from './Core/GetLabelInfoRequest';
|
|
15
13
|
import { GetInboxMessagesRequest, GetInboxMessagesResponse } from './Inbox';
|
|
14
|
+
import { GetStoreItemsResponse } from './Store';
|
|
15
|
+
import { GetAchievementMapRequest, GetAchievementMapResponse } from './Missions';
|
|
16
|
+
import { GetTournamentInfoRequest, GetTournamentInfoResponse, GetTournamentsRequest, GetTournamentsResponse } from './Tournaments';
|
|
17
|
+
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
18
21
|
const AVATAR_DOMAIN = 'https://img{ENV_ID}.smr.vc';
|
|
@@ -23,18 +26,19 @@ interface IOptions {
|
|
|
23
26
|
logHTTPTiming?: boolean;
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
type MessageSender = (message: any, publicApuUrl: string) => Promise<any>;
|
|
30
|
+
|
|
26
31
|
|
|
27
32
|
class SmarticoAPI {
|
|
28
33
|
|
|
29
34
|
private publicUrl: string;
|
|
30
35
|
private avatarDomain: string;
|
|
31
36
|
|
|
32
|
-
|
|
33
37
|
private logger: ILogger;
|
|
34
38
|
private logCIDs: ClassId[];
|
|
35
39
|
private logHTTPTiming: boolean;
|
|
36
40
|
|
|
37
|
-
public constructor(private label_api_key: string, private brand_api_key: string, options: IOptions = {}) {
|
|
41
|
+
public constructor(private label_api_key: string, private brand_api_key: string, private messageSender: MessageSender, options: IOptions = {}) {
|
|
38
42
|
|
|
39
43
|
this.logger = options.logger || (console as any);
|
|
40
44
|
|
|
@@ -68,15 +72,13 @@ class SmarticoAPI {
|
|
|
68
72
|
|
|
69
73
|
try {
|
|
70
74
|
const timeStart = new Date().getTime();
|
|
71
|
-
|
|
72
|
-
// const res = await superagent.post('http://channel01.int.smartico.ai:81/services/public').send(message);
|
|
75
|
+
result = await this.messageSender(message, this.publicUrl);
|
|
73
76
|
const timeEnd = new Date().getTime();
|
|
74
77
|
|
|
75
78
|
if (this.logHTTPTiming) {
|
|
76
79
|
this.logger.always('HTTP time, ms:' + (timeEnd - timeStart))
|
|
77
80
|
}
|
|
78
|
-
|
|
79
|
-
result = JSON.parse(res.text);
|
|
81
|
+
|
|
80
82
|
} catch (e) {
|
|
81
83
|
this.logger.error(`Failed to make request to smartico channel. ${e.message}`, { url: this.publicUrl, request: message, error: e.message });
|
|
82
84
|
throw(new Error(`Failed to make request to smartico channel. ${e.message}`));
|
|
@@ -177,7 +179,7 @@ class SmarticoAPI {
|
|
|
177
179
|
}, cacheSec );
|
|
178
180
|
|
|
179
181
|
return response;
|
|
180
|
-
}
|
|
182
|
+
}
|
|
181
183
|
|
|
182
184
|
public async coreIdentifyLabel(user_ext_id: string, cacheSec: number = 60): Promise<GetLabelInfoResponse> {
|
|
183
185
|
|
|
@@ -200,7 +202,7 @@ class SmarticoAPI {
|
|
|
200
202
|
const r = await this.send<ResponseIdentify>(message, ClassId.IDENTIFY_RESPONSE);
|
|
201
203
|
|
|
202
204
|
if (!(r.avatar_id && r.avatar_id.startsWith('http'))) {
|
|
203
|
-
r.avatar_id =
|
|
205
|
+
r.avatar_id = this.avatarDomain + '/avatar/' + r.avatar_id
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
return r;
|
|
@@ -241,28 +243,6 @@ class SmarticoAPI {
|
|
|
241
243
|
|
|
242
244
|
}
|
|
243
245
|
|
|
244
|
-
public async sawFormatTemplatesForWidget(templates: SAWTemplate[], pointsBalance: number): Promise<any[]> {
|
|
245
|
-
|
|
246
|
-
return templates.filter( r => r.saw_template_id >= 1).map( r => (
|
|
247
|
-
{
|
|
248
|
-
id: r.saw_template_id,
|
|
249
|
-
name: r.saw_template_ui_definition.name,
|
|
250
|
-
// description: r.saw_template_ui_definition.description,
|
|
251
|
-
game_type: SAWGameTypeName[r.saw_game_type_id] || 'unknown',
|
|
252
|
-
buyin_type: SAWBuyInTypeName[r.saw_buyin_type_id] || 'unknown',
|
|
253
|
-
jackpot: r.jackpot_current,
|
|
254
|
-
spin_count: r.spin_count,
|
|
255
|
-
buyin_cost_points: r.buyin_cost_points,
|
|
256
|
-
can_play: SAWUtils.canPlay(r, pointsBalance),
|
|
257
|
-
icon:
|
|
258
|
-
r.saw_skin_ui_definition?.skin_folder
|
|
259
|
-
? r.saw_skin_ui_definition?.skin_folder + '/ico.png'
|
|
260
|
-
: `https://libs.smartico.ai/gf/images/saw/${r.saw_skin_key}/ico.png`
|
|
261
|
-
}
|
|
262
|
-
));
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
|
|
266
246
|
public async sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id: number): Promise<SAWDoSpinResponse> {
|
|
267
247
|
|
|
268
248
|
const message = this.buildMessage<SAWDoSpinRequest, SAWDoSpinResponse>(user_ext_id, ClassId.SAW_DO_SPIN_REQUEST, {
|
|
@@ -299,12 +279,42 @@ class SmarticoAPI {
|
|
|
299
279
|
offset
|
|
300
280
|
});
|
|
301
281
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
return response;
|
|
282
|
+
return await this.send<GetInboxMessagesResponse>(message);
|
|
305
283
|
|
|
306
284
|
}
|
|
307
285
|
|
|
286
|
+
public async storeGetItems(user_ext_id: string): Promise<GetStoreItemsResponse> {
|
|
287
|
+
|
|
288
|
+
const message = this.buildMessage<any, GetStoreItemsResponse>(user_ext_id, ClassId.GET_SHOP_ITEMS_REQUEST);
|
|
289
|
+
return await this.send<GetStoreItemsResponse>(message);
|
|
290
|
+
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
public async missionsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse> {
|
|
294
|
+
|
|
295
|
+
const message = this.buildMessage<GetAchievementMapRequest, GetAchievementMapResponse>(user_ext_id, ClassId.GET_ACHIEVEMENT_MAP_REQUEST);
|
|
296
|
+
return await this.send<GetAchievementMapResponse>(message);
|
|
297
|
+
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
public async tournamentsGetLobby(user_ext_id: string): Promise<GetTournamentsResponse> {
|
|
301
|
+
|
|
302
|
+
const message = this.buildMessage<GetTournamentsRequest, GetTournamentsResponse>(user_ext_id, ClassId.GET_TOURNAMENT_LOBBY_REQUEST);
|
|
303
|
+
return await this.send<GetTournamentsResponse>(message);
|
|
304
|
+
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
public async tournamentsGetInfo(user_ext_id: string, tournamentInstanceId: number): Promise<GetTournamentInfoResponse> {
|
|
308
|
+
|
|
309
|
+
const message = this.buildMessage<GetTournamentInfoRequest, GetTournamentInfoResponse>(user_ext_id, ClassId.GET_TOURNAMENT_INFO_REQUEST,
|
|
310
|
+
{
|
|
311
|
+
tournamentInstanceId
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
return await this.send<GetTournamentInfoResponse>(message);
|
|
315
|
+
|
|
316
|
+
}
|
|
317
|
+
|
|
308
318
|
}
|
|
309
319
|
|
|
310
|
-
export { SmarticoAPI }
|
|
320
|
+
export { SmarticoAPI, MessageSender }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StoreItemPublicMeta } from "./StoreItemPublicMeta";
|
|
2
|
+
import { StoreItemType } from "./StoreItemType";
|
|
3
|
+
|
|
4
|
+
export interface StoreItem {
|
|
5
|
+
id: number;
|
|
6
|
+
itemTypeId: StoreItemType;
|
|
7
|
+
itemPublicMeta: StoreItemPublicMeta;
|
|
8
|
+
categoryIds?: number[];
|
|
9
|
+
canBuy?: boolean;
|
|
10
|
+
}
|
package/src/Store/index.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { BuyStoreItemErrorCode } from "./BuyStoreItemErrorCode";
|
|
2
|
+
import { BuyStoreItemRequest } from "./BuyStoreItemRequest";
|
|
3
|
+
import { BuyStoreItemResponse } from "./BuyStoreItemResponse";
|
|
4
|
+
import { GetCategoriesStoreResponse } from "./GetCategoriesStoreResponse";
|
|
5
|
+
import { GetStoreItemsResponse } from "./GetStoreItemsResponse";
|
|
6
|
+
import { StoreCategory } from "./StoreCategory";
|
|
7
|
+
import { StoreCategoryPublicMeta } from "./StoreCategoryPublicMeta";
|
|
8
|
+
import { StoreItem } from "./StoreItem";
|
|
9
|
+
import { StoreItemPublicMeta } from "./StoreItemPublicMeta";
|
|
10
|
+
import { StoreItemType } from "./StoreItemType";
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
BuyStoreItemErrorCode,
|
|
15
|
+
BuyStoreItemRequest,
|
|
16
|
+
BuyStoreItemResponse,
|
|
17
|
+
GetCategoriesStoreResponse,
|
|
18
|
+
GetStoreItemsResponse,
|
|
19
|
+
StoreCategory,
|
|
20
|
+
StoreCategoryPublicMeta,
|
|
21
|
+
StoreItem,
|
|
22
|
+
StoreItemPublicMeta,
|
|
23
|
+
StoreItemType,
|
|
24
24
|
|
|
25
25
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {Tournament} from "./Tournament";
|
|
2
|
+
import {TournamentPlayer} from "./TournamentPlayer";
|
|
3
|
+
import { ProtocolResponse } from "../Base/ProtocolResponse";
|
|
4
|
+
import { TournamentPrize } from "./TournamentPrize";
|
|
5
|
+
|
|
6
|
+
export interface GetTournamentInfoResponse extends ProtocolResponse {
|
|
7
|
+
|
|
8
|
+
/** tournament info */
|
|
9
|
+
tournamentInfo: {
|
|
10
|
+
/** id of label, not in use */
|
|
11
|
+
labelId: number;
|
|
12
|
+
tournamentLobbyInfo: Tournament;
|
|
13
|
+
/** list of registered users */
|
|
14
|
+
players: TournamentPlayer[];
|
|
15
|
+
},
|
|
16
|
+
/** information about current user position */
|
|
17
|
+
userPosition: TournamentPlayer,
|
|
18
|
+
/** prizes structure */
|
|
19
|
+
prizeStructure?: {
|
|
20
|
+
prizes: TournamentPrize[],
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {TournamentRegistrationType} from "./TournamentRegistrationType";
|
|
2
|
+
import {TournamentInstanceStatus} from "./TournamentInstanceStatus";
|
|
3
|
+
import { TournamentRegistrationStatus } from "./TournamentRegistrationStatus";
|
|
4
|
+
import { TournamentType } from "./TournamentType";
|
|
5
|
+
import { TournamentPublicMeta } from "./TournamentPublicMeta";
|
|
6
|
+
|
|
7
|
+
export interface Tournament {
|
|
8
|
+
|
|
9
|
+
/** ID of tournament template */
|
|
10
|
+
tournamentId?: number;
|
|
11
|
+
/** ID of tournament instance. Generated every time when tournament based on specific template is scheduled for run */
|
|
12
|
+
tournamentInstanceId?: number;
|
|
13
|
+
/** Type of the tournament. For now only SCHEDULED is support */
|
|
14
|
+
tournamentType?: TournamentType;
|
|
15
|
+
/** Meta information about tournament that should be used to build UI */
|
|
16
|
+
publicMeta?: TournamentPublicMeta;
|
|
17
|
+
/** Cost of registration in the tournament in gamification points */
|
|
18
|
+
buyInAmount?: number;
|
|
19
|
+
/** Not in use */
|
|
20
|
+
prizePool?: number;
|
|
21
|
+
/** The time when tournament is going to start */
|
|
22
|
+
startTime?: string;
|
|
23
|
+
/** The time when tournament is going to finish */
|
|
24
|
+
endTime?: string;
|
|
25
|
+
/** Number of users registered in the tournament */
|
|
26
|
+
registrationCount?: number;
|
|
27
|
+
/** Not in use */
|
|
28
|
+
totalCount?: number;
|
|
29
|
+
/** Type of registration in the tournament */
|
|
30
|
+
registrationType?: TournamentRegistrationType;
|
|
31
|
+
/** Status of registration in the tournament for current user */
|
|
32
|
+
tournamentRegistrationStatus?: TournamentRegistrationStatus;
|
|
33
|
+
/** Status of tournament instance */
|
|
34
|
+
tournamentInstanceStatus?: TournamentInstanceStatus;
|
|
35
|
+
/** flag indicating if current user is registered in the tournament */
|
|
36
|
+
isUserRegistered?: boolean;
|
|
37
|
+
/** Indicator if tournament allows later registration, when tournament is already started */
|
|
38
|
+
allowLateRegistration?: boolean;
|
|
39
|
+
/** Minimum number of participant for this tournament. If tournament doesnt have enough registrations, it will not start */
|
|
40
|
+
playersMinCount?: number;
|
|
41
|
+
/** Maximum number of participant for this tournament. When reached, new users won't be able to register */
|
|
42
|
+
playersMaxCount?: number;
|
|
43
|
+
/** Tournament duration in millisecnnds */
|
|
44
|
+
durationMs?: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export enum TournamentInstanceStatus {
|
|
2
|
+
|
|
3
|
+
PUBLISHED = 1,
|
|
4
|
+
REGISTER = 2,
|
|
5
|
+
STARTED = 3,
|
|
6
|
+
FINISHED = 4,
|
|
7
|
+
CANCELLED = 5,
|
|
8
|
+
FAILED = 6,
|
|
9
|
+
FINALIZING = 7,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const TournamentInstanceStatusName = (s: TournamentInstanceStatus): string => {
|
|
13
|
+
return {
|
|
14
|
+
[TournamentInstanceStatus.PUBLISHED]: "PUBLISHED",
|
|
15
|
+
[TournamentInstanceStatus.REGISTER]: "REGISTER",
|
|
16
|
+
[TournamentInstanceStatus.STARTED]: "STARTED",
|
|
17
|
+
[TournamentInstanceStatus.FINISHED]: "FINISHED",
|
|
18
|
+
[TournamentInstanceStatus.CANCELLED]: "CANCELLED",
|
|
19
|
+
[TournamentInstanceStatus.FAILED]: "FAILED",
|
|
20
|
+
[TournamentInstanceStatus.FINALIZING]: "FINALIZING",
|
|
21
|
+
}[s];
|
|
22
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ActivityTypeLimited } from "../Core/ActivityTypeLimited";
|
|
2
|
+
|
|
3
|
+
export interface TournamentPrize {
|
|
4
|
+
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
image_url: string;
|
|
8
|
+
place_from: number;
|
|
9
|
+
place_to: number;
|
|
10
|
+
type: ActivityTypeLimited;
|
|
11
|
+
points: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface TournamentPublicMeta {
|
|
2
|
+
/** Name of tournament */
|
|
3
|
+
name?: string;
|
|
4
|
+
/** 1st image */
|
|
5
|
+
image_url?: string;
|
|
6
|
+
/** 2nd image */
|
|
7
|
+
image_url2?: string;
|
|
8
|
+
/** Description, html capable */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Short explanation of prize pool */
|
|
11
|
+
prize_pool_short?: string;
|
|
12
|
+
/** Message to show when user is not matching to the segment allowed to register (error code 30005 in registration response) */
|
|
13
|
+
segment_dont_match_message?: string;
|
|
14
|
+
/** Short explanation of registration price */
|
|
15
|
+
custom_price_text?: string;
|
|
16
|
+
/** Indicator if the scores of other users should be shown in the leaderboard of tournament */
|
|
17
|
+
show_other_users_score?: boolean;
|
|
18
|
+
|
|
19
|
+
custom_section_id?: number;
|
|
20
|
+
|
|
21
|
+
only_in_custom_section?: boolean;
|
|
22
|
+
|
|
23
|
+
label_tag?: string;
|
|
24
|
+
|
|
25
|
+
featured?: boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ProtocolResponse } from "../Base/ProtocolResponse";
|
|
2
|
+
import { TournamentRegistrationError } from "./TournamentRegistrationError";
|
|
3
|
+
|
|
4
|
+
export interface TournamentRegisterResponse extends ProtocolResponse {
|
|
5
|
+
|
|
6
|
+
errCode?: TournamentRegistrationError;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export enum TournamentRegistrationError {
|
|
2
|
+
NO_ERROR = 0,
|
|
3
|
+
TOURNAMENT_INSTANCE_NOT_FOUND = 30001,
|
|
4
|
+
TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS = 30002,
|
|
5
|
+
TOURNAMENT_INSTANCE_NOT_IN_STATE = 30003,
|
|
6
|
+
TOURNAMENT_ALREADY_REGISTERED = 30004,
|
|
7
|
+
TOURNAMENT_USER_DONT_MATCH_CONDITIONS = 30005,
|
|
8
|
+
TOURNAMENT_USER_NOT_REGISTERED = 30006,
|
|
9
|
+
TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS = 30007,
|
|
10
|
+
TOURNAMENT_MAX_REGISTRATIONS_REACHED = 30008,
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { GetTournamentInfoRequest } from "./GetTournamentInfoRequest";
|
|
2
|
+
import { GetTournamentInfoResponse } from "./GetTournamentInfoResponse";
|
|
3
|
+
import { GetTournamentsRequest } from "./GetTournamentsRequest";
|
|
4
|
+
import { GetTournamentsResponse } from "./GetTournamentsResponse";
|
|
5
|
+
import { Tournament } from "./Tournament";
|
|
6
|
+
import { TournamentInstanceStatus } from "./TournamentInstanceStatus";
|
|
7
|
+
import { TournamentPlayer } from "./TournamentPlayer";
|
|
8
|
+
import { TournamentPrize } from "./TournamentPrize";
|
|
9
|
+
import { TournamentPublicMeta } from "./TournamentPublicMeta";
|
|
10
|
+
import { TournamentRegisterRequest } from "./TournamentRegisterRequest";
|
|
11
|
+
import { TournamentRegisterResponse } from "./TournamentRegisterResponse";
|
|
12
|
+
import { TournamentRegistrationError } from "./TournamentRegistrationError";
|
|
13
|
+
import { TournamentRegistrationStatus } from "./TournamentRegistrationStatus";
|
|
14
|
+
import { TournamentRegistrationType } from "./TournamentRegistrationType";
|
|
15
|
+
import { TournamentType } from "./TournamentType";
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
GetTournamentInfoRequest,
|
|
19
|
+
GetTournamentInfoResponse,
|
|
20
|
+
GetTournamentsRequest,
|
|
21
|
+
GetTournamentsResponse,
|
|
22
|
+
Tournament,
|
|
23
|
+
TournamentInstanceStatus,
|
|
24
|
+
TournamentPlayer,
|
|
25
|
+
TournamentPrize,
|
|
26
|
+
TournamentPublicMeta,
|
|
27
|
+
TournamentRegisterRequest,
|
|
28
|
+
TournamentRegisterResponse,
|
|
29
|
+
TournamentRegistrationError,
|
|
30
|
+
TournamentRegistrationStatus,
|
|
31
|
+
TournamentRegistrationType,
|
|
32
|
+
TournamentType,
|
|
33
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClassId } from './Base/ClassId'
|
|
2
2
|
import { ILogger } from './ILogger';
|
|
3
|
-
import { SmarticoAPI } from './SmarticoAPI'
|
|
3
|
+
import { MessageSender, SmarticoAPI } from './SmarticoAPI'
|
|
4
4
|
|
|
5
5
|
export * from './Core';
|
|
6
6
|
export * from './Inbox';
|
|
@@ -8,10 +8,12 @@ export * from './Leaderboard';
|
|
|
8
8
|
export * from './MiniGames';
|
|
9
9
|
export * from './Missions';
|
|
10
10
|
export * from './Store';
|
|
11
|
+
export * from './Tournaments';
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
export {
|
|
14
15
|
SmarticoAPI,
|
|
16
|
+
MessageSender,
|
|
15
17
|
ClassId,
|
|
16
18
|
ILogger
|
|
17
19
|
}
|
package/src/Store/ShopItem.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ShopItemPublicMeta } from "./ShopItemPublicMeta";
|
|
2
|
-
import { ShopItemType } from "./ShopItemType";
|
|
3
|
-
|
|
4
|
-
export interface ShopItem {
|
|
5
|
-
id: number;
|
|
6
|
-
itemTypeId: ShopItemType;
|
|
7
|
-
itemPublicMeta: ShopItemPublicMeta;
|
|
8
|
-
categoryIds?: number[];
|
|
9
|
-
canBuy?: boolean;
|
|
10
|
-
}
|