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 1.2.4 to 1.2.5

4

dist/kindred-api.min.js

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

!function(e,t){if("function"==typeof define&&define.amd)define("kindred-api",["module","double-ended-queue","xregexp","request","chalk","xregexp","query-string"],t);else if("undefined"!=typeof exports)t(module,require("double-ended-queue"),require("xregexp"),require("request"),require("chalk"),require("xregexp"),require("query-string"));else{var n={exports:{}};t(n,e.doubleEndedQueue,e.xregexp,e.request,e.chalk,e.xregexp,e.queryString),e.kindredApi=n.exports}}(this,function(e,t,n,i,r,s,o){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u="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},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),m=function(){function e(n,i){a(this,e),this.allowedRequests=n,this.seconds=i,this.madeRequests=new t}return l(e,[{key:"__reload",value:function(){for(var e=(new Date).getTime();this.madeRequests.length>0&&e-this.madeRequests.peekFront()>=1e3*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}(),g={DEV:[[10,10],[500,600]],PROD:[[3e3,10],[18e4,600]]},h={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"},d={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"},p={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"},y={CHAMPION:1.2,CURRENT_GAME:1,FEATURED_GAMES:1,GAME:1.3,LEAGUE:2.5,STATIC_DATA:1.2,STATUS:1,MATCH:2.2,MATCH_LIST:2.2,RUNES_MASTERIES:1.4,STATS:1.3,SUMMONER:1.4},c=n("^[0-9\\p{L} _\\.]+$"),v={int:function(e){return e.every(function(e){return Number.isInteger(e)})},string:function(e){return e.every(function(e){return"string"==typeof e})}},f={int:function(e){return e&&Array.isArray(e)&&v.int(e)&&e.length>0},string:function(e){return e&&Array.isArray(e)&&v.string(e)&&e.length>0}},b=function(e){var t=!0,n=!1,i=void 0;try{for(var r,s=Object.keys(d)[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;if(d[o]===e)return!0}}catch(e){n=!0,i=e}finally{try{!t&&s.return&&s.return()}finally{if(n)throw i}}return!1},R={400:"Bad Request",403:"Forbidden",404:"Not Found",415:"Unsupported Media Type",429:"Rate Limit Exceeded",500:"Internal Service Error",503:"Service Unavailable"},I=function(e){var t=R[e];if(t)return t},_=function(e){return(Array.isArray(e)&&2!==e.length||!f.int(e[0])||2!==e[0].length||!f.int(e[1])||2!==e[1].length)&&"dev"!==e&&"prod"!==e},S=function(){function e(t){var n=t.key,i=t.defaultRegion,s=void 0===i?d.NORTH_AMERICA:i,o=t.debug,u=void 0!==o&&o,l=t.limits;if(a(this,e),this.key=n,this.defaultRegion=b(s)?s:void 0,this.defaultRegion||(console.log(""+r.red("Initialization of Kindred failed: "+r.yellow(s)+" is an invalid region.")),console.log(""+r.red("Try importing "+r.yellow("require('./dist/kindred-api').REGIONS")+" and using one of those values instead.")),process.exit(1)),this.debug=u,l){_(l)&&(console.log(r.red("Initialization of Kindred failed: Invalid "+r.yellow("limits")+". Valid examples: "+r.yellow("[[10, 10], [500, 600]]"))+"."),console.log(r.red("You can also pass in one of these two strings:")+" dev/prod "),console.log(""+r.red("and Kindred will set the limits appropriately.")),process.exit(1)),this.limits={},"dev"===l&&(l=g.DEV),"prod"===l&&(l=g.PROD);var h=!0,p=!1,y=void 0;try{for(var c,v=Object.keys(d)[Symbol.iterator]();!(h=(c=v.next()).done);h=!0){var f=c.value;this.limits[d[f]]=[new m(l[0][0],l[0][1]),new m(l[1][0],l[1][1])]}}catch(e){p=!0,y=e}finally{try{!h&&v.return&&v.return()}finally{if(p)throw y}}}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)},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),getTopChampions:this.getTopChamps.bind(this),top:this.getTopChamps.bind(this),best:this.getTopChamps.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)},this.Game={getRecentGames:this.getRecentGames.bind(this),getRecent:this.getRecentGames.bind(this),get:this.getRecentGames.bind(this)},this.League={getLeagues:this.getLeagues.bind(this),get:this.getLeagues.bind(this),getLeagueEntries:this.getLeagueEntries.bind(this),getEntries:this.getLeagueEntries.bind(this),entries:this.getLeagueEntries.bind(this),getChallengers:this.getChallengers.bind(this),challengers:this.getChallengers.bind(this),getMasters:this.getMasters.bind(this),masters:this.getMasters.bind(this)},this.Static={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),getMap:this.getMap.bind(this),map:this.getMap.bind(this),getMasteries:this.getMasteryList.bind(this),masteries:this.getMasteryList.bind(this),getMastery:this.getMastery.bind(this),mastery:this.getMastery.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),getShardList:this.getShardList.bind(this),getShards:this.getShardList.bind(this),getAll:this.getShardList.bind(this),all:this.getShardList.bind(this)},this.Match={getMatch:this.getMatch.bind(this),get:this.getMatch.bind(this)},this.MatchList={getMatchList:this.getMatchList.bind(this),get:this.getMatchList.bind(this)},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)},this.Masteries={get:this.getMasteries.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={getSummoners:this.getSummoners.bind(this),getAll:this.getSummoners.bind(this),all:this.getSummoners.bind(this),getSummoner:this.getSummoner.bind(this),get:this.getSummoner.bind(this),getSummonerNames:this.getSummonerNames.bind(this),getNames:this.getSummonerNames.bind(this),names:this.getSummonerNames.bind(this),getSummonerName:this.getSummonerName.bind(this),getName:this.getSummonerName.bind(this),name:this.getSummonerName.bind(this)}}return l(e,[{key:"canMakeRequest",value:function(e){return!(!this.limits[e][0].requestAvailable()||!this.limits[e][1].requestAvailable())}},{key:"_sanitizeName",value:function(e){if(this._validName(e))return e.replace(/\s/g,"").toLowerCase();this._logError(this._validName.name,"Name "+r.yellow(e)+" is not valid. Request failed."),process.exit(1)}},{key:"_validName",value:function(e){return c.test(e)}},{key:"_makeUrl",value:function(e,t,n,i,r,s){var o=n?"":t+"/",a=i||r||s?"":"api/lol/"+o,u="https://"+t+".api.riotgames.com/"+a+encodeURI(e);return u+(u.lastIndexOf("?")===-1?"?":"&")+"api_key="+this.key}},{key:"_baseRequest",value:function(e,t){var n=this,s=e.endUrl,a=e.region,u=void 0===a?this.defaultRegion:a,l=e.status,m=void 0!==l&&l,g=e.observerMode,h=void 0!==g&&g,d=e.staticReq,p=void 0!==d&&d,y=e.championMastery,c=void 0!==y&&y,v=e.options,f=void 0===v?{}:v,b=function(){return new Promise(function(e,a){var l=p?"global":u,g=o.stringify(f),d=g?"?"+g:"",y=n._makeUrl(s+d,l,p,m,h,c);if(n.limits){var v=n;!function t(n){v.canMakeRequest(u)?(p||(v.limits[u][0].addRequest(),v.limits[u][1].addRequest()),i({url:y},function(i,s,o){if(s&&o){var u=void 0,l=s.statusCode;if(l>=200&&l<300?u=r.green(l):l>=400&&l<500?u=r.red(l+" "+I(l)):l>=500&&(u=r.bold.red(l+" "+I(l))),v.debug&&(console.log(u,y),console.log({"x-app-rate-limit-count":s.headers["x-app-rate-limit-count"],"x-method-rate-limit-count":s.headers["x-method-rate-limit-count"],"x-rate-limit-count":s.headers["x-rate-limit-count"],"retry-after":s.headers["retry-after"]}),console.log()),"function"==typeof n)return l>=500&&(v.debug&&console.log("!!! resending request !!!"),setTimeout(function(){t.bind(v)(n)},1e3)),429===l&&(v.debug&&console.log("!!! resending request !!!"),setTimeout(function(){t.bind(v)(n)},1e3*s.headers["retry-after"]+50)),l>=400?n(u+" : "+r.yellow(y)):n(i,JSON.parse(o));if(500===l)v.debug&&console.log("!!! resending promise request !!!"),setTimeout(function(){return a("retry")},1e3);else{if(429!==l)return i||l>=400?a("err:",i,l):e(JSON.parse(o));v.debug&&console.log("!!! resending promise request !!!"),setTimeout(function(){return a("retry")},1e3*s.headers["retry-after"]+50)}}else console.log(i,y)})):setTimeout(function(){t.bind(v)(n)},1e3)}(t)}else i({url:y},function(i,s,o){if(s){var u=void 0,l=s.statusCode;return l>=200&&l<300?u=r.green(l):l>=400&&l<500?u=r.red(l+" "+I(l)):l>=500&&(u=r.bold.red(l+" "+I(l))),n.debug&&(console.log(s&&u,y),console.log({"x-app-rate-limit-count":s.headers["x-app-rate-limit-count"],"x-method-rate-limit-count":s.headers["x-method-rate-limit-count"],"x-rate-limit-count":s.headers["x-rate-limit-count"],"retry-after":s.headers["retry-after"]})),"function"==typeof t?l>=400?t(u+" : "+r.yellow(y)):t(i,JSON.parse(o)):i?a("err:",i):e(JSON.parse(o))}console.log(i,y)})})};return t?b():b().catch(b).catch(b).catch(b).then(function(e){return e})}},{key:"_observerRequest",value:function(e,t){var n=e.endUrl,i=e.region;return this._baseRequest({endUrl:"observer-mode/rest/"+n,observerMode:!0,region:i},t)}},{key:"_championRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.CHAMPION+"/"+n,region:i,options:r},t)}},{key:"_championMasteryRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"championmastery/location/"+n,region:i,options:r,championMastery:!0},t)}},{key:"_currentGameRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.platformId;return this._observerRequest({endUrl:"consumer/getSpectatorGameInfo/"+r+"/"+n,region:i},t)}},{key:"_staticRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=void 0===i?this.defaultRegion:i,s=e.options;return this._baseRequest({endUrl:"static-data/"+r+"/v"+y.STATIC_DATA+"/"+n,staticReq:!0,region:r,options:s},t)}},{key:"_statusRequest",value:function(e,t){var n=e.endUrl,i=(e.region,e.options);return this._baseRequest({endUrl:"lol/status/v"+y.STATUS+"/"+n,status:!0,options:i},t)}},{key:"_gameRequest",value:function(e,t){var n=e.endUrl,i=e.region;return this._baseRequest({endUrl:"v"+y.GAME+"/game/"+n,region:i},t)}},{key:"_leagueRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.LEAGUE+"/league/"+n,region:i,options:r},t)}},{key:"_matchRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.MATCH+"/match/"+n,region:i,options:r},t)}},{key:"_matchListRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.MATCH_LIST+"/matchlist/by-summoner/"+n,region:i,options:r},t)}},{key:"_runesMasteriesRequest",value:function(e,t){var n=e.endUrl,i=e.region;return this._summonerRequest({endUrl:n,region:i},t)}},{key:"_statsRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.STATS+"/stats/by-summoner/"+n,region:i,options:r},t)}},{key:"_summonerRequest",value:function(e,t){var n=e.endUrl,i=e.region;return this._baseRequest({endUrl:"v"+y.SUMMONER+"/summoner/"+n,region:i},t)}},{key:"_logError",value:function(e,t){console.log(r.bold.yellow(e),r.red("request"),r.bold.red("FAILED")+r.red("; "+t))}},{key:"setRegion",value:function(e){this.defaultRegion=e}},{key:"getChamps",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._championRequest({endUrl:"champion",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getChamp",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.championID,s=arguments[1];return Number.isInteger(n)||Number.isInteger(i)?this._championRequest({endUrl:"champion/"+(n||i),region:t},s):this._logError(this.getChamp.name,"required params "+r.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,n=void 0===t?this.defaultRegion:t,i=e.playerID,s=e.championID,o=e.options,a=arguments[1];if(Number.isInteger(i)&&Number.isInteger(s)){var u=h[p[n]];return this._championMasteryRequest({endUrl:u+"/player/"+i+"/champion/"+s,region:n,options:o},a)}return this._logError(this.getChampMastery.name,"required params "+r.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]:{},n=t.region,i=void 0===n?this.defaultRegion:n,s=t.id,o=t.summonerID,a=t.playerID,l=t.name,m=t.options,g=arguments[1];if(Number.isInteger(s||o||a)){var d=h[p[i]];return this._championMasteryRequest({endUrl:d+"/player/"+(s||o||a)+"/champions",region:i,options:m},g)}if("object"===u(arguments[0])&&"string"==typeof l){var y=h[p[i]];return new Promise(function(t,n){return e.getSummoner({name:l,region:i},function(r,s){return r?void(g?g(r):n(r)):t(e._championMasteryRequest({endUrl:y+"/player/"+s[e._sanitizeName(l)].id+"/champions",region:i},g))})})}return this._logError(this.getChampMasteries.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (str)")+" not passed in")}},{key:"getTotalChampMasteryScore",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=void 0===n?this.defaultRegion:n,s=t.id,o=t.summonerID,a=t.playerID,l=t.name,m=t.options,g=arguments[1];if(Number.isInteger(s||o||a)){var d=h[p[i]];return this._championMasteryRequest({endUrl:d+"/player/"+(s||o||a)+"/score",region:i,options:m},g)}if("object"===u(arguments[0])&&"string"==typeof l){var y=h[p[i]];return new Promise(function(t,n){return e.getSummoner({name:l,region:i},function(r,s){return r?void(g?g(r):n(r)):t(e._championMasteryRequest({endUrl:y+"/player/"+s[e._sanitizeName(l)].id+"/score",region:i},g))})})}return this._logError(this.getTotalChampMasteryScore.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (str)")+" not passed in")}},{key:"getTopChamps",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=void 0===n?this.defaultRegion:n,s=t.id,o=t.summonerID,a=t.playerID,l=t.name,m=t.options,g=arguments[1];if(Number.isInteger(s||o||a)){var d=h[p[i]];return this._championMasteryRequest({endUrl:d+"/player/"+(s||o||a)+"/topchampions",region:i,options:m},g)}if("object"===u(arguments[0])&&"string"==typeof l){var y=h[p[i]];return new Promise(function(t,n){return e.getSummoner({name:l,region:i},function(r,s){return r?void(g?g(r):n(r)):t(e._championMasteryRequest({endUrl:y+"/player/"+s[e._sanitizeName(l)].id+"/topchampions",region:i},g))})})}return this._logError(this.getTopChamps.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (str)")+" not passed in")}},{key:"getCurrentGame",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=void 0===n?this.defaultRegion:n,s=t.id,o=t.summonerID,a=t.playerID,l=t.name,m=arguments[1],g=h[p[i]];return Number.isInteger(s||o||a)?this._currentGameRequest({endUrl:""+(s||o||a),platformId:g,region:i},m):"object"===u(arguments[0])&&"string"==typeof l?new Promise(function(t,n){return e.getSummoner({name:l,region:i},function(r,s){return r?void(m?m(r):n(r)):t(e._currentGameRequest({endUrl:""+s[e._sanitizeName(l)].id,platformId:g,region:i},m))})}):this._logError(this.getCurrentGame.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getFeaturedGames",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._observerRequest({endUrl:"featured",region:t},n=t?n:arguments[0])}},{key:"getRecentGames",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.id,s=t.summonerID,o=t.playerID,a=t.name,l=arguments[1];return Number.isInteger(i||s||o)?this._gameRequest({endUrl:"by-summoner/"+(i||s||o)+"/recent",region:n},l):"object"===u(arguments[0])&&"string"==typeof a?new Promise(function(t,i){return e.getSummoner({name:a,region:n},function(r,s){return r?void(l?l(r):i(r)):t(e._gameRequest({endUrl:"by-summoner/"+s[e._sanitizeName(a)].id+"/recent",region:n},l))})}):this._logError(this.getRecentGames.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getLeagues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=t.options,p=arguments[1];return f.int(i||s||o)?this._leagueRequest({endUrl:"by-summoner/"+(i||s||o).join(","),region:n,options:d},p):Number.isInteger(i||a||s||l||o||m)?this._leagueRequest({endUrl:"by-summoner/"+(i||a||s||l||o||m),region:n,options:d},p):f.string(g)?new Promise(function(t,i){return e.getSummoners({names:g,region:n},function(r,s){if(r)return void(p?p(r):i(r));var o=[],a=!0,u=!1,l=void 0;try{for(var m,h=g[Symbol.iterator]();!(a=(m=h.next()).done);a=!0){var y=m.value;o.push(s[e._sanitizeName(y)].id)}}catch(e){u=!0,l=e}finally{try{!a&&h.return&&h.return()}finally{if(u)throw l}}return t(e._leagueRequest({endUrl:"by-summoner/"+o.join(","),region:n,options:d},p))})}):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?this._logError(this.getLeagues.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):new Promise(function(t,i){return e.getSummoner({name:g||h,region:n},function(r,s){return r?void(p?p(r):i(r)):t(e._leagueRequest({endUrl:"by-summoner/"+s[e._sanitizeName(g||h)].id,region:n,options:d},p))})})}},{key:"getLeagueEntries",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=arguments[1];return f.int(i||s||o)?this._leagueRequest({endUrl:"by-summoner/"+(i||s||o).join(",")+"/entry",region:n},d):Number.isInteger(i||a||s||l||o||m)?this._leagueRequest({endUrl:"by-summoner/"+(i||a||s||l||o||m)+"/entry",region:n},d):f.string(g)?new Promise(function(t,i){return e.getSummoners({names:g,region:n},function(r,s){if(r)return void(d?d(r):i(r));var o=[],a=!0,u=!1,l=void 0;try{for(var m,h=g[Symbol.iterator]();!(a=(m=h.next()).done);a=!0){var p=m.value;o.push(s[e._sanitizeName(p)].id)}}catch(e){u=!0,l=e}finally{try{!a&&h.return&&h.return()}finally{if(u)throw l}}return t(e._leagueRequest({endUrl:"by-summoner/"+o.join(",")+"/entry",region:n},d))})}):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?void this._logError(this.getLeagueEntries.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):new Promise(function(t,i){return e.getSummoner({name:g||h,region:n},function(r,s){return r?void(d?d(r):i(r)):t(e._leagueRequest({endUrl:"by-summoner/"+s[e._sanitizeName(g||h)].id+"/entry",region:n},d))})})}},{key:"getChallengers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=void 0===n?{type:"RANKED_SOLO_5x5"}:n,r=arguments[1];return console.log(arguments.length),console.log("object"===u(arguments[0])),this._leagueRequest({endUrl:"challenger",region:t,options:i},r=2===arguments.length?r:arguments[0])}},{key:"getMasters",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=void 0===n?{type:"RANKED_SOLO_5x5"}:n,r=arguments[1];return this._leagueRequest({endUrl:"master",region:t,options:i},r=(t||i)&&2===arguments.length?r:arguments[0])}},{key:"getChampionList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"champion",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getChampion",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.championID,s=e.options,o=arguments[1];return Number.isInteger(n||i)?this._staticRequest({endUrl:"champion/"+(n||i),region:t,options:s},o):this._logError(this.getChampion.name,"required params "+r.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,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"item",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getItem",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.itemID,s=e.options,o=arguments[1];return Number.isInteger(n||i)?this._staticRequest({endUrl:"item/"+(n||i),region:t,options:s},o):this._logError(this.getItem.name,"required params "+r.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,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"language-strings",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getLanguages",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._staticRequest({endUrl:"languages",region:t},n=t?n:arguments[0])}},{key:"getMap",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"map",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getMasteryList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"mastery",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getMastery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.masteryID,s=e.options,o=arguments[1];return Number.isInteger(n||i)?this._staticRequest({endUrl:"mastery/"+(n||i),region:t,options:s},o):this._logError(this.getMastery.name,"required params "+r.yellow("`id/masteryID` (int)")+" not passed in")}},{key:"getRealmData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._staticRequest({endUrl:"realm",region:t},n=t?n:arguments[0])}},{key:"getRuneList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"rune",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getRune",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.runeID,s=e.options,o=arguments[1];return Number.isInteger(n||i)?this._staticRequest({endUrl:"rune/"+(n||i),region:t,options:s},o):this._logError(this.getRune.name,"required params "+r.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,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"summoner-spell",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getSummonerSpell",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.spellID,s=e.summonerSpellID,o=e.options,a=arguments[1];return Number.isInteger(n||i||s)?this._staticRequest({endUrl:"summoner-spell/"+(n||i||s),region:t,options:o},a):this._logError(this.getSummonerSpell.name,"required params "+r.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,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"versions",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getShardStatus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._statusRequest({endUrl:"shard",region:t},n=t?n:arguments[0])}},{key:"getShardList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._statusRequest({endUrl:"shards",region:t},n=t?n:arguments[0])}},{key:"getMatch",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.matchID,s=e.options,o=void 0===s?{includeTimeline:!0}:s,a=arguments[1];return Number.isInteger(n||i)?this._matchRequest({endUrl:""+(n||i),region:t,options:o},a):this._logError(this.getMatch.name,"required params "+r.yellow("`id/matchID` (int)")+" not passed in")}},{key:"getMatchList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.id,s=t.summonerID,o=t.playerID,a=t.name,l=t.options,m=void 0===l?{rankedQueues:"RANKED_SOLO_5x5"}:l,g=arguments[1];return Number.isInteger(i||s||o)?this._matchListRequest({endUrl:""+(i||s||o),region:n,options:m},g):"object"===u(arguments[0])&&"string"==typeof a?new Promise(function(t,i){return e.getSummoner({name:a,region:n},function(r,s){return r?void(g?g(r):i(r)):t(e._matchListRequest({endUrl:""+s[e._sanitizeName(a)].id,region:n,options:m},g))})}):this._logError(this.getMatchList.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (str)")+" not passed in")}},{key:"getRunes",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=arguments[1];return f.int(i||s||o)?this._runesMasteriesRequest({endUrl:(i||s||o).join()+"/runes",region:n},d):Number.isInteger(i||a||s||l||o||m)?this._runesMasteriesRequest({endUrl:(i||a||s||l||o||m)+"/runes",region:n},d):f.string(g)?new Promise(function(t,i){return e.getSummoners({names:g,region:n},function(r,s){if(r)return void(d?d(r):i(r));var o=[],a=!0,u=!1,l=void 0;try{for(var m,h=g[Symbol.iterator]();!(a=(m=h.next()).done);a=!0){var p=m.value;o.push(s[e._sanitizeName(p)].id)}}catch(e){u=!0,l=e}finally{try{!a&&h.return&&h.return()}finally{if(u)throw l}}return t(e._runesMasteriesRequest({endUrl:o.join(",")+"/runes",region:n},d))})}):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?this._logError(this.getRunes.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):new Promise(function(t,i){return e.getSummoner({name:g||h,region:n},function(r,s){return r?void(d?d(r):i(r)):t(e._runesMasteriesRequest({endUrl:s[e._sanitizeName(g||h)].id+"/runes",region:n},d))})})}},{key:"getMasteries",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=arguments[1];return f.int(i||s||o)?this._runesMasteriesRequest({endUrl:(i||s||o).join()+"/masteries",region:n},d):Number.isInteger(i||a||s||l||o||m)?this._runesMasteriesRequest({endUrl:(i||a||s||l||o||m)+"/masteries",region:n},d):f.string(g)?new Promise(function(t,i){return e.getSummoners({names:g,region:n},function(r,s){if(r)return void(d?d(r):i(r));var o=[],a=!0,u=!1,l=void 0;try{for(var m,h=g[Symbol.iterator]();!(a=(m=h.next()).done);a=!0){var p=m.value;o.push(s[e._sanitizeName(p)].id)}}catch(e){u=!0,l=e}finally{try{!a&&h.return&&h.return()}finally{if(u)throw l}}return t(e._runesMasteriesRequest({endUrl:o.join(",")+"/masteries",region:n},d))})}):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?this._logError(this.getMasteries.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):new Promise(function(t,i){return e.getSummoner({name:g||h,region:n},function(r,s){return r?void(d?d(r):i(r)):t(e._runesMasteriesRequest({endUrl:s[e._sanitizeName(g||h)].id+"/masteries",region:n},d))})})}},{key:"getRankedStats",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.id,s=t.summonerID,o=t.playerID,a=t.name,l=t.options,m=arguments[1];return Number.isInteger(i||s||o)?this._statsRequest({endUrl:(i||s||o)+"/ranked",region:n,options:l},m):"object"===u(arguments[0])&&"string"==typeof a?new Promise(function(t,i){return e.getSummoner({name:a,region:n},function(r,s){return r?void(m?m(r):i(r)):t(e._statsRequest({endUrl:s[e._sanitizeName(a)].id+"/ranked",region:n,options:l},m))})}):void this._logError(this.getRankedStats.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getStatsSummary",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.id,s=t.summonerID,o=t.playerID,a=t.name,l=t.options,m=arguments[1];return Number.isInteger(i||s||o)?this._statsRequest({
endUrl:(i||s||o)+"/summary",region:n,options:l},m):"object"===u(arguments[0])&&"string"==typeof a?new Promise(function(t,i){return e.getSummoner({name:a,region:n},function(r,s){return r?void(m?m(r):i(r)):t(e._statsRequest({endUrl:s[e._sanitizeName(a)].id+"/summary",region:n,options:l},m))})}):void this._logError(this.getRankedStats.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getSummoners",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=arguments[1];return f.int(i||s||o)?this._summonerRequest({endUrl:""+(i||s||o).join(","),region:n},d):Number.isInteger(i||a||s||l||o||m)?this._summonerRequest({endUrl:""+(i||a||s||l||o||m),region:n},d):f.string(g)?this._summonerRequest({endUrl:"by-name/"+g.map(function(t){return e._sanitizeName(t)}).join(","),region:n},d):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?void this._logError(this.getSummoners.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):this._summonerRequest({endUrl:"by-name/"+this._sanitizeName(g||h),region:n},d)}},{key:"getSummoner",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.summonerID,s=e.playerID,o=e.name,a=arguments[1];return Number.isInteger(n||i||s)?this.getSummoners({region:t,ids:[n||i||s]},a):"object"===u(arguments[0])&&"string"==typeof o?this.getSummoners({region:t,names:[o]},a):this._logError(this.getSummoner.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getSummonerNames",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.ids,i=e.summonerIDs,s=e.playerIDs,o=e.id,a=e.summonerID,u=e.playerID,l=arguments[1];return f.int(n||i||s)?this._summonerRequest({endUrl:(n||i||s).join(",")+"/name",region:t},l):Number.isInteger(n||o||i||a||s||u)?this._summonerRequest({endUrl:(n||o||i||a||s||u)+"/name",region:t},l):void this._logError(this.getSummonerNames.name,"required params "+r.yellow("required params `ids/summonerIDs/playerIDs` ([int]/int)")+" or "+r.yellow("`id/summonerID/playerID` (int)")+" not passed in")}},{key:"getSummonerName",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.summonerID,s=e.playerID,o=arguments[1];if(Number.isInteger(n))return this.getSummonerNames({region:t,id:n||i||s},o);this._logError(this.getSummonerName.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" not passed in")}}]),e}(),q={Kindred:S,REGIONS:d,LIMITS:g};e.exports=q});
!function(e,t){if("function"==typeof define&&define.amd)define("kindred-api",["module","double-ended-queue","xregexp","request","chalk","xregexp","query-string"],t);else if("undefined"!=typeof exports)t(module,require("double-ended-queue"),require("xregexp"),require("request"),require("chalk"),require("xregexp"),require("query-string"));else{var n={exports:{}};t(n,e.doubleEndedQueue,e.xregexp,e.request,e.chalk,e.xregexp,e.queryString),e.kindredApi=n.exports}}(this,function(e,t,n,i,r,s,o){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u="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},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),m=function(){function e(n,i){a(this,e),this.allowedRequests=n,this.seconds=i,this.madeRequests=new t}return l(e,[{key:"__reload",value:function(){for(var e=(new Date).getTime();this.madeRequests.length>0&&e-this.madeRequests.peekFront()>=1e3*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}(),g={DEV:[[10,10],[500,600]],PROD:[[3e3,10],[18e4,600]]},h={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"},d={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"},p={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"},y={CHAMPION:1.2,CURRENT_GAME:1,FEATURED_GAMES:1,GAME:1.3,LEAGUE:2.5,STATIC_DATA:1.2,STATUS:1,MATCH:2.2,MATCH_LIST:2.2,RUNES_MASTERIES:1.4,STATS:1.3,SUMMONER:1.4},c=n("^[0-9\\p{L} _\\.]+$"),v={int:function(e){return e.every(function(e){return Number.isInteger(e)})},string:function(e){return e.every(function(e){return"string"==typeof e})}},f={int:function(e){return e&&Array.isArray(e)&&v.int(e)&&e.length>0},string:function(e){return e&&Array.isArray(e)&&v.string(e)&&e.length>0}},b=function(e){var t=!0,n=!1,i=void 0;try{for(var r,s=Object.keys(d)[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;if(d[o]===e)return!0}}catch(e){n=!0,i=e}finally{try{!t&&s.return&&s.return()}finally{if(n)throw i}}return!1},R={400:"Bad Request",403:"Forbidden",404:"Not Found",415:"Unsupported Media Type",429:"Rate Limit Exceeded",500:"Internal Service Error",503:"Service Unavailable"},I=function(e){var t=R[e];if(t)return t},_=function(e){return(Array.isArray(e)&&2!==e.length||!f.int(e[0])||2!==e[0].length||!f.int(e[1])||2!==e[1].length)&&"dev"!==e&&"prod"!==e},S=function(){function e(t){var n=t.key,i=t.defaultRegion,s=void 0===i?d.NORTH_AMERICA:i,o=t.debug,u=void 0!==o&&o,l=t.limits;if(a(this,e),this.key=n,this.defaultRegion=b(s)?s:void 0,this.defaultRegion||(console.log(""+r.red("Initialization of Kindred failed: "+r.yellow(s)+" is an invalid region.")),console.log(""+r.red("Try importing "+r.yellow("require('./dist/kindred-api').REGIONS")+" and using one of those values instead.")),process.exit(1)),this.debug=u,l){_(l)&&(console.log(r.red("Initialization of Kindred failed: Invalid "+r.yellow("limits")+". Valid examples: "+r.yellow("[[10, 10], [500, 600]]"))+"."),console.log(r.red("You can also pass in one of these two strings:")+" dev/prod "),console.log(""+r.red("and Kindred will set the limits appropriately.")),process.exit(1)),this.limits={},"dev"===l&&(l=g.DEV),"prod"===l&&(l=g.PROD);var h=!0,p=!1,y=void 0;try{for(var c,v=Object.keys(d)[Symbol.iterator]();!(h=(c=v.next()).done);h=!0){var f=c.value;this.limits[d[f]]=[new m(l[0][0],l[0][1]),new m(l[1][0],l[1][1])]}}catch(e){p=!0,y=e}finally{try{!h&&v.return&&v.return()}finally{if(p)throw y}}}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)},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),getTopChampions:this.getTopChamps.bind(this),top:this.getTopChamps.bind(this),best:this.getTopChamps.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)},this.Game={getRecentGames:this.getRecentGames.bind(this),getRecent:this.getRecentGames.bind(this),get:this.getRecentGames.bind(this)},this.League={getLeagues:this.getLeagues.bind(this),get:this.getLeagues.bind(this),getLeagueEntries:this.getLeagueEntries.bind(this),getEntries:this.getLeagueEntries.bind(this),entries:this.getLeagueEntries.bind(this),getChallengers:this.getChallengers.bind(this),challengers:this.getChallengers.bind(this),getMasters:this.getMasters.bind(this),masters:this.getMasters.bind(this)},this.Static={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),getMap:this.getMap.bind(this),map:this.getMap.bind(this),getMasteries:this.getMasteryList.bind(this),masteries:this.getMasteryList.bind(this),getMastery:this.getMastery.bind(this),mastery:this.getMastery.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),getShardList:this.getShardList.bind(this),getShards:this.getShardList.bind(this),getAll:this.getShardList.bind(this),all:this.getShardList.bind(this)},this.Match={getMatch:this.getMatch.bind(this),get:this.getMatch.bind(this)},this.MatchList={getMatchList:this.getMatchList.bind(this),get:this.getMatchList.bind(this)},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)},this.Masteries={get:this.getMasteries.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={getSummoners:this.getSummoners.bind(this),getAll:this.getSummoners.bind(this),all:this.getSummoners.bind(this),getSummoner:this.getSummoner.bind(this),get:this.getSummoner.bind(this),getSummonerNames:this.getSummonerNames.bind(this),getNames:this.getSummonerNames.bind(this),names:this.getSummonerNames.bind(this),getSummonerName:this.getSummonerName.bind(this),getName:this.getSummonerName.bind(this),name:this.getSummonerName.bind(this)}}return l(e,[{key:"canMakeRequest",value:function(e){return!(!this.limits[e][0].requestAvailable()||!this.limits[e][1].requestAvailable())}},{key:"_sanitizeName",value:function(e){if(this._validName(e))return e.replace(/\s/g,"").toLowerCase();this._logError(this._validName.name,"Name "+r.yellow(e)+" is not valid. Request failed."),process.exit(1)}},{key:"_validName",value:function(e){return c.test(e)}},{key:"_makeUrl",value:function(e,t,n,i,r,s){var o=n?"":t+"/",a=i||r||s?"":"api/lol/"+o,u="https://"+t+".api.riotgames.com/"+a+encodeURI(e);return u+(u.lastIndexOf("?")===-1?"?":"&")+"api_key="+this.key}},{key:"_baseRequest",value:function(e,t){var n=this,s=e.endUrl,a=e.region,u=void 0===a?this.defaultRegion:a,l=e.status,m=void 0!==l&&l,g=e.observerMode,h=void 0!==g&&g,d=e.staticReq,p=void 0!==d&&d,y=e.championMastery,c=void 0!==y&&y,v=e.options,f=void 0===v?{}:v,b=function(){return new Promise(function(e,a){var l=p?"global":u,g=o.stringify(f),d=g?"?"+g:"",y=n._makeUrl(s+d,l,p,m,h,c);if(n.limits){var v=n;!function t(n){v.canMakeRequest(u)?(p||(v.limits[u][0].addRequest(),v.limits[u][1].addRequest()),i({url:y},function(i,s,o){if(s&&o){var u=void 0,l=s.statusCode;if(l>=200&&l<300?u=r.green(l):l>=400&&l<500?u=r.red(l+" "+I(l)):l>=500&&(u=r.bold.red(l+" "+I(l))),v.debug&&(console.log(u,y),console.log({"x-app-rate-limit-count":s.headers["x-app-rate-limit-count"],"x-method-rate-limit-count":s.headers["x-method-rate-limit-count"],"x-rate-limit-count":s.headers["x-rate-limit-count"],"retry-after":s.headers["retry-after"]}),console.log()),"function"==typeof n)return l>=500&&(v.debug&&console.log("!!! resending request !!!"),setTimeout(function(){t.bind(v)(n)},1e3)),429===l&&(v.debug&&console.log("!!! resending request !!!"),setTimeout(function(){t.bind(v)(n)},1e3*s.headers["retry-after"]+50)),l>=400?n(u+" : "+r.yellow(y)):n(i,JSON.parse(o));if(500===l)v.debug&&console.log("!!! resending promise request !!!"),setTimeout(function(){return a("retry")},1e3);else{if(429!==l)return i||l>=400?a("err:",i,l):e(JSON.parse(o));v.debug&&console.log("!!! resending promise request !!!"),setTimeout(function(){return a("retry")},1e3*s.headers["retry-after"]+50)}}else console.log(i,y)})):setTimeout(function(){t.bind(v)(n)},1e3)}(t)}else i({url:y},function(i,s,o){if(s){var u=void 0,l=s.statusCode;return l>=200&&l<300?u=r.green(l):l>=400&&l<500?u=r.red(l+" "+I(l)):l>=500&&(u=r.bold.red(l+" "+I(l))),n.debug&&(console.log(s&&u,y),console.log({"x-app-rate-limit-count":s.headers["x-app-rate-limit-count"],"x-method-rate-limit-count":s.headers["x-method-rate-limit-count"],"x-rate-limit-count":s.headers["x-rate-limit-count"],"retry-after":s.headers["retry-after"]})),"function"==typeof t?l>=400?t(u+" : "+r.yellow(y)):t(i,JSON.parse(o)):i?a("err:",i):e(JSON.parse(o))}console.log(i,y)})})};return t?b():b().catch(b).catch(b).catch(b).then(function(e){return e})}},{key:"_observerRequest",value:function(e,t){var n=e.endUrl,i=e.region;return this._baseRequest({endUrl:"observer-mode/rest/"+n,observerMode:!0,region:i},t)}},{key:"_championRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.CHAMPION+"/"+n,region:i,options:r},t)}},{key:"_championMasteryRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"championmastery/location/"+n,region:i,options:r,championMastery:!0},t)}},{key:"_currentGameRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.platformId;return this._observerRequest({endUrl:"consumer/getSpectatorGameInfo/"+r+"/"+n,region:i},t)}},{key:"_staticRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=void 0===i?this.defaultRegion:i,s=e.options;return this._baseRequest({endUrl:"static-data/"+r+"/v"+y.STATIC_DATA+"/"+n,staticReq:!0,region:r,options:s},t)}},{key:"_statusRequest",value:function(e,t){var n=e.endUrl,i=(e.region,e.options);return this._baseRequest({endUrl:"lol/status/v"+y.STATUS+"/"+n,status:!0,options:i},t)}},{key:"_gameRequest",value:function(e,t){var n=e.endUrl,i=e.region;return this._baseRequest({endUrl:"v"+y.GAME+"/game/"+n,region:i},t)}},{key:"_leagueRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.LEAGUE+"/league/"+n,region:i,options:r},t)}},{key:"_matchRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.MATCH+"/match/"+n,region:i,options:r},t)}},{key:"_matchListRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.MATCH_LIST+"/matchlist/by-summoner/"+n,region:i,options:r},t)}},{key:"_runesMasteriesRequest",value:function(e,t){var n=e.endUrl,i=e.region;return this._summonerRequest({endUrl:n,region:i},t)}},{key:"_statsRequest",value:function(e,t){var n=e.endUrl,i=e.region,r=e.options;return this._baseRequest({endUrl:"v"+y.STATS+"/stats/by-summoner/"+n,region:i,options:r},t)}},{key:"_summonerRequest",value:function(e,t){var n=e.endUrl,i=e.region;return this._baseRequest({endUrl:"v"+y.SUMMONER+"/summoner/"+n,region:i},t)}},{key:"_logError",value:function(e,t){console.log(r.bold.yellow(e),r.red("request"),r.bold.red("FAILED")+r.red("; "+t))}},{key:"setRegion",value:function(e){this.defaultRegion=e}},{key:"getChamps",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._championRequest({endUrl:"champion",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getChamp",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.championID,s=arguments[1];return Number.isInteger(n)||Number.isInteger(i)?this._championRequest({endUrl:"champion/"+(n||i),region:t},s):this._logError(this.getChamp.name,"required params "+r.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,n=void 0===t?this.defaultRegion:t,i=e.playerID,s=e.championID,o=e.options,a=arguments[1];if(Number.isInteger(i)&&Number.isInteger(s)){var u=h[p[n]];return this._championMasteryRequest({endUrl:u+"/player/"+i+"/champion/"+s,region:n,options:o},a)}return this._logError(this.getChampMastery.name,"required params "+r.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]:{},n=t.region,i=void 0===n?this.defaultRegion:n,s=t.id,o=t.summonerID,a=t.playerID,l=t.name,m=t.options,g=arguments[1];if(Number.isInteger(s||o||a)){var d=h[p[i]];return this._championMasteryRequest({endUrl:d+"/player/"+(s||o||a)+"/champions",region:i,options:m},g)}if("object"===u(arguments[0])&&"string"==typeof l){var y=h[p[i]];return new Promise(function(t,n){return e.getSummoner({name:l,region:i},function(r,s){return r?void(g?g(r):n(r)):t(e._championMasteryRequest({endUrl:y+"/player/"+s[e._sanitizeName(l)].id+"/champions",region:i},g))})})}return this._logError(this.getChampMasteries.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (str)")+" not passed in")}},{key:"getTotalChampMasteryScore",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=void 0===n?this.defaultRegion:n,s=t.id,o=t.summonerID,a=t.playerID,l=t.name,m=t.options,g=arguments[1];if(Number.isInteger(s||o||a)){var d=h[p[i]];return this._championMasteryRequest({endUrl:d+"/player/"+(s||o||a)+"/score",region:i,options:m},g)}if("object"===u(arguments[0])&&"string"==typeof l){var y=h[p[i]];return new Promise(function(t,n){return e.getSummoner({name:l,region:i},function(r,s){return r?void(g?g(r):n(r)):t(e._championMasteryRequest({endUrl:y+"/player/"+s[e._sanitizeName(l)].id+"/score",region:i},g))})})}return this._logError(this.getTotalChampMasteryScore.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (str)")+" not passed in")}},{key:"getTopChamps",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=void 0===n?this.defaultRegion:n,s=t.id,o=t.summonerID,a=t.playerID,l=t.name,m=t.options,g=arguments[1];if(Number.isInteger(s||o||a)){var d=h[p[i]];return this._championMasteryRequest({endUrl:d+"/player/"+(s||o||a)+"/topchampions",region:i,options:m},g)}if("object"===u(arguments[0])&&"string"==typeof l){var y=h[p[i]];return new Promise(function(t,n){return e.getSummoner({name:l,region:i},function(r,s){return r?void(g?g(r):n(r)):t(e._championMasteryRequest({endUrl:y+"/player/"+s[e._sanitizeName(l)].id+"/topchampions",region:i},g))})})}return this._logError(this.getTopChamps.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (str)")+" not passed in")}},{key:"getCurrentGame",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=void 0===n?this.defaultRegion:n,s=t.id,o=t.summonerID,a=t.playerID,l=t.name,m=arguments[1],g=h[p[i]];return Number.isInteger(s||o||a)?this._currentGameRequest({endUrl:""+(s||o||a),platformId:g,region:i},m):"object"===u(arguments[0])&&"string"==typeof l?new Promise(function(t,n){return e.getSummoner({name:l,region:i},function(r,s){return r?void(m?m(r):n(r)):t(e._currentGameRequest({endUrl:""+s[e._sanitizeName(l)].id,platformId:g,region:i},m))})}):this._logError(this.getCurrentGame.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getFeaturedGames",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._observerRequest({endUrl:"featured",region:t},n=t?n:arguments[0])}},{key:"getRecentGames",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.id,s=t.summonerID,o=t.playerID,a=t.name,l=arguments[1];return Number.isInteger(i||s||o)?this._gameRequest({endUrl:"by-summoner/"+(i||s||o)+"/recent",region:n},l):"object"===u(arguments[0])&&"string"==typeof a?new Promise(function(t,i){return e.getSummoner({name:a,region:n},function(r,s){return r?void(l?l(r):i(r)):t(e._gameRequest({endUrl:"by-summoner/"+s[e._sanitizeName(a)].id+"/recent",region:n},l))})}):this._logError(this.getRecentGames.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getLeagues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=t.options,p=arguments[1];return f.int(i||s||o)?this._leagueRequest({endUrl:"by-summoner/"+(i||s||o).join(","),region:n,options:d},p):Number.isInteger(i||a||s||l||o||m)?this._leagueRequest({endUrl:"by-summoner/"+(i||a||s||l||o||m),region:n,options:d},p):f.string(g)?new Promise(function(t,i){return e.getSummoners({names:g,region:n},function(r,s){if(r)return void(p?p(r):i(r));var o=[],a=!0,u=!1,l=void 0;try{for(var m,h=g[Symbol.iterator]();!(a=(m=h.next()).done);a=!0){var y=m.value;o.push(s[e._sanitizeName(y)].id)}}catch(e){u=!0,l=e}finally{try{!a&&h.return&&h.return()}finally{if(u)throw l}}return t(e._leagueRequest({endUrl:"by-summoner/"+o.join(","),region:n,options:d},p))})}):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?this._logError(this.getLeagues.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):new Promise(function(t,i){return e.getSummoner({name:g||h,region:n},function(r,s){return r?void(p?p(r):i(r)):t(e._leagueRequest({endUrl:"by-summoner/"+s[e._sanitizeName(g||h)].id,region:n,options:d},p))})})}},{key:"getLeagueEntries",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=arguments[1];return f.int(i||s||o)?this._leagueRequest({endUrl:"by-summoner/"+(i||s||o).join(",")+"/entry",region:n},d):Number.isInteger(i||a||s||l||o||m)?this._leagueRequest({endUrl:"by-summoner/"+(i||a||s||l||o||m)+"/entry",region:n},d):f.string(g)?new Promise(function(t,i){return e.getSummoners({names:g,region:n},function(r,s){if(r)return void(d?d(r):i(r));var o=[],a=!0,u=!1,l=void 0;try{for(var m,h=g[Symbol.iterator]();!(a=(m=h.next()).done);a=!0){var p=m.value;o.push(s[e._sanitizeName(p)].id)}}catch(e){u=!0,l=e}finally{try{!a&&h.return&&h.return()}finally{if(u)throw l}}return t(e._leagueRequest({endUrl:"by-summoner/"+o.join(",")+"/entry",region:n},d))})}):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?void this._logError(this.getLeagueEntries.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):new Promise(function(t,i){return e.getSummoner({name:g||h,region:n},function(r,s){return r?void(d?d(r):i(r)):t(e._leagueRequest({endUrl:"by-summoner/"+s[e._sanitizeName(g||h)].id+"/entry",region:n},d))})})}},{key:"getChallengers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=void 0===n?{type:"RANKED_SOLO_5x5"}:n,r=arguments[1];return this._leagueRequest({endUrl:"challenger",region:t,options:i},r=2===arguments.length?r:arguments[0])}},{key:"getMasters",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=void 0===n?{type:"RANKED_SOLO_5x5"}:n,r=arguments[1];return this._leagueRequest({endUrl:"master",region:t,options:i},r=2===arguments.length?r:arguments[0])}},{key:"getChampionList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"champion",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getChampion",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.championID,s=e.options,o=arguments[1];return Number.isInteger(n||i)?this._staticRequest({endUrl:"champion/"+(n||i),region:t,options:s},o):this._logError(this.getChampion.name,"required params "+r.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,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"item",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getItem",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.itemID,s=e.options,o=arguments[1];return Number.isInteger(n||i)?this._staticRequest({endUrl:"item/"+(n||i),region:t,options:s},o):this._logError(this.getItem.name,"required params "+r.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,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"language-strings",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getLanguages",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._staticRequest({endUrl:"languages",region:t},n=t?n:arguments[0])}},{key:"getMap",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"map",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getMasteryList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"mastery",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getMastery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.masteryID,s=e.options,o=arguments[1];return Number.isInteger(n||i)?this._staticRequest({endUrl:"mastery/"+(n||i),region:t,options:s},o):this._logError(this.getMastery.name,"required params "+r.yellow("`id/masteryID` (int)")+" not passed in")}},{key:"getRealmData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._staticRequest({endUrl:"realm",region:t},n=t?n:arguments[0])}},{key:"getRuneList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"rune",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getRune",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.runeID,s=e.options,o=arguments[1];return Number.isInteger(n||i)?this._staticRequest({endUrl:"rune/"+(n||i),region:t,options:s},o):this._logError(this.getRune.name,"required params "+r.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,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"summoner-spell",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getSummonerSpell",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.spellID,s=e.summonerSpellID,o=e.options,a=arguments[1];return Number.isInteger(n||i||s)?this._staticRequest({endUrl:"summoner-spell/"+(n||i||s),region:t,options:o},a):this._logError(this.getSummonerSpell.name,"required params "+r.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,n=e.options,i=arguments[1];return this._staticRequest({endUrl:"versions",region:t,options:n},i=2===arguments.length?i:arguments[0])}},{key:"getShardStatus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._statusRequest({endUrl:"shard",region:t},n=t?n:arguments[0])}},{key:"getShardList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=arguments[1];return this._statusRequest({endUrl:"shards",region:t},n=t?n:arguments[0])}},{key:"getMatch",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.matchID,s=e.options,o=void 0===s?{includeTimeline:!0}:s,a=arguments[1];return Number.isInteger(n||i)?this._matchRequest({endUrl:""+(n||i),region:t,options:o},a):this._logError(this.getMatch.name,"required params "+r.yellow("`id/matchID` (int)")+" not passed in")}},{key:"getMatchList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.id,s=t.summonerID,o=t.playerID,a=t.name,l=t.options,m=void 0===l?{rankedQueues:"RANKED_SOLO_5x5"}:l,g=arguments[1];return Number.isInteger(i||s||o)?this._matchListRequest({endUrl:""+(i||s||o),region:n,options:m},g):"object"===u(arguments[0])&&"string"==typeof a?new Promise(function(t,i){return e.getSummoner({name:a,region:n},function(r,s){return r?void(g?g(r):i(r)):t(e._matchListRequest({endUrl:""+s[e._sanitizeName(a)].id,region:n,options:m},g))})}):this._logError(this.getMatchList.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (str)")+" not passed in")}},{key:"getRunes",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=arguments[1];return f.int(i||s||o)?this._runesMasteriesRequest({endUrl:(i||s||o).join()+"/runes",region:n},d):Number.isInteger(i||a||s||l||o||m)?this._runesMasteriesRequest({endUrl:(i||a||s||l||o||m)+"/runes",region:n},d):f.string(g)?new Promise(function(t,i){return e.getSummoners({names:g,region:n},function(r,s){if(r)return void(d?d(r):i(r));var o=[],a=!0,u=!1,l=void 0;try{for(var m,h=g[Symbol.iterator]();!(a=(m=h.next()).done);a=!0){var p=m.value;o.push(s[e._sanitizeName(p)].id)}}catch(e){u=!0,l=e}finally{try{!a&&h.return&&h.return()}finally{if(u)throw l}}return t(e._runesMasteriesRequest({endUrl:o.join(",")+"/runes",region:n},d))})}):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?this._logError(this.getRunes.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):new Promise(function(t,i){return e.getSummoner({name:g||h,region:n},function(r,s){return r?void(d?d(r):i(r)):t(e._runesMasteriesRequest({endUrl:s[e._sanitizeName(g||h)].id+"/runes",region:n},d))})})}},{key:"getMasteries",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=arguments[1];return f.int(i||s||o)?this._runesMasteriesRequest({endUrl:(i||s||o).join()+"/masteries",region:n},d):Number.isInteger(i||a||s||l||o||m)?this._runesMasteriesRequest({endUrl:(i||a||s||l||o||m)+"/masteries",region:n},d):f.string(g)?new Promise(function(t,i){return e.getSummoners({names:g,region:n},function(r,s){if(r)return void(d?d(r):i(r));var o=[],a=!0,u=!1,l=void 0;try{for(var m,h=g[Symbol.iterator]();!(a=(m=h.next()).done);a=!0){var p=m.value;o.push(s[e._sanitizeName(p)].id)}}catch(e){u=!0,l=e}finally{try{!a&&h.return&&h.return()}finally{if(u)throw l}}return t(e._runesMasteriesRequest({endUrl:o.join(",")+"/masteries",region:n},d))})}):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?this._logError(this.getMasteries.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):new Promise(function(t,i){return e.getSummoner({name:g||h,region:n},function(r,s){return r?void(d?d(r):i(r)):t(e._runesMasteriesRequest({endUrl:s[e._sanitizeName(g||h)].id+"/masteries",region:n},d))})})}},{key:"getRankedStats",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.id,s=t.summonerID,o=t.playerID,a=t.name,l=t.options,m=arguments[1];return Number.isInteger(i||s||o)?this._statsRequest({endUrl:(i||s||o)+"/ranked",region:n,options:l},m):"object"===u(arguments[0])&&"string"==typeof a?new Promise(function(t,i){return e.getSummoner({name:a,region:n},function(r,s){return r?void(m?m(r):i(r)):t(e._statsRequest({endUrl:s[e._sanitizeName(a)].id+"/ranked",region:n,options:l},m))})}):void this._logError(this.getRankedStats.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getStatsSummary",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.id,s=t.summonerID,o=t.playerID,a=t.name,l=t.options,m=arguments[1];return Number.isInteger(i||s||o)?this._statsRequest({endUrl:(i||s||o)+"/summary",region:n,options:l
},m):"object"===u(arguments[0])&&"string"==typeof a?new Promise(function(t,i){return e.getSummoner({name:a,region:n},function(r,s){return r?void(m?m(r):i(r)):t(e._statsRequest({endUrl:s[e._sanitizeName(a)].id+"/summary",region:n,options:l},m))})}):void this._logError(this.getRankedStats.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getSummoners",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.region,i=t.ids,s=t.summonerIDs,o=t.playerIDs,a=t.id,l=t.summonerID,m=t.playerID,g=t.names,h=t.name,d=arguments[1];return f.int(i||s||o)?this._summonerRequest({endUrl:""+(i||s||o).join(","),region:n},d):Number.isInteger(i||a||s||l||o||m)?this._summonerRequest({endUrl:""+(i||a||s||l||o||m),region:n},d):f.string(g)?this._summonerRequest({endUrl:"by-name/"+g.map(function(t){return e._sanitizeName(t)}).join(","),region:n},d):"object"!==u(arguments[0])||"string"!=typeof g&&"string"!=typeof h?void this._logError(this.getSummoners.name,"required params "+r.yellow("`ids/summonerIDs/playerIDs` ([int]/int)")+", "+r.yellow("`id/summonerID/playerID` (int)")+", "+r.yellow("`names` ([str]/str)")+", or "+r.yellow("`name` (str)")+" not passed in"):this._summonerRequest({endUrl:"by-name/"+this._sanitizeName(g||h),region:n},d)}},{key:"getSummoner",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.summonerID,s=e.playerID,o=e.name,a=arguments[1];return Number.isInteger(n||i||s)?this.getSummoners({region:t,ids:[n||i||s]},a):"object"===u(arguments[0])&&"string"==typeof o?this.getSummoners({region:t,names:[o]},a):this._logError(this.getSummoner.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" or "+r.yellow("`name` (string)")+" not passed in")}},{key:"getSummonerNames",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.ids,i=e.summonerIDs,s=e.playerIDs,o=e.id,a=e.summonerID,u=e.playerID,l=arguments[1];return f.int(n||i||s)?this._summonerRequest({endUrl:(n||i||s).join(",")+"/name",region:t},l):Number.isInteger(n||o||i||a||s||u)?this._summonerRequest({endUrl:(n||o||i||a||s||u)+"/name",region:t},l):void this._logError(this.getSummonerNames.name,"required params "+r.yellow("required params `ids/summonerIDs/playerIDs` ([int]/int)")+" or "+r.yellow("`id/summonerID/playerID` (int)")+" not passed in")}},{key:"getSummonerName",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.region,n=e.id,i=e.summonerID,s=e.playerID,o=arguments[1];if(Number.isInteger(n))return this.getSummonerNames({region:t,id:n||i||s},o);this._logError(this.getSummonerName.name,"required params "+r.yellow("`id/summonerID/playerID` (int)")+" not passed in")}}]),e}(),q={Kindred:S,REGIONS:d,LIMITS:g};e.exports=q});
{
"name": "kindred-api",
"version": "1.2.4",
"version": "1.2.5",
"description": "Kindred is a thin Node.js wrapper on top of Riot Games API for League of Legends",

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

@@ -785,4 +785,2 @@ const request = require('request')

} = {}, cb) {
console.log(arguments.length)
console.log(typeof arguments[0] === 'object')
return this._leagueRequest({

@@ -799,3 +797,3 @@ endUrl: 'challenger', region, options

endUrl: 'master', region, options
}, cb = (region || options) && arguments.length === 2 ? cb : arguments[0])
}, cb = arguments.length === 2 ? cb : arguments[0])
}

@@ -802,0 +800,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