guerrillamail_client/lib.rs
1//! # GuerrillaMail Client
2//! Asynchronous wrapper around the GuerrillaMail disposable email HTTP API, providing simple methods to create, poll, and delete temporary inboxes from Rust using [`Client`] and [`ClientBuilder`].
3//!
4//! ## Audience and uses
5//! For Rust developers who need throwaway addresses in integration tests, demos, or automation scripts without running mail infrastructure: configure with [`ClientBuilder`], obtain an address, poll for messages ([`Message`]), then discard the inbox when done.
6//!
7//! ## Runtime requirements
8//! Async-only; run inside a Tokio (v1) runtime. HTTP calls use `reqwest`, so ensure the chosen Tokio features (`rt-multi-thread` or `current_thread`) are available in your application.
9//!
10//! ## Out of scope
11//! Not a general-purpose mail client, SMTP sender, or durable mailbox. It only proxies the GuerrillaMail service and inherits its availability, spam filtering, and retention limits.
12//!
13//! ## Errors
14//! All network calls surface transport and non-2xx statuses as [`Error::Request`]; shape or content issues become [`Error::ResponseParse`] or [`Error::Json`]. The crate-wide [`Result`] alias wraps these errors.
15//!
16//! ## Example
17//! ```no_run
18//! use guerrillamail_client::Client;
19//!
20//! #[tokio::main]
21//! async fn main() -> Result<(), guerrillamail_client::Error> {
22//! let client = Client::new().await?;
23//! let email = client.create_email("myalias").await?;
24//! println!("Created: {}", email);
25//!
26//! let messages = client.get_messages(&email).await?;
27//! for msg in messages {
28//! println!("From: {}, Subject: {}", msg.mail_from, msg.mail_subject);
29//! }
30//!
31//! client.delete_email(&email).await?;
32//! Ok(())
33//! }
34//! ```
35
36mod client;
37mod error;
38mod models;
39
40pub use client::{Client, ClientBuilder};
41pub use error::Error;
42pub use models::{Attachment, EmailDetails, Message};
43
44/// Result type alias for GuerrillaMail operations.
45///
46/// This is equivalent to `std::result::Result<T, Error>`.
47pub type Result<T> = std::result::Result<T, Error>;