all files / lib/Endpoints/ ChampionEndpoint.js

69.23% Statements 9/13
100% Branches 0/0
33.33% Functions 1/3
69.23% Lines 9/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65                                                                                                                
import PlatformSuperclass from './PlatformSuperclass'
import Request from 'RequestClient/Request'
import METHOD_NAMES from 'Enums/method-names'
 
class ChampionEndpoint extends PlatformSuperclass {
    constructor(config, limiter) {
        super()
 
        this.config = config
 
        this.get = this.get.bind(this)
        this.list = this.list.bind(this)
 
        this.serviceName = 'platform'
 
        this.limiter = limiter
    }
 
    /**
     * Retrieve champion by ID.
     *
     * @deprecated Deprecated on Monday, October 15, 2018.
     *
     * Implements GET `/lol/platform/v3/champions/{id}`.
     *
     * @param {number} championID - The ID of the champion.
     */
    get(championID) {
        console.warn(
            'Deprecated method. Static endpoints will be removed on October 15th.',
        )
        return new Request(
            this.config,
            this.serviceName,
            `champions/${championID}`,
            METHOD_NAMES.CHAMPION.GET_CHAMPION_BY_ID,
            'GET',
            this.limiter,
        )
    }
 
    /**
     * Retrieve all champions.
     *
     * @deprecated Deprecated on Monday, October 15, 2018.
     *
     * Implements GET `/lol/platform/v3/champions`.
     */
    list() {
        console.warn(
            'Deprecated method. Static endpoints will be removed on October 15th.',
        )
        return new Request(
            this.config,
            this.serviceName,
            `champions`,
            METHOD_NAMES.CHAMPION.GET_CHAMPIONS,
            'GET',
            this.limiter,
        )
    }
}
 
export default ChampionEndpoint