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
68
69
70
71
//! The official Rust SDK for [Mailtea](https://mailtea.app) — a thin, typed
//! wrapper over the [REST API](https://docs.mailtea.app/docs/api-reference).
//!
//! ```no_run
//! use mailtea::{Mailtea, SendEmail};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Reads MAILTEA_API_KEY, and MAILTEA_API_BASE_URL when it is set.
//! let mailtea = Mailtea::from_env()?;
//!
//! let sent = mailtea
//! .emails
//! .send(
//! &SendEmail::new(
//! "you@yourdomain.com",
//! ["recipient@example.com"],
//! "Hello from Mailtea",
//! )
//! .html("<p>Your first email, sent with <strong>Mailtea</strong>.</p>"),
//! )
//! .await?;
//!
//! let email = mailtea.emails.get(&sent.id).await?;
//! println!("{} {:?}", email.id, email.status);
//! Ok(())
//! }
//! ```
//!
//! # Payloads
//!
//! Every method takes `impl Serialize`, so a payload can be a typed request
//! struct ([`SendEmail`], [`CreateContact`], [`CreatePost`], [`CreateTopic`],
//! [`SendTestPost`], [`UploadAsset`], …), a `serde_json::json!({...})` literal,
//! or any struct of your own. Pass `()` where a method takes parameters you do
//! not need.
//!
//! Responses are typed on the transactional email path ([`SentEmail`],
//! [`Email`], [`BatchSent`]) and `serde_json::Value` elsewhere. To deserialize
//! any endpoint into your own type, call [`Mailtea::request`].
//!
//! # Errors
//!
//! Every call returns [`Result<T>`], whose error is [`Error`] — one struct
//! carrying the HTTP `status`, the API's `message`, its `code` and `details`
//! when present, and the `x-request-id`. A `status` of `0` means the request
//! never reached the API, so nothing was sent.
//!
//! # Webhooks
//!
//! [`verify_webhook_signature`] checks a Standard Webhooks delivery and rejects
//! replays; [`sign_webhook`] produces the same header for tests.
pub use ;
pub use ;
pub use ;
pub use *;
pub use ;