[−][src]Crate brawlhalla
brawlhalla - An async Brawlhalla API Wrapper using tokio
With this crate, you can now conveniently call the official Brawlhalla API from Rust! At this point in time, this crate has 100% API coverage, but no additional functionality.
Creating an API Connector
To call the API, you must first create an APIConnection
. To do so, you should use a ConnectionBuilder.
A typical API call would look like this:
extern crate brawlhalla; use brawlhalla::ConnectionBuilder; #[tokio::main] async fn main() -> Result<(), brawlhalla::APIError> { let conn = ConnectionBuilder::default() // Make a builder struct .with_apikey("your personal API key") // Configure your API key .build(); // Create an APIConnection from the template let legends = conn.legends().await?; // Retrieves data about all legends println!("{}", legends[0].bio_aka()); Ok(()) }
At this time, the API can only be called via async/tokio.
Modules
clan | |
error | |
legends | |
player | |
rankedstats | |
rankings | |
result | |
searchresult |
Structs
APIConnection | The actual API handler struct which is created from a ConnectionBuilder. |
CallingError | Represents the JSON error response that gets sent by the API server on a false API call. Calling errors are mostly caused by the rate limit or invalid API keys. |
Clan | |
ConnectionBuilder | Builder struct for an APIConnection. |
FullLegend | |
Player | |
RankedStats | |
Rankings | |
SearchResult | |
SmallLegend | Represents an entry of the APIConnection.legends() result. Methods are self-explanatory. |
Enums
APIError | This enum represents any error that could occur during an API call. It can either be a ReqwestError, which occurs when there is a problem with the network or the API, or a CallingError, which represents the JSON error response that gets sent by the API server on a false API call. Calling errors are mostly caused by the rate limit or invalid API keys. |