Skip to main content

io_gmail/v1/rest/
threads.rs

1//! Gmail threads (`users.threads`): list, get, modify, trash, untrash,
2//! delete.
3//!
4//! <https://developers.google.com/gmail/api/reference/rest/v1/users.threads>
5
6use alloc::{string::String, vec::Vec};
7
8use serde::{Deserialize, Serialize};
9
10use crate::v1::rest::messages::GmailMessage;
11
12pub mod delete;
13pub mod get;
14pub mod list;
15pub mod modify;
16pub mod trash;
17pub mod untrash;
18
19/// A Gmail thread resource.
20///
21/// A thread groups related messages into a single conversation.
22#[derive(Debug, Clone, Deserialize, Serialize, Eq, PartialEq)]
23#[serde(rename_all = "camelCase")]
24pub struct GmailThread {
25    /// Immutable identifier of the thread.
26    pub id: String,
27    /// Short part of the message text.
28    #[serde(default)]
29    pub snippet: Option<String>,
30    /// Id of the last history record that modified the thread.
31    #[serde(default)]
32    pub history_id: Option<String>,
33    /// Messages belonging to the thread.
34    #[serde(default)]
35    pub messages: Vec<GmailMessage>,
36}
37
38/// A Gmail thread summary, as returned by `users.threads.list`.
39///
40/// A summary carries the thread metadata without its messages; fetch
41/// the full [`GmailThread`] with `users.threads.get`.
42#[derive(Debug, Clone, Deserialize, Serialize, Eq, PartialEq)]
43#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44#[serde(rename_all = "camelCase")]
45pub struct GmailThreadSummary {
46    /// Immutable identifier of the thread.
47    pub id: String,
48    /// Short part of the message text.
49    #[serde(default)]
50    pub snippet: Option<String>,
51    /// Id of the last history record that modified the thread.
52    #[serde(default)]
53    pub history_id: Option<String>,
54}