[![ci-badge][]][ci] [![license-badge][]][license] [![docs-badge][]][docs] [![rust badge]][rust link]
# top-gg
An unofficial async Rust HTTP client around the [top.gg] API.
### Installation
This library requires at least Rust 1.39.0.
Add the following to your `Cargo.toml` file:
```toml
[dependencies]
top-gg = "0.1.0-alpha.0"
```
### Examples
Request a bot by ID:
```rust
use reqwest::Client as HttpClient;
use top_gg::Client;
use std::{
env,
error::Error,
};
#[tokio::main]
async fn main() -> Result<(), Box<Error>> {
// Create the Reqwest Client.
let reqwest_client = HttpClient::new();
let token = env::var("TOP_GG_TOKEN")?;
// Create the API Client with authorization.
let client = Client::from(http_client, token);
// Request the bot information.
let bot = client.get_bot(270_198_738_570_444_801).await?;
println!("The bot's name is: {}", bot.username);
Ok(())
}
```
[top.gg]: https://top.gg
[ci-badge]: https://github.com/zeyla/top.gg.rs/workflows/Test/badge.svg
[ci]: https://github.com/zeyla/top.gg.rs/actions
[docs-badge]: https://img.shields.io/badge/docs-online-2020ff.svg?style=flat-square
[docs]: https://docs.rs/top-gg
[license-badge]: https://img.shields.io/badge/license-ISC-blue.svg?style=flat-square
[license]: https://opensource.org/licenses/ISC
[rust badge]: https://img.shields.io/badge/rust-1.39%20(beta)+-93450a.svg?style=flat-square
[rust link]: https://blog.rust-lang.org/2019/09/30/Async-await-hits-beta.html