2019-08-31 16:42:08 +00:00
|
|
|
import RiotRateLimiter from 'riot-ratelimiter'
|
2019-08-24 14:56:55 +00:00
|
|
|
|
|
|
|
|
import SummonerEndpoint from './Endpoints/SummonerEndpoint'
|
|
|
|
|
|
2019-08-31 16:42:08 +00:00
|
|
|
import DDragonVersionEndpoint from './Endpoints/DDragonEndpoints/DDragonVersionEndpoint'
|
|
|
|
|
import DDragonChampionEndpoint from './Endpoints/DDragonEndpoints/DDragonChampionEndpoint'
|
|
|
|
|
|
2019-08-24 14:56:55 +00:00
|
|
|
class Jax {
|
|
|
|
|
constructor(key = process.env.API_KEY, region = 'euw1') {
|
2019-08-31 16:42:08 +00:00
|
|
|
return (async () => {
|
|
|
|
|
this.key = key
|
|
|
|
|
this.limiter = new RiotRateLimiter()
|
|
|
|
|
this.region = region
|
|
|
|
|
|
|
|
|
|
this.Summoner = new SummonerEndpoint(this.limiter, this.region)
|
|
|
|
|
|
|
|
|
|
this.version = (await new DDragonVersionEndpoint().list())[0]
|
|
|
|
|
|
|
|
|
|
this.DDragon = {
|
|
|
|
|
Champion: new DDragonChampionEndpoint(this.version),
|
|
|
|
|
Version: this.version
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this
|
|
|
|
|
})()
|
2019-08-24 14:56:55 +00:00
|
|
|
|
|
|
|
|
}
|
2019-08-31 16:42:08 +00:00
|
|
|
|
2019-08-24 14:56:55 +00:00
|
|
|
set regionName(regionName) {
|
|
|
|
|
this.region = regionName
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
Jax
|
|
|
|
|
}
|