Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/types/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,22 @@ impl Fetch {
unreachable!()
}
}

/// Extract the `X-GM-THRID` of a `FETCH` response
///
/// See [Access to the Gmail thread ID: X-GM-THRID](https://developers.google.com/workspace/gmail/imap/imap-extensions#access_to_the_gmail_thread_id_x-gm-thrid)
/// for details.
pub fn gmail_thrid(&self) -> Option<&u64> {
if let Response::Fetch(_, attrs) = self.response.parsed() {
attrs

@iequidoo iequidoo May 21, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now i think it's better to add a function like fetch_response_attrs() and let its users filter the attributes on their own, otherwise we're going to have too much Gmail-specific code here, and in the future, for other random providers as well. And we're always late with updating the API for specific providers.

.iter()
.filter_map(|av| match av {
AttributeValue::GmailThrId(id) => Some(id),
_ => None,
})
.next()
} else {
unreachable!()
}
}
}