2020-10-04 15:30:04 +00:00
|
|
|
import LeagueEndpoint from './Endpoints/LeagueEndpoint'
|
|
|
|
|
import MatchEndpoint from './Endpoints/MatchEndpoint'
|
|
|
|
|
import MatchlistEndpoint from './Endpoints/MatchlistEndpoint'
|
|
|
|
|
import SummonerEndpoint from './Endpoints/SummonerEndpoint'
|
|
|
|
|
import SpectatorEndpoint from './Endpoints/SpectatorEndpoint'
|
|
|
|
|
import CDragonEndpoint from './Endpoints/CDragonEndpoint'
|
|
|
|
|
import { JaxConfig } from '../JaxConfig'
|
2020-10-10 20:39:13 +00:00
|
|
|
// import { RiotRateLimiter } from '@fightmegg/riot-rate-limiter'
|
|
|
|
|
import RiotRateLimiter from 'riot-ratelimiter'
|
|
|
|
|
import { STRATEGY } from 'riot-ratelimiter/dist/RateLimiter'
|
2020-10-04 15:30:04 +00:00
|
|
|
|
|
|
|
|
export default class Jax {
|
|
|
|
|
public key: string
|
|
|
|
|
public limiter: RiotRateLimiter
|
|
|
|
|
public config: JaxConfig
|
|
|
|
|
public League: LeagueEndpoint
|
|
|
|
|
public Match: MatchEndpoint
|
|
|
|
|
public Matchlist: MatchlistEndpoint
|
|
|
|
|
public Spectator: SpectatorEndpoint
|
|
|
|
|
public Summoner: SummonerEndpoint
|
|
|
|
|
public CDragon: CDragonEndpoint
|
|
|
|
|
|
|
|
|
|
constructor (config:JaxConfig) {
|
|
|
|
|
this.key = config.key
|
2020-10-10 20:39:13 +00:00
|
|
|
// this.limiter = new RiotRateLimiter({
|
|
|
|
|
// debug: true,
|
|
|
|
|
// retryCount: 0,
|
|
|
|
|
// })
|
2020-10-04 15:30:04 +00:00
|
|
|
this.limiter = new RiotRateLimiter({
|
2020-10-10 20:39:13 +00:00
|
|
|
debug: false,
|
|
|
|
|
strategy: STRATEGY.SPREAD,
|
2020-10-04 15:30:04 +00:00
|
|
|
})
|
|
|
|
|
this.config = config
|
|
|
|
|
|
|
|
|
|
this.League = new LeagueEndpoint(this.config, this.limiter)
|
|
|
|
|
this.Match = new MatchEndpoint(this.config, this.limiter)
|
|
|
|
|
this.Matchlist = new MatchlistEndpoint(this.config, this.limiter)
|
|
|
|
|
this.Spectator = new SpectatorEndpoint(this.config, this.limiter)
|
|
|
|
|
this.Summoner = new SummonerEndpoint(this.config, this.limiter)
|
|
|
|
|
this.CDragon = new CDragonEndpoint(this.config)
|
|
|
|
|
}
|
|
|
|
|
}
|