Skip to main content

yopmail_client/
models.rs

1//! Public data models returned by the client.
2
3use serde::Serialize;
4
5/// Summary information for a mailbox message.
6#[derive(Debug, Clone, Serialize)]
7pub struct Message {
8    /// Yopmail message identifier.
9    pub id: String,
10    /// Message subject line.
11    pub subject: String,
12    /// Sender address if available.
13    pub sender: Option<String>,
14    /// Message date (as provided by Yopmail).
15    pub date: Option<String>,
16    /// Message time (as provided by Yopmail).
17    pub time: Option<String>,
18}
19
20/// RSS item parsed from a Yopmail feed.
21#[derive(Debug, Clone, Serialize)]
22pub struct RssItem {
23    /// Item subject/title.
24    pub subject: String,
25    /// Sender address parsed from the description.
26    pub sender: String,
27    /// Publication date string.
28    pub date: String,
29    /// Link to the message.
30    pub url: String,
31    /// Raw description HTML/text.
32    pub description: Option<String>,
33}
34
35/// Attachment metadata from a message.
36#[derive(Debug, Clone, Serialize)]
37pub struct Attachment {
38    /// Attachment display name if available.
39    pub name: Option<String>,
40    /// Absolute URL to download the attachment.
41    pub url: String,
42}
43
44/// Full message content including text, HTML, and attachments.
45#[derive(Debug, Clone, Serialize)]
46pub struct MessageContent {
47    /// Plaintext message content.
48    pub text: String,
49    /// HTML message content.
50    pub html: String,
51    /// Raw message response body.
52    pub raw: String,
53    /// Attachments found in the message.
54    pub attachments: Vec<Attachment>,
55}