1.0.5 • Published 6 years ago

node-league-api v1.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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

constantservice platform
RUSSIAru
KOREAkr
BRAZILbr
OCEANAoc1
JAPANjp1
NORTH_AMERICAna1
EUROPE_NORTHeun1
EUROPE_WESTeuw1
TURKEYtr1
LATIN_AMERICA_NORTHla1
LATIN_AMERICA_SOUTHla2

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

constantranked queue
SOLORANKED_SOLO_5x5
FLEX_SRRANKED_FLEX_SR
FLEX_TTRANKED_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

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago