GithubHelp home page GithubHelp logo

hennyumut / riot-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from serhann/riot-api

0.0 0.0 0.0 10 KB

A node.js library for fetching League of Legends data from the Riot API.

JavaScript 100.00%

riot-api's Introduction

RiotAPI

A node.js library for fetching League of Legends data from the Riot API.

Riot's API requires a API Key. More information about how to get a Key, Rate Limits and more can be found on their official Site.

Game constants like queue types, maps, game types, game modes and rune slots are explained here.

Getting started

RiotAPI is designed to be simple.

var RiotApi = require('riot-api');
var api = new RiotApi('YOUR_API_KEY_GOES_HERE');

Each Method takes an options object and a callback. The callback is always a json object, either a set of results or a status message if the call was invalid.

Methods

api.getChampions(options, callback)

Retrieve all champions currently in the game.

Options:

  • region - string - Region where to retrieve the data. If no region is given, TR will be used. Currently available regions are: NA, EUW, EUNE.
  • filter - object - (Optional) Filter the result to only get Champions who match the specific options.
  • active - boolean - Indicates if the champion is active.
  • rankedPlayEnabled - boolean - Ranked play enabled flag.
  • botEnabled - boolean - Bot enabled flag (for custom games).
  • botMmEnabled - boolean - Bot Match Made enabled flag (for Co-op vs. AI games).
  • freeToPlay - boolean - Indicates if the champion is free to play. Free to play champions are rotated periodically.
  • attackRank - int - Champion attack rank.
  • defenseRank - int - Champion defense rank.
  • difficultyRank - int - Champion difficulty rank.
  • magicRank - int - Champion magic rank.
  • id - int - Champion ID.
  • name - string - Champion name.

Result:

The Result is a array of objects containing information about the champion. An object might look like this:

{
    "botMmEnabled": false,
    "defenseRank": 4,
    "attackRank": 8,
    "id": 266,
    "rankedPlayEnabled": true,
    "name": "Aatrox",
    "botEnabled": false,
    "difficultyRank": 6,
    "active": true,
    "freeToPlay": false,
    "magicRank": 3
}

Example:

api.getChampions({
    'region': 'TR',
    'filter': {
        'freeToPlay': true
    }
}, function(data) {
    console.log('These champions are currently free to play:');
    data.forEach(function(champion) {
        console.log('Name: ' + champion.name + ', Difficulty: ' + champion.difficultyRank);
    });
});

api.getRecentGames(options, callback)

Get the recent games for summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, TR will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is a object with informations about the recent games of the given summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getChampions({
    'region': 'TR',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getLeagues(options, callback)

Retrieves leagues data for summoner, including leagues for all of summoner's teams.

Options:

  • region - string - Region where to retrieve the data. If no region is given, TR will be used. Currently available regions are: NA, EUW, EUNE, BR, TR.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.
  • queue - string - (Optional) Only recive data for the given queue type. Legal values are: RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the leagues for the given summoner. The object is the exact same object given by the default API call (except if you only want to recieve a specific queue type), which can be tested here.

Example:

api.getLeagues({
    'region': 'TR',
    'queue': 'RANKED_SOLO_5x5',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getStatsSummary(options, callback)

Get player stats summaries for summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, TR will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.
  • season - int - (Optional) If specified, stats for the given season are returned. Otherwise, stats for the current season are returned.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the stats of summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getStatsSummary({
    'region': 'TR',
    'season': 3,
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getRankedStats(options, callback)

Get ranked stats for summoner. Includes statistics for Twisted Treeline and Summoner's Rift

Options:

  • region - string - Region where to retrieve the data. If no region is given, TR will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.
  • season - int - (Optional) If specified, stats for the given season are returned. Otherwise, stats for the current season are returned.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the ranked stats of summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getRankedStats({
    'region': 'TR',
    'season': 3,
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getMasteries(options, callback)

Get mastery pages for summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, TR will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the mastery pages of summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getMasteries({
    'region': 'TR',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getRunes(options, callback)

Get rune pages for summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, TR will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the rune pages of summoner. The object is the exact same object given by the default API call, which can be tested here.

The runeSlotId fields are explained here.

Example:

api.getRunes({
    'region': 'TR',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getSummonerNamesByIds(options, callback)

Get list of summoner names by summoner IDs.

Options:

  • region - string - Region where to retrieve the data. If no region is given, TR will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerIds - array[int] - Summoner ID's.

Result:

The Result is an array with objects containing name and id of a summoner.

[
    {
        "id": 60783,
        "name": "TheOddOne"
    },
    {
        "id": 5908,
        "name": "Dyrus"
    }
]

Example:

api.getRunes({
    'region': 'TR',
    'summonerIds': [60783, 5908]
}, function(data) {
    //process data
});

api.getSummoner(options, callback)

Get basic information about summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: TR, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is an object containing basic information of a summoner.

{
    "id": 60783,
    "name": "TheOddOne",
    "profileIconId": 558,
    "summonerLevel": 30,
    "revisionDate": 1386684611000,
    "revisionDateStr": "12/10/2013 02:10 PM UTC"
}

Example:

api.getSummoner({
    'region': 'TR',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getTeams(options, callback)

Retrieves teams of summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, TR will be used. Currently available regions are: NA, EUW, EUNE, TR, BR.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the teams of summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getTeams({
    'region': 'TR',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

riot-api's People

Contributors

serhann avatar blainsmith avatar tplaindoux avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.