2020-10-10 20:39:13 +00:00
|
|
|
// import { RiotRateLimiter } from '@fightmegg/riot-rate-limiter'
|
|
|
|
|
import RiotRateLimiter from 'riot-ratelimiter'
|
2020-10-04 15:30:04 +00:00
|
|
|
import { JaxConfig } from '../../JaxConfig'
|
|
|
|
|
import JaxRequest from '../JaxRequest'
|
|
|
|
|
|
2020-10-04 20:05:16 +00:00
|
|
|
export interface LeagueEntryDTO {
|
2021-09-20 17:20:51 +00:00
|
|
|
leagueId: string
|
|
|
|
|
queueType: string
|
|
|
|
|
tier: string
|
|
|
|
|
rank: string
|
2025-08-12 20:10:58 +00:00
|
|
|
puuid: string
|
2021-09-20 17:20:51 +00:00
|
|
|
leaguePoints: number
|
|
|
|
|
wins: number
|
|
|
|
|
losses: number
|
|
|
|
|
veteran: boolean
|
|
|
|
|
inactive: boolean
|
|
|
|
|
freshBlood: boolean
|
|
|
|
|
hotStreak: boolean
|
2020-10-04 20:05:16 +00:00
|
|
|
miniSeries?: MiniSeriesDTO
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface MiniSeriesDTO {
|
2021-09-20 17:20:51 +00:00
|
|
|
losses: number
|
|
|
|
|
progress: string
|
|
|
|
|
target: number
|
2020-10-04 20:05:16 +00:00
|
|
|
wins: number
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-04 15:30:04 +00:00
|
|
|
export default class LeagueEndpoint {
|
|
|
|
|
private config: JaxConfig
|
|
|
|
|
private limiter: RiotRateLimiter
|
|
|
|
|
|
2021-09-20 17:20:51 +00:00
|
|
|
constructor(config: JaxConfig, limiter: RiotRateLimiter) {
|
2020-10-04 15:30:04 +00:00
|
|
|
this.config = config
|
|
|
|
|
this.limiter = limiter
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-12 20:10:58 +00:00
|
|
|
public puuid(puuid: string, region: string): Promise<LeagueEntryDTO[]> {
|
2020-10-04 15:30:04 +00:00
|
|
|
return new JaxRequest(
|
|
|
|
|
region,
|
|
|
|
|
this.config,
|
2025-08-12 20:10:58 +00:00
|
|
|
`league/v4/entries/by-puuid/${puuid}`,
|
2020-10-04 15:30:04 +00:00
|
|
|
this.limiter,
|
|
|
|
|
300
|
|
|
|
|
).execute()
|
|
|
|
|
}
|
|
|
|
|
}
|