Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMail - Expose GMail labels ? #115

Open
mikolfaro opened this issue Jan 31, 2025 · 0 comments
Open

GMail - Expose GMail labels ? #115

mikolfaro opened this issue Jan 31, 2025 · 0 comments

Comments

@mikolfaro
Copy link

mikolfaro commented Jan 31, 2025

Response supports X-GM-Labels, that is the labeling system used by GMail.
Is it possible to expose the value in Fetch?

/// Extract the `X-GM-LABELS` of a `FETCH` response
///
/// See [Access to Gmail labels: X-GM-LABELS](https://developers.google.com/gmail/imap/imap-extensions#access_to_labels_x-gm-labels)
/// for details.
pub fn gmail_labels(&self) -> Option<&Vec<Cow<'_, str>>> {
    if let Response::Fetch(_, attrs) = self.response.parsed() {
         attrs
            .iter()
             .filter_map(|av| match av {
                AttributeValue::GmailLabels(gl) => Some(gl),
                _ => None,
            })
            .next()
    } else {
         unreachable!()
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant