node-league-api

    1.0.5 • Public • Published

    Node League API

    Promise based Riot API wrapper for node.js.

    The reason I had for building this wrapper is because I wanted an up-to-date and consistent experience with that of the Riot API. I just added hint of sugar.

    Installing

    Using npm:

    $ npm install node-league-api

    Getting Started

    Initialize the library with your Riot API key:

    const leagueAPI = require('node-league-api');
     
    const RIOT_API_KEY = 'RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';
     
    leagueAPI.init(RIOT_API_KEY);
     
    leagueAPI.getAllChampions()
        .then((response) => {
            console.log(response);
        })
        .catch((error) => {
            console.error(error);
        });

    Regions

    Setting the Default Region

    The default region for requests is NA (NA1). If you would prefer an alternative default region, then you can set it with our region constants:

    const REGION = leagueAPI.CONSTANTS.REGION;
     
    leagueAPI.init(RIOT_API_KEY, {
        defaultRegion: REGION.JAPAN
    });

    Region Constants

    constant service platform
    RUSSIA ru
    KOREA kr
    BRAZIL br
    OCEANA oc1
    JAPAN jp1
    NORTH_AMERICA na1
    EUROPE_NORTH eun1
    EUROPE_WEST euw1
    TURKEY tr1
    LATIN_AMERICA_NORTH la1
    LATIN_AMERICA_SOUTH la2

    Options Schema

    Every method in Node League API takes in an options argument. The options argument will always be the last argument.

    const options = {
        region: <String>,
        query: {
            key1: <Array|String|Boolean>
        },
        params: {
            key1: <Array|String|Boolean>
        }
    }

    This can be used to make a request to a specific region that differs from the default region:

    const REGION = leagueAPI.CONSTANTS.REGION;
     
    leagueApi.getAllChampions({
        region: REGION.EUROPE_NORTH
    });

    Or it can be used to add API specific query params from the Riot API docs:

    const REGION = leagueAPI.CONSTANTS.REGION;
     
    leagueApi.getAllChampions({
        query: {
            dataById: true,
            tags: [
                'blurb',
                'images',
                'allytips',
                'info'
            ]
        }
    });

    Node League API Methods

    CHAMPION-MASTERY-V3

    leagueAPI.getAllChampionMasteries(summonerId[, options])

    leagueAPI.getChampionMastery(summonerId[, championId[, options]])

    leagueAPI.getChampionMasteryScore(summonerId[, options])

    CHAMPION-V3

    leagueAPI.getAllChampionFlags(options)

    leagueAPI.getChampionFlags(championId[, options])

    LEAGUE-V3

    leagueAPI.getChallengerLeagues(queue[, options])

    leagueAPI.getLeague(leagueId[, options])

    leagueAPI.getMasterLeagues(queue[, options])

    leagueAPI.getSummonerPosition(summonerId[, options])

    Ranked Queue Constants

    constant ranked queue
    SOLO RANKED_SOLO_5x5
    FLEX_SR RANKED_FLEX_SR
    FLEX_TT RANKED_FLEX_TT
    const RANKED_QUEUE = leagueAPI.CONSTANTS.RANKED_QUEUE;

    LOL-STATIC-DATA-V3

    leagueAPI.getAllChampions(options)

    leagueAPI.getChampion(championId[, options])

    leagueAPI.getItems(options)

    leagueAPI.getItem(id[, options])

    leagueAPI.getLanguageStrings(options)

    leagueAPI.getLanguages(options)

    leagueAPI.getMaps(options)

    leagueAPI.getAllMasteries(options)

    leagueAPI.getMastery(masteryId[, options])

    leagueAPI.getProfileIcons(options)

    leagueAPI.getRealms(options)

    leagueAPI.getAllReforgedRunePaths(options)

    leagueAPI.getReforgedRunePath(reforgedRunePathId[, options])

    leagueAPI.getAllReforgedRunes(options)

    leagueAPI.getReforgedRune(reforgedRuneId[, options])

    leagueAPI.getAllRunes(options)

    leagueAPI.getRune(runeId[, options])

    leagueAPI.getAllSummonerSpells(options)

    leagueAPI.getSummonerSpell(summonerSpellId[, options])

    leagueAPI.getTarballLinks(options)

    MATCH-V3

    leagueAPI.getMatch(matchId[, options])

    leagueAPI.getMatchlist(accountId[, options])

    leagueAPI.getMatchTimeline(matchId[, options])

    leagueAPI.getTournamentMatchIds(tournamentCode[, options])

    leagueAPI.getMatchByTournament(matchId[, tournamentCode[, options]])

    SPECTATOR-V3

    leagueAPI.getSummonerActiveGame(summonerId[, options])

    leagueAPI.getFeaturedActiveGames(options)

    STATUS-V3

    leagueAPI.getShardStatus(options)

    SUMMONER-V3

    leagueAPI.getSummonerByName(name[, options])

    leagueAPI.getSummonerByAccountId(accountId[, options])

    leagueAPI.getSummonerBySummonerId(summonerId[, options])

    THIRD-PARTY-CODE-V3

    leagueAPI.getSummonerThirdPartyCode(summonerId[, options])

    TOURNAMENT-STUB-V3

    leagueAPI.createStubTournamentCodes(options)

    leagueAPI.getStubTournamentLobbyEvents(tournamentCode[, options])

    leagueAPI.createStubTournamentProvider(options)

    leagueAPI.createStubTournament(options)

    TOURNAMENT-V3

    leagueAPI.createTournamentCodes(options)

    leagueAPI.updateTournament(tournamentCode[, options])

    leagueAPI.getTournament(tournamentCode[, options])

    leagueAPI.getTournamentLobbyEvents(tournamentCode[, options])

    leagueAPI.createTournamentProvider(options)

    leagueAPI.createTournament(options)

    License

    MIT

    Install

    npm i node-league-api

    DownloadsWeekly Downloads

    1

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    57.2 kB

    Total Files

    24

    Last publish

    Collaborators

    • vinhvanvu