npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

leagueapiwrapper

v2.5.0

Published

League API Wrapper. Easy to use wrapper for the League Of Legends API

Downloads

70

Readme

LeagueAPIWrapper (Node.JS)

Simple Wrapper for all League Of Legends API methods

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

let LeagueAPI = require('leagueapiwrapper');
LeagueAPI = new LeagueAPI(leagueAPIKey, Region.NA);

LeagueAPI.getSummonerByName('LeagueOfSausage')
    .then(function(accountInfo) {
        // do something with accountInfo
	console.log(accountInfo);
    })
    .catch(console.error);

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

Methods

// 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);

// 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();

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

// Changed Region for API calls
LeagueAPI.changeRegion(Region.NA);

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

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

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

// 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);

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

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

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

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

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

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

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

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

// 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);

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

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

const drMundoChampId = 36;
const leagueOfDrMundoSummonerId = 'IE2WdICfZnhEWYPIBfHio7jxCeo1IFynclJAPquqENRrpeYK';

// Returns the championMastery details for the given account/accountId and champion/championId
LeagueAPI.getChampionMasteryByChampion(leagueOfDrMundoSummonerId, drMundoChampId)
	.then(console.log)
	.catch(console.error);


// Returns details for the current champion rotation. Initialize first for details on each champion
LeagueAPI.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.