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
//! A library for fetching various structures from the Discord API. This is not a fully fledged Discord wrapper
//! nor does it attempt to be. It contains some structures deemed useful.
//!
//! This library should maintain feature parity with the included binary, available at [https://github.com/jos-b/discord](https://github.com/jos-b/discord)
//! in that all new structures added to this library should be accessible in some way through the binary.
//!
//! # Examples
//!
//! Fetch a guild name from an invite code
//! ```
//! # #[tokio::main]
//! # async fn main() -> Result<(), reqwest::Error> {
//! use discord_api::get_invite;
//! let invite = get_invite("python").await?;
//!
//! if let Some(guild) = invite.guild {
//!   println!("Invite for: {}", guild.name);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! Fetch a guild invite and list the features
//!
//! ```
//! # #[tokio::main]
//! # async fn main() -> Result<(), reqwest::Error> {
//! use discord_api::get_invite;
//!
//! let invite = get_invite("python").await?;
//!
//! if let Some(guild) = invite.guild {
//!   for feature in guild.features {
//!     println!("{}", feature);
//!   }
//! }
//! # Ok(())
//! # }
//! ```

#[macro_use]
extern crate log;

pub mod http;
pub mod models;

pub use http::get_invite;