lol-api-client
Version:
A Node client for interfacing with the League of Legends API
37 lines (28 loc) • 1.08 kB
JavaScript
const web = require('./web')
class ChampionMastery {
constructor (apiKey, platformId, region) {
this.apiKey = apiKey
this.platformId = platformId
this.region = region
this.championMasteryUrl = `https://${this.region}.api.pvp.net/championmastery` +
`/location/${this.platformId}/player`
}
getByPlayerAndChampion (playerId, championId) {
const requestUrl = `${this.championMasteryUrl}/${playerId}/champion/${championId}?api_key=${this.apiKey}`
return web.makeRequest(requestUrl)
}
getAllByPlayer (playerId) {
const requestUrl = `${this.championMasteryUrl}/${playerId}/champions?api_key=${this.apiKey}`
return web.makeRequest(requestUrl)
}
getScore (playerId) {
const requestUrl = `${this.championMasteryUrl}/${playerId}/score?api_key=${this.apiKey}`
return web.makeRequest(requestUrl)
}
getTopChampions (playerId) {
const requestUrl = `${this.championMasteryUrl}/${playerId}/topchampions?api_key=${this.apiKey}`
return web.makeRequest(requestUrl)
}
}
module.exports = ChampionMastery