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

brawl-api-wrapper

v1.4.2

Published

An API wrapper for the well know supercell game called Brawl Stars

Downloads

192

Readme

BRAWL API WRAPPER

npm i brawl-api-wrapper

First of all you have to get a brawl stars API key

const { Client } = require('brawl-api-wrapper')
const client = new Client('YOUR API KEY GOES HERE')

Or if you're using ES6 import:

import { Client } from 'brawl-api-wrapper'
const client = new Client('YOUR API KEY GOES HERE')

This method return a player object, we only have to provide the player's tag

const player = await client.getPlayer('PLAYER TAG GOES HERE', true) //the second param is to select if you want the battlelog to show or not. The default is false

console.log(player.name) // return the player username

//NOTE: Requesting the battlelog might get a 500 error by the Brawl Stars Api.

This method returns a player battlelog, we have to provide the player's tag

const battlelog = await client.getBattleLog('PLAYER TAG GOES HERE')

Or you can access to a Player property called battlelog

const player = await client.getPlayer('PLAYER TAG GOES HERE')
console.log(player.battlelog) // return the player battlelog

This method return a club, we have only to provide the club's tag

const club = await client.getClub('CLUB TAG GOES HERE')
console.log(club.memberCount) // return the number of members of the club

To get a brawler you have to pass the brawlerId that this module provides to you in form of an enum

const { Brawlers } = require('brawl-api-wrapper')
const brawler = await client.getBrawler(Brawlers.Amber)
console.log(brawler.gadgets) // return the gadgets in form of an array

This method return all the brawlers in form of an array

const brawlers = await client.getBrawlers()
console.log(brawlers) // return an array of all the brawlers

This method returns the 200 players with more trophies of a country.

const topPlayers = await client.getRankingOfPlayers('es') // return the top 200 players with more trophies of Spain, by default return the global top.
console.log(topPlayers)

This method return the 200 clubs with more trophies of a country

const topClubs = await client.getRankingOfClubs('es') // return the top 200 clubs with more trophies of Spain, by default return the global top.
console.log(topClubs)

This method return the 200 players with more trophies of a country.You have to pass the brawlerId in the method so we import the Brawlers enum

const { Brawlers } = require('brawl-api-wrapper')
const topBrawlers = await client.getRankingOfBrawlers(Brawlers.Amber, 'es') // return the top 200 players with more trophies with Amber of Spain, by default is the global top

This method return the event rotation of the game

const events = await client.getEvents()
console.log(event) // return an array of events

If you find a bug create an issue in the official repository