An asynchronous wrapper for the official Clash Royale API. Official API Link https://developer.clashroyale.com Important noteThis wrapper will only work from a nodejs server app. The official clash royale api is, unfortunately, blocking requests done directly from the browser. Getting startedIn order to use the official api, you will need a token. This token can be obtained at the Official API website https://developer.clashroyale.com. Once you register and get the token, you are ready to start. UsageInstall the package:
OR
Usage: // Import the package const { ClashRoyaleAPI } = require('@varandas/clash-royale-api') // Initialize the api const api = new ClashRoyaleAPI('the token you got from the api') // Use the api to get cards api.getCards() .then((cards) => { // Do something with the cards }) .catch((err) => { // handle errors }) MethodsAll api calls are asynchronous and used in the same way as above in the getCards example. Clans
Players
Tournaments
Cards
Locations
Configuration ObjectsIClanRequestParams /** * Note: * Only the name property is required. */ export interface IClanRequestParams { /** * Search clans by name. * If name is used as part of search query, it needs to be at least three * characters long. Name search parameter is interpreted as wild card * search, so it may appear anywhere in the clan name. */ name: string /** * Filter by clan location identifier. For list of available locations, * refer to getLocations operation. */ locationId?: number /** * Filter by minimum amount of clan members. */ minMembers?: number /** * Filter by maximum amount of clan members. */ maxMembers?: number /** * Filter by minimum amount of clan score. */ minScore?: number /** * Limit the number of items returned in the response. */ limit?: number /** * Return only items that occur after this marker. * After marker can be found from the response, inside the 'paging' property. * Note that only after or before can be specified for a request, not both. */ after?: number /** * Return only items that occur before this marker. * Before marker can be found from the response, inside the 'paging' property. * Note that only after or before can be specified for a request, not both. */ before?: number } ITournamentRequestParams /** * Note: * Only the name property is required. */ export interface ITournamentRequestParams { /** * Search tournaments by name. */ name: string /** * Limit the number of items returned in the response. */ limit?: number /** * Return only items that occur after this marker. * After marker can be found from the response, inside the 'paging' property. * Note that only after or before can be specified for a request, not both. */ after?: number /** * Return only items that occur before this marker. * Before marker can be found from the response, inside the 'paging' property. * Note that only after or before can be specified for a request, not both. */ before?: number } ILocationRequestParams export interface ILocationRequestParams { /** * Limit the number of items returned in the response. */ limit?: number /** * Return only items that occur after this marker. * After marker can be found from the response, * inside the 'paging' property. Note that only * after or before can be specified for a request, not both. */ after?: number /** * Return only items that occur before this marker. * Before marker can be found from the response, * inside the 'paging' property. Note that only * after or before can be specified for a request, not both. */ before?: number } LICENSE - MIT CreditsLogo by Caneco. This content is not affiliated with, endorsed, sponsored, or specifically approved by Supercell and Supercell is not responsible for it. For more information see Supercell’s Fan Content Policy. |