Struct rust_gmail::GmailClientBuilder
source · pub struct GmailClientBuilder { /* private fields */ }
Expand description
The GmailClientBuilder
is the intended way of creating a GmailClient
.
Implementations§
source§impl<'a> GmailClientBuilder
impl<'a> GmailClientBuilder
sourcepub fn new<P: AsRef<Path>, S: Into<String>>(
service_account_path: P,
send_from_email: S
) -> Result<Self, GoogleApiError>
pub fn new<P: AsRef<Path>, S: Into<String>>( service_account_path: P, send_from_email: S ) -> Result<Self, GoogleApiError>
Create a new GmailClientBuilder
.
Will return an error if unable to read & parse the service_account_path
if, for example, the file does not exist or has an incorrect format.
sourcepub fn mock_mode(self) -> Self
pub fn mock_mode(self) -> Self
Enables “mock mode” which will log print the email instead of sending it.
sourcepub async fn build(self) -> Result<GmailClient, GoogleApiError>
pub async fn build(self) -> Result<GmailClient, GoogleApiError>
Build a GmailClient
from this GmailClientBuilder
.
Note: This function will retrieve an access token from the Google API and as such make an API request.
Trait Implementations§
source§impl Clone for GmailClientBuilder
impl Clone for GmailClientBuilder
source§fn clone(&self) -> GmailClientBuilder
fn clone(&self) -> GmailClientBuilder
Returns a copy of the value. Read more
1.0.0 · 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 RefUnwindSafe for GmailClientBuilder
impl Send for GmailClientBuilder
impl Sync for GmailClientBuilder
impl Unpin for GmailClientBuilder
impl UnwindSafe for GmailClientBuilder
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