From e850f0d9bbf149e0238d6ce07cfaddeca731baa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EB=8B=A4=ED=98=84=20=28Dahyeon=20Park=29?= Date: Wed, 15 Apr 2026 01:30:17 +0900 Subject: [PATCH] feat(riot): introduce core Riot API types --- apps/api/src/modules/riot/riot.types.ts | 169 ++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 apps/api/src/modules/riot/riot.types.ts diff --git a/apps/api/src/modules/riot/riot.types.ts b/apps/api/src/modules/riot/riot.types.ts new file mode 100644 index 00000000..55c9eafb --- /dev/null +++ b/apps/api/src/modules/riot/riot.types.ts @@ -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; + signal?: AbortSignal; +} + +export type RiotResponseParser = (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 { + 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 { + 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 { + 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; +}