Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kindred-api

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kindred-api - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

2

package.json
{
"name": "kindred-api",
"version": "2.0.1",
"version": "2.0.2",
"description": "Kindred is a thin Node.js wrapper on top of Riot Games API for League of Legends",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,3 +20,2 @@ # Kindred

* Promise-based requests retry up to three times.
* Callback-based requests are infinite at the moment.
* Built-in parameter checks so you can hopefully refer to documentation less! :)

@@ -41,37 +40,27 @@ * Built-in, flexible caching (in-memory and redis).

* [CHAMPION-V1.2](#champion)
* [CHAMPIONMASTERY](#champion-mastery)
* [CURRENT-GAME-V1.0](#current-game)
* [FEATURED-GAMES-V1.0](#featured-games)
* [CHAMPION-MASTERY-V3](#champion-mastery)
* [CHAMPION-V3](#champion)
* [GAME-V1.3](#game)
* [LEAGUE-V2.5](#league)
* [LOL-STATIC-DATA-V1.2](#lol-static-data)
* [LOL-STATUS-V1.0](#lol-status)
* [LOL-STATUS-V3](#lol-status)
* [MASTERIES-V3](#masteries)
* [MATCH-V.2.2](#match)
* [MATCHLIST-V2.2](#matchlist)
* [RUNES-MASTERIES-V1.4](#runes-masteries)
* [RUNES-V3](#runes)
* [SPECTATOR-V3](#spectator)
* [STATIC-DATA-V3](#static-data)
* [STATS-V1.3](#stats)
* [SUMMONER-V1.4](#summoner)
* [SUMMONER-V3](#summoner)
### Champion
[docs](https://developer.riotgames.com/api-methods/#champion-v1.2)
1. **/api/lol/{region}/v1.2/champion**
* Retrieve all champions. (REST)
* getChamps({ region, id (int), options (object) }, cb)
* Namespaced Functions: *Champion.getChampions, Champion.getAll, Champion.all*
* Example 1: ```k.Champion.getAll({ region: REGIONS.KOREA }, rprint)```
2. **/api/lol/{region}/v1.2/champion/{id}**
* Retrieve champion by ID. (REST)
* getChamp({ region, id/championID (int) }, cb)
* Namespaced Functions: *Champion.getChampion, Champion.get*
* Example 1: ```k.Champion.get({ championID: 67 }, rprint)```
* Example 2: ```k.Champion.get({ championID: 67 }).then(data => console.log(data))```
* Example 3: ```k.Champion.get({ championID: 67, region: 'kr' }, rprint)```
### Champion Mastery
[docs](https://developer.riotgames.com/api-methods/#championmastery)
[docs](https://developer.riotgames.com/api-methods/#champion-mastery-v3)
1. **/championmastery/location/{location}/player/{playerId}/champion/{championId}**
* Get a champion mastery by player id and champion id. Response code 204 means there were no masteries found for given player id or player id and champion id combination. (RPC)
1. **/lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}**
* Get all champion mastery entries sorted by number of champion points descending. (RPC)
* getChampMasteries({ region = this.defaultRegion, id/summonerID/playerID (int), name (string), options (object) }, cb)
* Namespaced Functions: *ChampionMastery.getChampionMasteries, ChampionMastery.getAll, ChampionMastery.all*
* Example 1: ```k.ChampionMastery.all({ id: 20026563 }, rprint)```
* Example 2: ```k.ChampionMastery.all({ id: 20026563 }).then(data => console.log(data))```
2. **/lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}/by-champion/{championId}**
* Get a champion mastery by player id and champion id.(RPC)
* getChampMastery({ region = this.defaultRegion, playerID (int), championID (int), options (object) }, cb)

@@ -81,39 +70,24 @@ * Namespaced Functions: *ChampionMastery.getChampionMastery, ChampionMastery.get*

* Example 2: ```k.ChampionMastery.get({ playerID: 20026563, championID: 203 }).then(data => console.log(data))```
2. **/championmastery/location/{location}/player/{playerId}/champions**
* Get all champion mastery entries sorted by number of champion points descending. (RPC)
* getChampMasteries({ region = this.defaultRegion, id/summonerID/playerID (int), name (string), options (object) }, cb)
* Namespaced Functions: *ChampionMastery.getChampionMasteries, ChampionMastery.getAll, ChampionMastery.all*
* Example 1: ```k.ChampionMastery.getChampionMasteries({ id: 20026563 }, rprint)```
* Example 2: ```k.ChampionMastery.getAll({ id: 20026563 }).then(data => console.log(data))```
3. **/championmastery/location/{location}/player/{playerId}/score**
* Get a player's total champion mastery score, which is sum of individual champion mastery levels. (RPC)
3. **/lol/champion-mastery/v3/scores/by-summoner/{summonerId}**
* Get a player's total champion mastery score, which is sum of individual champion mastery levels (RPC)
* getTotalChampMasteryScore({ region = this.defaultRegion, id/summonerID/playerID (int), name (string), options (object) }, cb)
* Namespaced Functions: *ChampionMastery.getTotalChampMasteryScore, ChampionMastery.getTotalScore, ChampionMastery.totalScore, ChampionMastery.total, ChampionMastery.score*
* Example 1: ```k.ChampionMastery.totalScore({ id: 20026563 }, rprint)```
4. **/championmastery/location/{location}/player/{playerId}/topchampions**
* Get specified number of top champion mastery entries sorted by number of champion points descending. (RPC)
* getTopChamps({ region = this.defaultRegion, id/summonerID/playerID (int), name (string), options (object) }, cb)
* Namespaced Functions: *ChampionMastery.getTopChampions, ChampionMastery.top, ChampionMastery.best*
* Example 1: ```k.ChampionMastery.best({ id: 20026563 }, rprint)```
* Example 1: ```k.ChampionMastery.score({ id: 20026563 }, rprint)```
### Current Game
[docs](https://developer.riotgames.com/api-methods/#current-game-v1.0)
### Champion
[docs](https://developer.riotgames.com/api-methods/#champion-v3)
1. **/observer-mode/rest/consumer/getSpectatorGameInfo/{platformId}/{summonerId}**
* Get current game information for the given summoner ID. (REST)
* getCurrentGame({ region = this.defaultRegion, id/summonerID/playerID (int), name (str) }, cb)
* Namespaced Functions: *CurrentGame.getCurrentGame, CurrentGame.get*
* Example 1: ```k.CurrentGame.get({ name: 'Contractz' }, rprint)```
1. **/lol/platform/v3/champions**
* Retrieve all champions.
* getChamps({ region, id (int), options (object) }, cb)
* Namespaced Functions: *Champion.getChampions, Champion.getAll, Champion.all*
* Example 1: ```k.Champion.all({ region: REGIONS.KOREA }, rprint)```
2. **/lol/platform/v3/champions/{id}**
* Retrieve champion by ID.
* getChamp({ region, id/championID (int) }, cb)
* Namespaced Functions: *Champion.getChampion, Champion.get*
* Example 1: ```k.Champion.get({ championID: 67 }, rprint)```
* Example 2: ```k.Champion.get({ championID: 67 }).then(data => console.log(data))```
* Example 3: ```k.Champion.get({ championID: 67, region: 'kr' }, rprint)```
### Featured Games
[docs](https://developer.riotgames.com/api-methods/#featured-games-v1.0)
1. **/observer-mode/rest/featured**
* Get list of featured games. (REST)
* getFeaturedGames({ region }, cb)
* Namespaced Functions: *FeaturedGames.getFeaturedGames, FeaturedGames.get*
* Example 1: ```k.FeaturedGames.getFeaturedGames(rprint)```
* Example 2: ```k.FeaturedGames.get().then(data => console.log(data))```
* Example 3: ```k.FeaturedGames.get({ region: 'na' }, rprint)```
### Game

@@ -133,3 +107,3 @@ [docs](https://developer.riotgames.com/api-methods/#game-v1.3)

* Get leagues mapped by summoner ID for a given list of summoner IDs. (REST)
* getLeagues({ region, ids/summonerIDs/playerIDs ([int]/int), id/summonerID/player/ID (int), names ([str]/str), name (str) }, cb)
* getLeagues({ region, id/summonerID/player/ID (int), name (str) }, cb)
* Namespaced Functions: *League.getLeagues, League.get*

@@ -140,5 +114,5 @@ * Example 1: ```k.League.getLeagues({ summonerID: 20026563 }, rprint)```

* Get league entries mapped by summoner ID for a given list of summoner IDs. (REST)
* getLeagueEntries({ region, ids/summonerIDs/playerIDs ([int]/int), id/summonerID/playerID (int), names ([str]/str), name (str) }, cb)
* getLeagueEntries({ region, id/summonerID/playerID (int), name (str) }, cb)
* Namespaced Functions: *League.getLeagueEntries, League.getEntries, League.entries*
* Example 1: ```k.League.getEntries({ summonerID: 20026563 }, rprint)```
* Example 1: ```k.League.entries({ summonerID: 20026563 }, rprint)```
3. **/api/lol/{region}/v2.5/league/challenger**

@@ -157,62 +131,124 @@ * Get challenger tier leagues. (REST)

### LoL Static Data
[docs](https://developer.riotgames.com/api-methods/#lol-static-data-v1.2)
### LoL Status
[docs](https://developer.riotgames.com/api-methods/#lol-status-v3)
1. **/api/lol/static-data/{region}/v1.2/champion**
1. **/lol/status/v3/shard-data**
* Get League of Legends status for the given shard.
* getShardStatus({ region }, cb)
* Namespaced Functions: *Status.getShardStatus, Status.getStatus, Status.get*
* Example 1: ```k.Status.get().then(data => console.log(data))```
### Masteries
[docs](https://developer.riotgames.com/api-methods/#masteries-v3)
1. **/api/lol/{region}/v1.4/summoner/{summonerIds}/masteries**
* Get mastery pages for a given summoner ID.
* getMasteries({ region, id/summonerID/playerID (int), name (str)}, cb)
* Namespaced Functions: *RunesMasteries.getMasteries, RunesMasteries.masteries, Masteries.get*
* Example 1: ```k.Masteries.get({ id: 20026563 }, rprint)```
### Match
[docs](https://developer.riotgames.com/api-methods/#match-v2.2)
1. **/api/lol/{region}/v2.2/match/{matchId}**
* Retrieve match by match ID. (REST)
* getMatch({ region, id/matchID (int), options: { includeTimeline: true } }, cb)
* Namespaced Functions: *Match.getMatch, Match.get*
* Example 1: ```k.Match.get({ id: 1912829920 }, rprint)```
* Example 2: ```k.Match.get({ id: 1912829920, options: { includeTimeline: false } }, rprint)```
### MatchList
[docs](https://developer.riotgames.com/api-methods/#matchlist-v2.2)
1. **/api/lol/{region}/v2.2/matchlist/by-summoner/{summonerId}**
* Retrieve match list by match ID. (REST)
* getMatchList({ region, id/summonerID/playerID (int), name (str), options: { rankedQueues: 'RANKED_SOLO_5x5' } }, cb)
* Namespaced Functions: *MatchList.getMatchList, MatchList.get*
* Example 1: ```k.MatchList.get({ id: 20026563 }, rprint)```
* Example 2: ```k.MatchList.get({ id: 20026563, options: { rankedQueues: 'RANKED_FLEX_SR' } }, rprint)```
### Runes
[docs](https://developer.riotgames.com/api-methods/#runes-v3)
1. **/api/lol/{region}/v1.4/summoner/{summonerIds}/runes**
* Get rune pages for a given summoner ID.
* getRunes({ region, id/summonerID/playerID (int), name (str) }, cb)
* Namespaced Functions: *RunesMasteries.getRunes, RunesMasteries.runes, Runes.get*
* Example 1: ```k.Runes.get({ id: 20026563 }, rprint)```
### Spectator
[docs](https://developer.riotgames.com/api-methods/#spectator-v3)
1. **/lol/spectator/v3/active-games/by-summoner/{summonerId}**
* Get current game information for the given summoner ID. (REST)
* getCurrentGame({ region = this.defaultRegion, id/summonerID/playerID (int), name (str) }, cb)
* Namespaced Functions: *CurrentGame.getCurrentGame, CurrentGame.get*
* Example 1: ```k.CurrentGame.get({ name: 'Contractz' }, rprint)```
2. **/lol/spectator/v3/featured-games**
* Get list of featured games. (REST)
* getFeaturedGames({ region }, cb)
* Namespaced Functions: *FeaturedGames.getFeaturedGames, FeaturedGames.get*
* Example 1: ```k.FeaturedGames.get().then(data => console.log(data))```
* Example 2: ```k.FeaturedGames.get({ region: 'na' }, rprint)```
### Static Data
[docs](https://developer.riotgames.com/api-methods/#static-data-v3)
1. **/lol/static-data/v3/champions**
* Retrieves champion list. (REST)
* getChampionList({ region, options (object) }, cb)
* Namespaced Functions: *Static.getChampions, Static.champions*
2. **/api/lol/static-data/{region}/v1.2/champion/{id}**
2. **/lol/static-data/v3/champions/{id}**
* Retrieves a champion by its id. (REST)
* getChampion({ region, id/championID (int), options (object) }, cb)
* Namespaced Functions: *Static.getChampion, Static.champion*
3. **/api/lol/static-data/{region}/v1.2/item**
3. **/lol/static-data/v3/items**
* Retrieves item list. (REST)
* getItems({ region, options (object) }, cb)
* Namespaced Functions: *Static.getItems, Static.items*
4. **/api/lol/static-data/{region}/v1.2/item/{id}**
4. **/lol/static-data/v3/items/{id}**
* Get master tier leagues. (REST)
* getItem({ region, id/itemID (int), options (object) }, cb)
* Namespaced Functions: *Static.getItem, Static.item*
5. **/api/lol/static-data/{region}/v1.2/language-strings**
5. **/lol/static-data/v3/language-strings**
* Retrieve language strings data. (REST)
* getLanguageStrings({ region, options (object) }, cb)
* Namespaced Functions: *Static.getLanguageStrings, Static.languageStrings*
6. **/api/lol/static-data/{region}/v1.2/languages**
6. **/lol/static-data/v3/languages**
* Retrieve supported languages data. (REST)
* getLanguages({ region }, cb)
* Namespaced Functions: *Static.getLanguages, Static.languages*
7. **/api/lol/static-data/{region}/v1.2/map**
7. **/lol/static-data/v3/maps**
* Retrieve map data. (REST)
* getMapData({ region, options (object) }, cb)
* Namespaced Functions: *Static.getMapData, Static.mapData, Static.map, Static.maps*
8. **/api/lol/static-data/{region}/v1.2/mastery**
8. **/lol/static-data/v3/masteries**
* Retrieve mastery list. (REST)
* getMasteryList({ region, options (object) }, cb)
* Namespaced Functions: *Static.getMasteries, Static.masteries*
9. **/api/lol/static-data/{region}/v1.2/mastery/{id}**
9. **/lol/static-data/v3/masteries/{id}**
* Retrieves mastery item by its unique id. (REST)
* getMastery({ region, id/masteryID (int), options (object) }, cb)
* Namespaced Functions: *Static.getMastery, Static.mastery*
10. **/api/lol/static-data/{region}/v1.2/realm**
10. **/lol/static-data/v3/profile-icons**
11. **/lol/static-data/v3/realms**
* Retrieve realm data. (REST)
* getRealmData({ region }, cb)
* Namespaced Functions: *Static.getRealmData, Static.realmData, Static.realm, Static.realms*
11. **/api/lol/static-data/{region}/v1.2/rune**
12. **/lol/static-data/v3/runes**
* Retrieves rune list. (REST)
* getRuneList({ region, options (object) }, cb)
* Namespaced Functions: *Static.getRunes, Static.runes*
12. **/api/lol/static-data/{region}/v1.2/rune/{id}**
13. **/lol/static-data/v3/runes/{id}**
* Retrieves rune by its unique id. (REST)
* getRune({ region, id/runeID (int), options (object) }, cb)
* Namespaced Functions: *Static.getRune, Static.rune*
13. **/api/lol/static-data/{region}/v1.2/summoner-spell**
14. **/lol/static-data/v3/summoner-spells**
* Retrieves summoner spell list. (REST)
* getSummonerSpells({ region, options (object) }, cb)
* Namespaced Functions: *Static.getSummonerSpells, Static.summonerSpells, Static.spells*
14. **/api/lol/static-data/{region}/v1.2/summoner-spell/{id}**
15. **/lol/static-data/v3/summoner-spells/{id}**
* Retrieves summoner spell by its unique id. (REST)
* getSummonerSpell({ region, id/spellID/summonerSpellID (int), options (object) }, cb)
* Namespaced Functions: *Static.getSummonerSpell, Static.summonerSpell, Static.spell*
15. **/api/lol/static-data/{region}/v1.2/versions**
16. **/lol/static-data/v3/versions**
* Retrieve version data. (REST)

@@ -222,52 +258,2 @@ * getVersionData({ region, options (object) }, cb)

### LoL Status
[docs](https://developer.riotgames.com/api-methods/#lol-status-v1.0)
1. **/lol/status/v1/shard**
* Get shard status. Returns the data available on the status.leagueoflegends.com website for the given region. (REST)
* getShardStatus({ region }, cb)
* Namespaced Functions: *Status.getShardStatus, Status.getStatus, Status.get*
* Example 1: ```k.Status.get().then(data => console.log(data))```
2. **/lol/status/v1/shards**
* Get shard list. (REST)
* getShardList({ region }, cb)
* Namepsaced Functions: *Status.getShardList, Status.getShards, Status.getAll, Status.all*
* Example 1: ```k.Status.all().then(data => console.log(data))```
### Match
[docs](https://developer.riotgames.com/api-methods/#match-v2.2)
1. **/api/lol/{region}/v2.2/match/{matchId}**
* Retrieve match by match ID. (REST)
* getMatch({ region, id/matchID (int), options: { includeTimeline: true } }, cb)
* Namespaced Functions: *Match.getMatch, Match.get*
* Example 1: ```k.Match.get({ id: 1912829920 }, rprint)```
* Example 2: ```k.Match.get({ id: 1912829920, options: { includeTimeline: false } }, rprint)```
### MatchList
[docs](https://developer.riotgames.com/api-methods/#matchlist-v2.2)
1. **/api/lol/{region}/v2.2/matchlist/by-summoner/{summonerId}**
* Retrieve match list by match ID. (REST)
* getMatchList({ region, id/summonerID/playerID (int), name (str), options: { rankedQueues: 'RANKED_SOLO_5x5' } }, cb)
* Namespaced Functions: *MatchList.getMatchList, MatchList.get*
* Example 1: ```k.MatchList.get({ id: 20026563 }, rprint)```
* Example 2: ```k.MatchList.get({ id: 20026563, options: { rankedQueues: 'RANKED_FLEX_SR' } }, rprint)```
### Runes Masteries
[docs](https://developer.riotgames.com/api-methods/#runes-masteries-v1.4)
1. **/api/lol/{region}/v1.4/summoner/{summonerIds}/masteries**
* Get mastery pages mapped by summoner ID for a given list of summoner IDs. (REST)
* getMasteries({ region, ids/summonerIDs/playerIDs ([int]/int), id/summonerID/playerID (int), names ([str]/str), name (str)}, cb)
* Namespaced Functions: *RunesMasteries.getRunes, RunesMasteries.runes, Runes.get*
* Example 1: ```k.RunesMasteries.runes({ id: 20026563 }, rprint)```
* Example 2: ```k.Runes.get({ id: 20026563 }, rprint)```
2. **/api/lol/{region}/v1.4/summoner/{summonerIds}/runes**
* Retrieve match list by match ID. (REST)
* getRunes({ region, ids/summonerIDs/playerIDs ([int]/int), id/summonerID/playerID (int), names ([str]/str), name (str) }, cb)
* Namespaced Functions: *RunesMasteries.getMasteries, RunesMasteries.masteries, Masteries.get*
* Example 1: ```k.RunesMasteries.masteries({ id: 20026563 }, rprint)```
* Example 2: ```k.Masteries.get({ id: 20026563 }, rprint)```
### Stats

@@ -289,3 +275,3 @@ [docs](https://developer.riotgames.com/api-methods/#stats-v1.3)

### Summoner
[docs](https://developer.riotgames.com/api-methods/#summoner-v1.4)
[docs](https://developer.riotgames.com/api-methods/#summoner-v3)

@@ -295,25 +281,13 @@ 1. **/api/lol/{region}/v1.4/summoner/by-account/{accountIds}**

* N/A
2. **/api/lol/{region}/v1.4/summoner/by-name/{summonerNames}**
* Get a list of summoners by summoner names. (RPC)
* getSummoners({ region, ids/summonerIDs/playerIDs ([int]/int), id (int), names ([str]/ str), name (str) }, cb)
2. **/lol/summoner/v3/summoners/by-name/{summonerName}**, **/lol/summoner/v3/summoners/{summonerId}**
* Get a summoner by summoner name, Get a summoner by summoner id
* getSummoners({ region, name (str) }, cb)
* getSummoner({ region, id (int), name (str) }, cb)
* Namespaced Functions: *Summoner.getSummoners, Summoner.getAll, Summoner.all, Summoner.getSummoner, Summoner.get*
* Example 1: ```k.Summoner.get({ name: 'caaaaaaaaarIa' }, rprint)```
* Example 2: ```k.Summoner.all({ names: ['caaaaaaaaarIa', 'Contractz'] }, rprint)```
3. **/api/lol/{region}/v1.4/summoner/{summonerIds}**
* Get challenger tier leagues. (REST)
* getSummoners({ region, ids/summonerIDs/playerIDs ([int]/int), id (int), names ([str]/ str), name (str) }, cb)
* getSummoner({ region, id (int), name (str) }, cb)
* Namespaced Functions: *Summoner.getSummoners, Summoner.getAll, Summoner.all, Summoner.getSummoner, Summoner.get*
* Example 1: ```k.Summoner.get({ id: 20026563 }, rprint)```
* Example 2: ```k.Summoner.getAll({ ids: [20026563, 32932398] }, rprint)```
4. **/api/lol/{region}/v1.4/summoner/{summonerIds}/name**
* Get master tier leagues. (REST)
* getSummonerNames({ region, ids/summonerIDs/playerIDs ([int]/int), id/summonerID/playerID (int) }, cb)
* getSummonerName({ region, id/summonerID/playerID (int) }, cb)
* Namespaced Functions: *Summoner.getSummonerNames, Summoner.getNames, Summoner.names, Summoner.getSummonerName, Summoner.getName, Summoner.name*
* Example 1: ```k.Summoner.names({ ids: [20026563, 32932398] }, rprint)```
* Example 2: ```k.Summoner.get({ id: 20026563 }, rprint)```
## Quickstart
Debug on, dev key rate limiting per region, in-memory cache with default settings on for quick scripts
```javascript

@@ -338,12 +312,20 @@ var KindredAPI = require('kindred-api')

rankedQueues: ['RANKED_SOLO_5x5', 'RANKED_FLEX_SR'], // no need for joins or messy strings
championIDs: '67'
}
championIDs: '67' // single values can be integers as well
} // option params should be spelled and capitalized the same as it is in Riot's docs!
}
k.getSummoner({ name, region: opts.region })
.then(data => k.getMatchList(
Object.assign({ id: data[name].id }, opts)
k.Summoner.get({ name: name, region: opts.region })
.then(data => k.MatchList.get(
Object.assign({ id: data.id }, opts)
))
.then(data => console.log(data))
.catch(err => console.err(error))
/*
Instead of chaining requests like in the above, you can simply call
k.MatchList.get with the `name` param.
*/
k.MatchList.get({ name: name, options: opts.options })
.then(data => console.log(data))
.catch(err => console.error(err))
```

@@ -392,7 +374,6 @@

k.Summoner.get({ id: 354959 }, rprint)
k.Summoner.name({ id: 354959 }, rprint)
k.Summoner.get({ id: 354959 }).then(data => console.log(data))
k.Match.get({ id: 2459973154, options: {
includeTimeline: false
includeTimeline: false // of course, option params must be the same as the ones in Riot Docs
}}, rprint)

@@ -418,17 +399,7 @@

*/
k.getSummoner(rprint)
// getSummoners request FAILED; required params `ids` (array of ints), `id` (int), `names` (array of strings), or `name` (string) not passed in
k.Summoner.get(rprint)
// same as above
k.getSummoner(rprint)
// getSummoner request FAILED; required params `id` (int) or `name` (string) not passed in
k.getTopChamps(rprint)
// getTopChamps request FAILED; required params `id` (int) or `playerID` (int) not passed in
k.getChampMastery(rprint)
k.ChampionMastery.get(rprint)
// getChampMastery request FAILED; required params `playerID` (int) AND `championID` (int) not passed in
k.ChampionMastery.get(rprint)
// same as above

@@ -446,70 +417,36 @@ /*

*/
k.getChallengers(rprint) // default region, default solo queue mode, valid
k.League.challengers(rprint) // same as above
k.League.challengers(rprint) // default region, default solo queue mode, valid
k.getRuneList(rprint) // only optional arguments & not passing in any optional arguments, valid
k.Static.runes(rprint)
k.Static.runes(rprint) // only optional arguments & not passing in any optional arguments, valid
/*
I have recently added namespacing to the methods.
All the namespaces are named after the official endpoint names (there
are shorthand ones too).
*/
k.League.getChallengers(rprint)
k.League.challengers(rprint)
k.League.challengers()
.then(data => console.log(data))
.catch(err => console.error(err))
/*
getSummoners & getSummoner target both the by-name and by-id endpoints.
In the case of the summoner endpoints, it made a lot more sense for the two
functions to target both the by-name and by-id summoner endpoints.
The example above targets the by-name endpoint, while
the example below targets the by-id endpoint.
*/
k.getSummoner({ id: 354959 }, rprint)
k.Summoner.getSummoner({ id: 354959 }, rprint)
k.Summoner.get({ name: 'Contractz' }, rprint)
k.Summoner.get({ id: 354959 }, rprint)
/*
The 'id', 'ids', 'name', and 'names' parameters
stay consistent throughout the API but for the one
exception above. However, I do have aliases for them.
There are aliases for the `id` param.
For example, for summoners, you have summonerID, summonerIDs,
playerID, and playerIDs.
Plural parameters can take in both arrays and singular values.
Single parameters, however, can only take singular values.
*/
k.getSummoner({ summonerID: 354959 }, rprint)
k.Summoner.get({ summonerID: 354959 }, rprint)
k.getSummoner({ summonerID: 354959 })
k.Summoner.get({ summonerID: 354959 })
.then(json => console.log(json))
.catch(err => console.log(err))
k.getSummoners({ summonerIDs: [354959, 21542029] }, rprint)
k.getMatch({ id: 2459973154 }, rprint)
k.getMatch({ matchID: 2459973154 }, rprint)
k.Match.get({ id: 2459973154 }, rprint)
k.Match.get({ id: 2459973154 })
k.Match.get({ matchID: 2459973154 })
.then(data => console.log(data))
.catch(err => console.error(err))
var names = ['beautifulkorean', 'c9gun', 'caaaaaaaaarIa']
k.Summoner.getAll({ names }, rprint) // getSummoners
var ids = [22059766, 20026563, 44989337]
k.Summoner.names({ ids }, rprint)
k.getSummoners({ names: 'caaaaaaaaaria' }, rprint)
k.getSummoners({ name: 'caaaaaaaaaria' }, rprint)
/* Every method has an optional 'region' parameter. */
var params = { name: 'sktt1peanut', region: REGIONS.KOREA }
k.getSummoner(params, rprint) // peanut's data
k.Summoner.get(params, rprint) // peanut's data

@@ -522,16 +459,6 @@ /* Changing the default region! */

var fakerId
k.getSummoner(fakerIgn, function (err, data) {
/*
But you should sanitize the name if you want to access the dictionary.
{ hideonbush:
{ id: 4460427,
name: 'Hide on bush',
profileIconId: 6,
revisionDate: 1490355284000,
summonerLevel: 30 } }
*/
fakerId = data[fakerIgn.name.replace(/\s/g, '').toLowerCase()].id
k.Summoner.get(fakerIgn, function (err, data) {
fakerId = data.id
console.log('fakerId:', fakerId)
}) // faker's data
})

@@ -545,44 +472,38 @@ /*

k.getRunes({ ids: [354959, 21542029] }, rprint)
k.getRunes({ id: 354959 }, rprint)
k.getRunes({ ids: 354959 }, rprint)
k.Runes.get({ id: 354959 }, rprint)
k.getRunes({ id: 354959 })
k.Runes.get({ id: 354959 })
.then(json => console.log(json))
.catch(err => console.error(err))
k.Runes.get({ id: 354959 })
.then(json => console.log(json))
.catch(err => console.log(err))
/*
But what if you want to quickly get the rune pages given
that you have a list of names?
But what if you want to quickly get the rune page of
some random summoner given their name?
You'd chain it like in many other clients:
Get the ids from the names, get the runes from the ids.
Get the id from the name, get the runes from the id.
*/
names = ['Richelle', 'Grigne']
k.getSummoners({ names }, function (err, data) {
var ids = []
for (var name of names)
ids.push(data[name.replace(/\s/g, '').toLowerCase()].id)
k.getRunes({ ids }, rprint)
var name = 'Richelle'
k.Summoner.get({ name }, function (err, data) {
if (data) k.Runes.get({ id: data.id }, rprint)
else console.err(err)
})
// or with promises
k.Summoner.get({ name })
.then(data => k.Runes.get({ id: data.id }))
.then(data => console.log(data))
.catch(err => console.log(err))
/* I find that inconvenient, and so I just chain it for you in my code. */
// all methods that target endpoints that only accept ids
k.getRunes({ names: ['Richelle', 'Grigne'] }, rprint)
k.getRunes({ name: 'Richelle' }, rprint)
k.getRecentGames({ name: 'Richelle' }, rprint)
k.getLeagues({ names: ['Richelle', 'Grigne'] }, rprint)
k.Runes.get({ name: 'Richelle' }, rprint)
k.Game.get({ name: 'Richelle' }, rprint)
k.League.get({ name: '5tunt' }, rprint)
k.getCurrentGame({ name: 'Fràe', region: REGIONS.OCEANIA }, rprint)
k.getLeagues({ names: ['Richelle', 'Grigne'] })
k.CurrentGame.get({ name: 'Fràe', region: REGIONS.OCEANIA }, rprint)
k.League.get({ name: '5tunt' })
.then(data => console.log(data))
var name = 'Grigne'
k.RunesMasteries.runes({ name })
.then(data => console.log(data))
k.Runes.get({ name })

@@ -605,4 +526,4 @@ .then(data => console.log(data))

*/
k.getChallengers({ region: 'na' }, rprint) // get challengers from ranked solo queue ladder
k.getChallengers({ region: 'na', options: {
k.League.challengers({ region: 'na' }, rprint) // get challengers from ranked solo queue ladder
k.League.challengers({ region: 'na', options: {
type: 'RANKED_FLEX_SR'

@@ -619,27 +540,23 @@ }}, rprint) // get challengers from ranked flex ladder

var name = 'caaaaaaaaaria'
k.getSummoners({ region: 'na', names: name }, function (err, data) {
if (data) {
k.getMatchList({ region: 'na', id: data[name].id, options: {
/*
According to Riot API, query parameters that can accept multiple values
must be a comma separated list (or a single value), which is why one can do the below join.
k.MatchList.get({ name, region: 'na', options: {
/*
According to Riot API, query parameters that can accept multiple values
must be a comma separated list (or a single value), which is why one can do the below join.
However, both these options are inconvenient, and so I check if you pass in array values
for every option parameter, and manually join it for you. You can still pass in string values
if you want though.
However, both these options are inconvenient, and so I check if you pass in array values
for every option parameter, and manually join it for you. You can still pass in string values
if you want though.
Note, for arrays of values that are conceptually integers,
both strings and integers work because they're joined together as a string anyways.
*/
// rankedQueues: ['RANKED_SOLO_5x5', 'RANKED_FLEX_SR'].join(','), STILL VALID
// championIds: '67' // '267,67' or ['267', '67'].join(',') STILL VALID
rankedQueues: ['RANKED_SOLO_5x5', 'RANKED_FLEX_SR'], // valid
championIDs: [67, 62, '61'] // valid
} }, rprint)
}
})
Note, for arrays of values that are conceptually integers,
both strings and integers work because they're joined together as a string anyways.
*/
// rankedQueues: ['RANKED_SOLO_5x5', 'RANKED_FLEX_SR'].join(','), STILL VALID
// championIds: '67' // '267,67' or ['267', '67'].join(',') STILL VALID
rankedQueues: ['RANKED_SOLO_5x5', 'RANKED_FLEX_SR'], // valid
championIDs: [67, 62, '61'] // valid
} }, rprint)
/* The above example with promises. */
var name = 'caaaaaaaaaria'
var opts = {
name: 'caaaaaaaaaria',
region: 'na',

@@ -652,11 +569,7 @@ options: {

k.getSummoner({ name, region: opts.region })
.then(data => k.getMatchList(
Object.assign({ id: data[name].id }, opts)
))
.then(data => console.log(data))
.catch(err => console.err(error))
k.MatchList.get({ name: opts.name, region: opts.region, options: opts.options })
.then(data => console.log(data))
.catch(err => console.err(error))
var furyMasteryId = 6111
k.getMastery({ id: furyMasteryId }, rprint)
k.Static.mastery({ id: furyMasteryId }, rprint)

@@ -663,0 +576,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc