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.
- Host: GitHub
- URL: https://github.com/natoune/royale-api
- Owner: Natoune
- License: mit
- Created: 2024-02-08T14:45:54.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-08T15:26:23.000Z (over 1 year ago)
- Last Synced: 2025-03-26T03:34:32.535Z (4 months ago)
- Topics: clash, clash-royale, clash-royale-api, clashroyale, supercell
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Clash Royale API for NPM

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).