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.50 to 2.0.51

6

CHANGELOG.md

@@ -9,6 +9,5 @@ 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.50]() - Champion.list() bug is now fixed.
## [2.0.51]() - More tinkering with buffers to increase Rate Limiter efficiency!
## [2.0.50](https://github.com/ChauTNguyen/kindred-api/commit/655ba1497352c83edd62c5178725e146d6925fd2) - Champion.list() bug is now fixed.
## [2.0.49](https://github.com/ChauTNguyen/kindred-api/commit/bf1ea95828ccfcd615e71671de6f8726ea85ad8a) - Rate limit logs now prints out `x-rate-limit-type` header as well.
## [2.0.48](https://github.com/ChauTNguyen/kindred-api/commit/f721f0790889ca4f4714066525cf1b4819b10b4b) - Matchlist is now cachable.

@@ -52,3 +51,2 @@

## [2.0.38](https://github.com/ChauTNguyen/kindred-api/commit/d2f63a58a73e5b8c2c8d811f7ca40da9394afdc1) - Simplified [.env](https://github.com/ChauTNguyen/kindred-api/wiki/Tests) setup.
## [2.0.37](https://github.com/ChauTNguyen/kindred-api/commit/f624869c9549a3ec59b468ceba3cb83555d82124) - Set of core, core-utils, in-memory-cache, summoner, runes, masteries tests complete.

@@ -55,0 +53,0 @@

@@ -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,s,r,o,a){"use strict";function u(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=void 0),new K({key:e,defaultRegion:t,debug:i,limits:I.DEV,cacheOptions:M[0]})}function g(e,t){e?console.log(e):console.log(t)}var l="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},h=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}}(),c=function(){function e(){u(this,e),this.cache={}}return h(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}(),m=function(){function e(i){u(this,e);var n=Object.assign({},i||{},{host:"127.0.0.1",port:6379,keyPrefix:"kindredAPI-"});this.client=t.createClient(n.port,n.host),this.client.on("error",function(e){console.log("Redis error:",e)}),process.on("exit",function(){console.log("closing"),this.client.quit()}),this.prefix=n.keyPrefix}return h(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}(),y=function(){function e(t,n){u(this,e),this.allowedRequests=t,this.seconds=n,this.madeRequests=new i}return h(e,[{key:"__reload",value:function(){for(var e=(new Date).getTime();this.madeRequests.length>0&&e-this.madeRequests.peekFront()>=50*this.seconds;)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}(),p={CHAMPION:"platform",CHAMPION_MASTERY:"champion-mastery",GAME:null,LEAGUE:"league",STATUS:"status",MASTERIES:"platform",MATCH:"match",MATCHLIST:null,RUNES:"platform",RUNES_MASTERIES:"platform",SPECTATOR:"spectator",STATIC_DATA:"static-data",STATS:null,SUMMONER:"summoner",TOURNAMENT_STUB:"tournament-stub",TOURNAMENT:"tournament"},v={MONTH:2592e3,WEEK:604800,DAY:846400,SIX_HOURS:21600,THREE_HOURS:10800,TWO_HOURS:7200,HOUR:3600,THIRTY_MINUTES:1800,SHORT:600,NONE:null},R={CHAMPION:v.MONTH,CHAMPION_MASTERY:v.SIX_HOURS,CURRENT_GAME:v.NONE,FEATURED_GAMES:v.NONE,GAME:v.HOUR,LEAGUE:v.SIX_HOURS,STATIC:v.MONTH,STATUS:v.NONE,MATCH:v.MONTH,MATCHLIST:v.HOUR,RUNES_MASTERIES:v.WEEK,SPECTATOR:v.NONE,STATS:v.HOUR,SUMMONER:v.DAY,TOURNAMENT_STUB:v.HOUR,TOURNAMENT:v.HOUR},I={DEV:[[10,10],[500,600]],PROD:[[500,10],[3e4,600]]},S={BRAZIL:"BR1",EUROPE:"EUN1",EUROPE_WEST:"EUW1",KOREA:"KR",LATIN_AMERICA_NORTH:"LA1",LATIN_AMERICA_SOUTH:"LA2",NORTH_AMERICA:"NA1",OCEANIA:"OC1",RUSSIA:"RU",TURKEY:"TR1",JAPAN:"JP1"},f={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},b={RANKED_SOLO_5x5:"RANKED_SOLO_5x5",RANKED_FLEX_SR:"RANKED_FLEX_SR",RANKED_FLEX_TT:"RANKED_FLEX_TT"},E={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"},_={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"},A={CHAMPION:3,CHAMPION_MASTERY:3,CURRENT_GAME:1,FEATURED_GAMES:1,GAME:1.3,LEAGUE:3,STATIC_DATA:3,STATUS:3,MATCH:3,RUNES_MASTERIES:3,SPECTATOR:3,STATS:1.3,SUMMONER:3,TOURNAMENT_STUB:3,TOURNAMENT:3},M=["in-memory-cache","redis"],T=n("^[0-9\\p{L} _\\.]+$"),N=function(e){var t=!0,i=!1,n=void 0;try{for(var s,r=Object.keys(E)[Symbol.iterator]();!(t=(s=r.next()).done);t=!0){var o=s.value;if(E[o]===e)return!0}}catch(e){i=!0,n=e}finally{try{!t&&r.return&&r.return()}finally{if(i)throw n}}return!1},U={int:function(e){return e.every(function(e){return Number.isInteger(e)})},string:function(e){return e.every(function(e){return"string"==typeof e})}},C={int:function(e){return e&&Array.isArray(e)&&U.int(e)&&e.length>0},string:function(e){return e&&Array.isArray(e)&&U.string(e)&&e.length>0}},q=function(e){return(Array.isArray(e)&&2!==e.length||!C.int(e[0])||2!==e[0].length||!C.int(e[1])||2!==e[1].length)&&"dev"!==e&&"prod"!==e},O=function(e){return"function"==typeof e},k={200:"Success",400:"Bad Request",403:"Forbidden",404:"Not Found",415:"Unsupported Media Type",429:"Rate Limit Exceeded",500:"Internal Service Error",503:"Service Unavailable"},L=function(e){return k[e]||""},w=[200,400,500],P=function(e){var t=L(e).toUpperCase(),i=e+" "+t;return e>=w[0]&&e<w[1]?s.green(e):e>=w[1]&&e<w[2]?s.red(i):s.bold.red(i)},D=function(e,t,i){console.log(t,"@",i),console.log({"x-rate-limit-type":e.headers["x-rate-limit-type"],"x-app-rate-limit-count":e.headers["x-app-rate-limit-count"],"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()},B={BAD_REQUEST:400,FORBIDDEN:403,NOT_FOUND:404,UNSUPPORTED_MEDIA_TYPE:415,RATE_LIMIT_EXCEEDED:429,INTERNAL_SERVICE_ERROR:500,SERVICE_UNAVAILABLE:503},x=B.INTERNAL_SERVICE_ERROR,H=B.RATE_LIMIT_EXCEEDED,G=function(e){return e>=x||e===H},K=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.key,n=t.defaultRegion,s=void 0===n?E.NORTH_AMERICA:n,r=t.debug,a=void 0!==r&&r,d=t.limits,g=t.spread,h=t.cacheOptions,p=t.cacheTTL;if(u(this,e),0===arguments.length||"object"!==l(arguments[0])||"string"!=typeof i)throw new Error(""+o.red("API key not passed in!"));if(this.key=i,this.defaultRegion=N(s)?s:void 0,!this.defaultRegion)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.debug=a,h?(h===M[0]?this.cache=new c:h===M[1]?this.cache=new m:this.cache=new h,this.CACHE_TIMERS=p?p:R):this.cache={get:function(e,t){return t(null,null)},set:function(e,t){}},this.CACHE_TIMERS||(this.CACHE_TIMERS={CHAMPION:0,CHAMPION_MASTERY:0,CURRENT_GAME:0,FEATURED_GAMES:0,GAME:0,LEAGUE:0,STATIC:0,STATUS:0,MATCH:0,MATCHLIST:0,RUNES_MASTERIES:0,STATS:0,SUMMONER:0}),d){if(q(d))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 strings:")+" dev/prod "),console.log(""+o.red("and Kindred will set the limits appropriately.")),new Error;this.limits={},"dev"===d&&(d=I.DEV),"prod"===d&&(d=I.PROD),this.spread=g;var v=!0,S=!1,f=void 0;try{for(var b,_=Object.keys(E)[Symbol.iterator]();!(v=(b=_.next()).done);v=!0){var A=b.value;this.limits[E[A]]=[new y(d[0][0],d[0][1]),new y(d[1][0],d[1][1]),this.spread?new y(d[0][0]/10,.5):null]}}catch(e){S=!0,f=e}finally{try{!v&&_.return&&_.return()}finally{if(S)throw f}}}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.Game={getRecentGames:this.getRecentGames.bind(this),getRecent:this.getRecentGames.bind(this),recent:this.getRecentGames.bind(this),get:this.getRecentGames.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.Stats={getRankedStats:this.getRankedStats.bind(this),ranked:this.getRankedStats.bind(this),getStatsSummary:this.getStatsSummary.bind(this),summary:this.getStatsSummary.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)}},this.Tournament={getDTOByCode:this.getDTOByCode.bind(this),DTO:{by:{code:this.getDTOByCode.bind(this)}},getLobbyListEventsByCode:this.getLobbyListEventsByCode.bind(this),LobbyListEvents:{by:{code:this.getLobbyListEventsByCode.bind(this)}}},this.Ex={getSummonerByAccId:this.getSummonerByAccId.bind(this),getMatchlistByName:this.getMatchlistByName.bind(this),getRunesBySummonerId:this.getRunesBySummonerId.bind(this),getRunesByAccountId:this.getRunesByAccountId.bind(this),staticRuneList:this.staticRuneList.bind(this)}}return h(e,[{key:"canMakeRequest",value:function(e){var t=!this.spread||this.limits[e][2].requestAvailable();return this.limits[e][0].requestAvailable()&&this.limits[e][1].requestAvailable()&&t}},{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 T.test(e)}},{key:"_makeUrl",value:function(e,t,i){var n=i?"":t+"/",s="api/lol/"+n,r="https://"+t+".api.riotgames.com/"+s+encodeURI(e),o="https://"+S[_[t]].toLowerCase()+".api.riotgames.com/lol/"+encodeURI(e);return o.lastIndexOf("v3")==-1?r:o}},{key:"_baseRequest",value:function(e,t){var i=this,n=e.endUrl,s=e.region,u=void 0===s?this.defaultRegion:s,d=e.staticReq,g=void 0!==d&&d,l=e.options,h=void 0===l?{}:l,c=e.cacheParams,m=void 0===c?{}:c;return function e(){return new Promise(function(s,d){var l="";if(n.lastIndexOf("v3")==-1){var c=!0,y=!1,p=void 0;try{for(var v,R=Object.keys(h)[Symbol.iterator]();!(c=(v=R.next()).done);c=!0){var I=v.value;Array.isArray(h[I])&&(h[I]=h[I].join(","))}}catch(e){y=!0,p=e}finally{try{!c&&R.return&&R.return()}finally{if(y)throw p}}l=a.stringify(h).replace(/%2C/,",")}else{var S=!0,f=!1,b=void 0;try{for(var E,_=Object.keys(h)[Symbol.iterator]();!(S=(E=_.next()).done);S=!0){var A=E.value;if(Array.isArray(h[A]))for(var M=0;M<h[A].length;++M)l&&(l+="&"),l+=A+"="+h[A][M];else l&&(l+="&"),l+=A+"="+h[A]}}catch(e){f=!0,b=e}finally{try{!S&&_.return&&_.return()}finally{if(f)throw b}}}var T=l?"?"+l:"",N=i._makeUrl(n+T,u,g),U=N+(N.lastIndexOf("?")===-1?"?":"&")+"api_key="+i.key;i.cache.get({key:N},function(n,a){if(a){i.debug&&console.log(o.green("CACHE HIT")+" "+U);var l=JSON.parse(a);return t?t(n,l):s(l)}if(i.limits){var h=i;!function t(i){if(!h.canMakeRequest(u))return setTimeout(function(){return t.bind(h)(i)},1e3);g||(h.limits[u][0].addRequest(),h.limits[u][1].addRequest(),h.spread&&h.limits[u][2].addRequest()),r({url:U},function(n,r,a){if(r&&a){var u=r.statusCode,g=P(u),l=1e3*r.headers["retry-after"]+50||1e3;return h.debug&&D(r,g,o.yellow(U)),O(i)?G(u)?(h.debug&&console.log("Resending callback request.\n"),setTimeout(function(){return t.bind(h)(i)},l)):u>=400?i(u):(Number.isInteger(m.ttl)&&m.ttl>0&&h.cache.set({key:N,ttl:m.ttl},a),i(n,JSON.parse(a))):G(u)?(h.debug&&console.log("Resending promise request.\n"),setTimeout(function(){return s(e())},l)):u>=400?d(u):(Number.isInteger(m.ttl)&&m.ttl>0&&h.cache.set({key:N,ttl:m.ttl},a),s(JSON.parse(a)))}console.log(n,N)})}(t)}else r({url:U},function(e,n,r){if(n){var a=i,u=n.statusCode,g=P(u);return a.debug&&D(n,g,o.yellow(U)),O(t)?u>=400?t(u):t(e,JSON.parse(r)):u>=400?d(u):s(JSON.parse(r))}console.log(e,N)})})})}()}},{key:"_championMasteryRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.CHAMPION_MASTERY+"/v"+A.CHAMPION+"/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.CHAMPION_MASTERY}},t)}},{key:"_championRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.CHAMPION+"/v"+A.CHAMPION+"/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.CHAMPION}},t)}},{key:"_spectatorRequest",value:function(e,t){var i=e.endUrl,n=e.region;return this._baseRequest({endUrl:p.SPECTATOR+"/v"+A.SPECTATOR+"/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.SPECTATOR}},t)}},{key:"_staticRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.STATIC_DATA+"/v"+A.STATIC_DATA+"/"+i,staticReq:!0,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.STATIC}},t)}},{key:"_statusRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.STATUS+"/v"+A.STATUS+"/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.STATUS}},t)}},{key:"_gameRequest",value:function(e,t){var i=e.endUrl,n=e.region;return this._baseRequest({endUrl:"v"+A.GAME+"/game/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.GAME}},t)}},{key:"_leagueRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.LEAGUE+"/v"+A.LEAGUE+"/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.LEAGUE}},t)}},{key:"_matchRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options,r=e.cacheParams,o=void 0===r?{ttl:this.CACHE_TIMERS.MATCH}:r;return this._baseRequest({endUrl:p.MATCH+"/v"+A.MATCH+"/"+i,region:n,options:s,cacheParams:o},t)}},{key:"_matchlistRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._matchRequest({endUrl:"matchlists/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.MATCHLIST}},t)}},{key:"_runesMasteriesRequest",value:function(e,t){var i=e.endUrl,n=e.region;return this._baseRequest({endUrl:p.RUNES_MASTERIES+"/v"+A.RUNES_MASTERIES+"/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.RUNES_MASTERIES}},t)}},{key:"_statsRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:"v"+A.STATS+"/stats/by-summoner/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.STATS}},t)}},{key:"_summonerRequest",value:function(e,t){var i=e.endUrl,n=e.region;return this._baseRequest({endUrl:p.SUMMONER+"/v"+A.SUMMONER+"/summoners/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.SUMMONER}},t)}},{key:"_tournamentRequest",value:function(e,t){var i=(e.endUrl,e.region);return this._baseRequest({endUrl:p.TOURNAMENT+"/v"+A.TOURNAMENT,region:i,cacheParams:{ttl:this.CACHE_TIMERS.TOURNAMENT}},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(this.defaultRegion=N(e)?e:void 0,!this.defaultRegion)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."))}},{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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._championRequest({endUrl:"champions",region:t,options:i},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,s=arguments[1];return Number.isInteger(i)||Number.isInteger(n)?this._championRequest({endUrl:"champions/"+(i||n),region:t},s):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,s=e.options,r=arguments[1];return Number.isInteger(i)&&Number.isInteger(n)?this._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+i+"/by-champion/"+n,region:t,options:s},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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+r.id,region:i},g))})}):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._championMasteryRequest({endUrl:"scores/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._championMasteryRequest({endUrl:"scores/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._championMasteryRequest({endUrl:"scores/by-summoner/"+r.id,region:i},g))})}):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._spectatorRequest({endUrl:"active-games/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._spectatorRequest({endUrl:"active-games/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._spectatorRequest({endUrl:"active-games/by-summoner/"+r.id,region:i},g))})}):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 O(arguments[0])&&(i=arguments[0],arguments[0]=void 0),this._spectatorRequest({endUrl:"featured-games",region:t},i)}},{key:"getRecentGames",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._gameRequest({endUrl:"by-summoner/"+s.id+"/recent",region:i},g))})}):Number.isInteger(r||a||u)?this._gameRequest({endUrl:"by-summoner/"+(r||a||u)+"/recent",region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._gameRequest({endUrl:"by-summoner/"+r.id+"/recent",region:i},g))})}):this._logError(this.getRecentGames.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (string)")+" not passed in")}},{key:"getLeagues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=t.options,l=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(l?l(n):r(n)):t(e._leagueRequest({endUrl:"leagues/by-summoner/"+s.id,region:i,options:g},l))})}):Number.isInteger(r||a||u)?this._leagueRequest({endUrl:"leagues/by-summoner/"+(r||a||u),region:i,options:g},l):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(l?l(s):n(s)):t(e._leagueRequest({endUrl:"leagues/by-summoner/"+r.id,region:i,options:g},l))})}):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._leagueRequest({endUrl:"positions/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._leagueRequest({endUrl:"positions/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._leagueRequest({endUrl:"positions/by-summoner/"+r.id,region:i},g))})}):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,s=arguments[1];if(s=O(arguments[0])?arguments[0]:arguments[1],"string"==typeof n)return this._leagueRequest({endUrl:"challengerleagues/by-queue/"+n,region:t},s);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,s=arguments[1];if(s=O(arguments[0])?arguments[0]:arguments[1],"string"==typeof n)return this._leagueRequest({endUrl:"masterleagues/by-queue/"+n,region:t},s);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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"champions",region:t,options:i},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,s=e.options,r=arguments[1];return Number.isInteger(i||n)?this._staticRequest({endUrl:"champions/"+(i||n),region:t,options:s},r):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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"items",region:t,options:i},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,s=e.options,r=arguments[1];return Number.isInteger(i||n)?this._staticRequest({endUrl:"items/"+(i||n),region:t,options:s},r):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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"language-strings",region:t,options:i},n)}},{key:"getLanguages",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=arguments[1];return O(arguments[0])&&(i=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"languages",region:t},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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"maps",region:t,options:i},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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"masteries",region:t,options:i},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,s=e.options,r=arguments[1];return Number.isInteger(i||n)?this._staticRequest({endUrl:"masteries/"+(i||n),region:t,options:s
!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,s,r,o,a){"use strict";function u(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=void 0),new K({key:e,defaultRegion:t,debug:i,limits:I.DEV,cacheOptions:M[0]})}function g(e,t){e?console.log(e):console.log(t)}var l="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},h=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}}(),c=function(){function e(){u(this,e),this.cache={}}return h(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}(),m=function(){function e(i){u(this,e);var n=Object.assign({},i||{},{host:"127.0.0.1",port:6379,keyPrefix:"kindredAPI-"});this.client=t.createClient(n.port,n.host),this.client.on("error",function(e){console.log("Redis error:",e)}),process.on("exit",function(){console.log("closing"),this.client.quit()}),this.prefix=n.keyPrefix}return h(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}(),y=function(){function e(t,n){u(this,e),this.allowedRequests=t,this.seconds=n,this.madeRequests=new i,this.buffer=50*this.seconds}return h(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}(),p={CHAMPION:"platform",CHAMPION_MASTERY:"champion-mastery",GAME:null,LEAGUE:"league",STATUS:"status",MASTERIES:"platform",MATCH:"match",MATCHLIST:null,RUNES:"platform",RUNES_MASTERIES:"platform",SPECTATOR:"spectator",STATIC_DATA:"static-data",STATS:null,SUMMONER:"summoner",TOURNAMENT_STUB:"tournament-stub",TOURNAMENT:"tournament"},v={MONTH:2592e3,WEEK:604800,DAY:846400,SIX_HOURS:21600,THREE_HOURS:10800,TWO_HOURS:7200,HOUR:3600,THIRTY_MINUTES:1800,SHORT:600,NONE:null},R={CHAMPION:v.MONTH,CHAMPION_MASTERY:v.SIX_HOURS,CURRENT_GAME:v.NONE,FEATURED_GAMES:v.NONE,GAME:v.HOUR,LEAGUE:v.SIX_HOURS,STATIC:v.MONTH,STATUS:v.NONE,MATCH:v.MONTH,MATCHLIST:v.HOUR,RUNES_MASTERIES:v.WEEK,SPECTATOR:v.NONE,STATS:v.HOUR,SUMMONER:v.DAY,TOURNAMENT_STUB:v.HOUR,TOURNAMENT:v.HOUR},I={DEV:[[10,10],[500,600]],PROD:[[500,10],[3e4,600]]},S={BRAZIL:"BR1",EUROPE:"EUN1",EUROPE_WEST:"EUW1",KOREA:"KR",LATIN_AMERICA_NORTH:"LA1",LATIN_AMERICA_SOUTH:"LA2",NORTH_AMERICA:"NA1",OCEANIA:"OC1",RUSSIA:"RU",TURKEY:"TR1",JAPAN:"JP1"},f={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},b={RANKED_SOLO_5x5:"RANKED_SOLO_5x5",RANKED_FLEX_SR:"RANKED_FLEX_SR",RANKED_FLEX_TT:"RANKED_FLEX_TT"},E={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"},_={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"},A={CHAMPION:3,CHAMPION_MASTERY:3,CURRENT_GAME:1,FEATURED_GAMES:1,GAME:1.3,LEAGUE:3,STATIC_DATA:3,STATUS:3,MATCH:3,RUNES_MASTERIES:3,SPECTATOR:3,STATS:1.3,SUMMONER:3,TOURNAMENT_STUB:3,TOURNAMENT:3},M=["in-memory-cache","redis"],T=n("^[0-9\\p{L} _\\.]+$"),N=function(e){var t=!0,i=!1,n=void 0;try{for(var s,r=Object.keys(E)[Symbol.iterator]();!(t=(s=r.next()).done);t=!0){var o=s.value;if(E[o]===e)return!0}}catch(e){i=!0,n=e}finally{try{!t&&r.return&&r.return()}finally{if(i)throw n}}return!1},U={int:function(e){return e.every(function(e){return Number.isInteger(e)})},string:function(e){return e.every(function(e){return"string"==typeof e})}},C={int:function(e){return e&&Array.isArray(e)&&U.int(e)&&e.length>0},string:function(e){return e&&Array.isArray(e)&&U.string(e)&&e.length>0}},q=function(e){return(Array.isArray(e)&&2!==e.length||!C.int(e[0])||2!==e[0].length||!C.int(e[1])||2!==e[1].length)&&"dev"!==e&&"prod"!==e},O=function(e){return"function"==typeof e},k={200:"Success",400:"Bad Request",403:"Forbidden",404:"Not Found",415:"Unsupported Media Type",429:"Rate Limit Exceeded",500:"Internal Service Error",503:"Service Unavailable"},L=function(e){return k[e]||""},w=[200,400,500],P=function(e){var t=L(e).toUpperCase(),i=e+" "+t;return e>=w[0]&&e<w[1]?s.green(e):e>=w[1]&&e<w[2]?s.red(i):s.bold.red(i)},D=function(e,t,i){console.log(t,"@",i),console.log({"x-rate-limit-type":e.headers["x-rate-limit-type"],"x-app-rate-limit-count":e.headers["x-app-rate-limit-count"],"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()},B={BAD_REQUEST:400,FORBIDDEN:403,NOT_FOUND:404,UNSUPPORTED_MEDIA_TYPE:415,RATE_LIMIT_EXCEEDED:429,INTERNAL_SERVICE_ERROR:500,SERVICE_UNAVAILABLE:503},x=B.INTERNAL_SERVICE_ERROR,H=B.RATE_LIMIT_EXCEEDED,G=function(e){return e>=x||e===H},K=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.key,n=t.defaultRegion,s=void 0===n?E.NORTH_AMERICA:n,r=t.debug,a=void 0!==r&&r,d=t.limits,g=t.spread,h=t.cacheOptions,p=t.cacheTTL;if(u(this,e),0===arguments.length||"object"!==l(arguments[0])||"string"!=typeof i)throw new Error(""+o.red("API key not passed in!"));if(this.key=i,this.defaultRegion=N(s)?s:void 0,!this.defaultRegion)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.debug=a,h?(h===M[0]?this.cache=new c:h===M[1]?this.cache=new m:this.cache=new h,this.CACHE_TIMERS=p?p:R):this.cache={get:function(e,t){return t(null,null)},set:function(e,t){}},this.CACHE_TIMERS||(this.CACHE_TIMERS={CHAMPION:0,CHAMPION_MASTERY:0,CURRENT_GAME:0,FEATURED_GAMES:0,GAME:0,LEAGUE:0,STATIC:0,STATUS:0,MATCH:0,MATCHLIST:0,RUNES_MASTERIES:0,STATS:0,SUMMONER:0}),d){if(q(d))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 strings:")+" dev/prod "),console.log(""+o.red("and Kindred will set the limits appropriately.")),new Error;this.limits={},"dev"===d&&(d=I.DEV),"prod"===d&&(d=I.PROD),this.spread=g;var v=!0,S=!1,f=void 0;try{for(var b,_=Object.keys(E)[Symbol.iterator]();!(v=(b=_.next()).done);v=!0){var A=b.value;this.limits[E[A]]=[new y(d[0][0],d[0][1]),new y(d[1][0],d[1][1]),this.spread?new y(d[0][0]/10,.5):null]}}catch(e){S=!0,f=e}finally{try{!v&&_.return&&_.return()}finally{if(S)throw f}}}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.Game={getRecentGames:this.getRecentGames.bind(this),getRecent:this.getRecentGames.bind(this),recent:this.getRecentGames.bind(this),get:this.getRecentGames.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.Stats={getRankedStats:this.getRankedStats.bind(this),ranked:this.getRankedStats.bind(this),getStatsSummary:this.getStatsSummary.bind(this),summary:this.getStatsSummary.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)}},this.Tournament={getDTOByCode:this.getDTOByCode.bind(this),DTO:{by:{code:this.getDTOByCode.bind(this)}},getLobbyListEventsByCode:this.getLobbyListEventsByCode.bind(this),LobbyListEvents:{by:{code:this.getLobbyListEventsByCode.bind(this)}}},this.Ex={getSummonerByAccId:this.getSummonerByAccId.bind(this),getMatchlistByName:this.getMatchlistByName.bind(this),getRunesBySummonerId:this.getRunesBySummonerId.bind(this),getRunesByAccountId:this.getRunesByAccountId.bind(this),staticRuneList:this.staticRuneList.bind(this)}}return h(e,[{key:"canMakeRequest",value:function(e){var t=!this.spread||this.limits[e][2].requestAvailable();return this.limits[e][0].requestAvailable()&&this.limits[e][1].requestAvailable()&&t}},{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 T.test(e)}},{key:"_makeUrl",value:function(e,t,i){var n=i?"":t+"/",s="api/lol/"+n,r="https://"+t+".api.riotgames.com/"+s+encodeURI(e),o="https://"+S[_[t]].toLowerCase()+".api.riotgames.com/lol/"+encodeURI(e);return o.lastIndexOf("v3")==-1?r:o}},{key:"_baseRequest",value:function(e,t){var i=this,n=e.endUrl,s=e.region,u=void 0===s?this.defaultRegion:s,d=e.staticReq,g=void 0!==d&&d,l=e.options,h=void 0===l?{}:l,c=e.cacheParams,m=void 0===c?{}:c;return function e(){return new Promise(function(s,d){var l="";if(n.lastIndexOf("v3")==-1){var c=!0,y=!1,p=void 0;try{for(var v,R=Object.keys(h)[Symbol.iterator]();!(c=(v=R.next()).done);c=!0){var I=v.value;Array.isArray(h[I])&&(h[I]=h[I].join(","))}}catch(e){y=!0,p=e}finally{try{!c&&R.return&&R.return()}finally{if(y)throw p}}l=a.stringify(h).replace(/%2C/,",")}else{var S=!0,f=!1,b=void 0;try{for(var E,_=Object.keys(h)[Symbol.iterator]();!(S=(E=_.next()).done);S=!0){var A=E.value;if(Array.isArray(h[A]))for(var M=0;M<h[A].length;++M)l&&(l+="&"),l+=A+"="+h[A][M];else l&&(l+="&"),l+=A+"="+h[A]}}catch(e){f=!0,b=e}finally{try{!S&&_.return&&_.return()}finally{if(f)throw b}}}var T=l?"?"+l:"",N=i._makeUrl(n+T,u,g),U=N+(N.lastIndexOf("?")===-1?"?":"&")+"api_key="+i.key;i.cache.get({key:N},function(n,a){if(a){i.debug&&console.log(o.green("CACHE HIT")+" "+U);var l=JSON.parse(a);return t?t(n,l):s(l)}if(i.limits){var h=i;!function t(i){if(!h.canMakeRequest(u)){return setTimeout(function(){return t.bind(h)(i)},1e3/4.5)}g||(h.limits[u][0].addRequest(),h.limits[u][1].addRequest(),h.spread&&h.limits[u][2].addRequest()),r({url:U},function(n,r,a){if(r&&a){var u=r.statusCode,g=P(u),l=1e3*r.headers["retry-after"]||1e3;return h.debug&&D(r,g,o.yellow(U)),O(i)?G(u)?(h.debug&&console.log("Resending callback request.\n"),setTimeout(function(){return t.bind(h)(i)},l)):u>=400?i(u):(Number.isInteger(m.ttl)&&m.ttl>0&&h.cache.set({key:N,ttl:m.ttl},a),i(n,JSON.parse(a))):G(u)?(h.debug&&console.log("Resending promise request.\n"),setTimeout(function(){return s(e())},l)):u>=400?d(u):(Number.isInteger(m.ttl)&&m.ttl>0&&h.cache.set({key:N,ttl:m.ttl},a),s(JSON.parse(a)))}console.log(n,N)})}(t)}else r({url:U},function(e,n,r){if(n){var a=i,u=n.statusCode,g=P(u);return a.debug&&D(n,g,o.yellow(U)),O(t)?u>=400?t(u):t(e,JSON.parse(r)):u>=400?d(u):s(JSON.parse(r))}console.log(e,N)})})})}()}},{key:"_championMasteryRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.CHAMPION_MASTERY+"/v"+A.CHAMPION+"/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.CHAMPION_MASTERY}},t)}},{key:"_championRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.CHAMPION+"/v"+A.CHAMPION+"/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.CHAMPION}},t)}},{key:"_spectatorRequest",value:function(e,t){var i=e.endUrl,n=e.region;return this._baseRequest({endUrl:p.SPECTATOR+"/v"+A.SPECTATOR+"/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.SPECTATOR}},t)}},{key:"_staticRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.STATIC_DATA+"/v"+A.STATIC_DATA+"/"+i,staticReq:!0,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.STATIC}},t)}},{key:"_statusRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.STATUS+"/v"+A.STATUS+"/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.STATUS}},t)}},{key:"_gameRequest",value:function(e,t){var i=e.endUrl,n=e.region;return this._baseRequest({endUrl:"v"+A.GAME+"/game/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.GAME}},t)}},{key:"_leagueRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:p.LEAGUE+"/v"+A.LEAGUE+"/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.LEAGUE}},t)}},{key:"_matchRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options,r=e.cacheParams,o=void 0===r?{ttl:this.CACHE_TIMERS.MATCH}:r;return this._baseRequest({endUrl:p.MATCH+"/v"+A.MATCH+"/"+i,region:n,options:s,cacheParams:o},t)}},{key:"_matchlistRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._matchRequest({endUrl:"matchlists/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.MATCHLIST}},t)}},{key:"_runesMasteriesRequest",value:function(e,t){var i=e.endUrl,n=e.region;return this._baseRequest({endUrl:p.RUNES_MASTERIES+"/v"+A.RUNES_MASTERIES+"/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.RUNES_MASTERIES}},t)}},{key:"_statsRequest",value:function(e,t){var i=e.endUrl,n=e.region,s=e.options;return this._baseRequest({endUrl:"v"+A.STATS+"/stats/by-summoner/"+i,region:n,options:s,cacheParams:{ttl:this.CACHE_TIMERS.STATS}},t)}},{key:"_summonerRequest",value:function(e,t){var i=e.endUrl,n=e.region;return this._baseRequest({endUrl:p.SUMMONER+"/v"+A.SUMMONER+"/summoners/"+i,region:n,cacheParams:{ttl:this.CACHE_TIMERS.SUMMONER}},t)}},{key:"_tournamentRequest",value:function(e,t){var i=(e.endUrl,e.region);return this._baseRequest({endUrl:p.TOURNAMENT+"/v"+A.TOURNAMENT,region:i,cacheParams:{ttl:this.CACHE_TIMERS.TOURNAMENT}},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(this.defaultRegion=N(e)?e:void 0,!this.defaultRegion)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."))}},{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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._championRequest({endUrl:"champions",region:t,options:i},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,s=arguments[1];return Number.isInteger(i)||Number.isInteger(n)?this._championRequest({endUrl:"champions/"+(i||n),region:t},s):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,s=e.options,r=arguments[1];return Number.isInteger(i)&&Number.isInteger(n)?this._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+i+"/by-champion/"+n,region:t,options:s},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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._championMasteryRequest({endUrl:"champion-masteries/by-summoner/"+r.id,region:i},g))})}):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._championMasteryRequest({endUrl:"scores/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._championMasteryRequest({endUrl:"scores/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._championMasteryRequest({endUrl:"scores/by-summoner/"+r.id,region:i},g))})}):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._spectatorRequest({endUrl:"active-games/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._spectatorRequest({endUrl:"active-games/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._spectatorRequest({endUrl:"active-games/by-summoner/"+r.id,region:i},g))})}):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 O(arguments[0])&&(i=arguments[0],arguments[0]=void 0),this._spectatorRequest({endUrl:"featured-games",region:t},i)}},{key:"getRecentGames",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._gameRequest({endUrl:"by-summoner/"+s.id+"/recent",region:i},g))})}):Number.isInteger(r||a||u)?this._gameRequest({endUrl:"by-summoner/"+(r||a||u)+"/recent",region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._gameRequest({endUrl:"by-summoner/"+r.id+"/recent",region:i},g))})}):this._logError(this.getRecentGames.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (string)")+" not passed in")}},{key:"getLeagues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=t.options,l=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(l?l(n):r(n)):t(e._leagueRequest({endUrl:"leagues/by-summoner/"+s.id,region:i,options:g},l))})}):Number.isInteger(r||a||u)?this._leagueRequest({endUrl:"leagues/by-summoner/"+(r||a||u),region:i,options:g},l):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(l?l(s):n(s)):t(e._leagueRequest({endUrl:"leagues/by-summoner/"+r.id,region:i,options:g},l))})}):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._leagueRequest({endUrl:"positions/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._leagueRequest({endUrl:"positions/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._leagueRequest({endUrl:"positions/by-summoner/"+r.id,region:i},g))})}):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,s=arguments[1];if(s=O(arguments[0])?arguments[0]:arguments[1],"string"==typeof n)return this._leagueRequest({endUrl:"challengerleagues/by-queue/"+n,region:t},s);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,s=arguments[1];if(s=O(arguments[0])?arguments[0]:arguments[1],"string"==typeof n)return this._leagueRequest({endUrl:"masterleagues/by-queue/"+n,region:t},s);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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"champions",region:t,options:i},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,s=e.options,r=arguments[1];return Number.isInteger(i||n)?this._staticRequest({endUrl:"champions/"+(i||n),region:t,options:s},r):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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"items",region:t,options:i},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,s=e.options,r=arguments[1];return Number.isInteger(i||n)?this._staticRequest({endUrl:"items/"+(i||n),region:t,options:s},r):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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"language-strings",region:t,options:i},n)}},{key:"getLanguages",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=arguments[1];return O(arguments[0])&&(i=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"languages",region:t},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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"maps",region:t,options:i},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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"masteries",region:t,options:i},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,s=e.options,r=arguments[1];return Number.isInteger(i||n)?this._staticRequest({endUrl:"masteries/"+(i||n),region:t,options:s
},r):this._logError(this.getMastery.name,"required params "+o.yellow("`id/masteryId` (int)")+" not passed in")}},{key:"getProfileIcons",value:function(e,t){var i=e.region,n=e.options;return O(arguments[0])&&(t=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"profile-icons",region:i,options:n},t)}},{key:"getRealmData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=arguments[1];return O(arguments[0])&&(i=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"realms",region:t},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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"runes",region:t,options:i},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,s=e.options,r=arguments[1];return Number.isInteger(i||n)?this._staticRequest({endUrl:"runes/"+(i||n),region:t,options:s},r):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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"summoner-spells",region:t,options:i},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,s=e.summonerSpellId,r=e.options,a=arguments[1];return Number.isInteger(i||n||s)?this._staticRequest({endUrl:"summoner-spells/"+(i||n||s),region:t,options:r},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 O(arguments[0])&&(n=arguments[0],arguments[0]=void 0),this._staticRequest({endUrl:"versions",region:t,options:i},n)}},{key:"getShardStatus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=arguments[1];return O(arguments[0])&&(i=arguments[0],arguments[0]=void 0),"string"==typeof arguments[0]?N(arguments[0])?this._statusRequest({endUrl:"shard-data",region:arguments[0]},i):this._logError(this.getShardStatus.name,"invalid region!"):this._statusRequest({endUrl:"shard-data",region:t},i)}},{key:"getMatch",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,i=e.id,n=e.matchId,s=e.options,r=arguments[1];return Number.isInteger(arguments[0])?this._matchRequest({endUrl:"matches/"+arguments[0],region:t,options:s},r):Number.isInteger(i||n)?this._matchRequest({endUrl:"matches/"+(i||n),region:t,options:s},r):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=t.options,l=void 0===g?{queue:f.TEAM_BUILDER_RANKED_SOLO}:g,h=arguments[1];return Number.isInteger(n||s)?this._matchlistRequest({endUrl:"by-account/"+(n||s),region:i,options:l},h):Number.isInteger(r||a||u)?new Promise(function(t,n){return e.getSummoner({id:r,region:i},function(s,r){return s?void(h?h(s):n(s)):t(e._matchlistRequest({endUrl:"by-account/"+r.accountId,region:i,options:l},h))})}):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(h?h(s):n(s)):t(e._matchlistRequest({endUrl:"by-account/"+r.accountId,region:i,options:l},h))})}):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?this._matchlistRequest({endUrl:"by-account/"+(n||s)+"/recent",region:i},g):Number.isInteger(r||a||u)?new Promise(function(t,n){return e.getSummoner({id:r,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._matchlistRequest({endUrl:"by-account/"+r.accountId+"/recent",region:i},g))})}):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._matchlistRequest({endUrl:"by-account/"+r.accountId+"/recent",region:i},g))})}):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,s=arguments[1];return Number.isInteger(i||n)?this._matchRequest({endUrl:"timelines/by-match/"+(i||n),region:t},s):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._runesMasteriesRequest({endUrl:"runes/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._runesMasteriesRequest({endUrl:"runes/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._runesMasteriesRequest({endUrl:"runes/by-summoner/"+r.id,region:i},g))})}):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,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(g?g(n):r(n)):t(e._runesMasteriesRequest({endUrl:"masteries/by-summoner/"+s.id,region:i},g))})}):Number.isInteger(r||a||u)?this._runesMasteriesRequest({endUrl:"masteries/by-summoner/"+(r||a||u),region:i},g):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(g?g(s):n(s)):t(e._runesMasteriesRequest({endUrl:"masteries/by-summoner/"+r.id,region:i},g))})}):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:"getRankedStats",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=t.options,l=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(l?l(n):r(n)):t(e._statsRequest({endUrl:s.id+"/ranked",region:i,options:g},l))})}):Number.isInteger(r||a||u)?this._statsRequest({endUrl:(r||a||u)+"/ranked",region:i,options:g},l):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(l?l(s):n(s)):t(e._statsRequest({endUrl:r.id+"/ranked",region:i,options:g},l))})}):void this._logError(this.getRankedStats.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (string)")+" not passed in")}},{key:"getStatsSummary",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.region,n=t.accountId,s=t.accId,r=t.id,a=t.summonerId,u=t.playerId,d=t.name,g=t.options,l=arguments[1];return Number.isInteger(n||s)?new Promise(function(t,r){return e.getSummoner({accId:n||s,region:i},function(n,s){return n?void(l?l(n):r(n)):t(e._statsRequest({endUrl:s.id+"/summary",region:i,options:g},l))})}):Number.isInteger(r||a||u)?this._statsRequest({endUrl:(r||a||u)+"/summary",region:i,options:g},l):"string"==typeof d?new Promise(function(t,n){return e.getSummoner({name:d,region:i},function(s,r){return s?void(l?l(s):n(s)):t(e._statsRequest({endUrl:r.id+"/summary",region:i,options:g},l))})}):void this._logError(this.getStatsSummary.name,"required params "+o.yellow("`id/summonerId/playerId` (int)")+", "+o.yellow("`accountId/accId` (int)")+", or "+o.yellow("`name` (string)")+" 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,s=e.playerId,r=e.accountId,a=e.accId,u=e.name,d=arguments[1];return Number.isInteger(i||n||s)?this._summonerRequest({endUrl:""+(i||n||s),region:t},d):"string"==typeof u?this._summonerRequest({endUrl:"by-name/"+this._sanitizeName(u),region:t},d):Number.isInteger(r||a)?this._summonerRequest({endUrl:"by-account/"+(r||a),region:t},d):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:"getDTOByCode",value:function(e,t){return"string"==typeof e?this._tournamentRequest({endUrl:"lobby-events/codes/"+e},t):this._logError(this.getDTOByCode.name,"required params "+o.yellow("`code` (string)")+" not passed in")}},{key:"getLobbyListEventsByCode",value:function(e,t){return"string"==typeof e?this._tournamentRequest({endUrl:"lobby-events/by-code/"+e},t):this._logError(this.getLobbyListEventsByCode.name,"required params "+o.yellow("`code` (string)")+" not passed in")}},{key:"listChampions",value:function(e,t,i){return O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),"string"==typeof e&&(t=e,e=void 0),this.Champion.all({options:e,region:t},i)}},{key:"getChampionById",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Champion.get({id:e,region:t},i)}},{key:"listFeaturedGames",value:function(e,t){return O(e)&&(t=e,e=void 0),this.FeaturedGames.get({region:e},t)}},{key:"listChallengers",value:function(e,t,i){return N(e)&&(O(t)&&(i=t,t=void 0),t=e,e=void 0),O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),this.League.challengers({queue:e,region:t},i)}},{key:"listMasters",value:function(e,t,i){return N(e)&&(O(t)&&(i=t,t=void 0),t=e,e=void 0),O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),this.League.masters({queue:e,region:t},i)}},{key:"getSummonerByAccountId",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Summoner.get({region:t,accId:e},i)}},{key:"getSummonerById",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Summoner.get({region:t,id:e},i)}},{key:"getSummonerByName",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Summoner.get({region:t,name:e},i)}},{key:"getMasteriesByAccountId",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Masteries.get({region:t,accId:e},i)}},{key:"getMasteriesById",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Masteries.get({region:t,id:e},i)}},{key:"getMasteriesByName",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Masteries.get({region:t,name:e},i)}},{key:"getMatchById",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Match.get({region:t,id:e},i)}},{key:"getMatchlistByAccountId",value:function(e,t,i,n){return O(t)&&(n=t,t=void 0),O(i)&&(n=i,i=void 0),"string"==typeof t&&(i=t,t=void 0),this.Matchlist.get({region:i,accId:e},n)}},{key:"getMatchlistById",value:function(e,t,i,n){return O(t)&&(n=t,t=void 0),O(i)&&(n=i,i=void 0),"string"==typeof t&&(i=t,t=void 0),this.Matchlist.get({region:i,id:e},n)}},{key:"getMatchlistByName",value:function(e,t,i,n){return O(t)&&(n=t,t=void 0),O(i)&&(n=i,i=void 0),"string"==typeof t&&(i=t,t=void 0),this.Matchlist.get({name:e,options:t,region:i},n)}},{key:"getMatchTimelineById",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Match.timeline({id:e,region:t},i)}},{key:"getRunesByAccountId",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Runes.get({region:t,accId:e},i)}},{key:"getRunesById",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Runes.get({region:t,id:e},i)}},{key:"getRunesByName",value:function(e,t,i){return O(t)&&(i=t,t=void 0),this.Runes.get({region:t,name:e},i)}},{key:"getStaticChampionList",value:function(e,t,i){return O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),"string"==typeof e&&(t=e,e=void 0),this.Static.champions({region:t,options:e},i)}},{key:"getStaticChampionById",value:function(e,t,i,n){return O(t)&&(n=t,t=void 0),O(i)&&(n=i,i=void 0),"string"==typeof t&&(i=t,t=void 0),this.Static.champion({id:e,options:t,region:i},n)}},{key:"getStaticItemList",value:function(e,t,i){return O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),"string"==typeof e&&(t=e,e=void 0),this.Static.items({options:e,region:t},i)}},{key:"getStaticItemById",value:function(e,t,i,n){return O(t)&&(n=t,t=void 0),O(i)&&(n=i,i=void 0),"string"==typeof t&&(i=t,t=void 0),this.Static.item({id:e,options:t,region:i},n)}},{key:"getStaticLanguageStringList",value:function(e,t,i){return O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),"string"==typeof e&&(t=e,e=void 0),this.Static.languageStrings({options:e,region:t},i)}},{key:"getStaticLanguageList",value:function(e,t){return O(e)&&(t=e,e=void 0),this.Static.languages({region:e},t)}},{key:"getStaticMapList",value:function(e,t,i){return O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),"string"==typeof e&&(t=e,e=void 0),this.Static.mapData({options:e,region:t},i)}},{key:"getStaticMasteryList",value:function(e,t,i){return O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),"string"==typeof e&&(t=e,e=void 0),this.Static.masteries({options:e,region:t},i)}},{key:"getStaticMasteryById",value:function(e,t,i,n){return O(t)&&(n=t,t=void 0),O(i)&&(n=i,i=void 0),"string"==typeof t&&(i=t,t=void 0),this.Static.mastery({id:e,options:t,region:i},n)}},{key:"getStaticProfileIconList",value:function(e,t,i){return O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),"string"==typeof e&&(t=e,e=void 0),this.Static.profileIcons({options:e,region:t},i)}},{key:"getStaticRealmList",value:function(e,t){return O(e)&&(t=e,e=void 0),this.Static.realm({region:e},t)}},{key:"getStaticRuneList",value:function(e,t,i){return O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),"string"==typeof e&&(t=e,e=void 0),this.Static.runes({options:e,region:t},i)}},{key:"getStaticRuneById",value:function(e,t,i,n){return O(t)&&(n=t,t=void 0),O(i)&&(n=i,i=void 0),"string"==typeof t&&(i=t,t=void 0),this.Static.rune({id:e,options:t,region:i},n)}},{key:"getStaticSummonerSpellList",value:function(e,t,i){return O(e)&&(i=e,e=void 0),O(t)&&(i=t,t=void 0),"string"==typeof e&&(t=e,e=void 0),this.Static.spells({options:e,region:t},i)}},{key:"getStaticSummonerSpellById",value:function(e,t,i,n){return O(t)&&(n=t,t=void 0),O(i)&&(n=i,i=void 0),"string"==typeof t&&(i=t,t=void 0),this.Static.spell({id:e,options:t,region:i},n)}},{key:"getStaticVersionList",value:function(e,t){return O(e)&&(t=e,e=void 0),this.Static.versions({region:e},t)}},{key:"getSummonerByAccId",value:function(e,t,i){return this.Summoner.get({region:t,accId:e},i)}},{key:"getRunesBySummonerId",value:function(e,t,i){return this.Runes.get({region:t,id:e},i)}},{key:"staticRuneList",value:function(e,t,i){return this.Static.runes({region:e,options:t},i)}}]),e}(),F={Kindred:K,REGIONS:E,LIMITS:I,TIME_CONSTANTS:v,CACHE_TYPES:M,QUEUE_TYPES:f,QUEUE_STRINGS:b,QuickStart:d,print:g};e.exports=F});
{
"name": "kindred-api",
"version": "2.0.50",
"version": "2.0.51",
"description": "Node.js League of Legends v3 API wrapper with built-in rate-limiting (enforced per region, burst/spread, follows retry headers), caching (in-memory, Redis), automatic retries, and parameter checking.",

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

@@ -33,3 +33,3 @@ # Kindred

# How the Methods Work
* [Object + Callback Functions](#object-callback-functions)
* [Object + Callback Functions](#object-and-callback-functions)
* [Standard Functions](#standard-functions)

@@ -52,4 +52,18 @@

## Object + Callback Functions
## Object and Callback Functions
```javascript
const id = 32932398 // summonerId
const name = 'Contractz'
const accId = 47776491
k.Matchlist.get({ id }, KindredAPI.print)
k.Matchlist.get({ name }, KindredAPI.print)
k.Matchlist.get({ accId }, KindredAPI.print)
k.Summoner.get({ id }, KindredAPI.print)
k.Summoner.get({ name }, KindredAPI.print)
k.Summoner.get({ accId }, KindredAPI.print)
// Want to use more regular-looking functions? Scroll to the `Standard Functions` section!
const config = {

@@ -117,8 +131,2 @@ id: 6323,

const summonerConfig = {
name: 'Contractz'
}
k.Summoner.get(summonerConfig, KindredAPI.print)
// As you can see in the above, all functions that aren't named `list` or `by-id`

@@ -134,3 +142,9 @@ // will take in an object parameter as the first parameter ALWAYS.

k.Summoner.by.name('Contractz', KindredAPI.print)
k.Summoner.by.id(32932398, KindredAPI.print)
k.Summoner
.by.account(47776491)
.then(data => console.log(data))
.catch(error => console.error(error))
const opts = {

@@ -137,0 +151,0 @@ queue: [QUEUES.TEAM_BUILDER_RANKED_SOLO, QUEUES.RANKED_FLEX_SR],

@@ -530,3 +530,3 @@ const request = require('request')

const responseMessage = prettifyStatusMessage(statusCode)
const retry = response.headers['retry-after'] * SECOND + 50 || SECOND
const retry = response.headers['retry-after'] * SECOND || SECOND

@@ -564,4 +564,4 @@ if (self.debug)

} else {
// Can't make request -> retry in a second.
return setTimeout(() => sendRequest.bind(self)(callback), SECOND)
const buffer = SECOND / 4.5
return setTimeout(() => sendRequest.bind(self)(callback), buffer)
}

@@ -568,0 +568,0 @@ })(cb)

@@ -8,18 +8,18 @@ const Deque = require('double-ended-queue')

this.madeRequests = new Deque()
this.buffer = this.seconds * 50
}
__reload() {
_reload() {
const t = (new Date()).getTime()
while (this.madeRequests.length > 0 && (t - this.madeRequests.peekFront() >= (this.seconds*50))) {
while (this.madeRequests.length > 0 && t - this.madeRequests.peekFront() >= this.buffer)
this.madeRequests.shift()
}
}
addRequest() {
this.madeRequests.push((new Date()).getTime() + (this.seconds*1000))
this.madeRequests.push((new Date()).getTime() + this.seconds*1000)
}
requestAvailable() {
this.__reload()
this._reload()
return this.madeRequests.length < this.allowedRequests

@@ -26,0 +26,0 @@ }

@@ -181,3 +181,3 @@ /* eslint-disable max-nested-callbacks */

function count(err, data) {
if (data)--num
if (data) --num
if (num == 0) done()

@@ -184,0 +184,0 @@ }

@@ -82,3 +82,3 @@ /* eslint-disable max-nested-callbacks */

describe('get', function () {
describe('should work with just id param', function (done) {
it('should work with just id param', function (done) {
init().Match

@@ -85,0 +85,0 @@ .get(matchId)

@@ -15,2 +15,4 @@ /* eslint-disable max-nested-callbacks */

describe('Status', function () {
this.timeout(0)
describe('get', function () {

@@ -25,2 +27,10 @@ describe('object param', function () {

})
it('should be a successful call', function (done) {
init().Status.get()
.then(data => {
expect(data).to.not.be.undefined
done()
})
})
})

@@ -27,0 +37,0 @@

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