Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

112 Commits

Repository files navigation

LeagueAPIWrapper (Node.JS)

Simple Wrapper for all League Of Legends API methods

https://www.npmjs.com/package/leagueapiwrapper

Example get accountInfo object to be used in other methods:

letLeagueAPI=require('leagueapiwrapper');LeagueAPI=newLeagueAPI(leagueAPIKey,Region.NA);LeagueAPI.getSummonerByName('LeagueOfSausage').then(function(accountInfo){// do something with accountInfoconsole.log(accountInfo);}).catch(console.error);

Get featured games, populated with DDRagon data

LeagueAPI.initialize().then(function(){returnLeagueAPI.getFeaturedGames()}).then(function(data){console.log(data);}).catch(console.error);

Methods

initialize

// Objects will now contain full objects, instead of id's. // E.G from 'mapId: 12' to 'mapObject: { id: 12 name: howlingAbyss ... }'LeagueAPI.initialize().then(){// LeagueAPI returned objects will now have details from DDRagon API.}).catch(console.error);

getDDragonLocalDataVersion

// Gets the version of DDRagon that's included in this project. You can still use other versions, but it will require additional network calls to DDragon.// E.G from '11.1.1'LeagueAPI.getDDragonLocalDataVersion();

setFullyLoadClasses(boolean)

// Setting initialize() sets to true.// Must call initialize if setting this to trueLeagueAPI.setFullyLoadClasses(false);

changeRegion(Region)

// Changed Region for API callsLeagueAPI.changeRegion(Region.NA);

getThirdPartyCode(AccountObject)

// Returns thirdPartyCode. Note: will 'Forbidden' if no thirdPartyCode is available for the accountInfo/accountId// Note: I don't have an accountId example that works hereLeagueAPI.getThirdPartyCode(accountId).then(function(data){console.log(data);}).catch(console.error);

getStatus()

// Returns the status of the LeagueAPI endpoints LeagueAPI.getStatus().then(console.log).catch(console.error);

getFeaturedGames()

// Returns the current featured games on LeagueLeagueAPI.getFeaturedGames().then(console.log).catch(console.error);

getMatch(matchId) - Match-V5

// matchId taken from a getMatchList call// Gets the Match object for the ID passed// Now Match-V5 supported// matchid has a different format in Match-V5. LeagueAPI.getMatch('NA1_4102250582').then(console.log).catch(console.error);

getMatchByTournament(matchId, tournamentCode)

// Gets the Match object for the ID passed with tournamentCode. Note: I don't have an example tournament codeLeagueAPI.getMatchByTournament(2970107953,tournamentCode).then(console.log).catch(console.error);

getMatchIdsByTournament(tournamentCode)

// Gets the Match ids for the tournamentCode. Note: I don't have an example tournament codeLeagueAPI.getMatchIdsByTournament(tournamentCode).then(console.log).catch(console.error);

getClash(accountObj)

LeagueAPI.getClash(accountObj).then(console.log).catch(console.error);

getClashTournament()

LeagueAPI.getClashTournament().then(console.log).catch(console.error);

getLeagueRanking(accountObject)

LeagueAPI.getSummonerByName('LeagueOfDrMundo').then(function(accountObject){LeagueAPI.getLeagueRanking(accountObject).then(console.log).catch(console.error);});

getSummonerByName(summonerName)

// Returns an accountObject which can be used in other methods, or view account information onLeagueAPI.getSummonerByName('LeagueOfDrMundo').then(function(accountObject){console.log(accountObject);}).catch(console.error);

getActiveGames(accountObject)

LeagueAPI.getSummonerByName('LeagueOfDrMundo').then(function(accountObject){// Gets active games. Will return 404 if not currently in an active gamereturnLeagueAPI.getActiveGames(accountObject);}).then(function(activeGames){console.log(activeGames);}).catch(console.error);

getMatchList(accountObject) - Match-V5

//Now Match-V5 supportedLeagueAPI.getSummonerByName('LeagueOfDrMundo').then(function(accountObject){// Gets match list for the accountreturnLeagueAPI.getMatchList(accountObject);}).then(function(activeGames){console.log(activeGames);}).catch(console.error);

getMatchTimeline(matchId) - Match-V5

// Returns a timeline of the match//Now Match-V5 supported// matchid has a different format in Match-V5. LeagueAPI.getMatchTimeline('NA1_4102250582').then(console.log).catch(console.error);

getChampionMasteryTotal(accountObject)

LeagueAPI.getSummonerByName('LeagueOfSausage').then(function(accountObj){// Returns the total champion master (sum of all champion mastery for all champions)returnLeagueAPI.getChampionMasteryTotal(accountObj);}).then(function(championMasteryTotal){console.log(championMasteryTotal);}).catch(console.error);

getChampionMastery(accountObject)

LeagueAPI.getSummonerByName('LeagueOfDrMundo').then(function(accountObj){// Returns a list of every single champion played by the account, along with mastery detailsreturnLeagueAPI.getChampionMastery(accountObj);}).then(function(championMasteryList){console.log(championMasteryList);}).catch(console.error);

getChampionMasteryByChampion(accountObject, championObj)

constdrMundoChampId=36;constleagueOfDrMundoSummonerId='IE2WdICfZnhEWYPIBfHio7jxCeo1IFynclJAPquqENRrpeYK';// Returns the championMastery details for the given account/accountId and champion/championIdLeagueAPI.getChampionMasteryByChampion(leagueOfDrMundoSummonerId,drMundoChampId).then(console.log).catch(console.error);

getFreeChampionRotation()

// Returns details for the current champion rotation. Initialize first for details on each championLeagueAPI.getFreeChampionRotation().then(console.log).catch(console.error);

Disclaimer

MundoScript is not endorsed by Riot Games and does not reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.

Feel free to make suggestions on features/etc.

About

Node.js League/LoL/League Of Legends API wrapper, Focus is to be easy to use

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages