/clashapi

:crown: NPM package to consume Clash Royale API

Primary LanguageJavaScriptMIT LicenseMIT

A npm package for Clash Royale that consumes clashapi using trae to provide information about the game.

Content

  1. How to use
    1. Install
    2. Basic Usage
    3. Methods
  2. Want to help
  3. License

How to use?

Consume the API to get all the information you need.

Install

$ npm install --save clashapi
$ yarn add clashapi

Basic usage

If you are not using trae (Pro tip: give it a try):

import clashapi from 'clashapi'

clashapi.chests()
  .then(...)

If you are using that awesome library:

import trae from 'trae'
import clashapiFactory from 'clashapi/factory'

const clashapi = clashapiFactory(trae)

clashapi.chests()
  .then(...)

Methods

Method Description
clashapi.arenas() All Arenas information
clashapi.arenas(:id) Single Arena information
clashapi.arenas(:idName) Single Arena information
clashapi.cards All Cards information
clashapi.cards(:id) Single Card information
clashapi.cards(:idName) Single Card information
clashapi.chests All Chests information
clashapi.chests(:id) Single Chest information
clashapi.chests(:idName) Single Chest information
clashapi.leagues All Leagues information
clashapi.leagues(:id) Single League information
clashapi.leagues(:idName) Single League information
clashapi.players All Players levels information
clashapi.players(:id) Player level information
clashapi.players(:idName) Player level information

Examples

clashapi
  .chests() // returns all chests
  
clashapi
  .cards('royale-giant') // returns information about the royale giant

clashapi
  .leagues() // returns all the leagues
  .then(leagues => leagues[0]._id) // returns the first league id
  .then(clashapi.leagues) // returns the information for the first league, sending the id to the API

Want to help?

Create an issue to report bugs or give suggestions on how to improve this project.

If you like the package, please star this repository and/or the API repository.

If you create an app using this package, please mention that you are using clashapi and add your app to the table on the API repository.

If you want to contribute to the package, feel free to create a pull request.

If you ❤️ the API, help me pay the API hosting!

License

MIT License.