@mtgame/core 0.0.18 → 0.0.20

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.
@@ -14,4 +14,6 @@ export declare class HockeyGameApi {
14
14
  getTeamStatistic(gameId: number): Promise<HockeyGameTeamStatistic>;
15
15
  getUserStatistic(gameId: number): Promise<HockeyGameStatistic[]>;
16
16
  getLogs(gameId: number): Promise<HockeyGameLog[]>;
17
+ downloadProtocol(gameId: number, format: 'pdf' | 'xlsx'): Promise<any>;
18
+ downloadApplication(gameId: number, format: 'pdf' | 'xlsx', type: 'game_user' | 'tournament_user'): Promise<any>;
17
19
  }
@@ -327,12 +327,18 @@
327
327
  function penaltyTypeField() {
328
328
  return {
329
329
  toFront: function (data) {
330
+ if (!data) {
331
+ return null;
332
+ }
330
333
  if (typeof data === 'object') {
331
334
  return data;
332
335
  }
333
336
  return HockeyPenaltyTypes.find(function (item) { return item.id === data; });
334
337
  },
335
338
  toBack: function (data) {
339
+ if (!data) {
340
+ return null;
341
+ }
336
342
  if (typeof data === 'object') {
337
343
  return data.id;
338
344
  }
@@ -2870,6 +2876,26 @@
2870
2876
  });
2871
2877
  });
2872
2878
  };
2879
+ HockeyGameApi.prototype.downloadProtocol = function (gameId, format) {
2880
+ return __awaiter(this, void 0, void 0, function () {
2881
+ return __generator(this, function (_a) {
2882
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_hockey_game/" + gameId + "/game_protocol/", {
2883
+ params: new http.HttpParams().set('file_type', format),
2884
+ responseType: 'blob'
2885
+ }).toPromise()];
2886
+ });
2887
+ });
2888
+ };
2889
+ HockeyGameApi.prototype.downloadApplication = function (gameId, format, type) {
2890
+ return __awaiter(this, void 0, void 0, function () {
2891
+ return __generator(this, function (_a) {
2892
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_hockey_game/" + gameId + "/game_application_file/", {
2893
+ params: new http.HttpParams().set('file_type', format).set('application_type', type),
2894
+ responseType: 'blob'
2895
+ }).toPromise()];
2896
+ });
2897
+ });
2898
+ };
2873
2899
  HockeyGameApi.ctorParameters = function () { return [
2874
2900
  { type: http.HttpClient },
2875
2901
  { type: ConfigService }