#api #async #tokio #brawlhalla #gameapi

brawlhalla

An async Brawlhalla API Wrapper using tokio

5 releases

0.1.4 Apr 20, 2020
0.1.3 Apr 3, 2020
0.1.2 Apr 3, 2020
0.1.1 Apr 3, 2020
0.1.0 Apr 3, 2020

#142 in #tokio

23 downloads per month

Custom license

16KB
428 lines

brawlhalla

Rust wrapper for the Brawlhalla API.


lib.rs:

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.

Dependencies

~5.5–9MB
~201K SLoC