brawlstats
Version:
A simple API Wrapper for Brawl Stars
77 lines (65 loc) • 2.4 kB
Markdown
<div align="center">
**An advanced and lightweight wrapper around the Brawl Stars API**
[](https://www.npmjs.com/package/brawlstats)
[](https://github.com/SpecteraLabs/brawlstats/blob/main/LICENSE.md)
[](https://www.npmjs.com/package/brawlstats)
[](https://codecov.io/gh/SpecteraLabs/npm-packages)
[](https://github.com/SpecteraLabs/npm-packages)
</div>
An advanced API wrapper for the Brawl Stars API.
- Written in Typescript.
- Supports both ES modules and CommonJS.
```bash
yarn add brawlstats
```
```js
import { Client } from 'brawlstats';
const client = new Client({
/**
* Your Brawl Stars API key.
* @defaults to the environment variable `BRAWLSTARS_TOKEN`
*/
token: 'your-api-key'
})
// get a player
const player = await client.players.fetch('#22QJ0JPVJ');
// or a club
const club = await client.clubs.fetch('#XYZ');
// or events rotation
const events = await client.rotation.get();
// or all brawlers available in the game
const brawlers = client.brawlers;
```
```js
const { Client } = require('brawlstats');
const client = new Client({
/**
* Your Brawl Stars API key.
* @defaults to the environment variable `BRAWLSTARS_TOKEN`
*/
token: 'your-api-key'
})
(async () => {
// get a player
const player = await client.players.fetch('#22QJ0JPVJ');
// or a club
const club = await client.clubs.fetch('#XYZ');
// or events rotation
const events = await client.rotation.get();
// or all brawlers available in the game
const brawlers = client.brawlers;
})();
```
* Like the wrapper? then please star us at [GitHub](https://github.com/SpecteraLabs/npm-packages)
* If you have any questions, feel free to [open an issue](https://github.com/SpecteraLabs/npm-packages/issues)
* If you have any feedback, feel free to [open a discussion](https://github.com/SpecteraLabs/npm-packages/discussions/new?category=ideas)