✨ feat(gmail): add get messages functionality
- implement get_messages function to retrieve a list of messages from Gmail - create a hub function to get the Gmail hub from the client
This commit is contained in:
committed by
Jeremiah Russell
parent
ceb4548649
commit
455deb8420
@@ -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<HttpsConnector<HttpConnector>> {
|
||||
self.hub.clone()
|
||||
}
|
||||
|
||||
pub async fn get_messages(&self) -> Result<MessageList> {
|
||||
MessageList::new(&self).await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user