@mtgame/core 0.0.38 → 0.0.39

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.
@@ -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',
@@ -3165,6 +3178,9 @@
3165
3178
  if (filters.search) {
3166
3179
  params = params.set('search', filters.search);
3167
3180
  }
3181
+ if (filters.tournamentTour) {
3182
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
3183
+ }
3168
3184
  }
3169
3185
  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
3186
  total: +result.headers.get('X-Page-Count'),
@@ -3182,7 +3198,7 @@
3182
3198
  };
3183
3199
  LeagueApi.prototype.getGames = function (leagueId, page, size, filters) {
3184
3200
  return __awaiter(this, void 0, void 0, function () {
3185
- var params;
3201
+ var params, statuses;
3186
3202
  return __generator(this, function (_a) {
3187
3203
  params = new http.HttpParams().set('page', page.toString());
3188
3204
  if (size) {
@@ -3203,6 +3219,10 @@
3203
3219
  if (filters.status) {
3204
3220
  params = params.set('status', exports.GameStatuses[filters.status]);
3205
3221
  }
3222
+ if (filters.statuses) {
3223
+ statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
3224
+ params = params.set('statuses', statuses.join(','));
3225
+ }
3206
3226
  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
3227
  total: +result.headers.get('X-Page-Count'),
3208
3228
  data: Game.toFront(result.body)
@@ -3210,6 +3230,17 @@
3210
3230
  });
3211
3231
  });
3212
3232
  };
3233
+ LeagueApi.prototype.getSeasons = function (leagueId, notClosed) {
3234
+ return __awaiter(this, void 0, void 0, function () {
3235
+ var params;
3236
+ return __generator(this, function (_a) {
3237
+ params = new http.HttpParams().set('not_closed', notClosed ? '1' : '');
3238
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournament_seasons/", { params: params })
3239
+ .pipe(operators.map(function (result) { return TournamentSeason.toFront(result); }))
3240
+ .toPromise()];
3241
+ });
3242
+ });
3243
+ };
3213
3244
  LeagueApi.ctorParameters = function () { return [
3214
3245
  { type: http.HttpClient },
3215
3246
  { type: ConfigService }
@@ -3226,10 +3257,13 @@
3226
3257
  this.httpClient = httpClient;
3227
3258
  this.configService = configService;
3228
3259
  }
3229
- LeagueNewsApi.prototype.getLeagueNewsList = function (leagueId) {
3260
+ LeagueNewsApi.prototype.getLeagueNewsList = function (leagueId, page, size) {
3230
3261
  return __awaiter(this, void 0, void 0, function () {
3262
+ var params;
3231
3263
  return __generator(this, function (_a) {
3232
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/", { observe: 'response' })
3264
+ params = new http.HttpParams().set('page', page.toString())
3265
+ .set('size', size.toString());
3266
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/", { params: params, observe: 'response' })
3233
3267
  .pipe(operators.map(function (response) { return ({
3234
3268
  total: +response.headers.get('X-Page-Count'),
3235
3269
  data: LeagueNews.toFront(response.body)
@@ -3247,6 +3281,15 @@
3247
3281
  });
3248
3282
  });
3249
3283
  };
3284
+ LeagueNewsApi.prototype.getMainLeagueNewsList = function (leagueId) {
3285
+ return __awaiter(this, void 0, void 0, function () {
3286
+ return __generator(this, function (_a) {
3287
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/?is_main=true")
3288
+ .pipe(operators.map(function (response) { return LeagueNews.toFront(response); }))
3289
+ .toPromise()];
3290
+ });
3291
+ });
3292
+ };
3250
3293
  LeagueNewsApi.prototype.getNewsById = function (newsId) {
3251
3294
  return __awaiter(this, void 0, void 0, function () {
3252
3295
  return __generator(this, function (_a) {
@@ -3368,6 +3411,9 @@
3368
3411
  if (filters.mediaType) {
3369
3412
  params = params.set('media_type', filters.mediaType);
3370
3413
  }
3414
+ if (filters.sort) {
3415
+ params = params.set('sort', filters.sort);
3416
+ }
3371
3417
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/media/", { params: params, observe: 'response' })
3372
3418
  .pipe(operators.map(function (response) { return ({
3373
3419
  total: +response.headers.get('X-Page-Count'),
@@ -5207,10 +5253,10 @@
5207
5253
  this.httpClient = httpClient;
5208
5254
  this.configService = configService;
5209
5255
  }
5210
- TournamentApi.prototype.getByAlias = function (alias) {
5256
+ TournamentApi.prototype.getByAlias = function (leagueId, alias) {
5211
5257
  return __awaiter(this, void 0, void 0, function () {
5212
5258
  return __generator(this, function (_a) {
5213
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + alias + "/")
5259
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/" + alias + "/")
5214
5260
  .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
5215
5261
  .toPromise()];
5216
5262
  });
@@ -5238,6 +5284,9 @@
5238
5284
  if (filters.search) {
5239
5285
  params = params.set('search', filters.search);
5240
5286
  }
5287
+ if (filters.tournamentTour) {
5288
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
5289
+ }
5241
5290
  }
5242
5291
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
5243
5292
  .pipe(operators.map(function (result) { return ({
@@ -5281,7 +5330,7 @@
5281
5330
  TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
5282
5331
  if (filters === void 0) { filters = {}; }
5283
5332
  return __awaiter(this, void 0, void 0, function () {
5284
- var params;
5333
+ var params, statuses;
5285
5334
  return __generator(this, function (_a) {
5286
5335
  params = new http.HttpParams().set('page', page.toString());
5287
5336
  if (size) {
@@ -5302,6 +5351,10 @@
5302
5351
  if (filters.status) {
5303
5352
  params = params.set('status', exports.GameStatuses[filters.status]);
5304
5353
  }
5354
+ if (filters.statuses) {
5355
+ statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
5356
+ params = params.set('statuses', statuses.join(','));
5357
+ }
5305
5358
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
5306
5359
  .pipe(operators.map(function (result) { return ({
5307
5360
  total: +result.headers.get('X-Page-Count'),
@@ -5589,10 +5642,10 @@
5589
5642
  this.httpClient = httpClient;
5590
5643
  this.configService = configService;
5591
5644
  }
5592
- TournamentSeasonApi.prototype.getByAlias = function (alias) {
5645
+ TournamentSeasonApi.prototype.getByAlias = function (leagueId, alias) {
5593
5646
  return __awaiter(this, void 0, void 0, function () {
5594
5647
  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()];
5648
+ 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
5649
  });
5597
5650
  });
5598
5651
  };
@@ -5605,7 +5658,7 @@
5605
5658
  };
5606
5659
  TournamentSeasonApi.prototype.getGames = function (seasonId, page, size, filters) {
5607
5660
  return __awaiter(this, void 0, void 0, function () {
5608
- var params;
5661
+ var params, statuses;
5609
5662
  return __generator(this, function (_a) {
5610
5663
  params = new http.HttpParams().set('page', page.toString());
5611
5664
  if (size) {
@@ -5626,6 +5679,10 @@
5626
5679
  if (filters.status) {
5627
5680
  params = params.set('status', exports.GameStatuses[filters.status]);
5628
5681
  }
5682
+ if (filters.statuses) {
5683
+ statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
5684
+ params = params.set('statuses', statuses.join(','));
5685
+ }
5629
5686
  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
5687
  total: +result.headers.get('X-Page-Count'),
5631
5688
  data: Game.toFront(result.body)
@@ -5646,6 +5703,9 @@
5646
5703
  if (filters.search) {
5647
5704
  params = params.set('search', filters.search);
5648
5705
  }
5706
+ if (filters.tournamentTour) {
5707
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
5708
+ }
5649
5709
  }
5650
5710
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/events/", { params: params, observe: 'response' })
5651
5711
  .pipe(operators.map(function (result) { return ({
@@ -5698,6 +5758,15 @@
5698
5758
  });
5699
5759
  });
5700
5760
  };
5761
+ TournamentSeasonApi.prototype.getGamesStages = function (seasonId) {
5762
+ return __awaiter(this, void 0, void 0, function () {
5763
+ return __generator(this, function (_a) {
5764
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/games_stages/")
5765
+ .pipe(operators.map(function (data) { return GameTimelineStages.toFront(data); }))
5766
+ .toPromise()];
5767
+ });
5768
+ });
5769
+ };
5701
5770
  TournamentSeasonApi.ctorParameters = function () { return [
5702
5771
  { type: http.HttpClient },
5703
5772
  { type: ConfigService }