@mtgame/core 0.0.37 → 0.0.38

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 (36) hide show
  1. package/api/basketball-game-api.d.ts +1 -0
  2. package/api/league-api.d.ts +5 -1
  3. package/api/media-api.d.ts +4 -0
  4. package/api/public-api.d.ts +1 -0
  5. package/api/tournament-season-api.d.ts +21 -0
  6. package/bundles/mtgame-core.umd.js +228 -2
  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/basketball-game-api.js +7 -1
  11. package/esm2015/api/league-api.js +35 -1
  12. package/esm2015/api/media-api.js +14 -1
  13. package/esm2015/api/public-api.js +2 -1
  14. package/esm2015/api/tournament-season-api.js +123 -0
  15. package/esm2015/models/game.js +4 -1
  16. package/esm2015/models/public-api.js +2 -1
  17. package/esm2015/models/tournament-season.js +32 -0
  18. package/esm2015/models/tournament.js +6 -3
  19. package/esm5/api/basketball-game-api.js +9 -1
  20. package/esm5/api/league-api.js +40 -1
  21. package/esm5/api/media-api.js +18 -1
  22. package/esm5/api/public-api.js +2 -1
  23. package/esm5/api/tournament-season-api.js +139 -0
  24. package/esm5/models/game.js +4 -1
  25. package/esm5/models/public-api.js +2 -1
  26. package/esm5/models/tournament-season.js +37 -0
  27. package/esm5/models/tournament.js +6 -3
  28. package/fesm2015/mtgame-core.js +195 -3
  29. package/fesm2015/mtgame-core.js.map +1 -1
  30. package/fesm5/mtgame-core.js +227 -3
  31. package/fesm5/mtgame-core.js.map +1 -1
  32. package/models/game.d.ts +2 -0
  33. package/models/public-api.d.ts +1 -0
  34. package/models/tournament-season.d.ts +12 -0
  35. package/mtgame-core.metadata.json +1 -1
  36. package/package.json +1 -1
@@ -15,4 +15,5 @@ export declare class BasketballGameApi {
15
15
  getUserStatistic(gameId: number): Promise<BasketballGameStatistic[]>;
16
16
  getLogs(gameId: number): Promise<BasketballGameLog[]>;
17
17
  downloadProtocol(gameId: number, fileType: 'xlsx' | 'pdf'): Promise<any>;
18
+ downloadFibaProtocol(gameId: number, fileType: 'xlsx' | 'pdf'): Promise<any>;
18
19
  }
@@ -2,9 +2,11 @@ import { HttpClient } from '@angular/common/http';
2
2
  import { League } from '../models/league';
3
3
  import { Tournament } from '../models/tournament';
4
4
  import { ConfigService } from '../services/config.service';
5
- import { TournamentEventsListFilter } from './tournament-api';
5
+ import { TournamentEventsListFilter, TournamentGamesFilters } from './tournament-api';
6
6
  import { PaginatedResponse } from './paginated-response.interface';
7
7
  import { TournamentEvent } from '../models/tournament-event';
8
+ import { TournamentSeason } from '../models/tournament-season';
9
+ import { Game } from '../models/game';
8
10
  export declare class LeagueApi {
9
11
  private httpClient;
10
12
  private configService;
@@ -13,4 +15,6 @@ export declare class LeagueApi {
13
15
  getByDomain(domain: string): Promise<League>;
14
16
  getTournaments(leagueId: number): Promise<Tournament[]>;
15
17
  getEvents(leagueId: number, page: number, size: number, filters?: TournamentEventsListFilter): Promise<PaginatedResponse<TournamentEvent[]>>;
18
+ getTournamentSeasons(leagueId: number): Promise<TournamentSeason[]>;
19
+ getGames(leagueId: number, page: number, size: number, filters: TournamentGamesFilters): Promise<PaginatedResponse<Game[]>>;
16
20
  }
@@ -11,6 +11,9 @@ export interface GameMediaFilters {
11
11
  playoffId?: number;
12
12
  status?: GameStatuses;
13
13
  }
14
+ export interface MediaFilters {
15
+ mediaType?: 'photo' | 'video';
16
+ }
14
17
  export declare class MediaApi {
15
18
  private httpClient;
16
19
  private configService;
@@ -18,6 +21,7 @@ export declare class MediaApi {
18
21
  getMedia(mediaId: number): Promise<MediaItem>;
19
22
  getTournamentGameMedia(tournamentId: number, page: number, size: number, filters?: GameMediaFilters): Promise<PaginatedResponse<Game[]>>;
20
23
  getLeagueGameMedia(leagueId: number, page: number, size: number, filters?: GameMediaFilters): Promise<PaginatedResponse<Game[]>>;
24
+ getLeagueMedia(leagueId: number, page: number, size: number, filters?: MediaFilters): Promise<PaginatedResponse<MediaItem[]>>;
21
25
  getGameMediaById(gameId: number): Promise<Game>;
22
26
  getGameMedia(gameId: number): Promise<MediaItem[]>;
23
27
  createZip(mediaIds: number[]): Promise<any>;
@@ -14,6 +14,7 @@ export * from './team-api';
14
14
  export * from './team-event-api';
15
15
  export { TournamentApi, TournamentGamesFilters, TournamentEventsListFilter, StatisticGroupByTypes, StatisticFilters } from './tournament-api';
16
16
  export { TournamentJoinApi } from './tournament-join-api';
17
+ export * from './tournament-season-api';
17
18
  export { TournamentStageApi } from './tournament-stage-api';
18
19
  export * from './user-api';
19
20
  export { VolleyballGameApi } from './volleyball-game-api';
@@ -0,0 +1,21 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { TournamentSeason } from '../models/tournament-season';
3
+ import { ConfigService } from '../services/config.service';
4
+ import { Game } from '../models/game';
5
+ import { Tournament } from '../models/tournament';
6
+ import { TournamentEventsListFilter, TournamentGamesFilters } from './tournament-api';
7
+ import { PaginatedResponse } from './paginated-response.interface';
8
+ import { TournamentEvent } from '../models/tournament-event';
9
+ import { GameMediaFilters } from './media-api';
10
+ import { TournamentTeam } from '../models/tournament-team';
11
+ export declare class TournamentSeasonApi {
12
+ private httpClient;
13
+ private configService;
14
+ constructor(httpClient: HttpClient, configService: ConfigService);
15
+ getByAlias(alias: string): Promise<TournamentSeason>;
16
+ getTournaments(seasonId: number): Promise<Tournament[]>;
17
+ getGames(seasonId: number, page: number, size: number, filters: TournamentGamesFilters): Promise<PaginatedResponse<Game[]>>;
18
+ getEvents(seasonId: number, page: number, size: number, filters?: TournamentEventsListFilter): Promise<PaginatedResponse<TournamentEvent[]>>;
19
+ getGameMedia(seasonId: number, page: number, size: number, filters: GameMediaFilters): Promise<PaginatedResponse<Game[]>>;
20
+ getTeams(seasonId: number): Promise<TournamentTeam[]>;
21
+ }
@@ -1092,6 +1092,39 @@
1092
1092
  return League;
1093
1093
  }(BaseModel));
1094
1094
 
1095
+ var TournamentSeason = /** @class */ (function (_super) {
1096
+ __extends(TournamentSeason, _super);
1097
+ function TournamentSeason() {
1098
+ return _super !== null && _super.apply(this, arguments) || this;
1099
+ }
1100
+ TournamentSeason.toFront = function (data) { };
1101
+ TournamentSeason.toBack = function (data) { };
1102
+ __decorate([
1103
+ ToFrontHook
1104
+ ], TournamentSeason, "toFront", null);
1105
+ __decorate([
1106
+ ToBackHook
1107
+ ], TournamentSeason, "toBack", null);
1108
+ TournamentSeason = __decorate([
1109
+ ModelInstance({
1110
+ mappingFields: {
1111
+ id: 'id',
1112
+ name: 'name',
1113
+ alias: 'alias',
1114
+ logo: 'logo',
1115
+ cover: 'cover',
1116
+ preview_image: 'previewImage',
1117
+ },
1118
+ relation: {
1119
+ logo: File,
1120
+ cover: File,
1121
+ previewImage: File
1122
+ }
1123
+ })
1124
+ ], TournamentSeason);
1125
+ return TournamentSeason;
1126
+ }(BaseModel));
1127
+
1095
1128
 
1096
1129
  (function (TournamentTypes) {
1097
1130
  TournamentTypes["group"] = "group";
@@ -1269,7 +1302,8 @@
1269
1302
  teams_count: 'teamsCount',
1270
1303
  closest_game_datetime: 'closestGameDatetime',
1271
1304
  status: 'status',
1272
- team_winner: 'teamWinner'
1305
+ team_winner: 'teamWinner',
1306
+ season: 'season',
1273
1307
  },
1274
1308
  relation: {
1275
1309
  logo: File,
@@ -1282,7 +1316,8 @@
1282
1316
  date: DateTimeField,
1283
1317
  league: League,
1284
1318
  status: enumField(exports.TournamentStatuses),
1285
- teamWinner: TournamentTeamWinner
1319
+ teamWinner: TournamentTeamWinner,
1320
+ season: TournamentSeason,
1286
1321
  }
1287
1322
  })
1288
1323
  ], Tournament);
@@ -1595,6 +1630,7 @@
1595
1630
  tournament_court: 'tournamentCourt',
1596
1631
  media_count: 'mediaCount',
1597
1632
  media: 'media',
1633
+ tournament: 'tournament',
1598
1634
  },
1599
1635
  relation: {
1600
1636
  status: enumField(exports.GameStatuses),
@@ -1607,6 +1643,7 @@
1607
1643
  hockeyGameConfig: HockeyGameConfig,
1608
1644
  tournamentCourt: LeagueCourt,
1609
1645
  media: listField(MediaItem),
1646
+ tournament: Tournament,
1610
1647
  }
1611
1648
  })
1612
1649
  ], Game);
@@ -2397,6 +2434,14 @@
2397
2434
  });
2398
2435
  });
2399
2436
  };
2437
+ BasketballGameApi.prototype.downloadFibaProtocol = function (gameId, fileType) {
2438
+ return __awaiter(this, void 0, void 0, function () {
2439
+ return __generator(this, function (_a) {
2440
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_basketball_game/" + gameId + "/game_protocol_fiba/?file_type=" + fileType, { responseType: 'blob' })
2441
+ .toPromise()];
2442
+ });
2443
+ });
2444
+ };
2400
2445
  BasketballGameApi.ctorParameters = function () { return [
2401
2446
  { type: http.HttpClient },
2402
2447
  { type: ConfigService }
@@ -3128,6 +3173,43 @@
3128
3173
  });
3129
3174
  });
3130
3175
  };
3176
+ LeagueApi.prototype.getTournamentSeasons = function (leagueId) {
3177
+ return __awaiter(this, void 0, void 0, function () {
3178
+ return __generator(this, function (_a) {
3179
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournament_seasons/").pipe(operators.map(function (result) { return TournamentSeason.toFront(result); })).toPromise()];
3180
+ });
3181
+ });
3182
+ };
3183
+ LeagueApi.prototype.getGames = function (leagueId, page, size, filters) {
3184
+ return __awaiter(this, void 0, void 0, function () {
3185
+ var params;
3186
+ return __generator(this, function (_a) {
3187
+ params = new http.HttpParams().set('page', page.toString());
3188
+ if (size) {
3189
+ params = params.set('size', size.toString());
3190
+ }
3191
+ if (filters.tournamentStageId) {
3192
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
3193
+ }
3194
+ if (filters.tournamentTour) {
3195
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
3196
+ }
3197
+ if (filters.playoffStage) {
3198
+ params = params.set('playoff_stage', filters.playoffStage.toString());
3199
+ }
3200
+ if (filters.teamId) {
3201
+ params = params.set('team_id', filters.teamId.toString());
3202
+ }
3203
+ if (filters.status) {
3204
+ params = params.set('status', exports.GameStatuses[filters.status]);
3205
+ }
3206
+ 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
+ total: +result.headers.get('X-Page-Count'),
3208
+ data: Game.toFront(result.body)
3209
+ }); })).toPromise()];
3210
+ });
3211
+ });
3212
+ };
3131
3213
  LeagueApi.ctorParameters = function () { return [
3132
3214
  { type: http.HttpClient },
3133
3215
  { type: ConfigService }
@@ -3277,6 +3359,23 @@
3277
3359
  });
3278
3360
  });
3279
3361
  };
3362
+ MediaApi.prototype.getLeagueMedia = function (leagueId, page, size, filters) {
3363
+ if (filters === void 0) { filters = {}; }
3364
+ return __awaiter(this, void 0, void 0, function () {
3365
+ var params;
3366
+ return __generator(this, function (_a) {
3367
+ params = new http.HttpParams().set('page', page.toString()).set('size', size.toString());
3368
+ if (filters.mediaType) {
3369
+ params = params.set('media_type', filters.mediaType);
3370
+ }
3371
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/media/", { params: params, observe: 'response' })
3372
+ .pipe(operators.map(function (response) { return ({
3373
+ total: +response.headers.get('X-Page-Count'),
3374
+ data: MediaItem.toFront(response.body)
3375
+ }); })).toPromise()];
3376
+ });
3377
+ });
3378
+ };
3280
3379
  MediaApi.prototype.getGameMediaById = function (gameId) {
3281
3380
  return __awaiter(this, void 0, void 0, function () {
3282
3381
  return __generator(this, function (_a) {
@@ -5485,6 +5584,131 @@
5485
5584
  return TournamentJoinApi;
5486
5585
  }());
5487
5586
 
5587
+ var TournamentSeasonApi = /** @class */ (function () {
5588
+ function TournamentSeasonApi(httpClient, configService) {
5589
+ this.httpClient = httpClient;
5590
+ this.configService = configService;
5591
+ }
5592
+ TournamentSeasonApi.prototype.getByAlias = function (alias) {
5593
+ return __awaiter(this, void 0, void 0, function () {
5594
+ 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()];
5596
+ });
5597
+ });
5598
+ };
5599
+ TournamentSeasonApi.prototype.getTournaments = function (seasonId) {
5600
+ return __awaiter(this, void 0, void 0, function () {
5601
+ return __generator(this, function (_a) {
5602
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/tournaments/").pipe(operators.map(function (result) { return Tournament.toFront(result); })).toPromise()];
5603
+ });
5604
+ });
5605
+ };
5606
+ TournamentSeasonApi.prototype.getGames = function (seasonId, page, size, filters) {
5607
+ return __awaiter(this, void 0, void 0, function () {
5608
+ var params;
5609
+ return __generator(this, function (_a) {
5610
+ params = new http.HttpParams().set('page', page.toString());
5611
+ if (size) {
5612
+ params = params.set('size', size.toString());
5613
+ }
5614
+ if (filters.tournamentStageId) {
5615
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
5616
+ }
5617
+ if (filters.tournamentTour) {
5618
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
5619
+ }
5620
+ if (filters.playoffStage) {
5621
+ params = params.set('playoff_stage', filters.playoffStage.toString());
5622
+ }
5623
+ if (filters.teamId) {
5624
+ params = params.set('team_id', filters.teamId.toString());
5625
+ }
5626
+ if (filters.status) {
5627
+ params = params.set('status', exports.GameStatuses[filters.status]);
5628
+ }
5629
+ 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
+ total: +result.headers.get('X-Page-Count'),
5631
+ data: Game.toFront(result.body)
5632
+ }); })).toPromise()];
5633
+ });
5634
+ });
5635
+ };
5636
+ TournamentSeasonApi.prototype.getEvents = function (seasonId, page, size, filters) {
5637
+ return __awaiter(this, void 0, void 0, function () {
5638
+ var params;
5639
+ return __generator(this, function (_a) {
5640
+ params = new http.HttpParams().set('page', page.toString())
5641
+ .set('size', size.toString());
5642
+ if (filters) {
5643
+ if (filters.event) {
5644
+ params = params.set('event', exports.TournamentEventTypes[filters.event]);
5645
+ }
5646
+ if (filters.search) {
5647
+ params = params.set('search', filters.search);
5648
+ }
5649
+ }
5650
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/events/", { params: params, observe: 'response' })
5651
+ .pipe(operators.map(function (result) { return ({
5652
+ total: +result.headers.get('X-Page-Count'),
5653
+ data: TournamentEvent.toFront(result.body)
5654
+ }); }))
5655
+ .toPromise()];
5656
+ });
5657
+ });
5658
+ };
5659
+ TournamentSeasonApi.prototype.getGameMedia = function (seasonId, page, size, filters) {
5660
+ return __awaiter(this, void 0, void 0, function () {
5661
+ var params;
5662
+ return __generator(this, function (_a) {
5663
+ params = new http.HttpParams().set('page', page.toString()).set('size', size.toString());
5664
+ if (filters) {
5665
+ if (filters.tournamentTour) {
5666
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
5667
+ }
5668
+ if (filters.teamId) {
5669
+ params = params.set('team_id', filters.teamId.toString());
5670
+ }
5671
+ if (filters.tournamentStageId) {
5672
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
5673
+ }
5674
+ if (filters.playoffId) {
5675
+ params = params.set('playoff_id', filters.playoffId.toString());
5676
+ }
5677
+ if (filters.playoffStage) {
5678
+ params = params.set('playoff_stage', filters.playoffStage.toString());
5679
+ }
5680
+ if (filters.status) {
5681
+ params = params.set('status', exports.GameStatuses[filters.status]);
5682
+ }
5683
+ }
5684
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/game_media/", { observe: 'response', params: params })
5685
+ .pipe(operators.map(function (response) {
5686
+ return {
5687
+ total: +response.headers.get('X-Page-Count'),
5688
+ data: Game.toFront(response.body)
5689
+ };
5690
+ })).toPromise()];
5691
+ });
5692
+ });
5693
+ };
5694
+ TournamentSeasonApi.prototype.getTeams = function (seasonId) {
5695
+ return __awaiter(this, void 0, void 0, function () {
5696
+ return __generator(this, function (_a) {
5697
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/teams/").pipe(operators.map(function (result) { return TournamentTeam.toFront(result); })).toPromise()];
5698
+ });
5699
+ });
5700
+ };
5701
+ TournamentSeasonApi.ctorParameters = function () { return [
5702
+ { type: http.HttpClient },
5703
+ { type: ConfigService }
5704
+ ]; };
5705
+ TournamentSeasonApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentSeasonApi_Factory() { return new TournamentSeasonApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentSeasonApi, providedIn: "root" });
5706
+ TournamentSeasonApi = __decorate([
5707
+ core.Injectable({ providedIn: 'root' })
5708
+ ], TournamentSeasonApi);
5709
+ return TournamentSeasonApi;
5710
+ }());
5711
+
5488
5712
  var TournamentStageApi = /** @class */ (function () {
5489
5713
  function TournamentStageApi(httpClient, configService) {
5490
5714
  this.httpClient = httpClient;
@@ -6858,6 +7082,8 @@
6858
7082
  exports.TournamentJoinData = TournamentJoinData;
6859
7083
  exports.TournamentJoinTeam = TournamentJoinTeam;
6860
7084
  exports.TournamentNews = TournamentNews;
7085
+ exports.TournamentSeason = TournamentSeason;
7086
+ exports.TournamentSeasonApi = TournamentSeasonApi;
6861
7087
  exports.TournamentSettings = TournamentSettings;
6862
7088
  exports.TournamentStage = TournamentStage;
6863
7089
  exports.TournamentStageApi = TournamentStageApi;