brawlstats
TypeScript icon, indicating that this package has built-in type declarations

3.2.0 • Public • Published

brawlstats

An advanced and lightweight wrapper around the Brawl Stars API

npm GitHub npm codecov CI

Description

An advanced API wrapper for the Brawl Stars API.

Features

  • Written in Typescript.
  • Supports both ES modules and CommonJS.

Installation

yarn add brawlstats
# or npm install brawlstats
# or pnpm add brawlstats

Usage

With ESM

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;

With CJS

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;
})();

Miscallaneous

Package Sidebar

Install

npm i brawlstats

Weekly Downloads

25

Version

3.2.0

License

Apache-2.0

Unpacked Size

189 kB

Total Files

8

Last publish

Collaborators

  • undied