Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ravener/brawlstars.js

API wrapper for the official Brawl Stars API
https://github.com/ravener/brawlstars.js

api api-wrapper brawl brawlstars bs javascript nodejs stars typescript wrapper

Last synced: 18 days ago
JSON representation

API wrapper for the official Brawl Stars API

Awesome Lists containing this project

README

        

# Brawl Stars

![GitHub repo size](https://img.shields.io/github/repo-size/ravener/brawlstars.js)
![GitHub](https://img.shields.io/github/license/ravener/brawlstars.js)
[![Discord](https://discordapp.com/api/guilds/397479560876261377/embed.png)](https://discord.gg/mDkMbEh)

Unofficial API wrapper for the Official [Brawl Stars API](https://developer.brawlstars.com).

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

## Install

```sh
npm install brawlstars
```

TypeScript typings included in the installation.

## Usage

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

```js
// 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](https://ravener.github.io/brawlstars.js)

## License

BrawlStars Wrapper is released under the [MIT License](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.