@mtgame/core 1.0.33 → 1.0.35
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/api/league-api.d.ts +11 -1
- package/bundles/mtgame-core.umd.js +38 -3
- package/bundles/mtgame-core.umd.js.map +1 -1
- package/esm2015/api/league-api.js +36 -4
- package/fesm2015/mtgame-core.js +36 -4
- package/fesm2015/mtgame-core.js.map +1 -1
- package/mtgame-core.metadata.json +1 -1
- package/package.json +1 -1
package/api/league-api.d.ts
CHANGED
|
@@ -14,8 +14,17 @@ import { LeagueDocument } from '../models/league-document';
|
|
|
14
14
|
import { TeamsAndUsers } from '../models/teams-and-users';
|
|
15
15
|
import { SeasonTournament } from '../models/season-tournament';
|
|
16
16
|
import { LeaguePlayerField } from '../models/league-player-field';
|
|
17
|
+
export declare enum TournamentFilterStatusEnum {
|
|
18
|
+
open = 1,
|
|
19
|
+
recruitment = 2,
|
|
20
|
+
in_progress = 3,
|
|
21
|
+
closed = 4
|
|
22
|
+
}
|
|
17
23
|
export interface TournamentListFilters {
|
|
18
|
-
statuses
|
|
24
|
+
statuses?: TournamentStatuses[];
|
|
25
|
+
tournamentStatus?: TournamentFilterStatusEnum;
|
|
26
|
+
seasonId?: number;
|
|
27
|
+
seasonTournamentId?: number;
|
|
19
28
|
}
|
|
20
29
|
export declare class LeagueApi {
|
|
21
30
|
private httpClient;
|
|
@@ -25,6 +34,7 @@ export declare class LeagueApi {
|
|
|
25
34
|
getByDomain(domain: string): Promise<League>;
|
|
26
35
|
getSeasonTournaments(leagueId: number): Promise<SeasonTournament[]>;
|
|
27
36
|
getTournaments(leagueId: number, filters?: TournamentListFilters): Promise<Tournament[]>;
|
|
37
|
+
getTournamentsPaginated(leagueId: number, page: number, size: number, filters?: TournamentListFilters): Promise<PaginatedResponse<Tournament[]>>;
|
|
28
38
|
getEvents(leagueId: number, page: number, size: number, filters?: TournamentEventsListFilter): Promise<PaginatedResponse<TournamentEvent[]>>;
|
|
29
39
|
getTournamentSeasons(leagueId: number): Promise<TournamentSeason[]>;
|
|
30
40
|
getGames(leagueId: number, page: number, size: number, filters: TournamentGamesFilters): Promise<PaginatedResponse<Game[]>>;
|
|
@@ -9001,6 +9001,13 @@
|
|
|
9001
9001
|
})
|
|
9002
9002
|
], SeasonTournament);
|
|
9003
9003
|
|
|
9004
|
+
exports.TournamentFilterStatusEnum = void 0;
|
|
9005
|
+
(function (TournamentFilterStatusEnum) {
|
|
9006
|
+
TournamentFilterStatusEnum[TournamentFilterStatusEnum["open"] = 1] = "open";
|
|
9007
|
+
TournamentFilterStatusEnum[TournamentFilterStatusEnum["recruitment"] = 2] = "recruitment";
|
|
9008
|
+
TournamentFilterStatusEnum[TournamentFilterStatusEnum["in_progress"] = 3] = "in_progress";
|
|
9009
|
+
TournamentFilterStatusEnum[TournamentFilterStatusEnum["closed"] = 4] = "closed";
|
|
9010
|
+
})(exports.TournamentFilterStatusEnum || (exports.TournamentFilterStatusEnum = {}));
|
|
9004
9011
|
var LeagueApi = /** @class */ (function () {
|
|
9005
9012
|
function LeagueApi(httpClient, configService) {
|
|
9006
9013
|
this.httpClient = httpClient;
|
|
@@ -9033,14 +9040,27 @@
|
|
|
9033
9040
|
return __generator(this, function (_a) {
|
|
9034
9041
|
params = new i1.HttpParams();
|
|
9035
9042
|
if (filters) {
|
|
9036
|
-
|
|
9037
|
-
params = params.set('statuses', filters.statuses.map(function (s) { return exports.TournamentStatuses[s]; }).join(','));
|
|
9038
|
-
}
|
|
9043
|
+
params = applyTournamentListFilters(params, filters);
|
|
9039
9044
|
}
|
|
9040
9045
|
return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/", { params: params }).pipe(operators.map(function (result) { return exports.Tournament.toFront(result); })).toPromise()];
|
|
9041
9046
|
});
|
|
9042
9047
|
});
|
|
9043
9048
|
};
|
|
9049
|
+
LeagueApi.prototype.getTournamentsPaginated = function (leagueId, page, size, filters) {
|
|
9050
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9051
|
+
var params;
|
|
9052
|
+
return __generator(this, function (_a) {
|
|
9053
|
+
params = new i1.HttpParams().set('page', page).set('size', size);
|
|
9054
|
+
if (filters) {
|
|
9055
|
+
params = applyTournamentListFilters(params, filters);
|
|
9056
|
+
}
|
|
9057
|
+
return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/", { params: params, observe: 'response' }).pipe(operators.map(function (response) { return ({
|
|
9058
|
+
total: +response.headers.get('X-Page-Count'),
|
|
9059
|
+
data: exports.Tournament.toFront(response.body)
|
|
9060
|
+
}); })).toPromise()];
|
|
9061
|
+
});
|
|
9062
|
+
});
|
|
9063
|
+
};
|
|
9044
9064
|
LeagueApi.prototype.getEvents = function (leagueId, page, size, filters) {
|
|
9045
9065
|
return __awaiter(this, void 0, void 0, function () {
|
|
9046
9066
|
var params;
|
|
@@ -9175,6 +9195,21 @@
|
|
|
9175
9195
|
{ type: i1.HttpClient },
|
|
9176
9196
|
{ type: ConfigService }
|
|
9177
9197
|
]; };
|
|
9198
|
+
function applyTournamentListFilters(params, filters) {
|
|
9199
|
+
if (filters.statuses) {
|
|
9200
|
+
params = params.set('statuses', filters.statuses.map(function (s) { return exports.TournamentStatuses[s]; }).join(','));
|
|
9201
|
+
}
|
|
9202
|
+
if (filters.tournamentStatus) {
|
|
9203
|
+
params = params.set('tournament_status', exports.TournamentFilterStatusEnum[filters.tournamentStatus]);
|
|
9204
|
+
}
|
|
9205
|
+
if (filters.seasonId) {
|
|
9206
|
+
params = params.set('season_id', filters.seasonId);
|
|
9207
|
+
}
|
|
9208
|
+
if (filters.seasonTournamentId) {
|
|
9209
|
+
params = params.set('season_tournament_id', filters.seasonTournamentId);
|
|
9210
|
+
}
|
|
9211
|
+
return params;
|
|
9212
|
+
}
|
|
9178
9213
|
|
|
9179
9214
|
var LeagueNewsApi = /** @class */ (function () {
|
|
9180
9215
|
function LeagueNewsApi(httpClient, configService) {
|