#[non_exhaustive]pub enum Route {
Player(String),
PlayerBattlelogs(String),
Club(String),
ClubMembers(String),
PlayerRankings {
country_code: String,
limit: u8,
},
ClubRankings {
country_code: String,
limit: u8,
},
BrawlerRankings {
country_code: String,
brawler_id: usize,
limit: u8,
},
Brawlers,
Brawler(usize),
}Expand description
An enum representing the possible Brawl API routes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Player(String)
Route for the /players/:tag endpoint. (tag must begin with a # (%23) for correct
results.)
This fetches a player’s data.
PlayerBattlelogs(String)
Route for the /players/:tag/battlelog endpoint. (tag must begin with a # (%23) for
correct results.)
This fetches the player’s recently-played battles.
Club(String)
Route for the /clubs/:tag endpoint. (tag must begin with a # (%23) for correct
results.)
This fetches a club’s data.
ClubMembers(String)
Route for the /clubs/:tag/members endpoint.
(tag must begin with a # (%23) for correct results.)
This fetches a club’s members.
PlayerRankings
Route for the /rankings/:country_code/players?limit=x endpoint (shows the top x players
with most trophies in said country code).
The limit can be up to 200. Specifying higher than that simply works the same way as specifying 200, thus returning up to 200 entries.
Fields
ClubRankings
Route for the /rankings/:country_code/clubs?limit=x endpoint.
The limit can be up to 200. Specifying higher than that simply works the same way as specifying 200, thus returning up to 200 entries.
Fields
BrawlerRankings
Route for the /rankings/:country_code/brawlers/:brawler_id?limit=x endpoint.
The limit can be up to 200. Specifying higher than that simply works the same way as specifying 200, thus returning up to 200 entries.
Fields
country_code: StringThe two-letter country code whose leaderboard should be fetched (e.g. BR for Brazil,
ZW for Zimbabwe…), or "global" for the global leaderboard.
Brawlers
Route for the /brawlers/ endpoint, which returns data for all brawlers in the game.
Brawler(usize)
Route for the /brawlers/:id endpoint, which returns data for a specific brawler, given
that brawler’s ID.
Implementations§
Source§impl Route
impl Route
Sourcepub fn to_url_str(&self) -> String
pub fn to_url_str(&self) -> String
Evaluates the Route instance into a full URL path string.
§Examples
use brawl_api::Route;
assert_eq!(Route::Player("tag"), "https://api.brawlstars.com/v1/players/tag")
assert_eq!(
Route::PlayerBattlelogs("tag"), "https://api.brawlstars.com/v1/players/tag/battlelogs"
)
assert_eq!(Route::Club("tag"), "https://api.brawlstars.com/v1/clubs/tag")
assert_eq!(Route::ClubMembers("tag"), "https://api.brawlstars.com/v1/clubs/tag/members")Trait Implementations§
impl Eq for Route
impl StructuralPartialEq for Route
Auto Trait Implementations§
impl Freeze for Route
impl RefUnwindSafe for Route
impl Send for Route
impl Sync for Route
impl Unpin for Route
impl UnwindSafe for Route
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FetchFrom<T> for T
impl<T> FetchFrom<T> for T
Source§fn fetch_from(_: &Client, t: &T) -> Result<T, Error>
fn fetch_from(_: &Client, t: &T) -> Result<T, Error>
(Sync) Returns a copy of the current instance when attempting to fetch from itself.
In order to re-fetch, see Refetchable.
§Errors
Never errors; is only a Result in order to match the trait signature.
Source§fn a_fetch_from<'life0, 'life1, 'async_trait>(
_: &'life0 Client,
t: &'life1 T,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn a_fetch_from<'life0, 'life1, 'async_trait>(
_: &'life0 Client,
t: &'life1 T,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
(Async) Returns a copy of the current instance when attempting to fetch from itself.
In order to re-fetch, see Refetchable.
§Errors
Never errors; is only a Result in order to match the trait signature.