pub struct GmailClient { /* private fields */ }Implementations§
Source§impl GmailClient
impl GmailClient
pub fn new(auth: GmailAuth) -> Self
Sourcepub fn with_base_url(self, url: String) -> Self
pub fn with_base_url(self, url: String) -> Self
Override base URL (used for testing with wiremock).
pub async fn list_messages( &self, query: Option<&str>, page_token: Option<&str>, max_results: u32, ) -> Result<GmailListResponse, GmailError>
pub async fn get_message( &self, message_id: &str, format: MessageFormat, ) -> Result<GmailMessage, GmailError>
pub async fn batch_get_messages( &self, message_ids: &[String], format: MessageFormat, ) -> Result<Vec<GmailMessage>, GmailError>
pub async fn list_history( &self, start_history_id: u64, page_token: Option<&str>, ) -> Result<GmailHistoryResponse, GmailError>
Sourcepub async fn modify_message(
&self,
message_id: &str,
add_labels: &[&str],
remove_labels: &[&str],
) -> Result<(), GmailError>
pub async fn modify_message( &self, message_id: &str, add_labels: &[&str], remove_labels: &[&str], ) -> Result<(), GmailError>
Modify labels on a single message.
Sourcepub async fn batch_modify_messages(
&self,
message_ids: &[String],
add_labels: &[&str],
remove_labels: &[&str],
) -> Result<(), GmailError>
pub async fn batch_modify_messages( &self, message_ids: &[String], add_labels: &[&str], remove_labels: &[&str], ) -> Result<(), GmailError>
Batch modify labels on multiple messages.
Sourcepub async fn trash_message(&self, message_id: &str) -> Result<(), GmailError>
pub async fn trash_message(&self, message_id: &str) -> Result<(), GmailError>
Trash a message.
Sourcepub async fn send_message(
&self,
raw_base64url: &str,
) -> Result<Value, GmailError>
pub async fn send_message( &self, raw_base64url: &str, ) -> Result<Value, GmailError>
Send a message via Gmail API.
pub async fn get_attachment( &self, message_id: &str, attachment_id: &str, ) -> Result<Vec<u8>, GmailError>
Sourcepub async fn create_draft(
&self,
raw_base64url: &str,
) -> Result<String, GmailError>
pub async fn create_draft( &self, raw_base64url: &str, ) -> Result<String, GmailError>
Create a draft in Gmail. Returns the draft ID.
pub async fn list_labels(&self) -> Result<GmailLabelsResponse, GmailError>
pub async fn create_label( &self, name: &str, color: Option<&str>, ) -> Result<GmailLabel, GmailError>
pub async fn rename_label( &self, label_id: &str, new_name: &str, ) -> Result<GmailLabel, GmailError>
pub async fn delete_label(&self, label_id: &str) -> Result<(), GmailError>
Trait Implementations§
Source§impl GmailApi for GmailClient
impl GmailApi for GmailClient
fn list_messages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: Option<&'life1 str>,
page_token: Option<&'life2 str>,
max_results: u32,
) -> Pin<Box<dyn Future<Output = Result<GmailListResponse, GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn batch_get_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
message_ids: &'life1 [String],
format: MessageFormat,
) -> Pin<Box<dyn Future<Output = Result<Vec<GmailMessage>, GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_history<'life0, 'life1, 'async_trait>(
&'life0 self,
start_history_id: u64,
page_token: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<GmailHistoryResponse, GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn modify_message<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
message_id: &'life1 str,
add_labels: &'life2 [&'life3 str],
remove_labels: &'life4 [&'life5 str],
) -> Pin<Box<dyn Future<Output = Result<(), GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn trash_message<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_message<'life0, 'life1, 'async_trait>(
&'life0 self,
raw_base64url: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value, GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_attachment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message_id: &'life1 str,
attachment_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create_draft<'life0, 'life1, 'async_trait>(
&'life0 self,
raw_base64url: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_labels<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GmailLabelsResponse, GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_label<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
color: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<GmailLabel, GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn rename_label<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
label_id: &'life1 str,
new_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<GmailLabel, GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_label<'life0, 'life1, 'async_trait>(
&'life0 self,
label_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), GmailError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for GmailClient
impl !RefUnwindSafe for GmailClient
impl Send for GmailClient
impl Sync for GmailClient
impl Unpin for GmailClient
impl UnsafeUnpin for GmailClient
impl !UnwindSafe for GmailClient
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