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.81 to 2.0.82

4

CHANGELOG.md

@@ -9,4 +9,6 @@ From here onwards I'll try to adhere to [Semantic Versioning](http://semver.org). I kinda messed up early, and so it ended up as 2.0 (lol). Sorry guys!

## [2.0.81]() - Readjust champion/masteries/runes method limits.
## [2.0.82]() - Readjust champion/masteries/runes method limits -- should actually be 400 req / 1 min.
## [2.0.81](https://github.com/ChauTNguyen/kindred-api/commit/22a3f0065a67c5a65f1682c7d455483ada5a59e1) - Readjust champion/masteries/runes method limits.
```

@@ -13,0 +15,0 @@ now 200 requests / 1 minute

@@ -1,2 +0,2 @@

!function(e,t){if("function"==typeof define&&define.amd)define("kindred-api",["module","redis","double-ended-queue","xregexp","chalk","request","chalk","query-string"],t);else if("undefined"!=typeof exports)t(module,require("redis"),require("double-ended-queue"),require("xregexp"),require("chalk"),require("request"),require("chalk"),require("query-string"));else{var i={exports:{}};t(i,e.redis,e.doubleEndedQueue,e.xregexp,e.chalk,e.request,e.chalk,e.queryString),e.kindredApi=i.exports}}(this,function(e,t,i,n,r,s,o,a){"use strict";function u(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t,i){return"boolean"==typeof t&&(i=t,t=re),new ne({key:e,defaultRegion:t,debug:i,limits:S.DEV,cache:new E})}function l(e,t){e?console.log(e):console.log(t)}var m,g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),E=function(){function e(){h(this,e),this.cache={}}return c(e,[{key:"get",value:function(e,t){return this.cache[e.key]?Date.now()>this.cache[e.key].expires?(delete this.cache[e.key],t("expired cache key")):t(null,this.cache[e.key].value):t("cache key doesn't exist")}},{key:"set",value:function(e,t){this.cache[e.key]={expires:e.ttl?this.setExp(Date.now(),e.ttl):null,value:t}}},{key:"setExp",value:function(e,t){return e+1e3*t}}]),e}(),_=function(){function e(i){h(this,e);var n=Object.assign({host:"127.0.0.1",port:6379,keyPrefix:"kindredAPI-"},i||{});this.client=t.createClient(n.port,n.host),this.client.on("error",function(e){console.log("Redis error:",e)}),this.prefix=n.keyPrefix}return c(e,[{key:"get",value:function(e,t){this.client.get(this.prefix+e.key,function(e,i){i?t(e,i):t(e)})}},{key:"set",value:function(e,t){this.client.setex(this.prefix+e.key,e.ttl,t)}}]),e}(),T=function(){function e(t,n){h(this,e),this.allowedRequests=t,this.seconds=n,this.madeRequests=new i,this.buffer=55*this.seconds}return c(e,[{key:"_reload",value:function(){for(var e=(new Date).getTime();this.madeRequests.length>0&&e-this.madeRequests.peekFront()>=this.buffer;)this.madeRequests.shift()}},{key:"addRequest",value:function(){this.madeRequests.push((new Date).getTime()+1e3*this.seconds)}},{key:"requestAvailable",value:function(){return this._reload(),this.madeRequests.length<this.allowedRequests}}]),e}(),I={MONTH:2592e3,WEEK:604800,DAY:846400,SIX_HOURS:21600,THREE_HOURS:10800,TWO_HOURS:7200,HOUR:3600,THIRTY_MINUTES:1800,SHORT:600,NONE:null},y={CHAMPION:I.MONTH,CHAMPION_MASTERY:I.SIX_HOURS,CURRENT_GAME:I.NONE,FEATURED_GAMES:I.NONE,LEAGUE:I.SIX_HOURS,STATIC:I.MONTH,STATUS:I.NONE,MATCH:I.MONTH,MATCHLIST:I.HOUR,RUNES_MASTERIES:I.WEEK,SUMMONER:I.DAY,TOURNAMENT_STUB:I.HOUR,TOURNAMENT:I.HOUR},S={DEV:[[20,1],[100,120]],OLD_DEV:[[10,10],[500,600]],PROD:[[500,10],[3e4,600]]},R="/lol/",p="/v3/",A=R+"league"+p,M=R+"match"+p,f=R+"static-data"+p,v={LIST_CHAMPION_MASTERIES:"/lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}",GET_CHAMPION_MASTERY:"/lol/champion-mastery/v3//lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}/by-champion/{championId}",GET_TOTAL_CHAMPION_MASTERY_SCORE:"/lol/champion-mastery/v3//lol/champion-mastery/v3/scores/by-summoner/{summonerId}",LIST_CHAMPIONS:"/lol/platform/v3/champions",GET_CHAMPION:"/lol/platform/v3/champions/{id}",GET_CHALLENGER_LEAGUE:A+"challengerleagues/by-queue/{queue}",GET_LEAGUES_IN_ALL_QUEUES:A+"leagues/by-summoner/{summonerId}",GET_MASTER_LEAGUE:A+"masterleagues/by-queue/{queue}",GET_LEAGUE_POSITIONS_IN_ALL_QUEUES:A+"positions/by-summoner/{summonerId}",GET_SHARD_STATUS:"/lol/status/v3//shard-data",GET_MASTERY_PAGES:"/lol/platform/v3/masteries/by-summoner/{summonerId}",GET_MATCH:M+"matches/{matchId}",GET_MATCHLIST:M+"matchlists/by-account/{accountId}",GET_RECENT_MATCHLIST:M+"matchlists/by-account/{accountId}/recent",GET_MATCH_TIMELINE:M+"timelines/by-match/{matchId}",GET_RUNE_PAGES:"/lol/platform/v3/runes/by-summoner/{summonerId}",GET_CURRENT_GAME:"/lol/spectator/v3/active-games/by-summoner/{summonerId}",LIST_FEATURED_GAMES:"/lol/spectator/v3/featured-games",GET_SUMMONER_BY_ACCOUNT_ID:"/lol/summoner/v3/summoners/by-account/{accountId}",GET_SUMMONER_BY_NAME:"/lol/summoner/v3/summoners/by-name/{summonerName}",GET_SUMMONER_BY_ID:"/lol/summoner/v3/summoners/{summonerId}",RETRIEVE_CHAMPION_LIST:f+"champions",RETRIEVE_CHAMPION_BY_ID:f+"champions/{id}",RETRIEVE_ITEM_LIST:f+"items",RETRIEVE_ITEM_BY_ID:f+"items/{id}",RETRIEVE_LANGUAGE_STRINGS_DATA:f+"language-strings",RETRIEVE_SUPPORTED_LANGUAGES_DATA:f+"languages",RETRIEVE_MAP_DATA:f+"maps",RETRIEVE_MASTERIES:f+"masteries",RETRIEVE_MASTERY_BY_ID:f+"masteries/{id}",RETRIEVE_PROFILE_ICONS:f+"profile-icons",RETRIEVE_REALM_DATA:f+"realms",RETRIEVE_RUNE_LIST:f+"runes",RETRIEVE_RUNE_BY_ID:f+"runes/{id}",RETRIEVE_SUMMONER_SPELL_LIST:f+"summoner-spells",RETRIEVE_SUMMONER_SPELL_BY_ID:f+"summoner-spells/{id}",RETRIEVE_VERSIONS:f+"versions"},N={BRAZIL:"BR1",EUROPE:"EUN1",EUROPE_WEST:"EUW1",KOREA:"KR",LATIN_AMERICA_NORTH:"LA1",LATIN_AMERICA_SOUTH:"LA2",NORTH_AMERICA:"NA1",NORTH_AMERICA_OLD:"NA",OCEANIA:"OC1",RUSSIA:"RU",TURKEY:"TR1",JAPAN:"JP1"},b=["version","locale"],O={NONE:[],CHAMPION:{LIST:["freeToPlay"]},STATIC:{CHAMPION:{LIST:[].concat(b,["dataById","tags"]),ONE:[].concat(b,["tags"])},ITEM:{LIST:[].concat(b,["tags"]),ONE:[].concat(b,["tags"])},LANGUAGE_STRING:{LIST:[].concat(b)},MAP:{LIST:[].concat(b)},MASTERY:{LIST:[].concat(b,["tags"]),ONE:[].concat(b,["tags"])},PROFILE_ICON:{LIST:[].concat(b)},RUNE:{LIST:[].concat(b,["tags"]),ONE:[].concat(b,["tags"])},SUMMONER_SPELL:{LIST:[].concat(b,["dataById","tags"]),ONE:[].concat(b,["tags"])}},MATCH:{GET:["forAccountId","forPlatformId"]},MATCHLIST:{GET:["queue","beginTime","endIndex","season","champion","beginIndex","endTime"]}},L={CUSTOM:0,NORMAL_3x3:8,NORMAL_5x5_BLIND:2,NORMAL_5x5_DRAFT:14,RANKED_SOLO_5x5:4,RANKED_PREMADE_5x5:6,RANKED_PREMADE_3x3:9,RANKED_FLEX_TT:9,RANKED_TEAM_3x3:41,RANKED_TEAM_5x5:42,ODIN_5x5_BLIND:16,ODIN_5x5_DRAFT:17,BOT_5x5:7,BOT_ODIN_5x5:25,BOT_5x5_INTRO:31,BOT_5x5_BEGINNER:32,BOT_5x5_INTERMEDIATE:33,BOT_TT_3x3:52,GROUP_FINDER_5x5:61,ARAM_5x5:65,ONEFORALL_5x5:70,FIRSTBLOOD_1x1:72,FIRSTBLOOD_2x2:73,SR_6x6:75,URF_5x5:76,ONEFORALL_MIRRORMODE_5x5:78,BOT_URF_5x5:83,NIGHTMARE_BOT_5x5_RANK1:91,NIGHTMARE_BOT_5x5_RANK2:92,NIGHTMARE_BOT_5x5_RANK5:93,ASCENSION_5x5:96,HEXAKILL:98,BILGEWATER_ARAM_5x5:100,KING_PORO_5x5:300,COUNTER_PICK:310,BILGEWATER_5x5:313,SIEGE:315,DEFINITELY_NOT_DOMINION_5x5:317,ARURF_5X5:318,ARSR_5x5:325,TEAM_BUILDER_DRAFT_UNRANKED_5x5:400,TEAM_BUILDER_DRAFT_RANKED_5x5:410,TEAM_BUILDER_RANKED_SOLO:420,RANKED_FLEX_SR:440,ASSASSINATE_5x5:600,DARKSTAR_3x3:610},U={RANKED_SOLO_5x5:"RANKED_SOLO_5x5",RANKED_FLEX_SR:"RANKED_FLEX_SR",RANKED_FLEX_TT:"RANKED_FLEX_TT"},C={BRAZIL:"br",EUROPE:"eune",EUROPE_WEST:"euw",KOREA:"kr",LATIN_AMERICA_NORTH:"lan",LATIN_AMERICA_SOUTH:"las",NORTH_AMERICA:"na",OCEANIA:"oce",RUSSIA:"ru",TURKEY:"tr",JAPAN:"jp"},G={br:"BRAZIL",eune:"EUROPE",euw:"EUROPE_WEST",kr:"KOREA",lan:"LATIN_AMERICA_NORTH",las:"LATIN_AMERICA_SOUTH",na:"NORTH_AMERICA",oce:"OCEANIA",ru:"RUSSIA",tr:"TURKEY",jp:"JAPAN"},w={CHAMPION:"platform",CHAMPION_MASTERY:"champion-mastery",LEAGUE:"league",STATUS:"status",MASTERIES:"platform",MATCH:"match",RUNES:"platform",RUNES_MASTERIES:"platform",SPECTATOR:"spectator",STATIC_DATA:"static-data",SUMMONER:"summoner",TOURNAMENT_STUB:"tournament-stub",TOURNAMENT:"tournament"},P={CHAMPION:3,CHAMPION_MASTERY:3,LEAGUE:3,STATIC_DATA:3,STATUS:3,MATCH:3,RUNES_MASTERIES:3,SPECTATOR:3,SUMMONER:3,TOURNAMENT_STUB:3,TOURNAMENT:3},k=["allytips","blurb","enemytips","image","info","lore","partype","passive","recommended","skins","spells","stats"],q=["allytips","blurb","enemytips","format","image","info","keys","lore","partype","passive","recommended","skins","spells","stats","tags"],D=n("^[0-9\\p{L} _\\.]+$"),H=function(e){return Object.keys(C).some(function(t){return C[t]===e})},B={int:function(e){return e.every(function(e){return Number.isInteger(e)})},string:function(e){return e.every(function(e){return"string"==typeof e})}},x={int:function(e){return e&&Array.isArray(e)&&B.int(e)&&e.length>0},string:function(e){return e&&Array.isArray(e)&&B.string(e)&&e.length>0}},V=function(e){return Array.isArray(e)&&2!==e.length||!x.int(e[0])||2!==e[0].length||!x.int(e[1])||2!==e[1].length},Y=function(e){return"function"==typeof e},K=(m={},u(m,200,"Success"),u(m,400,"Bad Request"),u(m,401,"Unauthorized"),u(m,403,"Forbidden"),u(m,404,"Data Not Found"),u(m,405,"Method not allowed"),u(m,415,"Unsupported Media Type"),u(m,429,"Rate Limit Exceeded"),u(m,500,"Internal Service Error"),u(m,503,"Service Unavailable"),u(m,504,"Gateway Timeout"),m),F=function(e){return K[e]},Q=function(e){return F(e)||""},j=[200,400,500],X=function(e){var t=Q(e).toUpperCase(),i=e+" "+t;return e>=j[0]&&e<j[1]?r.green(e):e>=j[1]&&e<j[2]?r.red(i):r.bold.red(i)},W=function(e,t,i,n){console.log(t,"@",i),n&&(console.log({"x-rate-limit-type":e.headers["x-rate-limit-type"],"x-app-rate-limit":e.headers["x-app-rate-limit"],"x-app-rate-limit-count":e.headers["x-app-rate-limit-count"],"x-method-rate-limit":e.headers["x-method-rate-limit"],"x-method-rate-limit-count":e.headers["x-method-rate-limit-count"],"x-rate-limit-count":e.headers["x-rate-limit-count"],"retry-after":e.headers["retry-after"]}),console.log())},J={BAD_REQUEST:400,UNAUTHORIZED:401,FORBIDDEN:403,DATA_NOT_FOUND:404,METHOD_NOT_ALLOWED:405,UNSUPPORTED_MEDIA_TYPE:415,RATE_LIMIT_EXCEEDED:429,INTERNAL_SERVICE_ERROR:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504},z=J.INTERNAL_SERVICE_ERROR,Z=J.RATE_LIMIT_EXCEEDED,$=function(e){return e>=z||e===Z},ee=function(e){return Number.isInteger(e)&&e>0},te=function(e){return"string"==typeof e?new Date(0).setUTCMilliseconds(new Date(e)):"object"===(void 0===e?"undefined":g(e))?new Date(0).setUTCMilliseconds(e):"number"==typeof e?e:0},ie=function(e){return"beginTime"===e||"endTime"===e},ne=function(){function e(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=i.key,r=i.defaultRegion,s=void 0===r?C.NORTH_AMERICA:r,a=i.debug,d=void 0!==a&&a,l=i.showKey,m=void 0!==l&&l,c=i.showHeaders,E=void 0!==c&&c,_=i.limits,I=i.spread,S=i.retryOptions,R=void 0===S?{auto:!0,numberOfRetriesBeforeBreak:Number.MAX_VALUE}:S,p=i.timeout,A=i.cache,M=i.cacheTTL,f=i.methodLimits;if(h(this,e),0===arguments.length||"object"!==g(arguments[0])||"string"!=typeof n)throw new Error(""+o.red("API key not passed in!"));if(this.key=n,!H(s))throw new Error(o.red("setRegion() by Kindred failed: "+o.yellow(s)+" is an invalid region.")+"\n"+o.red("Try importing "+o.yellow("require('kindred-api').REGIONS")+" and using one of those values instead."));if(this.defaultRegion=s,this.debug=d,this.showKey=m,this.showHeaders=E,A?(this.cache=A,this.CACHE_TIMERS=M?M:y):(this.cache={get:function(e,t){return t(null,null)},set:function(e,t){}},this.CACHE_TIMERS=this._disableCache(y)),this.spread=I,this.retryOptions=R,this.timeout=p,_){if(V(_))throw console.log(o.red("Initialization of Kindred failed: Invalid "+o.yellow("limits")+". Valid examples: "+o.yellow("[[10, 10], [500, 600]]"))+"."),console.log(o.red("You can also pass in one of these two constants:")+" LIMITS.DEV/LIMITS.PROD"),console.log(""+o.red("and Kindred will set the limits appropriately.")),new Error;this.limits={},this.methodLimits={},Object.keys(C).map(function(e){var i;t.methodLimits[C[e]]=(i={},u(i,v.LIST_CHAMPION_MASTERIES,new T(2e4,10)),u(i,v.GET_CHAMPION_MASTERY,new T(2e4,10)),u(i,v.GET_TOTAL_CHAMPION_MASTERY_SCORE,new T(2e4,10)),u(i,v.LIST_CHAMPIONS,new T(200,60)),u(i,v.GET_CHAMPION,new T(200,60)),u(i,v.GET_CHALLENGER_LEAGUE,new T(2e4,10)),u(i,v.GET_LEAGUES_IN_ALL_QUEUES,new T(2e4,10)),u(i,v.GET_MASTER_LEAGUE,new T(2e4,10)),u(i,v.GET_LEAGUE_POSITIONS_IN_ALL_QUEUES,new T(2e4,10)),u(i,v.GET_MASTERY_PAGES,new T(200,60)),u(i,v.GET_MATCH,new T(500,10)),u(i,v.GET_MATCHLIST,new T(1e3,10)),u(i,v.GET_RECENT_MATCHLIST,new T(2e4,10)),u(i,v.GET_MATCH_TIMELINE,new T(500,10)),u(i,v.GET_RUNE_PAGES,new T(200,60)),u(i,v.GET_CURRENT_GAME,new T(2e4,10)),u(i,v.LIST_FEATURED_GAMES,new T(2e4,10)),u(i,v.GET_SHARD_STATUS,new T(2e4,10)),u(i,v.GET_SUMMONER_BY_ACCOUNT_ID,new T(2e4,10)),u(i,v.GET_SUMMONER_BY_ID,new T(2e4,10)),u(i,v.GET_SUMMONER_BY_NAME,new T(2e4,10)),u(i,v.RETRIEVE_CHAMPION_LIST,new T(10,3600)),u(i,v.RETRIEVE_CHAMPION_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_ITEM_LIST,new T(10,3600)),u(i,v.RETRIEVE_ITEM_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_LANGUAGE_STRINGS_DATA,new T(10,3600)),u(i,v.RETRIEVE_SUPPORTED_LANGUAGES_DATA,new T(10,3600)),u(i,v.RETRIEVE_MAP_DATA,new T(10,3600)),u(i,v.RETRIEVE_MASTERIES,new T(10,3600)),u(i,v.RETRIEVE_MASTERY_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_PROFILE_ICONS,new T(10,3600)),u(i,v.RETRIEVE_REALM_DATA,new T(10,3600)),u(i,v.RETRIEVE_RUNE_LIST,new T(10,3600)),u(i,v.RETRIEVE_RUNE_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_SUMMONER_SPELL_LIST,new T(10,3600)),u(i,v.RETRIEVE_SUMMONER_SPELL_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_VERSIONS,new T(10,3600)),i),Object.keys(t.methodLimits[C[e]]).map(function(i){if(f&&f[i]){if("number"!=typeof f[i])throw new Error("invalid method limit");t.methodLimits[C[e]][i]=new T(f[i],10)}return i})}),this.numberOfRetriesBeforeBreak=this.retryOptions.numberOfRetriesBeforeBreak;var N=!0,b=!1,O=void 0;try{for(var L,U=Object.keys(C)[Symbol.iterator]();!(N=(L=U.next()).done);N=!0){var G=L.value;this.limits[C[G]]=[new T(_[0][0],_[0][1]),new T(_[1][0],_[1][1]),this.spread?new T(_[0][0]/10,.5):null]}}catch(e){b=!0,O=e}finally{try{!N&&U.return&&U.return()}finally{if(b)throw O}}}this.Champion={getChampions:this.getChamps.bind(this),getAll:this.getChamps.bind(this),all:this.getChamps.bind(this),getChampion:this.getChamp.bind(this),get:this.getChamp.bind(this),list:this.listChampions.bind(this),by:{id:this.getChampionById.bind(this)}},this.ChampionMastery={getChampionMastery:this.getChampMastery.bind(this),get:this.getChampMastery.bind(this),getChampionMasteries:this.getChampMasteries.bind(this),getAll:this.getChampMasteries.bind(this),all:this.getChampMasteries.bind(this),getTotalChampionMasteryScore:this.getTotalChampMasteryScore.bind(this),getTotalScore:this.getTotalChampMasteryScore.bind(this),totalScore:this.getTotalChampMasteryScore.bind(this),total:this.getTotalChampMasteryScore.bind(this),score:this.getTotalChampMasteryScore.bind(this)},this.CurrentGame={getCurrentGame:this.getCurrentGame.bind(this),get:this.getCurrentGame.bind(this)},this.FeaturedGames={getFeaturedGames:this.getFeaturedGames.bind(this),get:this.getFeaturedGames.bind(this),list:this.listFeaturedGames.bind(this)},this.League={getLeagues:this.getLeagues.bind(this),leagues:this.getLeagues.bind(this),get:this.getLeagues.bind(this),getLeaguePositions:this.getLeaguePositions.bind(this),getPositions:this.getLeaguePositions.bind(this),positions:this.getLeaguePositions.bind(this),getChallengers:this.getChallengers.bind(this),challengers:this.getChallengers.bind(this),getMasters:this.getMasters.bind(this),masters:this.getMasters.bind(this)},this.Challenger={list:this.listChallengers.bind(this)},this.Master={list:this.listMasters.bind(this)},this.Static={Champion:{list:this.getStaticChampionList.bind(this),by:{id:this.getStaticChampionById.bind(this)}},Item:{list:this.getStaticItemList.bind(this),by:{id:this.getStaticItemById.bind(this)}},LanguageString:{list:this.getStaticLanguageStringList.bind(this)},Language:{list:this.getStaticLanguageList.bind(this)},Map:{list:this.getStaticMapList.bind(this)},Mastery:{list:this.getStaticMasteryList.bind(this),by:{id:this.getStaticMasteryById.bind(this)}},ProfileIcon:{list:this.getStaticProfileIconList.bind(this)},Realm:{list:this.getStaticRealmList.bind(this)},Rune:{list:this.getStaticRuneList.bind(this),by:{id:this.getStaticRuneById.bind(this)}},SummonerSpell:{list:this.getStaticSummonerSpellList.bind(this),by:{id:this.getStaticSummonerSpellById.bind(this)}},Version:{list:this.getStaticVersionList.bind(this)},getChampions:this.getChampionList.bind(this),champions:this.getChampionList.bind(this),getChampion:this.getChampion.bind(this),champion:this.getChampion.bind(this),getItems:this.getItems.bind(this),items:this.getItems.bind(this),getItem:this.getItem.bind(this),item:this.getItem.bind(this),getLanguageStrings:this.getLanguageStrings.bind(this),languageStrings:this.getLanguageStrings.bind(this),getLanguages:this.getLanguages.bind(this),languages:this.getLanguages.bind(this),getMapData:this.getMapData.bind(this),mapData:this.getMapData.bind(this),map:this.getMapData.bind(this),maps:this.getMapData.bind(this),getMasteries:this.getMasteryList.bind(this),masteries:this.getMasteryList.bind(this),getMastery:this.getMastery.bind(this),mastery:this.getMastery.bind(this),getProfileIcons:this.getProfileIcons.bind(this),profileIcons:this.getProfileIcons.bind(this),getRealmData:this.getRealmData.bind(this),realmData:this.getRealmData.bind(this),realm:this.getRealmData.bind(this),realms:this.getRealmData.bind(this),getRunes:this.getRuneList.bind(this),runes:this.getRuneList.bind(this),getRune:this.getRune.bind(this),rune:this.getRune.bind(this),getSummonerSpells:this.getSummonerSpells.bind(this),summonerSpells:this.getSummonerSpells.bind(this),spells:this.getSummonerSpells.bind(this),getSummonerSpell:this.getSummonerSpell.bind(this),summonerSpell:this.getSummonerSpell.bind(this),spell:this.getSummonerSpell.bind(this),getVersionData:this.getVersionData.bind(this),versionData:this.getVersionData.bind(this),version:this.getVersionData.bind(this),versions:this.getVersionData.bind(this)},this.Status={getShardStatus:this.getShardStatus.bind(this),getStatus:this.getShardStatus.bind(this),get:this.getShardStatus.bind(this)},this.Match={getMatch:this.getMatch.bind(this),get:this.getMatch.bind(this),getMatchTimeline:this.getMatchTimeline.bind(this),getTimeline:this.getMatchTimeline.bind(this),timeline:this.getMatchTimeline.bind(this),by:{id:this.getMatchById.bind(this)},Timeline:{by:{id:this.getMatchTimelineById.bind(this)}}},this.Matchlist={getMatchlist:this.getMatchlist.bind(this),get:this.getMatchlist.bind(this),getRecentMatchlist:this.getRecentMatchlist.bind(this),recent:this.getRecentMatchlist.bind(this),by:{account:this.getMatchlistByAccountId.bind(this),id:this.getMatchlistById.bind(this),name:this.getMatchlistByName.bind(this)}},this.MatchHistory={},this.RunesMasteries={getRunes:this.getRunes.bind(this),runes:this.getRunes.bind(this),getMasteries:this.getMasteries.bind(this),masteries:this.getMasteries.bind(this)},this.Runes={get:this.getRunes.bind(this),by:{account:this.getRunesByAccountId.bind(this),id:this.getRunesById.bind(this),name:this.getRunesByName.bind(this)}},this.Masteries={get:this.getMasteries.bind(this),by:{account:this.getMasteriesByAccountId.bind(this),id:this.getMasteriesById.bind(this),name:this.getMasteriesByName.bind(this)}},this.Summoner={getSummoner:this.getSummoner.bind(this),get:this.getSummoner.bind(this),getRunes:this.getRunes.bind(this),runes:this.getRunes.bind(this),getMasteries:this.getMasteries.bind(this),masteries:this.getMasteries.bind(this),getMatchHistory:this.getRecentMatchlist.bind(this),matchHistory:this.getRecentMatchlist.bind(this),getMatchlist:this.getMatchlist.bind(this),matchlist:this.getMatchlist.bind(this),getChampionMasteries:this.getChampMasteries.bind(this),championMasteries:this.getChampMasteries.bind(this),getTotalChampionMasteryScore:this.getTotalChampMasteryScore.bind(this),totalChampionMasteryScore:this.getTotalChampMasteryScore.bind(this),by:{account:this.getSummonerByAccountId.bind(this),id:this.getSummonerById.bind(this),name:this.getSummonerByName.bind(this)}}}return c(e,[{key:"canMakeRequest",value:function(e,t){var i=!this.spread||this.limits[e][2].requestAvailable(),n=this.methodLimits[e][t].requestAvailable();return this.limits[e][0].requestAvailable()&&this.limits[e][1].requestAvailable()&&i&&n}},{key:"_sanitizeName",value:function(e){if(this._validName(e))return e.replace(/\s/g,"").toLowerCase();this._logError(this._validName.name,"Name "+o.yellow(e)+" is not valid. Request failed.")}},{key:"_validName",value:function(e){return D.test(e)&&e.length<=16}},{key:"_cacheData",value:function(e,t,i){ee(t)&&this.cache.set({key:e,ttl:t},i)}},{key:"_makeUrl",value:function(e,t){var i=encodeURI(e),n=N[G[t]].toLowerCase();if(!H(t))throw new Error(o.red("setRegion() by Kindred failed: "+o.yellow(t)+" is an invalid region.")+"\n"+o.red("Try importing "+o.yellow("require('kindred-api').REGIONS")+" and using one of those values instead."));return"https://"+n+".api.riotgames.com/lol/"+i}},{key:"_stringifyOptions",value:function(e,t){var i="",n=function(e,t,i){return e+(e?"&":"")+t+"="+i},r=!0,s=!1,o=void 0;try{for(var a,u=Object.keys(e)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var h=a.value;if(Array.isArray(e[h])){var d=!0,l=!1,m=void 0;try{for(var g,c=e[h][Symbol.iterator]();!(d=(g=c.next()).done);d=!0){i=n(i,h,g.value)}}catch(e){l=!0,m=e}finally{try{!d&&c.return&&c.return()}finally{if(l)throw m}}}else ie(h)&&(e[h]=te(e[h])),i=n(i,h,e[h])}}catch(e){s=!0,o=e}finally{try{!r&&u.return&&u.return()}finally{if(s)throw o}}return i}},{key:"_constructFullUrl",value:function(e,t){return e+this._getAPIKeySuffix(e,t)}},{key:"_disableCache",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,s=Object.keys(e)[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){e[r.value]=0}}catch(e){i=!0,n=e}finally{try{!t&&s.return&&s.return()}finally{if(i)throw n}}return e}},{key:"_verifyOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],i=Object.keys(e);if(0!==t.length||0!==i.length){var n=!0,r=!1,s=void 0;try{for(var a,u=i[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var h=a.value;if(!t.includes(h))throw new Error(o.red("Invalid query params! Valid: "+t.toString()))}}catch(e){r=!0,s=e}finally{try{!n&&u.return&&u.return()}finally{if(r)throw s}}}}},{key:"_getAPIKeySuffix",value:function(e,t){return(e.lastIndexOf("?")===-1?"?":"&")+"api_key="+(t?t:"")}},{key:"_baseRequest",value:function(e,t){var i=this,n=e.endUrl,r=e.region,a=void 0===r?this.defaultRegion:r,u=e.options,h=void 0===u?{}:u,d=e.cacheParams,l=void 0===d?{}:d,m=e.methodType;e.staticReq;return function e(r){return new Promise(function(u,d){var g=i._stringifyOptions(h,n),c=g?"?"+g:"",E=i._makeUrl(n+c,a),_=E+i._getAPIKeySuffix(E),T=i._constructFullUrl(E,i.key);i.cache.get({key:E},function(n,h){if(h){if(i.debug){var g=i.showKey?T:E;console.log(o.green("CACHE HIT")+" @ "+g)}var c=JSON.parse(h);return t?t(n,c):u(c)}if(i.limits){var I=i;!function t(i,n){if(!I.canMakeRequest(a,m)){return setTimeout(function(){return t.bind(I)(i)},1e3/4.5)}I.limits[a][0].addRequest(),I.limits[a][1].addRequest(),I.spread&&I.limits[a][2].addRequest(),I.methodLimits[a][m].addRequest(),s({url:T,timeout:I.timeout},function(r,s,a){if(s&&a){var h=s.statusCode,m=X(h),g=1e3*s.headers["retry-after"]||1e3,c=E,y=l.ttl;if(I.debug){var S=I.showKey?T:_;W(s,m,o.yellow(S),I.showHeaders)}return Y(i)?$(h)?0==--n?i(h):I.retryOptions.auto?(I.debug&&console.log("Resending callback request.\n"),setTimeout(function(){return t.bind(I)(i,n)},g)):i(h):h>=400?i(h):(I._cacheData(c,y,a),i(r,JSON.parse(a))):$(h)?0==--n?d(h):I.retryOptions.auto?(I.debug&&console.log("Resending promise request.\n"),setTimeout(function(){return u(e(n))},g)):d(h):h>=400?d(h):(I._cacheData(c,y,a),u(JSON.parse(a)))}console.log(r,E)})}(t,r)}else s({url:T,timeout:i.timeout},function(e,n,r){if(n){var s=i,a=n.statusCode,h=X(a),m=E,g=l.ttl;if(s.debug){var c=s.showKey?T:_;W(n,h,o.yellow(c),s.showHeaders)}return Y(t)?a>=400?t(a):(s._cacheData(m,g,r),t(e,JSON.parse(r))):a>=400?d(a):(s._cacheData(m,g,r),u(JSON.parse(r)))}console.log(e,E)})})})}(this.numberOfRetriesBeforeBreak+1)}},{key:"_championMasteryRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.CHAMPION_MASTERY+"/v"+P.CHAMPION+"/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.CHAMPION_MASTERY},methodType:s},t)}},{key:"_championRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.CHAMPION+"/v"+P.CHAMPION+"/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.CHAMPION},methodType:s},t)}},{key:"_spectatorRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.methodType,s=r===v.GET_CURRENT_GAME?this.CACHE_TIMERS.CURRENT_GAME:this.CACHE_TIMERS.FEATURED_GAMES;return this._baseRequest({endUrl:w.SPECTATOR+"/v"+P.SPECTATOR+"/"+i,region:n,cacheParams:{ttl:s},methodType:r},t)}},{key:"_staticRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.STATIC_DATA+"/v"+P.STATIC_DATA+"/"+i,staticReq:!0,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.STATIC},methodType:s},t)}},{key:"_statusRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.STATUS+"/v"+P.STATUS+"/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.STATUS},methodType:s},t)}},{key:"_leagueRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.LEAGUE+"/v"+P.LEAGUE+"/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.LEAGUE},methodType:s},t)}},{key:"_matchRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.cacheParams,o=void 0===s?{ttl:this.CACHE_TIMERS.MATCH}:s,a=e.methodType;return this._baseRequest({endUrl:w.MATCH+"/v"+P.MATCH+"/"+i,region:n,options:r,cacheParams:o,methodType:a},t)}},{key:"_matchlistRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._matchRequest({endUrl:"matchlists/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.MATCHLIST},methodType:s},t)}},{key:"_runesMasteriesRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.methodType;return this._baseRequest({endUrl:w.RUNES_MASTERIES+"/v"+P.RUNES_MASTERIES+"/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.RUNES_MASTERIES},methodType:r},t)}},{key:"_summonerRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.methodType;return this._baseRequest({endUrl:w.SUMMONER+"/v"+P.SUMMONER+"/summoners/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.SUMMONER},methodType:r},t)}},{key:"_logError",value:function(e,t){throw new Error(o.bold.yellow(e)+" "+o.red("request")+" "+o.bold.red("FAILED")+o.red("; "+t))}},{key:"setRegion",value:function(e){if(!H(e))throw new Error(o.red("setRegion() by Kindred failed: "+o.yellow(e)+" is an invalid region.")+"\n"+o.red("Try importing "+o.yellow("require('kindred-api').REGIONS")+" and using one of those values instead."));this.defaultRegion=e}},{key:"getChamps",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.CHAMPION.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._championRequest({endUrl:"champions",region:t,options:i,methodType:v.LIST_CHAMPIONS},n)}},{key:"getChamp",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.championId,r=arguments[1],s="";return Number.isInteger(i)||Number.isInteger(n)?(i&&(s=i.toString()),n&&(s=n.toString()),this._championRequest({endUrl:"champions/"+s,region:t,methodType:v.GET_CHAMPION},r)):this._logError(this.getChamp.name,"required params "+o.yellow("`id/championId` (int)")+" not passed in")}},{key:"getChampMastery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.playerId,n=e.championId,r=arguments[1];return i&&n&&Number.isInteger(i)&&Number.isInteger(n)?this._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+i+"/by-champion/"+n,region:t,methodType:v.GET_CHAMPION_MASTERY},r):this._logError(this.getChampMastery.name,"required params "+o.yellow("`playerId` (int) AND `championId` (int)")+" not passed in")}},{key:"getChampMasteries",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";if(Number.isInteger(n||r)){var m=void 0;return n&&(m=n),r&&(m=r),new Promise(function(t,n){return e.getSummoner({accId:m,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+s.id,region:i,methodType:v.LIST_CHAMPION_MASTERIES},d)):void 0})})}return Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+l,region:i,methodType:v.LIST_CHAMPION_MASTERIES},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+s.id,region:i,methodType:v.LIST_CHAMPION_MASTERIES},d)):void 0})}):this._logError(this.getChampMasteries.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (str)")+" not passed in")}},{key:"getTotalChampMasteryScore",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";if(Number.isInteger(n||r)){var m=void 0;return n&&(m=n),r&&(m=r),new Promise(function(t,n){return e.getSummoner({accId:m,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._championMasteryRequest({endUrl:"scores/by-summoner/"+s.id,region:i,methodType:v.GET_CHAMPION_MASTERY},d)):void 0})})}return Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._championMasteryRequest({endUrl:"scores/by-summoner/"+l,region:i,methodType:v.GET_CHAMPION_MASTERY},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._championMasteryRequest({endUrl:"scores/by-summoner/"+s.id,region:i,methodType:v.GET_CHAMPION_MASTERY},d)):void 0})}):this._logError(this.getTotalChampMasteryScore.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (str)")+" not passed in")}},{key:"getCurrentGame",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";return Number.isInteger(n||r)?new Promise(function(t,s){return e.getSummoner({accId:n||r,region:i},function(n,r){return n?void(d?d(n):s(n)):r&&r.id?t(e._spectatorRequest({endUrl:"active-games/by-summoner/"+r.id,region:i,methodType:v.GET_CURRENT_GAME},d)):void 0})}):Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._spectatorRequest({endUrl:"active-games/by-summoner/"+l,region:i,methodType:v.GET_CURRENT_GAME},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._spectatorRequest({endUrl:"active-games/by-summoner/"+s.id,region:i,methodType:v.GET_CURRENT_GAME},d)):void 0})}):this._logError(this.getCurrentGame.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (string)")+" not passed in")}},{key:"getFeaturedGames",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=arguments[1];return Y(arguments[0])&&(i=arguments[0],arguments[0]=void 0),
!function(e,t){if("function"==typeof define&&define.amd)define("kindred-api",["module","redis","double-ended-queue","xregexp","chalk","request","chalk","query-string"],t);else if("undefined"!=typeof exports)t(module,require("redis"),require("double-ended-queue"),require("xregexp"),require("chalk"),require("request"),require("chalk"),require("query-string"));else{var i={exports:{}};t(i,e.redis,e.doubleEndedQueue,e.xregexp,e.chalk,e.request,e.chalk,e.queryString),e.kindredApi=i.exports}}(this,function(e,t,i,n,r,s,o,a){"use strict";function u(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t,i){return"boolean"==typeof t&&(i=t,t=re),new ne({key:e,defaultRegion:t,debug:i,limits:S.DEV,cache:new E})}function l(e,t){e?console.log(e):console.log(t)}var m,g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),E=function(){function e(){h(this,e),this.cache={}}return c(e,[{key:"get",value:function(e,t){return this.cache[e.key]?Date.now()>this.cache[e.key].expires?(delete this.cache[e.key],t("expired cache key")):t(null,this.cache[e.key].value):t("cache key doesn't exist")}},{key:"set",value:function(e,t){this.cache[e.key]={expires:e.ttl?this.setExp(Date.now(),e.ttl):null,value:t}}},{key:"setExp",value:function(e,t){return e+1e3*t}}]),e}(),_=function(){function e(i){h(this,e);var n=Object.assign({host:"127.0.0.1",port:6379,keyPrefix:"kindredAPI-"},i||{});this.client=t.createClient(n.port,n.host),this.client.on("error",function(e){console.log("Redis error:",e)}),this.prefix=n.keyPrefix}return c(e,[{key:"get",value:function(e,t){this.client.get(this.prefix+e.key,function(e,i){i?t(e,i):t(e)})}},{key:"set",value:function(e,t){this.client.setex(this.prefix+e.key,e.ttl,t)}}]),e}(),T=function(){function e(t,n){h(this,e),this.allowedRequests=t,this.seconds=n,this.madeRequests=new i,this.buffer=55*this.seconds}return c(e,[{key:"_reload",value:function(){for(var e=(new Date).getTime();this.madeRequests.length>0&&e-this.madeRequests.peekFront()>=this.buffer;)this.madeRequests.shift()}},{key:"addRequest",value:function(){this.madeRequests.push((new Date).getTime()+1e3*this.seconds)}},{key:"requestAvailable",value:function(){return this._reload(),this.madeRequests.length<this.allowedRequests}}]),e}(),I={MONTH:2592e3,WEEK:604800,DAY:846400,SIX_HOURS:21600,THREE_HOURS:10800,TWO_HOURS:7200,HOUR:3600,THIRTY_MINUTES:1800,SHORT:600,NONE:null},y={CHAMPION:I.MONTH,CHAMPION_MASTERY:I.SIX_HOURS,CURRENT_GAME:I.NONE,FEATURED_GAMES:I.NONE,LEAGUE:I.SIX_HOURS,STATIC:I.MONTH,STATUS:I.NONE,MATCH:I.MONTH,MATCHLIST:I.HOUR,RUNES_MASTERIES:I.WEEK,SUMMONER:I.DAY,TOURNAMENT_STUB:I.HOUR,TOURNAMENT:I.HOUR},S={DEV:[[20,1],[100,120]],OLD_DEV:[[10,10],[500,600]],PROD:[[500,10],[3e4,600]]},R="/lol/",p="/v3/",A=R+"league"+p,M=R+"match"+p,f=R+"static-data"+p,v={LIST_CHAMPION_MASTERIES:"/lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}",GET_CHAMPION_MASTERY:"/lol/champion-mastery/v3//lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}/by-champion/{championId}",GET_TOTAL_CHAMPION_MASTERY_SCORE:"/lol/champion-mastery/v3//lol/champion-mastery/v3/scores/by-summoner/{summonerId}",LIST_CHAMPIONS:"/lol/platform/v3/champions",GET_CHAMPION:"/lol/platform/v3/champions/{id}",GET_CHALLENGER_LEAGUE:A+"challengerleagues/by-queue/{queue}",GET_LEAGUES_IN_ALL_QUEUES:A+"leagues/by-summoner/{summonerId}",GET_MASTER_LEAGUE:A+"masterleagues/by-queue/{queue}",GET_LEAGUE_POSITIONS_IN_ALL_QUEUES:A+"positions/by-summoner/{summonerId}",GET_SHARD_STATUS:"/lol/status/v3//shard-data",GET_MASTERY_PAGES:"/lol/platform/v3/masteries/by-summoner/{summonerId}",GET_MATCH:M+"matches/{matchId}",GET_MATCHLIST:M+"matchlists/by-account/{accountId}",GET_RECENT_MATCHLIST:M+"matchlists/by-account/{accountId}/recent",GET_MATCH_TIMELINE:M+"timelines/by-match/{matchId}",GET_RUNE_PAGES:"/lol/platform/v3/runes/by-summoner/{summonerId}",GET_CURRENT_GAME:"/lol/spectator/v3/active-games/by-summoner/{summonerId}",LIST_FEATURED_GAMES:"/lol/spectator/v3/featured-games",GET_SUMMONER_BY_ACCOUNT_ID:"/lol/summoner/v3/summoners/by-account/{accountId}",GET_SUMMONER_BY_NAME:"/lol/summoner/v3/summoners/by-name/{summonerName}",GET_SUMMONER_BY_ID:"/lol/summoner/v3/summoners/{summonerId}",RETRIEVE_CHAMPION_LIST:f+"champions",RETRIEVE_CHAMPION_BY_ID:f+"champions/{id}",RETRIEVE_ITEM_LIST:f+"items",RETRIEVE_ITEM_BY_ID:f+"items/{id}",RETRIEVE_LANGUAGE_STRINGS_DATA:f+"language-strings",RETRIEVE_SUPPORTED_LANGUAGES_DATA:f+"languages",RETRIEVE_MAP_DATA:f+"maps",RETRIEVE_MASTERIES:f+"masteries",RETRIEVE_MASTERY_BY_ID:f+"masteries/{id}",RETRIEVE_PROFILE_ICONS:f+"profile-icons",RETRIEVE_REALM_DATA:f+"realms",RETRIEVE_RUNE_LIST:f+"runes",RETRIEVE_RUNE_BY_ID:f+"runes/{id}",RETRIEVE_SUMMONER_SPELL_LIST:f+"summoner-spells",RETRIEVE_SUMMONER_SPELL_BY_ID:f+"summoner-spells/{id}",RETRIEVE_VERSIONS:f+"versions"},N={BRAZIL:"BR1",EUROPE:"EUN1",EUROPE_WEST:"EUW1",KOREA:"KR",LATIN_AMERICA_NORTH:"LA1",LATIN_AMERICA_SOUTH:"LA2",NORTH_AMERICA:"NA1",NORTH_AMERICA_OLD:"NA",OCEANIA:"OC1",RUSSIA:"RU",TURKEY:"TR1",JAPAN:"JP1"},b=["version","locale"],O={NONE:[],CHAMPION:{LIST:["freeToPlay"]},STATIC:{CHAMPION:{LIST:[].concat(b,["dataById","tags"]),ONE:[].concat(b,["tags"])},ITEM:{LIST:[].concat(b,["tags"]),ONE:[].concat(b,["tags"])},LANGUAGE_STRING:{LIST:[].concat(b)},MAP:{LIST:[].concat(b)},MASTERY:{LIST:[].concat(b,["tags"]),ONE:[].concat(b,["tags"])},PROFILE_ICON:{LIST:[].concat(b)},RUNE:{LIST:[].concat(b,["tags"]),ONE:[].concat(b,["tags"])},SUMMONER_SPELL:{LIST:[].concat(b,["dataById","tags"]),ONE:[].concat(b,["tags"])}},MATCH:{GET:["forAccountId","forPlatformId"]},MATCHLIST:{GET:["queue","beginTime","endIndex","season","champion","beginIndex","endTime"]}},L={CUSTOM:0,NORMAL_3x3:8,NORMAL_5x5_BLIND:2,NORMAL_5x5_DRAFT:14,RANKED_SOLO_5x5:4,RANKED_PREMADE_5x5:6,RANKED_PREMADE_3x3:9,RANKED_FLEX_TT:9,RANKED_TEAM_3x3:41,RANKED_TEAM_5x5:42,ODIN_5x5_BLIND:16,ODIN_5x5_DRAFT:17,BOT_5x5:7,BOT_ODIN_5x5:25,BOT_5x5_INTRO:31,BOT_5x5_BEGINNER:32,BOT_5x5_INTERMEDIATE:33,BOT_TT_3x3:52,GROUP_FINDER_5x5:61,ARAM_5x5:65,ONEFORALL_5x5:70,FIRSTBLOOD_1x1:72,FIRSTBLOOD_2x2:73,SR_6x6:75,URF_5x5:76,ONEFORALL_MIRRORMODE_5x5:78,BOT_URF_5x5:83,NIGHTMARE_BOT_5x5_RANK1:91,NIGHTMARE_BOT_5x5_RANK2:92,NIGHTMARE_BOT_5x5_RANK5:93,ASCENSION_5x5:96,HEXAKILL:98,BILGEWATER_ARAM_5x5:100,KING_PORO_5x5:300,COUNTER_PICK:310,BILGEWATER_5x5:313,SIEGE:315,DEFINITELY_NOT_DOMINION_5x5:317,ARURF_5X5:318,ARSR_5x5:325,TEAM_BUILDER_DRAFT_UNRANKED_5x5:400,TEAM_BUILDER_DRAFT_RANKED_5x5:410,TEAM_BUILDER_RANKED_SOLO:420,RANKED_FLEX_SR:440,ASSASSINATE_5x5:600,DARKSTAR_3x3:610},U={RANKED_SOLO_5x5:"RANKED_SOLO_5x5",RANKED_FLEX_SR:"RANKED_FLEX_SR",RANKED_FLEX_TT:"RANKED_FLEX_TT"},C={BRAZIL:"br",EUROPE:"eune",EUROPE_WEST:"euw",KOREA:"kr",LATIN_AMERICA_NORTH:"lan",LATIN_AMERICA_SOUTH:"las",NORTH_AMERICA:"na",OCEANIA:"oce",RUSSIA:"ru",TURKEY:"tr",JAPAN:"jp"},G={br:"BRAZIL",eune:"EUROPE",euw:"EUROPE_WEST",kr:"KOREA",lan:"LATIN_AMERICA_NORTH",las:"LATIN_AMERICA_SOUTH",na:"NORTH_AMERICA",oce:"OCEANIA",ru:"RUSSIA",tr:"TURKEY",jp:"JAPAN"},w={CHAMPION:"platform",CHAMPION_MASTERY:"champion-mastery",LEAGUE:"league",STATUS:"status",MASTERIES:"platform",MATCH:"match",RUNES:"platform",RUNES_MASTERIES:"platform",SPECTATOR:"spectator",STATIC_DATA:"static-data",SUMMONER:"summoner",TOURNAMENT_STUB:"tournament-stub",TOURNAMENT:"tournament"},P={CHAMPION:3,CHAMPION_MASTERY:3,LEAGUE:3,STATIC_DATA:3,STATUS:3,MATCH:3,RUNES_MASTERIES:3,SPECTATOR:3,SUMMONER:3,TOURNAMENT_STUB:3,TOURNAMENT:3},k=["allytips","blurb","enemytips","image","info","lore","partype","passive","recommended","skins","spells","stats"],q=["allytips","blurb","enemytips","format","image","info","keys","lore","partype","passive","recommended","skins","spells","stats","tags"],D=n("^[0-9\\p{L} _\\.]+$"),H=function(e){return Object.keys(C).some(function(t){return C[t]===e})},B={int:function(e){return e.every(function(e){return Number.isInteger(e)})},string:function(e){return e.every(function(e){return"string"==typeof e})}},x={int:function(e){return e&&Array.isArray(e)&&B.int(e)&&e.length>0},string:function(e){return e&&Array.isArray(e)&&B.string(e)&&e.length>0}},V=function(e){return Array.isArray(e)&&2!==e.length||!x.int(e[0])||2!==e[0].length||!x.int(e[1])||2!==e[1].length},Y=function(e){return"function"==typeof e},K=(m={},u(m,200,"Success"),u(m,400,"Bad Request"),u(m,401,"Unauthorized"),u(m,403,"Forbidden"),u(m,404,"Data Not Found"),u(m,405,"Method not allowed"),u(m,415,"Unsupported Media Type"),u(m,429,"Rate Limit Exceeded"),u(m,500,"Internal Service Error"),u(m,503,"Service Unavailable"),u(m,504,"Gateway Timeout"),m),F=function(e){return K[e]},Q=function(e){return F(e)||""},j=[200,400,500],X=function(e){var t=Q(e).toUpperCase(),i=e+" "+t;return e>=j[0]&&e<j[1]?r.green(e):e>=j[1]&&e<j[2]?r.red(i):r.bold.red(i)},W=function(e,t,i,n){console.log(t,"@",i),n&&(console.log({"x-rate-limit-type":e.headers["x-rate-limit-type"],"x-app-rate-limit":e.headers["x-app-rate-limit"],"x-app-rate-limit-count":e.headers["x-app-rate-limit-count"],"x-method-rate-limit":e.headers["x-method-rate-limit"],"x-method-rate-limit-count":e.headers["x-method-rate-limit-count"],"x-rate-limit-count":e.headers["x-rate-limit-count"],"retry-after":e.headers["retry-after"]}),console.log())},J={BAD_REQUEST:400,UNAUTHORIZED:401,FORBIDDEN:403,DATA_NOT_FOUND:404,METHOD_NOT_ALLOWED:405,UNSUPPORTED_MEDIA_TYPE:415,RATE_LIMIT_EXCEEDED:429,INTERNAL_SERVICE_ERROR:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504},z=J.INTERNAL_SERVICE_ERROR,Z=J.RATE_LIMIT_EXCEEDED,$=function(e){return e>=z||e===Z},ee=function(e){return Number.isInteger(e)&&e>0},te=function(e){return"string"==typeof e?new Date(0).setUTCMilliseconds(new Date(e)):"object"===(void 0===e?"undefined":g(e))?new Date(0).setUTCMilliseconds(e):"number"==typeof e?e:0},ie=function(e){return"beginTime"===e||"endTime"===e},ne=function(){function e(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=i.key,r=i.defaultRegion,s=void 0===r?C.NORTH_AMERICA:r,a=i.debug,d=void 0!==a&&a,l=i.showKey,m=void 0!==l&&l,c=i.showHeaders,E=void 0!==c&&c,_=i.limits,I=i.spread,S=i.retryOptions,R=void 0===S?{auto:!0,numberOfRetriesBeforeBreak:Number.MAX_VALUE}:S,p=i.timeout,A=i.cache,M=i.cacheTTL,f=i.methodLimits;if(h(this,e),0===arguments.length||"object"!==g(arguments[0])||"string"!=typeof n)throw new Error(""+o.red("API key not passed in!"));if(this.key=n,!H(s))throw new Error(o.red("setRegion() by Kindred failed: "+o.yellow(s)+" is an invalid region.")+"\n"+o.red("Try importing "+o.yellow("require('kindred-api').REGIONS")+" and using one of those values instead."));if(this.defaultRegion=s,this.debug=d,this.showKey=m,this.showHeaders=E,A?(this.cache=A,this.CACHE_TIMERS=M?M:y):(this.cache={get:function(e,t){return t(null,null)},set:function(e,t){}},this.CACHE_TIMERS=this._disableCache(y)),this.spread=I,this.retryOptions=R,this.timeout=p,_){if(V(_))throw console.log(o.red("Initialization of Kindred failed: Invalid "+o.yellow("limits")+". Valid examples: "+o.yellow("[[10, 10], [500, 600]]"))+"."),console.log(o.red("You can also pass in one of these two constants:")+" LIMITS.DEV/LIMITS.PROD"),console.log(""+o.red("and Kindred will set the limits appropriately.")),new Error;this.limits={},this.methodLimits={},Object.keys(C).map(function(e){var i;t.methodLimits[C[e]]=(i={},u(i,v.LIST_CHAMPION_MASTERIES,new T(2e4,10)),u(i,v.GET_CHAMPION_MASTERY,new T(2e4,10)),u(i,v.GET_TOTAL_CHAMPION_MASTERY_SCORE,new T(2e4,10)),u(i,v.LIST_CHAMPIONS,new T(400,60)),u(i,v.GET_CHAMPION,new T(400,60)),u(i,v.GET_CHALLENGER_LEAGUE,new T(2e4,10)),u(i,v.GET_LEAGUES_IN_ALL_QUEUES,new T(2e4,10)),u(i,v.GET_MASTER_LEAGUE,new T(2e4,10)),u(i,v.GET_LEAGUE_POSITIONS_IN_ALL_QUEUES,new T(2e4,10)),u(i,v.GET_MASTERY_PAGES,new T(400,60)),u(i,v.GET_MATCH,new T(500,10)),u(i,v.GET_MATCHLIST,new T(1e3,10)),u(i,v.GET_RECENT_MATCHLIST,new T(2e4,10)),u(i,v.GET_MATCH_TIMELINE,new T(500,10)),u(i,v.GET_RUNE_PAGES,new T(400,60)),u(i,v.GET_CURRENT_GAME,new T(2e4,10)),u(i,v.LIST_FEATURED_GAMES,new T(2e4,10)),u(i,v.GET_SHARD_STATUS,new T(2e4,10)),u(i,v.GET_SUMMONER_BY_ACCOUNT_ID,new T(2e4,10)),u(i,v.GET_SUMMONER_BY_ID,new T(2e4,10)),u(i,v.GET_SUMMONER_BY_NAME,new T(2e4,10)),u(i,v.RETRIEVE_CHAMPION_LIST,new T(10,3600)),u(i,v.RETRIEVE_CHAMPION_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_ITEM_LIST,new T(10,3600)),u(i,v.RETRIEVE_ITEM_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_LANGUAGE_STRINGS_DATA,new T(10,3600)),u(i,v.RETRIEVE_SUPPORTED_LANGUAGES_DATA,new T(10,3600)),u(i,v.RETRIEVE_MAP_DATA,new T(10,3600)),u(i,v.RETRIEVE_MASTERIES,new T(10,3600)),u(i,v.RETRIEVE_MASTERY_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_PROFILE_ICONS,new T(10,3600)),u(i,v.RETRIEVE_REALM_DATA,new T(10,3600)),u(i,v.RETRIEVE_RUNE_LIST,new T(10,3600)),u(i,v.RETRIEVE_RUNE_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_SUMMONER_SPELL_LIST,new T(10,3600)),u(i,v.RETRIEVE_SUMMONER_SPELL_BY_ID,new T(10,3600)),u(i,v.RETRIEVE_VERSIONS,new T(10,3600)),i),Object.keys(t.methodLimits[C[e]]).map(function(i){if(f&&f[i]){if("number"!=typeof f[i])throw new Error("invalid method limit");t.methodLimits[C[e]][i]=new T(f[i],10)}return i})}),this.numberOfRetriesBeforeBreak=this.retryOptions.numberOfRetriesBeforeBreak;var N=!0,b=!1,O=void 0;try{for(var L,U=Object.keys(C)[Symbol.iterator]();!(N=(L=U.next()).done);N=!0){var G=L.value;this.limits[C[G]]=[new T(_[0][0],_[0][1]),new T(_[1][0],_[1][1]),this.spread?new T(_[0][0]/10,.5):null]}}catch(e){b=!0,O=e}finally{try{!N&&U.return&&U.return()}finally{if(b)throw O}}}this.Champion={getChampions:this.getChamps.bind(this),getAll:this.getChamps.bind(this),all:this.getChamps.bind(this),getChampion:this.getChamp.bind(this),get:this.getChamp.bind(this),list:this.listChampions.bind(this),by:{id:this.getChampionById.bind(this)}},this.ChampionMastery={getChampionMastery:this.getChampMastery.bind(this),get:this.getChampMastery.bind(this),getChampionMasteries:this.getChampMasteries.bind(this),getAll:this.getChampMasteries.bind(this),all:this.getChampMasteries.bind(this),getTotalChampionMasteryScore:this.getTotalChampMasteryScore.bind(this),getTotalScore:this.getTotalChampMasteryScore.bind(this),totalScore:this.getTotalChampMasteryScore.bind(this),total:this.getTotalChampMasteryScore.bind(this),score:this.getTotalChampMasteryScore.bind(this)},this.CurrentGame={getCurrentGame:this.getCurrentGame.bind(this),get:this.getCurrentGame.bind(this)},this.FeaturedGames={getFeaturedGames:this.getFeaturedGames.bind(this),get:this.getFeaturedGames.bind(this),list:this.listFeaturedGames.bind(this)},this.League={getLeagues:this.getLeagues.bind(this),leagues:this.getLeagues.bind(this),get:this.getLeagues.bind(this),getLeaguePositions:this.getLeaguePositions.bind(this),getPositions:this.getLeaguePositions.bind(this),positions:this.getLeaguePositions.bind(this),getChallengers:this.getChallengers.bind(this),challengers:this.getChallengers.bind(this),getMasters:this.getMasters.bind(this),masters:this.getMasters.bind(this)},this.Challenger={list:this.listChallengers.bind(this)},this.Master={list:this.listMasters.bind(this)},this.Static={Champion:{list:this.getStaticChampionList.bind(this),by:{id:this.getStaticChampionById.bind(this)}},Item:{list:this.getStaticItemList.bind(this),by:{id:this.getStaticItemById.bind(this)}},LanguageString:{list:this.getStaticLanguageStringList.bind(this)},Language:{list:this.getStaticLanguageList.bind(this)},Map:{list:this.getStaticMapList.bind(this)},Mastery:{list:this.getStaticMasteryList.bind(this),by:{id:this.getStaticMasteryById.bind(this)}},ProfileIcon:{list:this.getStaticProfileIconList.bind(this)},Realm:{list:this.getStaticRealmList.bind(this)},Rune:{list:this.getStaticRuneList.bind(this),by:{id:this.getStaticRuneById.bind(this)}},SummonerSpell:{list:this.getStaticSummonerSpellList.bind(this),by:{id:this.getStaticSummonerSpellById.bind(this)}},Version:{list:this.getStaticVersionList.bind(this)},getChampions:this.getChampionList.bind(this),champions:this.getChampionList.bind(this),getChampion:this.getChampion.bind(this),champion:this.getChampion.bind(this),getItems:this.getItems.bind(this),items:this.getItems.bind(this),getItem:this.getItem.bind(this),item:this.getItem.bind(this),getLanguageStrings:this.getLanguageStrings.bind(this),languageStrings:this.getLanguageStrings.bind(this),getLanguages:this.getLanguages.bind(this),languages:this.getLanguages.bind(this),getMapData:this.getMapData.bind(this),mapData:this.getMapData.bind(this),map:this.getMapData.bind(this),maps:this.getMapData.bind(this),getMasteries:this.getMasteryList.bind(this),masteries:this.getMasteryList.bind(this),getMastery:this.getMastery.bind(this),mastery:this.getMastery.bind(this),getProfileIcons:this.getProfileIcons.bind(this),profileIcons:this.getProfileIcons.bind(this),getRealmData:this.getRealmData.bind(this),realmData:this.getRealmData.bind(this),realm:this.getRealmData.bind(this),realms:this.getRealmData.bind(this),getRunes:this.getRuneList.bind(this),runes:this.getRuneList.bind(this),getRune:this.getRune.bind(this),rune:this.getRune.bind(this),getSummonerSpells:this.getSummonerSpells.bind(this),summonerSpells:this.getSummonerSpells.bind(this),spells:this.getSummonerSpells.bind(this),getSummonerSpell:this.getSummonerSpell.bind(this),summonerSpell:this.getSummonerSpell.bind(this),spell:this.getSummonerSpell.bind(this),getVersionData:this.getVersionData.bind(this),versionData:this.getVersionData.bind(this),version:this.getVersionData.bind(this),versions:this.getVersionData.bind(this)},this.Status={getShardStatus:this.getShardStatus.bind(this),getStatus:this.getShardStatus.bind(this),get:this.getShardStatus.bind(this)},this.Match={getMatch:this.getMatch.bind(this),get:this.getMatch.bind(this),getMatchTimeline:this.getMatchTimeline.bind(this),getTimeline:this.getMatchTimeline.bind(this),timeline:this.getMatchTimeline.bind(this),by:{id:this.getMatchById.bind(this)},Timeline:{by:{id:this.getMatchTimelineById.bind(this)}}},this.Matchlist={getMatchlist:this.getMatchlist.bind(this),get:this.getMatchlist.bind(this),getRecentMatchlist:this.getRecentMatchlist.bind(this),recent:this.getRecentMatchlist.bind(this),by:{account:this.getMatchlistByAccountId.bind(this),id:this.getMatchlistById.bind(this),name:this.getMatchlistByName.bind(this)}},this.MatchHistory={},this.RunesMasteries={getRunes:this.getRunes.bind(this),runes:this.getRunes.bind(this),getMasteries:this.getMasteries.bind(this),masteries:this.getMasteries.bind(this)},this.Runes={get:this.getRunes.bind(this),by:{account:this.getRunesByAccountId.bind(this),id:this.getRunesById.bind(this),name:this.getRunesByName.bind(this)}},this.Masteries={get:this.getMasteries.bind(this),by:{account:this.getMasteriesByAccountId.bind(this),id:this.getMasteriesById.bind(this),name:this.getMasteriesByName.bind(this)}},this.Summoner={getSummoner:this.getSummoner.bind(this),get:this.getSummoner.bind(this),getRunes:this.getRunes.bind(this),runes:this.getRunes.bind(this),getMasteries:this.getMasteries.bind(this),masteries:this.getMasteries.bind(this),getMatchHistory:this.getRecentMatchlist.bind(this),matchHistory:this.getRecentMatchlist.bind(this),getMatchlist:this.getMatchlist.bind(this),matchlist:this.getMatchlist.bind(this),getChampionMasteries:this.getChampMasteries.bind(this),championMasteries:this.getChampMasteries.bind(this),getTotalChampionMasteryScore:this.getTotalChampMasteryScore.bind(this),totalChampionMasteryScore:this.getTotalChampMasteryScore.bind(this),by:{account:this.getSummonerByAccountId.bind(this),id:this.getSummonerById.bind(this),name:this.getSummonerByName.bind(this)}}}return c(e,[{key:"canMakeRequest",value:function(e,t){var i=!this.spread||this.limits[e][2].requestAvailable(),n=this.methodLimits[e][t].requestAvailable();return this.limits[e][0].requestAvailable()&&this.limits[e][1].requestAvailable()&&i&&n}},{key:"_sanitizeName",value:function(e){if(this._validName(e))return e.replace(/\s/g,"").toLowerCase();this._logError(this._validName.name,"Name "+o.yellow(e)+" is not valid. Request failed.")}},{key:"_validName",value:function(e){return D.test(e)&&e.length<=16}},{key:"_cacheData",value:function(e,t,i){ee(t)&&this.cache.set({key:e,ttl:t},i)}},{key:"_makeUrl",value:function(e,t){var i=encodeURI(e),n=N[G[t]].toLowerCase();if(!H(t))throw new Error(o.red("setRegion() by Kindred failed: "+o.yellow(t)+" is an invalid region.")+"\n"+o.red("Try importing "+o.yellow("require('kindred-api').REGIONS")+" and using one of those values instead."));return"https://"+n+".api.riotgames.com/lol/"+i}},{key:"_stringifyOptions",value:function(e,t){var i="",n=function(e,t,i){return e+(e?"&":"")+t+"="+i},r=!0,s=!1,o=void 0;try{for(var a,u=Object.keys(e)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var h=a.value;if(Array.isArray(e[h])){var d=!0,l=!1,m=void 0;try{for(var g,c=e[h][Symbol.iterator]();!(d=(g=c.next()).done);d=!0){i=n(i,h,g.value)}}catch(e){l=!0,m=e}finally{try{!d&&c.return&&c.return()}finally{if(l)throw m}}}else ie(h)&&(e[h]=te(e[h])),i=n(i,h,e[h])}}catch(e){s=!0,o=e}finally{try{!r&&u.return&&u.return()}finally{if(s)throw o}}return i}},{key:"_constructFullUrl",value:function(e,t){return e+this._getAPIKeySuffix(e,t)}},{key:"_disableCache",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,s=Object.keys(e)[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){e[r.value]=0}}catch(e){i=!0,n=e}finally{try{!t&&s.return&&s.return()}finally{if(i)throw n}}return e}},{key:"_verifyOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],i=Object.keys(e);if(0!==t.length||0!==i.length){var n=!0,r=!1,s=void 0;try{for(var a,u=i[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var h=a.value;if(!t.includes(h))throw new Error(o.red("Invalid query params! Valid: "+t.toString()))}}catch(e){r=!0,s=e}finally{try{!n&&u.return&&u.return()}finally{if(r)throw s}}}}},{key:"_getAPIKeySuffix",value:function(e,t){return(e.lastIndexOf("?")===-1?"?":"&")+"api_key="+(t?t:"")}},{key:"_baseRequest",value:function(e,t){var i=this,n=e.endUrl,r=e.region,a=void 0===r?this.defaultRegion:r,u=e.options,h=void 0===u?{}:u,d=e.cacheParams,l=void 0===d?{}:d,m=e.methodType;e.staticReq;return function e(r){return new Promise(function(u,d){var g=i._stringifyOptions(h,n),c=g?"?"+g:"",E=i._makeUrl(n+c,a),_=E+i._getAPIKeySuffix(E),T=i._constructFullUrl(E,i.key);i.cache.get({key:E},function(n,h){if(h){if(i.debug){var g=i.showKey?T:E;console.log(o.green("CACHE HIT")+" @ "+g)}var c=JSON.parse(h);return t?t(n,c):u(c)}if(i.limits){var I=i;!function t(i,n){if(!I.canMakeRequest(a,m)){return setTimeout(function(){return t.bind(I)(i)},1e3/4.5)}I.limits[a][0].addRequest(),I.limits[a][1].addRequest(),I.spread&&I.limits[a][2].addRequest(),I.methodLimits[a][m].addRequest(),s({url:T,timeout:I.timeout},function(r,s,a){if(s&&a){var h=s.statusCode,m=X(h),g=1e3*s.headers["retry-after"]||1e3,c=E,y=l.ttl;if(I.debug){var S=I.showKey?T:_;W(s,m,o.yellow(S),I.showHeaders)}return Y(i)?$(h)?0==--n?i(h):I.retryOptions.auto?(I.debug&&console.log("Resending callback request.\n"),setTimeout(function(){return t.bind(I)(i,n)},g)):i(h):h>=400?i(h):(I._cacheData(c,y,a),i(r,JSON.parse(a))):$(h)?0==--n?d(h):I.retryOptions.auto?(I.debug&&console.log("Resending promise request.\n"),setTimeout(function(){return u(e(n))},g)):d(h):h>=400?d(h):(I._cacheData(c,y,a),u(JSON.parse(a)))}console.log(r,E)})}(t,r)}else s({url:T,timeout:i.timeout},function(e,n,r){if(n){var s=i,a=n.statusCode,h=X(a),m=E,g=l.ttl;if(s.debug){var c=s.showKey?T:_;W(n,h,o.yellow(c),s.showHeaders)}return Y(t)?a>=400?t(a):(s._cacheData(m,g,r),t(e,JSON.parse(r))):a>=400?d(a):(s._cacheData(m,g,r),u(JSON.parse(r)))}console.log(e,E)})})})}(this.numberOfRetriesBeforeBreak+1)}},{key:"_championMasteryRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.CHAMPION_MASTERY+"/v"+P.CHAMPION+"/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.CHAMPION_MASTERY},methodType:s},t)}},{key:"_championRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.CHAMPION+"/v"+P.CHAMPION+"/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.CHAMPION},methodType:s},t)}},{key:"_spectatorRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.methodType,s=r===v.GET_CURRENT_GAME?this.CACHE_TIMERS.CURRENT_GAME:this.CACHE_TIMERS.FEATURED_GAMES;return this._baseRequest({endUrl:w.SPECTATOR+"/v"+P.SPECTATOR+"/"+i,region:n,cacheParams:{ttl:s},methodType:r},t)}},{key:"_staticRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.STATIC_DATA+"/v"+P.STATIC_DATA+"/"+i,staticReq:!0,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.STATIC},methodType:s},t)}},{key:"_statusRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.STATUS+"/v"+P.STATUS+"/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.STATUS},methodType:s},t)}},{key:"_leagueRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._baseRequest({endUrl:w.LEAGUE+"/v"+P.LEAGUE+"/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.LEAGUE},methodType:s},t)}},{key:"_matchRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.cacheParams,o=void 0===s?{ttl:this.CACHE_TIMERS.MATCH}:s,a=e.methodType;return this._baseRequest({endUrl:w.MATCH+"/v"+P.MATCH+"/"+i,region:n,options:r,cacheParams:o,methodType:a},t)}},{key:"_matchlistRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.options,s=e.methodType;return this._matchRequest({endUrl:"matchlists/"+i,region:n,options:r,cacheParams:{ttl:this.CACHE_TIMERS.MATCHLIST},methodType:s},t)}},{key:"_runesMasteriesRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.methodType;return this._baseRequest({endUrl:w.RUNES_MASTERIES+"/v"+P.RUNES_MASTERIES+"/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.RUNES_MASTERIES},methodType:r},t)}},{key:"_summonerRequest",value:function(e,t){var i=e.endUrl,n=e.region,r=e.methodType;return this._baseRequest({endUrl:w.SUMMONER+"/v"+P.SUMMONER+"/summoners/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.SUMMONER},methodType:r},t)}},{key:"_logError",value:function(e,t){throw new Error(o.bold.yellow(e)+" "+o.red("request")+" "+o.bold.red("FAILED")+o.red("; "+t))}},{key:"setRegion",value:function(e){if(!H(e))throw new Error(o.red("setRegion() by Kindred failed: "+o.yellow(e)+" is an invalid region.")+"\n"+o.red("Try importing "+o.yellow("require('kindred-api').REGIONS")+" and using one of those values instead."));this.defaultRegion=e}},{key:"getChamps",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.CHAMPION.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._championRequest({endUrl:"champions",region:t,options:i,methodType:v.LIST_CHAMPIONS},n)}},{key:"getChamp",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.championId,r=arguments[1],s="";return Number.isInteger(i)||Number.isInteger(n)?(i&&(s=i.toString()),n&&(s=n.toString()),this._championRequest({endUrl:"champions/"+s,region:t,methodType:v.GET_CHAMPION},r)):this._logError(this.getChamp.name,"required params "+o.yellow("`id/championId` (int)")+" not passed in")}},{key:"getChampMastery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.playerId,n=e.championId,r=arguments[1];return i&&n&&Number.isInteger(i)&&Number.isInteger(n)?this._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+i+"/by-champion/"+n,region:t,methodType:v.GET_CHAMPION_MASTERY},r):this._logError(this.getChampMastery.name,"required params "+o.yellow("`playerId` (int) AND `championId` (int)")+" not passed in")}},{key:"getChampMasteries",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";if(Number.isInteger(n||r)){var m=void 0;return n&&(m=n),r&&(m=r),new Promise(function(t,n){return e.getSummoner({accId:m,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+s.id,region:i,methodType:v.LIST_CHAMPION_MASTERIES},d)):void 0})})}return Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+l,region:i,methodType:v.LIST_CHAMPION_MASTERIES},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+s.id,region:i,methodType:v.LIST_CHAMPION_MASTERIES},d)):void 0})}):this._logError(this.getChampMasteries.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (str)")+" not passed in")}},{key:"getTotalChampMasteryScore",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";if(Number.isInteger(n||r)){var m=void 0;return n&&(m=n),r&&(m=r),new Promise(function(t,n){return e.getSummoner({accId:m,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._championMasteryRequest({endUrl:"scores/by-summoner/"+s.id,region:i,methodType:v.GET_CHAMPION_MASTERY},d)):void 0})})}return Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._championMasteryRequest({endUrl:"scores/by-summoner/"+l,region:i,methodType:v.GET_CHAMPION_MASTERY},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._championMasteryRequest({endUrl:"scores/by-summoner/"+s.id,region:i,methodType:v.GET_CHAMPION_MASTERY},d)):void 0})}):this._logError(this.getTotalChampMasteryScore.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (str)")+" not passed in")}},{key:"getCurrentGame",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";return Number.isInteger(n||r)?new Promise(function(t,s){return e.getSummoner({accId:n||r,region:i},function(n,r){return n?void(d?d(n):s(n)):r&&r.id?t(e._spectatorRequest({endUrl:"active-games/by-summoner/"+r.id,region:i,methodType:v.GET_CURRENT_GAME},d)):void 0})}):Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._spectatorRequest({endUrl:"active-games/by-summoner/"+l,region:i,methodType:v.GET_CURRENT_GAME},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._spectatorRequest({endUrl:"active-games/by-summoner/"+s.id,region:i,methodType:v.GET_CURRENT_GAME},d)):void 0})}):this._logError(this.getCurrentGame.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (string)")+" not passed in")}},{key:"getFeaturedGames",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=arguments[1];return Y(arguments[0])&&(i=arguments[0],arguments[0]=void 0),
this._spectatorRequest({endUrl:"featured-games",region:t,methodType:v.LIST_FEATURED_GAMES},i)}},{key:"getLeagues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";if(Number.isInteger(n||r)){var m=void 0;return n&&(m=n),r&&(m=r),new Promise(function(t,n){return e.getSummoner({accId:m,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._leagueRequest({endUrl:"leagues/by-summoner/"+s.id,region:i,methodType:v.GET_LEAGUES_IN_ALL_QUEUES},d)):void 0})})}return Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._leagueRequest({endUrl:"leagues/by-summoner/"+l,region:i,methodType:v.GET_LEAGUES_IN_ALL_QUEUES},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._leagueRequest({endUrl:"leagues/by-summoner/"+s.id,region:i,methodType:v.GET_LEAGUES_IN_ALL_QUEUES},d)):void 0})}):this._logError(this.getLeagues.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (string)")+" not passed in")}},{key:"getLeaguePositions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";if(Number.isInteger(n||r)){var m=void 0;return n&&(m=n),r&&(m=r),new Promise(function(t,n){return e.getSummoner({accId:m,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._leagueRequest({endUrl:"positions/by-summoner/"+s.id,region:i,methodType:v.GET_LEAGUE_POSITIONS_IN_ALL_QUEUES},d)):void 0})})}return Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._leagueRequest({endUrl:"positions/by-summoner/"+l,region:i,methodType:v.GET_LEAGUE_POSITIONS_IN_ALL_QUEUES},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._leagueRequest({endUrl:"positions/by-summoner/"+s.id,region:i,methodType:v.GET_LEAGUE_POSITIONS_IN_ALL_QUEUES},d)):void 0})}):void this._logError(this.getLeaguePositions.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (string)")+" not passed in")}},{key:"getChallengers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.queue,n=void 0===i?"RANKED_SOLO_5x5":i,r=arguments[1];if(r=Y(arguments[0])?arguments[0]:arguments[1],"string"==typeof n)return this._leagueRequest({endUrl:"challengerleagues/by-queue/"+n,region:t,methodType:v.GET_CHALLENGER_LEAGUE},r);this._logError(this.getChallengers.name,"required params "+o.yellow("`queue` (string)")+" not passed in")}},{key:"getMasters",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.queue,n=void 0===i?"RANKED_SOLO_5x5":i,r=arguments[1];if(r=Y(arguments[0])?arguments[0]:arguments[1],"string"==typeof n)return this._leagueRequest({endUrl:"masterleagues/by-queue/"+n,region:t,methodType:v.GET_MASTER_LEAGUE},r);this._logError(this.getMasters.name,"required params "+o.yellow("`queue` (string)")+" not passed in")}},{key:"getChampionList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.STATIC.CHAMPION.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"champions",region:t,options:i,methodType:v.RETRIEVE_CHAMPION_LIST},n)}},{key:"getChampion",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.championId,r=e.options,s=arguments[1];this._verifyOptions(r,O.STATIC.CHAMPION.ONE);var a="";return Number.isInteger(i||n)?(i&&(a=i.toString()),n&&(a=n.toString()),this._staticRequest({endUrl:"champions/"+a,region:t,options:r,methodType:v.RETRIEVE_CHAMPION_BY_ID},s)):this._logError(this.getChampion.name,"required params "+o.yellow("`id/championId` (int)")+" not passed in")}},{key:"getItems",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.STATIC.ITEM.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"items",region:t,options:i,methodType:v.RETRIEVE_ITEM_LIST},n)}},{key:"getItem",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.itemId,r=e.options,s=arguments[1];this._verifyOptions(r,O.STATIC.ITEM.ONE);var a="";return Number.isInteger(i||n)?(i&&(a=i.toString()),n&&(a=n.toString()),this._staticRequest({endUrl:"items/"+a,region:t,options:r,methodType:v.RETRIEVE_ITEM_BY_ID},s)):this._logError(this.getItem.name,"required params "+o.yellow("`id/itemId` (int)")+" not passed in")}},{key:"getLanguageStrings",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.STATIC.LANGUAGE_STRING.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"language-strings",region:t,options:i,methodType:v.RETRIEVE_LANGUAGE_STRINGS_DATA},n)}},{key:"getLanguages",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=arguments[1];return Y(arguments[0])&&(i=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"languages",region:t,methodType:v.RETRIEVE_SUPPORTED_LANGUAGES_DATA},i)}},{key:"getMapData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.STATIC.MAP.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"maps",region:t,options:i,methodType:v.RETRIEVE_MAP_DATA},n)}},{key:"getMasteryList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.STATIC.MASTERY.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"masteries",region:t,options:i,methodType:v.RETRIEVE_MASTERIES},n)}},{key:"getMastery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.masteryId,r=e.options,s=arguments[1];this._verifyOptions(r,O.STATIC.MASTERY.ONE);var a="";return Number.isInteger(i||n)?(i&&(a=i.toString()),n&&(a=n.toString()),this._staticRequest({endUrl:"masteries/"+a,region:t,options:r,methodType:v.RETRIEVE_MASTERY_BY_ID},s)):this._logError(this.getMastery.name,"required params "+o.yellow("`id/masteryId` (int)")+" not passed in")}},{key:"getProfileIcons",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.STATIC.PROFILE_ICON.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"profile-icons",region:t,options:i,methodType:v.RETRIEVE_PROFILE_ICONS},n)}},{key:"getRealmData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=arguments[1];return Y(arguments[0])&&(i=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"realms",region:t,methodType:v.RETRIEVE_REALM_DATA},i)}},{key:"getRuneList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.STATIC.RUNE.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"runes",region:t,options:i,methodType:v.RETRIEVE_RUNE_LIST},n)}},{key:"getRune",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.runeId,r=e.options,s=arguments[1];this._verifyOptions(r,O.STATIC.RUNE.ONE);var a="";return Number.isInteger(i||n)?(i&&(a=i.toString()),n&&(a=n.toString()),this._staticRequest({endUrl:"runes/"+a,region:t,options:r,methodType:v.RETRIEVE_RUNE_BY_ID},s)):this._logError(this.getRune.name,"required params "+o.yellow("`id/runeId` (int)")+" not passed in")}},{key:"getSummonerSpells",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return this._verifyOptions(i,O.STATIC.SUMMONER_SPELL.LIST),Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"summoner-spells",region:t,options:i,methodType:v.RETRIEVE_SUMMONER_SPELL_LIST},n)}},{key:"getSummonerSpell",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.spellId,r=e.summonerSpellId,s=e.options,a=arguments[1];this._verifyOptions(s,O.STATIC.SUMMONER_SPELL.ONE);var u="";return Number.isInteger(i||n||r)?(i&&(u=i.toString()),n&&(u=n.toString()),r&&(u=r.toString()),this._staticRequest({endUrl:"summoner-spells/"+u,region:t,options:s,methodType:v.RETRIEVE_SUMMONER_SPELL_BY_ID},a)):this._logError(this.getSummonerSpell.name,"required params "+o.yellow("`id/spellId/summonerSpellId` (int)")+" not passed in")}},{key:"getVersionData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.options,n=arguments[1];return Y(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"versions",region:t,options:i,methodType:v.RETRIEVE_VERSIONS},n)}},{key:"getShardStatus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=arguments[1];return Y(arguments[0])&&(i=arguments[0],arguments[0]=void 0),"string"!=typeof t||H(t)?this._statusRequest({endUrl:"shard-data",region:t,methodType:v.GET_SHARD_STATUS},i):this._logError(this.getShardStatus.name,"invalid region!")}},{key:"getMatch",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.matchId,r=e.options,s=arguments[1];this._verifyOptions(r,O.MATCH.GET);var a="";return Number.isInteger(i||n)?(i&&(a=i.toString()),n&&(a=n.toString()),this._matchRequest({endUrl:"matches/"+a,region:t,options:r,methodType:v.GET_MATCH},s)):this._logError(this.getMatch.name,"required params "+o.yellow("`id/matchId` (int)")+" not passed in")}},{key:"getMatchlist",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=t.options,l=arguments[1];this._verifyOptions(d,O.MATCHLIST.GET);var m="";return Number.isInteger(n||r)?(n&&(m=n.toString()),r&&(m=r.toString()),this._matchlistRequest({endUrl:"by-account/"+m,region:i,options:d,methodType:v.GET_MATCHLIST},l)):Number.isInteger(s||a||u)?new Promise(function(t,n){return e.getSummoner({id:s,region:i},function(r,s){return r?void(l?l(r):n(r)):s&&s.accountId?t(e._matchlistRequest({endUrl:"by-account/"+s.accountId,region:i,options:d,methodType:v.GET_MATCHLIST},l)):void 0})}):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(l?l(r):n(r)):s&&s.accountId?t(e._matchlistRequest({endUrl:"by-account/"+s.accountId,region:i,options:d,methodType:v.GET_MATCHLIST},l)):void 0})}):this._logError(this.getMatchlist.name,"required params "+o.yellow("`accountId/accId` (int)")+", "+o.yellow("`id/summonerId/playerId` (int)")+", or "+o.yellow("`name` (str)")+" not passed in")}},{key:"getRecentMatchlist",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";return Number.isInteger(n||r)?(n&&(l=n.toString()),r&&(l=r.toString()),this._matchlistRequest({endUrl:"by-account/"+l+"/recent",region:i,methodType:v.GET_RECENT_MATCHLIST},d)):Number.isInteger(s||a||u)?new Promise(function(t,n){return e.getSummoner({id:s,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.accountId?t(e._matchlistRequest({endUrl:"by-account/"+s.accountId+"/recent",region:i,methodType:v.GET_RECENT_MATCHLIST},d)):void 0})}):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.accountId?t(e._matchlistRequest({endUrl:"by-account/"+s.accountId+"/recent",region:i,methodType:v.GET_RECENT_MATCHLIST},d)):void 0})}):this._logError(this.getRecentMatchlist.name,"required params "+o.yellow("`accountId/accId` (int)")+", "+o.yellow("`id/summonerId/playerId` (int)")+", or "+o.yellow("`name` (str)")+" not passed in")}},{key:"getMatchTimeline",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.matchId,r=arguments[1],s="";return Number.isInteger(i||n)?(i&&(s=i.toString()),n&&(s=n.toString()),this._matchRequest({endUrl:"timelines/by-match/"+s,region:t,methodType:v.GET_MATCH_TIMELINE},r)):this._logError(this.getMatchTimeline.name,"required params "+o.yellow("`id/matchId` (int)")+" not passed in")}},{key:"getRunes",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";return Number.isInteger(n||r)?new Promise(function(t,s){return e.getSummoner({accId:n||r,region:i},function(n,r){return n?void(d?d(n):s(n)):r&&r.id?t(e._runesMasteriesRequest({endUrl:"runes/by-summoner/"+r.id,region:i,methodType:v.GET_RUNE_PAGES},d)):void 0})}):Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._runesMasteriesRequest({endUrl:"runes/by-summoner/"+l,region:i,methodType:v.GET_RUNE_PAGES},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._runesMasteriesRequest({endUrl:"runes/by-summoner/"+s.id,region:i,methodType:v.GET_RUNE_PAGES},d)):void 0})}):this._logError(this.getRunes.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (str)")+" not passed in")}},{key:"getMasteries",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,r=t.accId,s=t.id,a=t.summonerId,u=t.playerId,h=t.name,d=arguments[1],l="";return Number.isInteger(n||r)?new Promise(function(t,s){return e.getSummoner({accId:n||r,region:i},function(n,r){return n?void(d?d(n):s(n)):r&&r.id?t(e._runesMasteriesRequest({endUrl:"masteries/by-summoner/"+r.id,region:i,methodType:v.GET_MASTERY_PAGES},d)):void 0})}):Number.isInteger(s||a||u)?(s&&(l=s.toString()),a&&(l=a.toString()),u&&(l=u.toString()),this._runesMasteriesRequest({endUrl:"masteries/by-summoner/"+l,region:i,methodType:v.GET_MASTERY_PAGES},d)):"string"==typeof h?new Promise(function(t,n){return e.getSummoner({name:h,region:i},function(r,s){return r?void(d?d(r):n(r)):s&&s.id?t(e._runesMasteriesRequest({endUrl:"masteries/by-summoner/"+s.id,region:i,methodType:v.GET_MASTERY_PAGES},d)):void 0})}):this._logError(this.getMasteries.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (str)")+" not passed in")}},{key:"getSummoner",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.summonerId,r=e.playerId,s=e.accountId,a=e.accId,u=e.name,h=arguments[1],d="";return Number.isInteger(i||n||r)?(i&&(d=i.toString()),n&&(d=n.toString()),r&&(d=r.toString()),this._summonerRequest({endUrl:d,region:t,methodType:v.GET_SUMMONER_BY_ID},h)):u&&"string"==typeof u?this._summonerRequest({endUrl:"by-name/"+this._sanitizeName(u),region:t,methodType:v.GET_SUMMONER_BY_NAME},h):Number.isInteger(s||a)?(s&&(d=s.toString()),a&&(d=a.toString()),this._summonerRequest({endUrl:"by-account/"+d,region:t,methodType:v.GET_SUMMONER_BY_ACCOUNT_ID},h)):this._logError(this.getSummoner.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (string)")+" not passed in")}},{key:"listChampions",value:function(e,t,i){return Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),"string"==typeof e&&(t=e,e=re),this.Champion.all({options:e,region:t},i)}},{key:"getChampionById",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Champion.get({id:e,region:t},i)}},{key:"listFeaturedGames",value:function(e,t){return Y(e)&&(t=e,e=re),this.FeaturedGames.get({region:e},t)}},{key:"listChallengers",value:function(e,t,i){return H(e)&&(Y(t)&&(i=t,t=re),t=e,e=re),Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),this.League.challengers({queue:e,region:t},i)}},{key:"listMasters",value:function(e,t,i){return H(e)&&(Y(t)&&(i=t,t=re),t=e,e=re),Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),this.League.masters({queue:e,region:t},i)}},{key:"getSummonerByAccountId",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Summoner.get({region:t,accId:e},i)}},{key:"getSummonerById",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Summoner.get({region:t,id:e},i)}},{key:"getSummonerByName",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Summoner.get({region:t,name:e},i)}},{key:"getMasteriesByAccountId",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Masteries.get({region:t,accId:e},i)}},{key:"getMasteriesById",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Masteries.get({region:t,id:e},i)}},{key:"getMasteriesByName",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Masteries.get({region:t,name:e},i)}},{key:"getMatchById",value:function(e,t,i,n){return Y(t)&&(n=t,t=re),Y(i)&&(n=i,i=re),"string"==typeof t&&(i=t,t=re),this.Match.get({region:i,id:e,options:t},n)}},{key:"getMatchlistByAccountId",value:function(e,t,i,n){return Y(t)&&(n=t,t=re),Y(i)&&(n=i,i=re),"string"==typeof t&&(i=t,t=re),this.Matchlist.get({accId:e,options:t,region:i},n)}},{key:"getMatchlistById",value:function(e,t,i,n){return Y(t)&&(n=t,t=re),Y(i)&&(n=i,i=re),"string"==typeof t&&(i=t,t=re),this.Matchlist.get({id:e,options:t,region:i},n)}},{key:"getMatchlistByName",value:function(e,t,i,n){return Y(t)&&(n=t,t=re),Y(i)&&(n=i,i=re),"string"==typeof t&&(i=t,t=re),this.Matchlist.get({name:e,options:t,region:i},n)}},{key:"getMatchTimelineById",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Match.timeline({id:e,region:t},i)}},{key:"getRunesByAccountId",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Runes.get({region:t,accId:e},i)}},{key:"getRunesById",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Runes.get({region:t,id:e},i)}},{key:"getRunesByName",value:function(e,t,i){return Y(t)&&(i=t,t=re),this.Runes.get({region:t,name:e},i)}},{key:"getStaticChampionList",value:function(e,t,i){return Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),"string"==typeof e&&(t=e,e=re),this.Static.champions({region:t,options:e},i)}},{key:"getStaticChampionById",value:function(e,t,i,n){return Y(t)&&(n=t,t=re),Y(i)&&(n=i,i=re),"string"==typeof t&&(i=t,t=re),this.Static.champion({id:e,options:t,region:i},n)}},{key:"getStaticItemList",value:function(e,t,i){return Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),"string"==typeof e&&(t=e,e=re),this.Static.items({options:e,region:t},i)}},{key:"getStaticItemById",value:function(e,t,i,n){return Y(t)&&(n=t,t=re),Y(i)&&(n=i,i=re),"string"==typeof t&&(i=t,t=re),this.Static.item({id:e,options:t,region:i},n)}},{key:"getStaticLanguageStringList",value:function(e,t,i){return Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),"string"==typeof e&&(t=e,e=re),this.Static.languageStrings({options:e,region:t},i)}},{key:"getStaticLanguageList",value:function(e,t){return Y(e)&&(t=e,e=re),this.Static.languages({region:e},t)}},{key:"getStaticMapList",value:function(e,t,i){return Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),"string"==typeof e&&(t=e,e=re),this.Static.mapData({options:e,region:t},i)}},{key:"getStaticMasteryList",value:function(e,t,i){return Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),"string"==typeof e&&(t=e,e=re),this.Static.masteries({options:e,region:t},i)}},{key:"getStaticMasteryById",value:function(e,t,i,n){return Y(t)&&(n=t,t=re),Y(i)&&(n=i,i=re),"string"==typeof t&&(i=t,t=re),this.Static.mastery({id:e,options:t,region:i},n)}},{key:"getStaticProfileIconList",value:function(e,t,i){return Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),"string"==typeof e&&(t=e,e=re),this.Static.profileIcons({options:e,region:t},i)}},{key:"getStaticRealmList",value:function(e,t){return Y(e)&&(t=e,e=re),this.Static.realm({region:e},t)}},{key:"getStaticRuneList",value:function(e,t,i){return Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),"string"==typeof e&&(t=e,e=re),this.Static.runes({options:e,region:t},i)}},{key:"getStaticRuneById",value:function(e,t,i,n){return Y(t)&&(n=t,t=re),Y(i)&&(n=i,i=re),"string"==typeof t&&(i=t,t=re),this.Static.rune({id:e,options:t,region:i},n)}},{key:"getStaticSummonerSpellList",value:function(e,t,i){return Y(e)&&(i=e,e=re),Y(t)&&(i=t,t=re),"string"==typeof e&&(t=e,e=re),this.Static.spells({options:e,region:t},i)}},{key:"getStaticSummonerSpellById",value:function(e,t,i,n){return Y(t)&&(n=t,t=re),Y(i)&&(n=i,i=re),"string"==typeof t&&(i=t,t=re),this.Static.spell({id:e,options:t,region:i},n)}},{key:"getStaticVersionList",value:function(e,t){return Y(e)&&(t=e,e=re),this.Static.versions({region:e},t)}}]),e}(),re=void 0,se={Kindred:ne,LIMITS:S,METHOD_TYPES:v,QUEUE_STRINGS:U,QUEUE_TYPES:L,REGIONS:C,TIME_CONSTANTS:I,PLATFORM_IDS:N,QuickStart:d,print:l,InMemoryCache:E,RedisCache:_,TAGS:{STATIC_CHAMPION_TAGS:k,STATIC_CHAMPION_LIST_TAGS:q}};e.exports=se});
{
"name": "kindred-api",
"version": "2.0.81",
"version": "2.0.82",
"description": "Node.js League of Legends v3 API wrapper with built-in rate-limiting (enforced per region, burst/spread, follows retry headers, app/method rate-limiting), caching (in-memory, Redis), automatic retries, and parameter checking.",

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

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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