@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.
Files changed (72) hide show
  1. package/dist/Core/ActivityTypeLimited.d.ts +7 -0
  2. package/dist/Core/index.d.ts +2 -1
  3. package/dist/SmarticoAPI.d.ts +11 -4
  4. package/dist/Store/BuyStoreItemErrorCode.d.ts +10 -0
  5. package/dist/Store/BuyStoreItemRequest.d.ts +4 -0
  6. package/dist/Store/BuyStoreItemResponse.d.ts +4 -0
  7. package/dist/Store/GetCategoriesStoreResponse.d.ts +5 -0
  8. package/dist/Store/GetStoreItemsResponse.d.ts +5 -0
  9. package/dist/Store/StoreCategory.d.ts +5 -0
  10. package/dist/Store/StoreCategoryPublicMeta.d.ts +4 -0
  11. package/dist/Store/StoreItem.d.ts +9 -0
  12. package/dist/Store/StoreItemPublicMeta.d.ts +10 -0
  13. package/dist/Store/StoreItemType.d.ts +4 -0
  14. package/dist/Store/index.d.ts +11 -11
  15. package/dist/Tournaments/GetTournamentInfoRequest.d.ts +4 -0
  16. package/dist/Tournaments/GetTournamentInfoResponse.d.ts +20 -0
  17. package/dist/Tournaments/GetTournamentsRequest.d.ts +3 -0
  18. package/dist/Tournaments/GetTournamentsResponse.d.ts +6 -0
  19. package/dist/Tournaments/Tournament.d.ts +43 -0
  20. package/dist/Tournaments/TournamentInstanceStatus.d.ts +10 -0
  21. package/dist/Tournaments/TournamentPlayer.d.ts +9 -0
  22. package/dist/Tournaments/TournamentPrize.d.ts +10 -0
  23. package/dist/Tournaments/TournamentPublicMeta.d.ts +22 -0
  24. package/dist/Tournaments/TournamentRegisterRequest.d.ts +4 -0
  25. package/dist/Tournaments/TournamentRegisterResponse.d.ts +5 -0
  26. package/dist/Tournaments/TournamentRegistrationError.d.ts +11 -0
  27. package/dist/Tournaments/TournamentRegistrationStatus.d.ts +9 -0
  28. package/dist/Tournaments/TournamentRegistrationType.d.ts +7 -0
  29. package/dist/Tournaments/TournamentType.d.ts +5 -0
  30. package/dist/Tournaments/index.d.ts +16 -0
  31. package/dist/index.d.ts +3 -2
  32. package/dist/index.js +121 -66
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.modern.mjs +102 -43
  35. package/dist/index.modern.mjs.map +1 -1
  36. package/package.json +2 -2
  37. package/src/Core/ActivityTypeLimited.ts +8 -0
  38. package/src/Core/index.ts +3 -1
  39. package/src/SmarticoAPI.ts +47 -37
  40. package/src/Store/{BuyShopItemErrorCode.ts → BuyStoreItemErrorCode.ts} +1 -1
  41. package/src/Store/{BuyShopItemRequest.ts → BuyStoreItemRequest.ts} +1 -1
  42. package/src/Store/{BuyShopItemResponse.ts → BuyStoreItemResponse.ts} +1 -1
  43. package/src/Store/GetCategoriesStoreResponse.ts +11 -0
  44. package/src/Store/GetStoreItemsResponse.ts +7 -0
  45. package/src/Store/StoreCategory.ts +7 -0
  46. package/src/Store/StoreCategoryPublicMeta.ts +5 -0
  47. package/src/Store/StoreItem.ts +10 -0
  48. package/src/Store/{ShopItemPublicMeta.ts → StoreItemPublicMeta.ts} +1 -1
  49. package/src/Store/{ShopItemType.ts → StoreItemType.ts} +1 -1
  50. package/src/Store/index.ts +20 -20
  51. package/src/Tournaments/GetTournamentInfoRequest.ts +6 -0
  52. package/src/Tournaments/GetTournamentInfoResponse.ts +25 -0
  53. package/src/Tournaments/GetTournamentsRequest.ts +5 -0
  54. package/src/Tournaments/GetTournamentsResponse.ts +8 -0
  55. package/src/Tournaments/Tournament.ts +47 -0
  56. package/src/Tournaments/TournamentInstanceStatus.ts +22 -0
  57. package/src/Tournaments/TournamentPlayer.ts +11 -0
  58. package/src/Tournaments/TournamentPrize.ts +12 -0
  59. package/src/Tournaments/TournamentPublicMeta.ts +26 -0
  60. package/src/Tournaments/TournamentRegisterRequest.ts +6 -0
  61. package/src/Tournaments/TournamentRegisterResponse.ts +10 -0
  62. package/src/Tournaments/TournamentRegistrationError.ts +11 -0
  63. package/src/Tournaments/TournamentRegistrationStatus.ts +11 -0
  64. package/src/Tournaments/TournamentRegistrationType.ts +9 -0
  65. package/src/Tournaments/TournamentType.ts +6 -0
  66. package/src/Tournaments/index.ts +33 -0
  67. package/src/index.ts +3 -1
  68. package/src/Store/GetCategoriesShopResponse.ts +0 -11
  69. package/src/Store/GetShopItemsResponse.ts +0 -7
  70. package/src/Store/ShopCategory.ts +0 -7
  71. package/src/Store/ShopCategoryPublicMeta.ts +0 -5
  72. package/src/Store/ShopItem.ts +0 -10
@@ -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 { SAWBuyInType, SAWBuyInTypeName, SAWDoSpinRequest, SAWDoSpinResponse, SAWGameType, SAWGameTypeName, SAWSpinErrorCode, SAWUtils } from './MiniGames';
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
- const res = await superagent.post(this.publicUrl).send(message);
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 = AVATAR_DOMAIN + '/avatar/' + 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
- const response = await this.send<GetInboxMessagesResponse>(message);
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 }
@@ -1,4 +1,4 @@
1
- export enum BuyShopItemErrorCode {
1
+ export enum BuyStoreItemErrorCode {
2
2
  FAILED_TO_BUY_SHOP_ITEM = 121,
3
3
  SHOP_NO_BALANCE = 11000,
4
4
  SHOP_WRONG_LABEL = 11001,
@@ -1,5 +1,5 @@
1
1
  import { ProtocolMessage } from "../Base/ProtocolMessage";
2
2
 
3
- export interface BuyShopItemRequest extends ProtocolMessage {
3
+ export interface BuyStoreItemRequest extends ProtocolMessage {
4
4
  itemId: number;
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { ProtocolResponse } from "../Base/ProtocolResponse";
2
2
 
3
- export interface BuyShopItemResponse extends ProtocolResponse {
3
+ export interface BuyStoreItemResponse extends ProtocolResponse {
4
4
  success?: boolean;
5
5
  }
6
6
 
@@ -0,0 +1,11 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import { StoreCategory } from "./StoreCategory";
3
+
4
+
5
+ export interface GetCategoriesStoreResponse extends ProtocolResponse {
6
+
7
+ categories: StoreCategory[];
8
+ }
9
+
10
+
11
+
@@ -0,0 +1,7 @@
1
+
2
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
3
+ import { StoreItem } from "./StoreItem";
4
+
5
+ export interface GetStoreItemsResponse extends ProtocolResponse {
6
+ items: StoreItem[];
7
+ }
@@ -0,0 +1,7 @@
1
+ import { StoreCategoryPublicMeta } from "./StoreCategoryPublicMeta";
2
+
3
+ export interface StoreCategory {
4
+
5
+ id?: number;
6
+ publicMeta?: StoreCategoryPublicMeta;
7
+ }
@@ -0,0 +1,5 @@
1
+ export interface StoreCategoryPublicMeta {
2
+
3
+ name?: string;
4
+ order?: number;
5
+ }
@@ -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
+ }
@@ -1,4 +1,4 @@
1
- export interface ShopItemPublicMeta {
1
+ export interface StoreItemPublicMeta {
2
2
  price: string;
3
3
  image_url: string;
4
4
  name: string;
@@ -1,4 +1,4 @@
1
- export enum ShopItemType {
1
+ export enum StoreItemType {
2
2
  Bonus = 1,
3
3
  Manual = 2
4
4
  }
@@ -1,25 +1,25 @@
1
- import { BuyShopItemErrorCode } from "./BuyShopItemErrorCode";
2
- import { BuyShopItemRequest } from "./BuyShopItemRequest";
3
- import { BuyShopItemResponse } from "./BuyShopItemResponse";
4
- import { GetCategoriesShopResponse } from "./GetCategoriesShopResponse";
5
- import { GetShopItemsResponse } from "./GetShopItemsResponse";
6
- import { ShopCategory } from "./ShopCategory";
7
- import { ShopCategoryPublicMeta } from "./ShopCategoryPublicMeta";
8
- import { ShopItem } from "./ShopItem";
9
- import { ShopItemPublicMeta } from "./ShopItemPublicMeta";
10
- import { ShopItemType } from "./ShopItemType";
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
- BuyShopItemErrorCode,
15
- BuyShopItemRequest,
16
- BuyShopItemResponse,
17
- GetCategoriesShopResponse,
18
- GetShopItemsResponse,
19
- ShopCategory,
20
- ShopCategoryPublicMeta,
21
- ShopItem,
22
- ShopItemPublicMeta,
23
- ShopItemType,
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,6 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+
3
+ export interface GetTournamentInfoRequest extends ProtocolMessage {
4
+
5
+ tournamentInstanceId: number;
6
+ }
@@ -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,5 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+
3
+ export interface GetTournamentsRequest extends ProtocolMessage {
4
+
5
+ }
@@ -0,0 +1,8 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import {Tournament} from "./Tournament";
3
+
4
+ export interface GetTournamentsResponse extends ProtocolResponse {
5
+
6
+ /** array of the tournaments */
7
+ tournaments?: Tournament[];
8
+ }
@@ -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,11 @@
1
+ export interface TournamentPlayer {
2
+
3
+ userAltName: string;
4
+ position: number;
5
+ scores: number;
6
+ isMe: boolean;
7
+ userId: number;
8
+ avatar_id: string;
9
+
10
+ avatar_url?: string;
11
+ }
@@ -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,6 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+
3
+ export interface TournamentRegisterRequest extends ProtocolMessage {
4
+
5
+ tournamentInstanceId: number;
6
+ }
@@ -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,11 @@
1
+ export enum TournamentRegistrationStatus {
2
+
3
+ NOT_REGISTERED = 0,
4
+ REGISTERED = 1,
5
+ FINISHED = 2,
6
+ PENDING = 3,
7
+ CANCELLED = 4,
8
+ REGISTERED_PENDING_QUALIFICATION = 5,
9
+ QUALIFIED_PENDING_REGISTRATION = 6
10
+ }
11
+
@@ -0,0 +1,9 @@
1
+ export enum TournamentRegistrationType {
2
+
3
+ AUTO = 1,
4
+ OPT_IN = 2,
5
+ BUY_IN_POINTS = 3,
6
+ MANUAL_APPROVAL = 4,
7
+ REQUIRES_QUALIFICATION = 5
8
+ // BUY_IN_CASH = 5???,
9
+ }
@@ -0,0 +1,6 @@
1
+ export enum TournamentType {
2
+
3
+ SCHEDULED = 1,
4
+ SNG = 2,
5
+ TEST = 3,
6
+ }
@@ -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
  }
@@ -1,11 +0,0 @@
1
- import { ProtocolResponse } from "../Base/ProtocolResponse";
2
- import { ShopCategory } from "./ShopCategory";
3
-
4
-
5
- export interface GetCategoriesShopResponse extends ProtocolResponse {
6
-
7
- categories: ShopCategory[];
8
- }
9
-
10
-
11
-
@@ -1,7 +0,0 @@
1
-
2
- import { ProtocolResponse } from "../Base/ProtocolResponse";
3
- import { ShopItem } from "./ShopItem";
4
-
5
- export interface GetShopItemsResponse extends ProtocolResponse {
6
- items: ShopItem[];
7
- }
@@ -1,7 +0,0 @@
1
- import { ShopCategoryPublicMeta } from "./ShopCategoryPublicMeta";
2
-
3
- export interface ShopCategory {
4
-
5
- id?: number;
6
- publicMeta?: ShopCategoryPublicMeta;
7
- }
@@ -1,5 +0,0 @@
1
- export interface ShopCategoryPublicMeta {
2
-
3
- name?: string;
4
- order?: number;
5
- }
@@ -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
- }