pub struct GmailCodeClient { /* private fields */ }Expand description
Blocking Gmail API client for reading verification codes from an authorized mailbox.
Implementations§
Source§impl GmailCodeClient
impl GmailCodeClient
Sourcepub fn new(access_token: impl Into<String>) -> GmailCodeResult<Self>
pub fn new(access_token: impl Into<String>) -> GmailCodeResult<Self>
Creates a client with default Gmail API settings and the required OAuth access token.
Sourcepub fn with_config(config: GmailCodeConfig) -> GmailCodeResult<Self>
pub fn with_config(config: GmailCodeConfig) -> GmailCodeResult<Self>
Creates a client from explicit configuration.
Sourcepub fn list_message_ids(
&self,
query: &GmailCodeQuery,
) -> GmailCodeResult<Vec<String>>
pub fn list_message_ids( &self, query: &GmailCodeQuery, ) -> GmailCodeResult<Vec<String>>
Searches Gmail messages using the query object and returns matching message ids.
Sourcepub fn get_message(
&self,
message_id: impl AsRef<str>,
) -> GmailCodeResult<GmailMessage>
pub fn get_message( &self, message_id: impl AsRef<str>, ) -> GmailCodeResult<GmailMessage>
Fetches one Gmail message by id with format=full.
Sourcepub fn find_latest_code(
&self,
query: GmailCodeQuery,
) -> GmailCodeResult<Option<ExtractedGmailCode>>
pub fn find_latest_code( &self, query: GmailCodeQuery, ) -> GmailCodeResult<Option<ExtractedGmailCode>>
Finds the latest verification code from messages matching the query.
Gmail returns list results newest-first for typical searches, so this method inspects messages in listed order and returns the first code found.
Trait Implementations§
Source§impl Clone for GmailCodeClient
impl Clone for GmailCodeClient
Source§fn clone(&self) -> GmailCodeClient
fn clone(&self) -> GmailCodeClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GmailCodeClient
impl !RefUnwindSafe for GmailCodeClient
impl Send for GmailCodeClient
impl Sync for GmailCodeClient
impl Unpin for GmailCodeClient
impl UnsafeUnpin for GmailCodeClient
impl !UnwindSafe for GmailCodeClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more