Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/ravener/brawlstars.js
- Owner: ravener
- License: mit
- Created: 2018-11-30T15:12:09.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-14T13:14:12.000Z (over 1 year ago)
- Last Synced: 2024-10-13T02:48:11.974Z (about 1 month ago)
- Topics: api, api-wrapper, brawl, brawlstars, bs, javascript, nodejs, stars, typescript, wrapper
- Language: TypeScript
- Homepage: https://ravener.github.io/brawlstars.js/
- Size: 101 KB
- Stars: 17
- Watchers: 0
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.