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

brawlhalla-api

v4.0.8

Published

Node.js wrapper for the Brawlhalla API.

Downloads

15

Readme

brawlhalla-api

A Node.js wrapper for the Brawlhalla API.

Table of contents

Change Log

Updating to v4 implements static data (legend info) caching and removes matching on inaccurate legend names.

Updating to v3 once again restructures data. See Static Data for details.

Updating to v2 changes how the package is initialized. The API key should now be supplied along with the require('brawlhalla-api')(YourApiKey) statement.

Installation

Install via npm as with any other package:

$ npm install --save brawlhalla-api

Within your script:

const bh = require('brawlhalla-api')(YourApiKey);

Data

  • bh.legends (map) - Uses the legend slug as the key, and object values with the legend's id, name, weapon1 slug, and weapon2 slug.
  • bh.legendSummaries (map) - Uses the legend slug, legend_id, and bio_name as keys, with basic legend information (no bio information).
  • bh.weapons (object) - An array of weapon slugs.
  • bh.regions (object) - An object with server regions as keys and subdomains as values.

Methods

.getSteamId(SteamProfileUrl)

bh.getSteamId(SteamProfileUrl).then(function(steamID){

}).catch(function(error){

});

Does not use a Brawlhalla API call.

.getBhidBySteamId(steamID)

Note: steamId must be passed as a string.

bh.getBhidBySteamId(steamID).then(function(bhid){

}).catch(function(error){

});

Uses one Brawlhalla API call.

.getBhidBySteamUrl(steamProfileUrl)

bh.getBhidBySteamUrl(steamProfileUrl).then(function(bhid){

}).catch(function(error){

});

Uses one Brawlhalla API call.

.getPlayerStats(bhid)

Note: bhid must be passed as a string.

bh.getPlayerStats(bhid).then(function(playerStats){

}).catch(function(error){

});

Uses one Brawlhalla API call.

.getPlayerRanked(bhid)

Note: steamId must be passed as a string.

bh.getPlayerRanked(bhid).then(function(playerRanked){

}).catch(function(error){

});

Uses one Brawlhalla API call.

.getLegendInfo(legend)

legend may be the legend id or the legend name.

bh.getLegendInfo(legend).then(function(legendInfo){

}).catch(function(error){

});

Uses one Brawlhalla API call if not previously cached.

.getLegendByName(legendName)

Alias for .getLegendInfo().

.getClanStats(clanId)

Note: steamId must be passed as a string.

bh.getClanStats(clanId).then(function(clanStats){

}).catch(function(error){

});

Uses one Brawlhalla API call.

.getRankings(options)

bh.getRankings(options).then(function(rankings){

}).catch(function(error){

});

The options object, along with each of its properties, is optional. Default values are as follows:

options = {
    "bracket": "1v1",
    "region": "all",
    "page": 1,
    "name": null
};

Uses one Brawlhalla API call.

.getBhidByName(name)

Returns exact name matches only.

bh.getBhidByName(name).then(function(users){

}).catch(function(error){

});

Uses one Brawlhalla API call.

.updateLegends()

Refreshes the .legendSummaries cache.

bh.updateLegends().then(function(legendSummaries){

}).catch(function(error) {

});

Uses one Brawlhalla API call.