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

https://github.com/natoune/royale-api

A wrapper for the Clash Royale API.
https://github.com/natoune/royale-api

clash clash-royale clash-royale-api clashroyale supercell

Last synced: 3 months ago
JSON representation

A wrapper for the Clash Royale API.

Awesome Lists containing this project

README

        

# Clash Royale API for NPM

![NPM Downloads](https://img.shields.io/npm/dm/royale-api)
![NPM License](https://img.shields.io/npm/l/royale-api)

A wrapper for the [Clash Royale API](https://developer.clashroyale.com).
This package is not affiliated with [Supercell](https://supercell.com/) or [RoyaleAPI](https://royaleapi.com/).

## Getting a token

To use Clash Royale API for NPM, you need to get an API token from the [Clash Royale Developer Portal](https://developer.clashroyale.com).
You can also use another API provider like [RoyaleAPI](https://docs.royaleapi.com/).

## Usage

First, install the package using NPM or your favorite package manager:

```bash
npm install royale-api
```

Usage example:

```javascript
const RoyaleAPI = require("royale-api");

const cr = new RoyaleAPI("token");

cr.getPlayer("#AAAAAAAA").then((player) => {
console.log(player);
});
```

## Methods

There is one method for each endpoint of the Clash Royale API (see [documentation](https://developer.clashroyale.com/#/documentation)):

### Clans

- `getClanWarLog(clanTag: string, options?: object): Promise`
- `getClans(options?: object): Promise`
- `getClanRiverRaceLog(clanTag: string, options?: object): Promise`
- `getClanCurrentWar(clanTag: string): Promise`
- `getClan(clanTag: string): Promise`
- `getClanMembers(clanTag: string, options?: object): Promise`
- `getClanCurrentRiverRace(clanTag: string): Promise`

### Players

- `getPlayer(playerTag: string): Promise`
- `getPlayerUpcomingChests(playerTag: string): Promise`
- `getPlayerBattleLog(playerTag: string): Promise`

### Cards

- `getCards(options?: object): Promise`

### Tournaments

- `getTournaments(options?: object): Promise`
- `getTournament(tournamentTag: string): Promise`

### Locations

- `getLocationClanRankings(locationId: number, options?: object): Promise`
- `getLocationPlayerRankings(locationId: number, options?: object): Promise`
- `getLocationClanWarRankings(locationId: number, options?: object): Promise`
- `getSeasonPathOfLegends(seasonId: string, options?: object): Promise`
- `getSeason(seasonId: string): Promise`
- `getSeasonPlayerRankings(seasonId: string, options?: object): Promise`
- `getSeasons(): Promise`
- `getLocations(options?: object): Promise`
- `getSeasonsV2(): Promise`
- `getLocation(locationId: number): Promise`
- `getGlobalTournamentRankings(tournamentTag: string, options?: object): Promise`
- `getLocationPathOfLegends(locationId: number, options?: object): Promise`

### Challenges

- `getChallenges(): Promise`

### Global Tournaments

- `getGlobalTournaments(): Promise`

## Contributing

Contributions to the "royale-api" project are welcome. To contribute, follow these steps:

1. Fork the repository
2. Create a new branch: `git checkout -b feature/my-feature`
3. Make your changes and commit them: `git commit -m "Add my feature"`
4. Push your changes to the branch: `git push origin feature/my-feature`
5. Open a pull request

## License

This project is licensed under the [MIT License](LICENSE.md).