@mtgame/core 0.0.38 → 0.0.40

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 (37) hide show
  1. package/api/league-api.d.ts +1 -0
  2. package/api/league-news-api.d.ts +2 -1
  3. package/api/media-api.d.ts +2 -1
  4. package/api/tournament-api.d.ts +4 -1
  5. package/api/tournament-season-api.d.ts +3 -1
  6. package/bundles/mtgame-core.umd.js +81 -10
  7. package/bundles/mtgame-core.umd.js.map +1 -1
  8. package/bundles/mtgame-core.umd.min.js +1 -1
  9. package/bundles/mtgame-core.umd.min.js.map +1 -1
  10. package/esm2015/api/league-api.js +16 -1
  11. package/esm2015/api/league-news-api.js +13 -4
  12. package/esm2015/api/media-api.js +4 -1
  13. package/esm2015/api/tournament-api.js +10 -3
  14. package/esm2015/api/tournament-season-api.js +18 -3
  15. package/esm2015/models/league-news.js +3 -1
  16. package/esm2015/models/tournament-season.js +11 -3
  17. package/esm2015/models/tournament-team.js +2 -1
  18. package/esm2015/models/tournament.js +5 -1
  19. package/esm5/api/league-api.js +20 -2
  20. package/esm5/api/league-news-api.js +16 -4
  21. package/esm5/api/media-api.js +4 -1
  22. package/esm5/api/tournament-api.js +11 -4
  23. package/esm5/api/tournament-season-api.js +21 -4
  24. package/esm5/models/league-news.js +3 -1
  25. package/esm5/models/tournament-season.js +11 -3
  26. package/esm5/models/tournament-team.js +2 -1
  27. package/esm5/models/tournament.js +5 -1
  28. package/fesm2015/mtgame-core.js +71 -8
  29. package/fesm2015/mtgame-core.js.map +1 -1
  30. package/fesm5/mtgame-core.js +82 -11
  31. package/fesm5/mtgame-core.js.map +1 -1
  32. package/models/league-news.d.ts +1 -0
  33. package/models/tournament-season.d.ts +6 -0
  34. package/models/tournament-team.d.ts +1 -0
  35. package/models/tournament.d.ts +4 -0
  36. package/mtgame-core.metadata.json +1 -1
  37. package/package.json +1 -1
@@ -17,4 +17,5 @@ export declare class LeagueApi {
17
17
  getEvents(leagueId: number, page: number, size: number, filters?: TournamentEventsListFilter): Promise<PaginatedResponse<TournamentEvent[]>>;
18
18
  getTournamentSeasons(leagueId: number): Promise<TournamentSeason[]>;
19
19
  getGames(leagueId: number, page: number, size: number, filters: TournamentGamesFilters): Promise<PaginatedResponse<Game[]>>;
20
+ getSeasons(leagueId: number, notClosed?: boolean): Promise<TournamentSeason[]>;
20
21
  }
@@ -6,8 +6,9 @@ export declare class LeagueNewsApi {
6
6
  private httpClient;
7
7
  private configService;
8
8
  constructor(httpClient: HttpClient, configService: ConfigService);
9
- getLeagueNewsList(leagueId: number): Promise<PaginatedResponse<LeagueNews[]>>;
9
+ getLeagueNewsList(leagueId: number, page: number, size: number): Promise<PaginatedResponse<LeagueNews[]>>;
10
10
  getMainLeagueNews(leagueId: number): Promise<LeagueNews>;
11
+ getMainLeagueNewsList(leagueId: number): Promise<LeagueNews[]>;
11
12
  getNewsById(newsId: number): Promise<LeagueNews>;
12
13
  getTournamentNewsList(tournamentId: number): Promise<PaginatedResponse<LeagueNews[]>>;
13
14
  }
@@ -12,7 +12,8 @@ export interface GameMediaFilters {
12
12
  status?: GameStatuses;
13
13
  }
14
14
  export interface MediaFilters {
15
- mediaType?: 'photo' | 'video';
15
+ mediaType?: 'photo' | 'video' | 'live_video';
16
+ sort?: string;
16
17
  }
17
18
  export declare class MediaApi {
18
19
  private httpClient;
@@ -22,10 +22,12 @@ export interface TournamentGamesFilters {
22
22
  playoffStage?: number;
23
23
  playoffId?: number;
24
24
  status?: GameStatuses;
25
+ statuses?: GameStatuses[];
25
26
  }
26
27
  export declare type StatisticGroupByTypes = 'team' | 'user' | 'team_user' | 'tournament_team' | 'tournament_team_user' | 'month' | 'win_loses';
27
28
  export interface StatisticFilters {
28
29
  tournament_id?: number;
30
+ tournament_season_id?: number;
29
31
  tournament_team_id?: number;
30
32
  tournament_team_user_id?: number;
31
33
  team_id?: number;
@@ -43,12 +45,13 @@ export interface StatisticFilters {
43
45
  export interface TournamentEventsListFilter {
44
46
  event?: TournamentEventTypes;
45
47
  search?: string;
48
+ tournamentTour?: number;
46
49
  }
47
50
  export declare class TournamentApi {
48
51
  private httpClient;
49
52
  private configService;
50
53
  constructor(httpClient: HttpClient, configService: ConfigService);
51
- getByAlias(alias: string): Promise<Tournament>;
54
+ getByAlias(leagueId: number, alias: string): Promise<Tournament>;
52
55
  getNews(tournamentId: number): Promise<TournamentNews[]>;
53
56
  getEvents(tournamentId: number, page: number, size: number, filters?: TournamentEventsListFilter): Promise<PaginatedResponse<TournamentEvent[]>>;
54
57
  getTournamentStages(tournamentId: number): Promise<TournamentStage[]>;
@@ -8,14 +8,16 @@ import { PaginatedResponse } from './paginated-response.interface';
8
8
  import { TournamentEvent } from '../models/tournament-event';
9
9
  import { GameMediaFilters } from './media-api';
10
10
  import { TournamentTeam } from '../models/tournament-team';
11
+ import { GameTimelineStages } from '../models/game-timeline-stages';
11
12
  export declare class TournamentSeasonApi {
12
13
  private httpClient;
13
14
  private configService;
14
15
  constructor(httpClient: HttpClient, configService: ConfigService);
15
- getByAlias(alias: string): Promise<TournamentSeason>;
16
+ getByAlias(leagueId: number, alias: string): Promise<TournamentSeason>;
16
17
  getTournaments(seasonId: number): Promise<Tournament[]>;
17
18
  getGames(seasonId: number, page: number, size: number, filters: TournamentGamesFilters): Promise<PaginatedResponse<Game[]>>;
18
19
  getEvents(seasonId: number, page: number, size: number, filters?: TournamentEventsListFilter): Promise<PaginatedResponse<TournamentEvent[]>>;
19
20
  getGameMedia(seasonId: number, page: number, size: number, filters: GameMediaFilters): Promise<PaginatedResponse<Game[]>>;
20
21
  getTeams(seasonId: number): Promise<TournamentTeam[]>;
22
+ getGamesStages(seasonId: number): Promise<GameTimelineStages>;
21
23
  }
@@ -1092,6 +1092,12 @@
1092
1092
  return League;
1093
1093
  }(BaseModel));
1094
1094
 
1095
+
1096
+ (function (TournamentSeasonStatuses) {
1097
+ TournamentSeasonStatuses[TournamentSeasonStatuses["open"] = 0] = "open";
1098
+ TournamentSeasonStatuses[TournamentSeasonStatuses["in_progress"] = 1] = "in_progress";
1099
+ TournamentSeasonStatuses[TournamentSeasonStatuses["closed"] = 2] = "closed";
1100
+ })(exports.TournamentSeasonStatuses || (exports.TournamentSeasonStatuses = {}));
1095
1101
  var TournamentSeason = /** @class */ (function (_super) {
1096
1102
  __extends(TournamentSeason, _super);
1097
1103
  function TournamentSeason() {
@@ -1114,11 +1120,13 @@
1114
1120
  logo: 'logo',
1115
1121
  cover: 'cover',
1116
1122
  preview_image: 'previewImage',
1123
+ status: 'status',
1117
1124
  },
1118
1125
  relation: {
1119
1126
  logo: File,
1120
1127
  cover: File,
1121
- previewImage: File
1128
+ previewImage: File,
1129
+ status: enumField(exports.TournamentSeasonStatuses),
1122
1130
  }
1123
1131
  })
1124
1132
  ], TournamentSeason);
@@ -1303,6 +1311,8 @@
1303
1311
  closest_game_datetime: 'closestGameDatetime',
1304
1312
  status: 'status',
1305
1313
  team_winner: 'teamWinner',
1314
+ team_second: 'teamSecond',
1315
+ team_third: 'teamThird',
1306
1316
  season: 'season',
1307
1317
  },
1308
1318
  relation: {
@@ -1317,6 +1327,8 @@
1317
1327
  league: League,
1318
1328
  status: enumField(exports.TournamentStatuses),
1319
1329
  teamWinner: TournamentTeamWinner,
1330
+ teamSecond: TournamentTeamWinner,
1331
+ teamThird: TournamentTeamWinner,
1320
1332
  season: TournamentSeason,
1321
1333
  }
1322
1334
  })
@@ -1746,6 +1758,7 @@
1746
1758
  tournament: 'tournament',
1747
1759
  team: 'team',
1748
1760
  group: 'group',
1761
+ final_standing: 'finalStanding',
1749
1762
  games_count: 'gamesCount',
1750
1763
  won_games_count: 'wonGamesCount',
1751
1764
  draw_games_count: 'drawGamesCount',
@@ -3069,6 +3082,7 @@
3069
3082
  detail_text: 'detailText',
3070
3083
  picture: 'picture',
3071
3084
  cover: 'cover',
3085
+ mobile_picture: 'mobilePicture',
3072
3086
  is_main: 'isMain',
3073
3087
  tournaments: 'tournaments',
3074
3088
  },
@@ -3076,6 +3090,7 @@
3076
3090
  datetime: DateTimeField,
3077
3091
  picture: File,
3078
3092
  cover: File,
3093
+ mobilePicture: File,
3079
3094
  tournaments: listField(Tournament)
3080
3095
  }
3081
3096
  })
@@ -3165,6 +3180,9 @@
3165
3180
  if (filters.search) {
3166
3181
  params = params.set('search', filters.search);
3167
3182
  }
3183
+ if (filters.tournamentTour) {
3184
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
3185
+ }
3168
3186
  }
3169
3187
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/events/", { params: params, observe: 'response' }).pipe(operators.map(function (result) { return ({
3170
3188
  total: +result.headers.get('X-Page-Count'),
@@ -3182,7 +3200,7 @@
3182
3200
  };
3183
3201
  LeagueApi.prototype.getGames = function (leagueId, page, size, filters) {
3184
3202
  return __awaiter(this, void 0, void 0, function () {
3185
- var params;
3203
+ var params, statuses;
3186
3204
  return __generator(this, function (_a) {
3187
3205
  params = new http.HttpParams().set('page', page.toString());
3188
3206
  if (size) {
@@ -3203,6 +3221,10 @@
3203
3221
  if (filters.status) {
3204
3222
  params = params.set('status', exports.GameStatuses[filters.status]);
3205
3223
  }
3224
+ if (filters.statuses) {
3225
+ statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
3226
+ params = params.set('statuses', statuses.join(','));
3227
+ }
3206
3228
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/games/", { params: params, observe: 'response' }).pipe(operators.map(function (result) { return ({
3207
3229
  total: +result.headers.get('X-Page-Count'),
3208
3230
  data: Game.toFront(result.body)
@@ -3210,6 +3232,17 @@
3210
3232
  });
3211
3233
  });
3212
3234
  };
3235
+ LeagueApi.prototype.getSeasons = function (leagueId, notClosed) {
3236
+ return __awaiter(this, void 0, void 0, function () {
3237
+ var params;
3238
+ return __generator(this, function (_a) {
3239
+ params = new http.HttpParams().set('not_closed', notClosed ? '1' : '');
3240
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournament_seasons/", { params: params })
3241
+ .pipe(operators.map(function (result) { return TournamentSeason.toFront(result); }))
3242
+ .toPromise()];
3243
+ });
3244
+ });
3245
+ };
3213
3246
  LeagueApi.ctorParameters = function () { return [
3214
3247
  { type: http.HttpClient },
3215
3248
  { type: ConfigService }
@@ -3226,10 +3259,13 @@
3226
3259
  this.httpClient = httpClient;
3227
3260
  this.configService = configService;
3228
3261
  }
3229
- LeagueNewsApi.prototype.getLeagueNewsList = function (leagueId) {
3262
+ LeagueNewsApi.prototype.getLeagueNewsList = function (leagueId, page, size) {
3230
3263
  return __awaiter(this, void 0, void 0, function () {
3264
+ var params;
3231
3265
  return __generator(this, function (_a) {
3232
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/", { observe: 'response' })
3266
+ params = new http.HttpParams().set('page', page.toString())
3267
+ .set('size', size.toString());
3268
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/", { params: params, observe: 'response' })
3233
3269
  .pipe(operators.map(function (response) { return ({
3234
3270
  total: +response.headers.get('X-Page-Count'),
3235
3271
  data: LeagueNews.toFront(response.body)
@@ -3247,6 +3283,15 @@
3247
3283
  });
3248
3284
  });
3249
3285
  };
3286
+ LeagueNewsApi.prototype.getMainLeagueNewsList = function (leagueId) {
3287
+ return __awaiter(this, void 0, void 0, function () {
3288
+ return __generator(this, function (_a) {
3289
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/?is_main=true")
3290
+ .pipe(operators.map(function (response) { return LeagueNews.toFront(response); }))
3291
+ .toPromise()];
3292
+ });
3293
+ });
3294
+ };
3250
3295
  LeagueNewsApi.prototype.getNewsById = function (newsId) {
3251
3296
  return __awaiter(this, void 0, void 0, function () {
3252
3297
  return __generator(this, function (_a) {
@@ -3368,6 +3413,9 @@
3368
3413
  if (filters.mediaType) {
3369
3414
  params = params.set('media_type', filters.mediaType);
3370
3415
  }
3416
+ if (filters.sort) {
3417
+ params = params.set('sort', filters.sort);
3418
+ }
3371
3419
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/media/", { params: params, observe: 'response' })
3372
3420
  .pipe(operators.map(function (response) { return ({
3373
3421
  total: +response.headers.get('X-Page-Count'),
@@ -5207,10 +5255,10 @@
5207
5255
  this.httpClient = httpClient;
5208
5256
  this.configService = configService;
5209
5257
  }
5210
- TournamentApi.prototype.getByAlias = function (alias) {
5258
+ TournamentApi.prototype.getByAlias = function (leagueId, alias) {
5211
5259
  return __awaiter(this, void 0, void 0, function () {
5212
5260
  return __generator(this, function (_a) {
5213
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + alias + "/")
5261
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/" + alias + "/")
5214
5262
  .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
5215
5263
  .toPromise()];
5216
5264
  });
@@ -5238,6 +5286,9 @@
5238
5286
  if (filters.search) {
5239
5287
  params = params.set('search', filters.search);
5240
5288
  }
5289
+ if (filters.tournamentTour) {
5290
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
5291
+ }
5241
5292
  }
5242
5293
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
5243
5294
  .pipe(operators.map(function (result) { return ({
@@ -5281,7 +5332,7 @@
5281
5332
  TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
5282
5333
  if (filters === void 0) { filters = {}; }
5283
5334
  return __awaiter(this, void 0, void 0, function () {
5284
- var params;
5335
+ var params, statuses;
5285
5336
  return __generator(this, function (_a) {
5286
5337
  params = new http.HttpParams().set('page', page.toString());
5287
5338
  if (size) {
@@ -5302,6 +5353,10 @@
5302
5353
  if (filters.status) {
5303
5354
  params = params.set('status', exports.GameStatuses[filters.status]);
5304
5355
  }
5356
+ if (filters.statuses) {
5357
+ statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
5358
+ params = params.set('statuses', statuses.join(','));
5359
+ }
5305
5360
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
5306
5361
  .pipe(operators.map(function (result) { return ({
5307
5362
  total: +result.headers.get('X-Page-Count'),
@@ -5589,10 +5644,10 @@
5589
5644
  this.httpClient = httpClient;
5590
5645
  this.configService = configService;
5591
5646
  }
5592
- TournamentSeasonApi.prototype.getByAlias = function (alias) {
5647
+ TournamentSeasonApi.prototype.getByAlias = function (leagueId, alias) {
5593
5648
  return __awaiter(this, void 0, void 0, function () {
5594
5649
  return __generator(this, function (_a) {
5595
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + alias + "/").pipe(operators.map(function (result) { return TournamentSeason.toFront(result); })).toPromise()];
5650
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournament_seasons/" + alias + "/").pipe(operators.map(function (result) { return TournamentSeason.toFront(result); })).toPromise()];
5596
5651
  });
5597
5652
  });
5598
5653
  };
@@ -5605,7 +5660,7 @@
5605
5660
  };
5606
5661
  TournamentSeasonApi.prototype.getGames = function (seasonId, page, size, filters) {
5607
5662
  return __awaiter(this, void 0, void 0, function () {
5608
- var params;
5663
+ var params, statuses;
5609
5664
  return __generator(this, function (_a) {
5610
5665
  params = new http.HttpParams().set('page', page.toString());
5611
5666
  if (size) {
@@ -5626,6 +5681,10 @@
5626
5681
  if (filters.status) {
5627
5682
  params = params.set('status', exports.GameStatuses[filters.status]);
5628
5683
  }
5684
+ if (filters.statuses) {
5685
+ statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
5686
+ params = params.set('statuses', statuses.join(','));
5687
+ }
5629
5688
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/games/", { params: params, observe: 'response' }).pipe(operators.map(function (result) { return ({
5630
5689
  total: +result.headers.get('X-Page-Count'),
5631
5690
  data: Game.toFront(result.body)
@@ -5646,6 +5705,9 @@
5646
5705
  if (filters.search) {
5647
5706
  params = params.set('search', filters.search);
5648
5707
  }
5708
+ if (filters.tournamentTour) {
5709
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
5710
+ }
5649
5711
  }
5650
5712
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/events/", { params: params, observe: 'response' })
5651
5713
  .pipe(operators.map(function (result) { return ({
@@ -5698,6 +5760,15 @@
5698
5760
  });
5699
5761
  });
5700
5762
  };
5763
+ TournamentSeasonApi.prototype.getGamesStages = function (seasonId) {
5764
+ return __awaiter(this, void 0, void 0, function () {
5765
+ return __generator(this, function (_a) {
5766
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/games_stages/")
5767
+ .pipe(operators.map(function (data) { return GameTimelineStages.toFront(data); }))
5768
+ .toPromise()];
5769
+ });
5770
+ });
5771
+ };
5701
5772
  TournamentSeasonApi.ctorParameters = function () { return [
5702
5773
  { type: http.HttpClient },
5703
5774
  { type: ConfigService }