npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

riotapi-grab

v1.0.2

Published

Riot games (league of legends) api library

Downloads

5

Readme

RiotAPI.grab

RiotAPI.grab is wrapper for the League of Legends public API. By default, it is written and supported in typescript. Deployment is not yet complete. Reference to this official document.

NPM

Build Status APICoverage

Installation

npm

npm i --save riotapi-grab

Quick start

const { RiotAPI, Region } = require('../lib/index.js')

const riotAPI = new RiotAPI("API key", Region.kr)

riotAPI.Status
    .getStatus()
    .then((result) => {
        /* Rate manager */
        const rateManager = result.rateManager
        /* The data is returned to result.model */
        const data = result.model

        /*
            [ 'app_rate_limit | 10/s: 0.00% used',
            'app_rate_limit_count | 600/s: 0.00% used' ] 
         */
        console.log(rateManager.getUsages())

        console.log(data.locales)
    })

    .getSummonersByName("SKT T1 Faker")
    .then((result) => {
        const data = result.model

        console.log(data.summonerLevel)
    }).catch((error) => {
        console.log(error)
    })

The result values are returned with the model and the rate manager.

result.model /* Result data */
result.rateManager /* Manager for corresponding API */

Configuration

Region

Region list. use it as a guide.

{
    br: {
        platform: 'BR1',
        host: 'br1.api.riotgames.com'
    },
    eune: {
        platform: 'EUN1',
        host: 'eun1.api.riotgames.com'
    },
    euw: {
        platform: 'EUW1',
        host: 'euw1.api.riotgames.com'
    },
    jp: {
        platform: 'JP1',
        host: 'jp1.api.riotgames.com'
    },
    kr: {
        platform: 'KR',
        host: 'kr.api.riotgames.com'
    },
    lan: {
        platform: 'LA1',
        host: 'la1.api.riotgames.com'
    },
    las: {
        platform: 'LA2',
        host: 'la2.api.riotgames.com'
    },
    na: {
        platform: 'NA1',
        host: 'na1.api.riotgames.com'
    },
    oce: {
        platform: 'OC1',
        host: 'oc1.api.riotgames.com'
    },
    tr: {
        platform: 'TR1',
        host: 'tr1.api.riotgames.com'
    },
    ru: {
        platform: 'RU',
        host: 'ru.api.riotgames.com'
    },
    pbe: {
        platform: 'PBE1',
        host: 'pbe1.api.riotgames.com'
    }
}

Request retries

If not, the timeout is 1000 ms and 3 retries by default.

const { RiotAPI, Region } = require('../lib/index.js')

const config = {
    requestOptions: {
        shouldRetry: true,

        // maximum amount of retries
        numberOfRetries: 3,

        // Required when API exponentially slow
        retryDelay: 1000
    }
}

const riotAPI = new RiotAPI("API key", Region.kr, config)

Rate Manager

Provides management of API usage and restrictions. It's not yet available, but it can be checked for monitoring.


RiotAPI.Status
    .getStatus()
    .then((result) => {
        let rateManager = result.rateManager

        /*
            [ 'app_rate_limit | 10/s: 0.00% used',
            'app_rate_limit_count | 600/s: 0.00% used' ] 
         */
        rateManager.getUsages()
    })

Methods

A list of implementations as indicated in the official document. If anything is missing, please make an issue.

/* CHAMPION-V3 */
RiotAPI.Champion.getChampions()
RiotAPI.Champion.getChampionsByID(id: number)

/* CHAMPION-MASTERY-V3 */
RiotAPI.ChampionMastery.getChampionMasteriesBySummoner(summonerID: number)
RiotAPI.ChampionMastery.getChampionMasteriesBySummonerByChampion(summonerID: number, championID: number)
RiotAPI.ChampionMastery.getChampionMasteryScoresBySummoner(summonerID: number)

/* LEAGUE-V3 */
RiotAPI.League.getChallengerLeagues(queue: string)
RiotAPI.League.getLeagues(leagueID: string)
RiotAPI.League.getMasterLeagues(queue: string)
RiotAPI.League.getPositionsBySummoner(summonerID: number)

/* MATCH-V3 */
RiotAPI.Match.getMatchIDsByTournamentCode(tournamentCode: number)
RiotAPI.Match.getMatchlistsByAccount(accountID: number)
RiotAPI.Match.getMatchs(matchID: number)
RiotAPI.Match.getMatchsByTournamentCode(matchID: number, tournamentCode: nymber)
RiotAPI.Match.getTimelinesByMatch(matchID: number)

/* SPECTATOR-V3 */
RiotAPI.Spectator.getActiveGamesBySummoner(summonerID: number)
RiotAPI.Spectator.getFeaturedGames()

/* LOL-STATUS-V3 */
RiotAPI.Status.getStatus()

/* SUMMONER-V3 */
RiotAPI.Summoner.getSummoners(summonerID: number)
RiotAPI.Summoner.getSummonersByAccount(accountID: number)
RiotAPI.Summoner.getSummonersByName(summonerName: string)

/* THIRD-PARTY-CODE-V3 */
RiotAPI.ThirdParty.getThirdPartyCodeBySummoner(summonerID: number)

/* TOURNAMENT-STUB-V3 */
RiotAPI.TournamentStub.createProviders(url: string, region: string)
RiotAPI.TournamentStub.createTournamentCodes(tournamentCode: number, count: number?, body: object?)
RiotAPI.TournamentStub.createTournaments(providerID: number, name: string)
RiotAPI.TournamentStub.getLobbyEventsByCode(tournamentCode: string)

/* TOURNAMENT-V3 */
RiotAPI.Tournament.createProviders(url: string, region: string)
RiotAPI.Tournament.createTournamentCodes(tournamentID: number, count: number?, body: object?)
RiotAPI.Tournament.createTournaments(providerID: number, name: string)
RiotAPI.Tournament.getLobbyEventsByCode(tournamentCode: string)
RiotAPI.Tournament.getTournamentCodes(tournamentCode: string)
RiotAPI.Tournament.updateTournamentCodes(tournamentCode: string, body: object?)

Setup develop

I hate to set it up and I prove it. I like making simple. So it's really simple. Just if you know how to write a typescript.

Just install dependensy library

  • npm i -g

And build for compile

  • npm run build

has not yet been written a test related code. going to add more soon.

  • test!!