314 lines
7.4 KiB
TypeScript
314 lines
7.4 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/**
|
|
* csgoWTF API
|
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
*
|
|
* The version of the OpenAPI document: 1.0.0
|
|
* Contact: api@csgow.tf
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
import * as runtime from "../runtime";
|
|
import {
|
|
Match,
|
|
MatchChat,
|
|
MatchChatFromJSON,
|
|
MatchFromJSON,
|
|
MatchWeapons,
|
|
MatchWeaponsFromJSON,
|
|
} from "@/api/models";
|
|
|
|
export interface GetMatchRequest {
|
|
id: string;
|
|
}
|
|
|
|
export interface GetMatchChatRequest {
|
|
id: string;
|
|
translated?: GetMatchChatTranslatedEnum;
|
|
}
|
|
|
|
export interface GetMatchRoundsRequest {
|
|
id: string;
|
|
}
|
|
|
|
export interface GetMatchWeaponsRequest {
|
|
id: string;
|
|
}
|
|
|
|
export interface GetMatchesRequest {
|
|
after?: number;
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
export class MatchesApi extends runtime.BaseAPI {
|
|
/**
|
|
* Get match by matchID
|
|
* gets match by MatchID
|
|
*/
|
|
async getMatchRaw(
|
|
requestParameters: GetMatchRequest,
|
|
initOverrides?: RequestInit
|
|
): Promise<runtime.ApiResponse<Match & object>> {
|
|
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
throw new runtime.RequiredError(
|
|
"id",
|
|
"Required parameter requestParameters.id was null or undefined when calling getMatch."
|
|
);
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
const response = await this.request(
|
|
{
|
|
path: `/match/{id}`.replace(
|
|
`{${"id"}}`,
|
|
encodeURIComponent(String(requestParameters.id))
|
|
),
|
|
method: "GET",
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
},
|
|
initOverrides
|
|
);
|
|
|
|
// @ts-ignore
|
|
return new runtime.JSONApiResponse(
|
|
response,
|
|
// @ts-ignore
|
|
(jsonValue) => Match & objectFromJSON(jsonValue)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get match by matchID
|
|
* gets match by MatchID
|
|
*/
|
|
async getMatch(
|
|
requestParameters: GetMatchRequest,
|
|
initOverrides?: RequestInit
|
|
): Promise<Match & object> {
|
|
const response = await this.getMatchRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Get match-chat by MatchID
|
|
* gets match-chat by MatchID
|
|
*/
|
|
async getMatchChatRaw(
|
|
requestParameters: GetMatchChatRequest,
|
|
initOverrides?: RequestInit
|
|
): Promise<runtime.ApiResponse<MatchChat>> {
|
|
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
throw new runtime.RequiredError(
|
|
"id",
|
|
"Required parameter requestParameters.id was null or undefined when calling getMatchChat."
|
|
);
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters.translated !== undefined) {
|
|
queryParameters["translated"] = requestParameters.translated;
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
const response = await this.request(
|
|
{
|
|
path: `/match/{id}/chat`.replace(
|
|
`{${"id"}}`,
|
|
encodeURIComponent(String(requestParameters.id))
|
|
),
|
|
method: "GET",
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
},
|
|
initOverrides
|
|
);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
MatchChatFromJSON(jsonValue)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get match-chat by MatchID
|
|
* gets match-chat by MatchID
|
|
*/
|
|
async getMatchChat(
|
|
requestParameters: GetMatchChatRequest,
|
|
initOverrides?: RequestInit
|
|
): Promise<MatchChat> {
|
|
const response = await this.getMatchChatRaw(
|
|
requestParameters,
|
|
initOverrides
|
|
);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Get match-rounds by MatchID
|
|
* gets match-rounds by MatchID
|
|
*/
|
|
async getMatchRoundsRaw(
|
|
requestParameters: GetMatchRoundsRequest,
|
|
initOverrides?: RequestInit
|
|
): Promise<
|
|
runtime.ApiResponse<{ [key: string]: { [key: string]: Array<number> } }>
|
|
> {
|
|
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
throw new runtime.RequiredError(
|
|
"id",
|
|
"Required parameter requestParameters.id was null or undefined when calling getMatchRounds."
|
|
);
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
const response = await this.request(
|
|
{
|
|
path: `/match/{id}/rounds`.replace(
|
|
`{${"id"}}`,
|
|
encodeURIComponent(String(requestParameters.id))
|
|
),
|
|
method: "GET",
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
},
|
|
initOverrides
|
|
);
|
|
|
|
return new runtime.JSONApiResponse<any>(response);
|
|
}
|
|
|
|
/**
|
|
* Get match-rounds by MatchID
|
|
* gets match-rounds by MatchID
|
|
*/
|
|
async getMatchRounds(
|
|
requestParameters: GetMatchRoundsRequest,
|
|
initOverrides?: RequestInit
|
|
): Promise<{ [key: string]: { [key: string]: Array<number> } }> {
|
|
const response = await this.getMatchRoundsRaw(
|
|
requestParameters,
|
|
initOverrides
|
|
);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Get match-weapons by MatchID
|
|
* gets match-weapons by MatchID
|
|
*/
|
|
async getMatchWeaponsRaw(
|
|
requestParameters: GetMatchWeaponsRequest,
|
|
initOverrides?: RequestInit
|
|
): Promise<runtime.ApiResponse<MatchWeapons>> {
|
|
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
throw new runtime.RequiredError(
|
|
"id",
|
|
"Required parameter requestParameters.id was null or undefined when calling getMatchWeapons."
|
|
);
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
const response = await this.request(
|
|
{
|
|
path: `/match/{id}/weapons`.replace(
|
|
`{${"id"}}`,
|
|
encodeURIComponent(String(requestParameters.id))
|
|
),
|
|
method: "GET",
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
},
|
|
initOverrides
|
|
);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
MatchWeaponsFromJSON(jsonValue)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get match-weapons by MatchID
|
|
* gets match-weapons by MatchID
|
|
*/
|
|
async getMatchWeapons(
|
|
requestParameters: GetMatchWeaponsRequest,
|
|
initOverrides?: RequestInit
|
|
): Promise<MatchWeapons> {
|
|
const response = await this.getMatchWeaponsRaw(
|
|
requestParameters,
|
|
initOverrides
|
|
);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Get last 10 matches
|
|
* gets matches
|
|
*/
|
|
async getMatchesRaw(
|
|
requestParameters: GetMatchesRequest,
|
|
initOverrides?: RequestInit
|
|
): Promise<runtime.ApiResponse<Match>> {
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters.after !== undefined) {
|
|
queryParameters["after"] = requestParameters.after;
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
const response = await this.request(
|
|
{
|
|
path: `/matches`,
|
|
method: "GET",
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
},
|
|
initOverrides
|
|
);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
MatchFromJSON(jsonValue)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get last 10 matches
|
|
* gets matches
|
|
*/
|
|
async getMatches(
|
|
requestParameters: GetMatchesRequest = {},
|
|
initOverrides?: RequestInit
|
|
): Promise<Match> {
|
|
const response = await this.getMatchesRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @export
|
|
* @enum {string}
|
|
*/
|
|
export enum GetMatchChatTranslatedEnum {
|
|
NUMBER_0 = 0,
|
|
NUMBER_1 = 1,
|
|
}
|