Skip to content

ravener/brawlstars.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brawl Stars

GitHub repo size GitHub Discord

Unofficial API wrapper for the Official Brawl Stars API.

This package implements all the API and is written in TypeScript for safety and full typings support.

Install

npm install brawlstars

TypeScript typings included in the installation.

Usage

Simply import the Client class and instantiate it with your API token:

// TypeScript, ESM
import { Client } from "brawlstars";

// CommonJS, Node.js
const { Client } = require("brawlstars");

// Create instance
const client = new Client("TOKEN", { 
  cache: true, // default is true
  cacheOptions: undefined /* options for node-cache, default is undefined. */
});

// Call into functions
client.getPlayer("TAG")
  .then(player => console.log(player.name))
  .catch(err => console.error(err));

All functions return a Promise. Tags are cleaned before use (Removes # and replaces letter O with zero 0)

All results are cached when supercell sends cache-control in the response, in that case the objects are in cache until the max-age expires. Caching can be disabled and options can be passed to the underlying node-cache library.

Browse the full API documentation here

License

BrawlStars Wrapper is released under the MIT License

This is an unofficial wrapper. We are not affiliated, associated, authorized, endorsed by, or in any way officially connected with Supercell, or any of its subsidiaries or its affiliates.