# all files / lib/Endpoints/LeagueEndpoint/ LeaguePositionsEndpointV4.js

100% Statements 10/10
100% Branches 0/0
100% Functions 3/3
100% Lines 10/10

    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
    621×
    1×
    1×

    5×

    5×

    5×

    5×

    1×

    3×

    1×
     import LeagueSuperclass from './LeagueSuperclass'
    import Request from 'RequestClient/Request'
    import METHOD_NAMES from 'Enums/method-names'

    class LeaguePositionsEndpointV4 extends LeagueSuperclass {
        constructor(config, limiter) {
            super()

            this.config = config

            this.by = {
                summonerID: this.summonerID.bind(this),
            }

            this.list = this.listLeagueEntries.bind(this)

            this.limiter = limiter
        }

        /**
         * Get league positions in all queues for a given summoner ID.
         *
         * Implements GET `/lol/league/v4/positions/by-summoner/{encryptedSummonerId}`.
         *
         * @param {string} summonerID - The ID of the summoner.
         */
        summonerID(summonerID) {
            return new Request(
                this.config,
                this.serviceName,
                `positions/by-summoner/${summonerID}`,
                METHOD_NAMES.LEAGUE.GET_ALL_LEAGUE_POSITIONS_FOR_SUMMONER_V4,
                'GET',
                this.limiter,
                null,
                false,
                4,
            )
        }

        /**
         * Get all the positional league entries.
         *
         * Implements GET `/lol/league/v4/positions/{positionalQueue}/{tier}/{division}/{position}/{page}`.
         */
        listLeagueEntries(positionalQueue, tier, division, position, page) {
            return new Request(
                this.config,
                this.serviceName,
                `positions/${positionalQueue}/${tier}/${division}/${position}/${page}`,
                METHOD_NAMES.LEAGUE.GET_ALL_POSITIONAL_LEAGUE_ENTRIES_V4,
                'GET',
                this.limiter,
                null,
                false,
                4,
            )
        }
    }

    export default LeaguePositionsEndpointV4