lettermint_rs/lib.rs
1//! Lettermint is an HTTP client-agnostic Rust client for the Lettermint email service.
2//!
3//! It provides a `reqwest` implementation that can be initialized and passed
4//! into the execute function of a [`Query`]. All [`Endpoint`] types implement
5//! the Query trait.
6//!
7//! To use the [`reqwest`] based client, enable the `"reqwest"` feature.
8//! You can also implement your own client by implementing the [`Client`] trait.
9//!
10//! # Example:
11//! ```
12//! use lettermint_rs::reqwest::LettermintClient;
13//! use lettermint_rs::*;
14//!
15//! # async fn send_email() {
16//! let client = LettermintClient::builder()
17//! .api_token("your-api-token")
18//! .build();
19//!
20//! let req = api::email::SendEmailRequest::builder()
21//! .from("sender@example.com")
22//! .to(vec!["recipient@example.com".into()])
23//! .subject("Hello")
24//! .html("<h1>Welcome!</h1>")
25//! .build();
26//!
27//! let resp = req.execute(&client).await;
28//! # }
29//! ```
30
31/// Default Lettermint API URL.
32pub const LETTERMINT_API_URL: &str = "https://api.lettermint.co/v1/";
33
34pub mod api;
35mod client;
36pub mod testing;
37pub mod webhook;
38
39pub use client::*;
40pub use secrecy::{ExposeSecret, SecretString};
41
42#[cfg(feature = "reqwest")]
43pub mod reqwest;