feat(api): introduce core Riot API types
This commit is contained in:
1 parent
e3da5d83b6
commit
af9fa2aa49
1 file changed
+169
@@ -0,0 +1,169 @@
|
|||||||
|
export type RiotRegionalRoute = 'americas' | 'asia' | 'europe' | 'sea';
|
||||||
|
export type RiotMatchType = 'ranked' | 'normal' | 'tourney' | 'tutorial';
|
||||||
|
|
||||||
|
export interface RiotAccountApiResponse {
|
||||||
|
puuid: string;
|
||||||
|
gameName?: string;
|
||||||
|
tagLine?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotAccountDto {
|
||||||
|
puuid: string;
|
||||||
|
gameName: string | null;
|
||||||
|
tagLine: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotRequestOptions {
|
||||||
|
region?: RiotRegionalRoute;
|
||||||
|
query?: Record<string, string | number | boolean | undefined>;
|
||||||
|
signal?: AbortSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RiotResponseParser<T> = (value: unknown) => T;
|
||||||
|
|
||||||
|
export interface RiotApiErrorBody {
|
||||||
|
status?: {
|
||||||
|
message?: string;
|
||||||
|
status_code?: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotAccountLookupOptions {
|
||||||
|
region?: RiotRegionalRoute;
|
||||||
|
signal?: AbortSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchLookupOptions {
|
||||||
|
region?: RiotRegionalRoute;
|
||||||
|
signal?: AbortSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchIdsLookupOptions extends RiotMatchLookupOptions {
|
||||||
|
start?: number;
|
||||||
|
count?: number;
|
||||||
|
queue?: number;
|
||||||
|
type?: RiotMatchType;
|
||||||
|
startTime?: number;
|
||||||
|
endTime?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchDto {
|
||||||
|
metadata: RiotMatchMetadataDto;
|
||||||
|
info: RiotMatchInfoDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchMetadataDto {
|
||||||
|
dataVersion: string;
|
||||||
|
matchId: string;
|
||||||
|
participants: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchInfoDto extends Record<string, unknown> {
|
||||||
|
endOfGameResult?: string;
|
||||||
|
gameCreation: number;
|
||||||
|
gameDuration: number;
|
||||||
|
gameEndTimestamp?: number;
|
||||||
|
gameId: number;
|
||||||
|
gameMode: string;
|
||||||
|
gameName: string;
|
||||||
|
gameStartTimestamp: number;
|
||||||
|
gameType: string;
|
||||||
|
gameVersion: string;
|
||||||
|
mapId: number;
|
||||||
|
participants: RiotMatchParticipantDto[];
|
||||||
|
platformId: string;
|
||||||
|
queueId: number;
|
||||||
|
teams: RiotMatchTeamDto[];
|
||||||
|
tournamentCode?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchParticipantDto extends Record<string, unknown> {
|
||||||
|
assists: number;
|
||||||
|
champExperience: number;
|
||||||
|
champLevel: number;
|
||||||
|
championId: number;
|
||||||
|
championName: string;
|
||||||
|
deaths: number;
|
||||||
|
goldEarned: number;
|
||||||
|
goldSpent: number;
|
||||||
|
individualPosition: string;
|
||||||
|
item0: number;
|
||||||
|
item1: number;
|
||||||
|
item2: number;
|
||||||
|
item3: number;
|
||||||
|
item4: number;
|
||||||
|
item5: number;
|
||||||
|
item6: number;
|
||||||
|
kills: number;
|
||||||
|
neutralMinionsKilled: number;
|
||||||
|
participantId: number;
|
||||||
|
perks: RiotMatchPerksDto;
|
||||||
|
puuid: string;
|
||||||
|
riotIdGameName?: string;
|
||||||
|
riotIdTagLine?: string;
|
||||||
|
summoner1Id: number;
|
||||||
|
summoner2Id: number;
|
||||||
|
summonerId: string;
|
||||||
|
summonerLevel: number;
|
||||||
|
summonerName: string;
|
||||||
|
teamId: number;
|
||||||
|
teamPosition: string;
|
||||||
|
timePlayed: number;
|
||||||
|
totalDamageDealtToChampions: number;
|
||||||
|
totalDamageTaken: number;
|
||||||
|
totalMinionsKilled: number;
|
||||||
|
visionScore: number;
|
||||||
|
wardsKilled: number;
|
||||||
|
wardsPlaced: number;
|
||||||
|
win: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchPerksDto {
|
||||||
|
statPerks: RiotMatchStatPerksDto;
|
||||||
|
styles: RiotMatchPerkStyleDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchStatPerksDto {
|
||||||
|
defense: number;
|
||||||
|
flex: number;
|
||||||
|
offense: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchPerkStyleDto {
|
||||||
|
description: string;
|
||||||
|
selections: RiotMatchPerkStyleSelectionDto[];
|
||||||
|
style: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchPerkStyleSelectionDto {
|
||||||
|
perk: number;
|
||||||
|
var1: number;
|
||||||
|
var2: number;
|
||||||
|
var3: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchTeamDto extends Record<string, unknown> {
|
||||||
|
bans: RiotMatchBanDto[];
|
||||||
|
objectives: RiotMatchObjectivesDto;
|
||||||
|
teamId: number;
|
||||||
|
win: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchBanDto {
|
||||||
|
championId: number;
|
||||||
|
pickTurn: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchObjectivesDto {
|
||||||
|
baron: RiotMatchObjectiveDto;
|
||||||
|
champion: RiotMatchObjectiveDto;
|
||||||
|
dragon: RiotMatchObjectiveDto;
|
||||||
|
inhibitor: RiotMatchObjectiveDto;
|
||||||
|
riftHerald: RiotMatchObjectiveDto;
|
||||||
|
tower: RiotMatchObjectiveDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RiotMatchObjectiveDto {
|
||||||
|
first: boolean;
|
||||||
|
kills: number;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user