Skip to content

Commit 4efd8fc

Browse files
committed
Records
1 parent 9b7f539 commit 4efd8fc

11 files changed

+435
-3
lines changed

src/app.module.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ import {
9090
MatchApi,
9191
MetaApi,
9292
PlayerApi,
93+
RecordApi,
9394
} from "./generated-api/gameserver";
9495
import { Provider } from "@nestjs/common/interfaces/modules/provider.interface";
9596
import {
@@ -123,6 +124,8 @@ import { StorageMapper } from "./rest/storage/storage.mapper";
123124
import { BlogpostController } from "./rest/blogpost/blogpost.controller";
124125
import { BlogpostMapper } from "./rest/blogpost/blogpost.mapper";
125126
import { StorageService } from "./rest/storage/storage.service";
127+
import { RecordController } from "./rest/record/record.controller";
128+
import { RecordMapper } from "./rest/record/record.mapper";
126129

127130
const OPENAPI_GENERATED: Provider[] = [
128131
{
@@ -170,7 +173,15 @@ const OPENAPI_GENERATED: Provider[] = [
170173
},
171174
inject: [ConfigService],
172175
},
173-
176+
{
177+
provide: RecordApi,
178+
useFactory: (config: ConfigService) => {
179+
return new RecordApi(
180+
new GSConfiguration({ basePath: config.get("api.gameserverApiUrl") }),
181+
);
182+
},
183+
inject: [ConfigService],
184+
},
174185
{
175186
provide: ForumApi,
176187
useFactory: (config: ConfigService) => {
@@ -298,6 +309,8 @@ const OPENAPI_GENERATED: Provider[] = [
298309
AdminUserController,
299310
LobbyController,
300311

312+
RecordController,
313+
301314
MetaController,
302315
StatsController,
303316
SteamController,
@@ -364,6 +377,7 @@ const OPENAPI_GENERATED: Provider[] = [
364377
FeedbackMapper,
365378
StorageMapper,
366379
BlogpostMapper,
380+
RecordMapper,
367381

368382
UserRepository,
369383
UserCreatedHandler,

src/generated-api/gameserver/apis/PlayerApi.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Matches, players, mmrs
66
*
77
* The version of the OpenAPI document: 1.0
8-
*
8+
*
99
*
1010
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1111
* https://openapi-generator.tech
@@ -72,7 +72,7 @@ export interface PlayerControllerReportPlayerRequest {
7272
}
7373

7474
/**
75-
*
75+
*
7676
*/
7777
export class PlayerApi extends runtime.BaseAPI {
7878

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* GameServer api
5+
* Matches, players, mmrs
6+
*
7+
* The version of the OpenAPI document: 1.0
8+
*
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
16+
import * as runtime from "../runtime";
17+
18+
import {
19+
GameserverPlayerRecordsResponse,
20+
GameserverPlayerRecordsResponseFromJSON,
21+
} from "../models";
22+
23+
export interface RecordControllerPlayerRecordRequest {
24+
steamId: string;
25+
}
26+
27+
/**
28+
*
29+
*/
30+
export class RecordApi extends runtime.BaseAPI {
31+
32+
/**
33+
*/
34+
recordControllerPlayerRecordContext(requestParameters: RecordControllerPlayerRecordRequest): runtime.RequestOpts {
35+
const queryParameters: any = {};
36+
37+
const headerParameters: runtime.HTTPHeaders = {};
38+
39+
return {
40+
path: `/record/{steam_id}`.replace(`{${"steam_id"}}`, encodeURIComponent(String(requestParameters.steamId))),
41+
method: 'GET',
42+
headers: headerParameters,
43+
query: queryParameters,
44+
};
45+
}
46+
47+
/**
48+
*/
49+
recordControllerPlayerRecord = async (steamId: string): Promise<GameserverPlayerRecordsResponse> => {
50+
const response = await this.recordControllerPlayerRecordRaw({ steamId: steamId });
51+
return await response.value();
52+
}
53+
54+
/**
55+
*/
56+
recordControllerRecordsContext(): runtime.RequestOpts {
57+
const queryParameters: any = {};
58+
59+
const headerParameters: runtime.HTTPHeaders = {};
60+
61+
return {
62+
path: `/record`,
63+
method: 'GET',
64+
headers: headerParameters,
65+
query: queryParameters,
66+
};
67+
}
68+
69+
/**
70+
*/
71+
recordControllerRecords = async (): Promise<GameserverPlayerRecordsResponse> => {
72+
const response = await this.recordControllerRecordsRaw();
73+
return await response.value();
74+
}
75+
76+
/**
77+
*/
78+
private async recordControllerPlayerRecordRaw(requestParameters: RecordControllerPlayerRecordRequest): Promise<runtime.ApiResponse<GameserverPlayerRecordsResponse>> {
79+
this.recordControllerPlayerRecordValidation(requestParameters);
80+
const context = this.recordControllerPlayerRecordContext(requestParameters);
81+
const response = await this.request(context);
82+
83+
return new runtime.JSONApiResponse(response, (jsonValue) => GameserverPlayerRecordsResponseFromJSON(jsonValue));
84+
}
85+
86+
/**
87+
*/
88+
private recordControllerPlayerRecordValidation(requestParameters: RecordControllerPlayerRecordRequest) {
89+
if (requestParameters.steamId === null || requestParameters.steamId === undefined) {
90+
throw new runtime.RequiredError('steamId','Required parameter requestParameters.steamId was null or undefined when calling recordControllerPlayerRecord.');
91+
}
92+
}
93+
94+
/**
95+
*/
96+
private async recordControllerRecordsRaw(): Promise<runtime.ApiResponse<GameserverPlayerRecordsResponse>> {
97+
this.recordControllerRecordsValidation();
98+
const context = this.recordControllerRecordsContext();
99+
const response = await this.request(context);
100+
101+
return new runtime.JSONApiResponse(response, (jsonValue) => GameserverPlayerRecordsResponseFromJSON(jsonValue));
102+
}
103+
104+
/**
105+
*/
106+
private recordControllerRecordsValidation() {
107+
}
108+
109+
}

src/generated-api/gameserver/apis/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './InfoApi';
33
export * from './MatchApi';
44
export * from './MetaApi';
55
export * from './PlayerApi';
6+
export * from './RecordApi';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* GameServer api
5+
* Matches, players, mmrs
6+
*
7+
* The version of the OpenAPI document: 1.0
8+
*
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
import { exists } from '../runtime';
16+
import {
17+
GameserverMatchDto,
18+
GameserverMatchDtoFromJSON,
19+
GameserverMatchDtoToJSON,
20+
GameserverRecordType,
21+
GameserverRecordTypeFromJSON,
22+
GameserverRecordTypeToJSON,
23+
} from './';
24+
25+
/**
26+
*
27+
* @export
28+
* @interface GameserverPlayerRecordDto
29+
*/
30+
export class GameserverPlayerRecordDto {
31+
/**
32+
*
33+
* @type {GameserverRecordType}
34+
* @memberof GameserverPlayerRecordDto
35+
*/
36+
recordType: GameserverRecordType;
37+
/**
38+
*
39+
* @type {string}
40+
* @memberof GameserverPlayerRecordDto
41+
*/
42+
steamId: string;
43+
/**
44+
*
45+
* @type {GameserverMatchDto}
46+
* @memberof GameserverPlayerRecordDto
47+
*/
48+
match?: GameserverMatchDto;
49+
}
50+
51+
export function GameserverPlayerRecordDtoFromJSON(json: any): GameserverPlayerRecordDto {
52+
return GameserverPlayerRecordDtoFromJSONTyped(json, false);
53+
}
54+
55+
export function GameserverPlayerRecordDtoFromJSONTyped(json: any, ignoreDiscriminator: boolean): GameserverPlayerRecordDto {
56+
if ((json === undefined) || (json === null)) {
57+
return json;
58+
}
59+
return {
60+
61+
'recordType': GameserverRecordTypeFromJSON(json['recordType']),
62+
'steamId': json['steamId'],
63+
'match': !exists(json, 'match') ? undefined : GameserverMatchDtoFromJSON(json['match']),
64+
};
65+
}
66+
67+
export function GameserverPlayerRecordDtoToJSON(value?: GameserverPlayerRecordDto | null): any {
68+
if (value === undefined) {
69+
return undefined;
70+
}
71+
if (value === null) {
72+
return null;
73+
}
74+
return {
75+
76+
'recordType': GameserverRecordTypeToJSON(value.recordType),
77+
'steamId': value.steamId,
78+
'match': GameserverMatchDtoToJSON(value.match),
79+
};
80+
}
81+
82+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* GameServer api
5+
* Matches, players, mmrs
6+
*
7+
* The version of the OpenAPI document: 1.0
8+
*
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
import { GameserverPlayerRecordDto, GameserverPlayerRecordDtoFromJSON, GameserverPlayerRecordDtoToJSON } from './';
16+
17+
/**
18+
*
19+
* @export
20+
* @interface GameserverPlayerRecordsResponse
21+
*/
22+
export class GameserverPlayerRecordsResponse {
23+
/**
24+
*
25+
* @type {Array<GameserverPlayerRecordDto>}
26+
* @memberof GameserverPlayerRecordsResponse
27+
*/
28+
season: Array<GameserverPlayerRecordDto>;
29+
/**
30+
*
31+
* @type {Array<GameserverPlayerRecordDto>}
32+
* @memberof GameserverPlayerRecordsResponse
33+
*/
34+
overall: Array<GameserverPlayerRecordDto>;
35+
/**
36+
*
37+
* @type {Array<GameserverPlayerRecordDto>}
38+
* @memberof GameserverPlayerRecordsResponse
39+
*/
40+
month: Array<GameserverPlayerRecordDto>;
41+
}
42+
43+
export function GameserverPlayerRecordsResponseFromJSON(json: any): GameserverPlayerRecordsResponse {
44+
return GameserverPlayerRecordsResponseFromJSONTyped(json, false);
45+
}
46+
47+
export function GameserverPlayerRecordsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GameserverPlayerRecordsResponse {
48+
if ((json === undefined) || (json === null)) {
49+
return json;
50+
}
51+
return {
52+
53+
'season': ((json['season'] as Array<any>).map(GameserverPlayerRecordDtoFromJSON)),
54+
'overall': ((json['overall'] as Array<any>).map(GameserverPlayerRecordDtoFromJSON)),
55+
'month': ((json['month'] as Array<any>).map(GameserverPlayerRecordDtoFromJSON)),
56+
};
57+
}
58+
59+
export function GameserverPlayerRecordsResponseToJSON(value?: GameserverPlayerRecordsResponse | null): any {
60+
if (value === undefined) {
61+
return undefined;
62+
}
63+
if (value === null) {
64+
return null;
65+
}
66+
return {
67+
68+
'season': ((value.season as Array<any>).map(GameserverPlayerRecordDtoToJSON)),
69+
'overall': ((value.overall as Array<any>).map(GameserverPlayerRecordDtoToJSON)),
70+
'month': ((value.month as Array<any>).map(GameserverPlayerRecordDtoToJSON)),
71+
};
72+
}
73+
74+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* GameServer api
5+
* Matches, players, mmrs
6+
*
7+
* The version of the OpenAPI document: 1.0
8+
*
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
/**
16+
*
17+
* @export
18+
* @enum {string}
19+
*/
20+
export enum GameserverRecordType {
21+
KILLS = 'KILLS',
22+
KDA = 'KDA',
23+
ASSISTS = 'ASSISTS',
24+
DEATHS = 'DEATHS',
25+
LASTHITS = 'LAST_HITS',
26+
DENIES = 'DENIES',
27+
GPM = 'GPM',
28+
XPM = 'XPM',
29+
NETWORTH = 'NETWORTH',
30+
TOWERDAMAGE = 'TOWER_DAMAGE',
31+
HERODAMAGE = 'HERO_DAMAGE',
32+
HEROHEALING = 'HERO_HEALING'
33+
}
34+
35+
export function GameserverRecordTypeFromJSON(json: any): GameserverRecordType {
36+
return GameserverRecordTypeFromJSONTyped(json, false);
37+
}
38+
39+
export function GameserverRecordTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): GameserverRecordType {
40+
return json as GameserverRecordType;
41+
}
42+
43+
export function GameserverRecordTypeToJSON(value?: GameserverRecordType | null): any {
44+
return value as any;
45+
}
46+

0 commit comments

Comments
 (0)