top_gg/lib.rs
1//! # top-gg
2//!
3//! An unofficial async Rust HTTP client around the [top.gg] API.
4//!
5//! ### Installation
6//!
7//! This library requires at least Rust 1.39.0.
8//!
9//! Add the following to your `Cargo.toml` file:
10//!
11//! ```toml
12//! [dependencies]
13//! top-gg = "0.1.0-alpha.0"
14//! ```
15//!
16//! ### Examples
17//!
18//! Request a bot by ID:
19//!
20//! ```no_run
21//! use reqwest::Client as HttpClient;
22//! use std::env;
23//! use top_gg::Client;
24//!
25//! #[tokio::main]
26//! async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
27//! // Create the Reqwest Client.
28//! let http_client = HttpClient::new();
29//! let token = env::var("TOP_GG_TOKEN")?;
30//!
31//! // Create the API Client with authorization.
32//! let client = Client::new(http_client, token);
33//!
34//! // Request the bot information.
35//! let bot = client.get_bot(270_198_738_570_444_801).await?;
36//!
37//! println!("The bot's name is: {}", bot.username);
38//!
39//! Ok(())
40//! }
41//! ```
42//!
43//! [top.gg]: https://top.gg
44
45#![deny(
46 clippy::all,
47 clippy::pedantic,
48 future_incompatible,
49 missing_docs,
50 nonstandard_style,
51 rust_2018_idioms,
52 unused,
53 warnings
54)]
55#![allow(clippy::module_name_repetitions)]
56
57pub mod client;
58pub mod error;
59pub mod model;
60pub mod widget;
61
62mod endpoints;
63
64pub use self::{
65 client::Client,
66 error::{Error, Result},
67};