From 455deb842043e1e1c1dca6a2c65d4cf076eae404 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Mon, 13 Oct 2025 12:48:39 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(gmail):=20add=20get=20messages?= =?UTF-8?q?=20functionality?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - implement get_messages function to retrieve a list of messages from Gmail - create a hub function to get the Gmail hub from the client --- src/gmail_client.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gmail_client.rs b/src/gmail_client.rs index 00eb2fa..a1de336 100644 --- a/src/gmail_client.rs +++ b/src/gmail_client.rs @@ -10,7 +10,7 @@ use google_gmail1::{ yup_oauth2::{ApplicationSecret, InstalledFlowAuthenticator, InstalledFlowReturnMethod}, }; -use crate::{Credential, Error, Result}; +use crate::{Credential, Error, MessageList, Result}; /// Default for the maximum number of results to return on a page pub const DEFAULT_MAX_RESULTS: &str = "200"; @@ -104,4 +104,13 @@ impl GmailClient { log::info!("{name}: {id}") } } + + /// Get the hub from the client + pub(crate) fn hub(&self) -> Gmail> { + self.hub.clone() + } + + pub async fn get_messages(&self) -> Result { + MessageList::new(&self).await + } }