1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! # 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:
//!
//! ```no_run
//! use reqwest::Client as HttpClient;
//! use std::env;
//! use top_gg::Client;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//!     // Create the Reqwest Client.
//!     let http_client = HttpClient::new();
//!     let token = env::var("TOP_GG_TOKEN")?;
//!
//!     // Create the API Client with authorization.
//!     let client = Client::new(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

#![deny(
    clippy::all,
    clippy::pedantic,
    future_incompatible,
    missing_docs,
    nonstandard_style,
    rust_2018_idioms,
    unused,
    warnings
)]
#![allow(clippy::module_name_repetitions)]

pub mod client;
pub mod error;
pub mod model;
pub mod widget;

mod endpoints;

pub use self::{
    client::Client,
    error::{Error, Result},
};