♻️ refactor(delete): rename struct and methods for deleting messages
- rename the `Trash` struct to `Delete` for clarity - update method names to reflect the deleting functionality
This commit is contained in:
committed by
Jeremiah Russell
parent
0fc0ca6a54
commit
fad35eb474
@@ -2,7 +2,7 @@ use google_gmail1::api::BatchDeleteMessagesRequest;
|
|||||||
|
|
||||||
use crate::{MessageList, Result};
|
use crate::{MessageList, Result};
|
||||||
|
|
||||||
/// Struct for trashing messages
|
/// Struct for deleting messages
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Delete {
|
pub struct Delete {
|
||||||
message_list: MessageList,
|
message_list: MessageList,
|
||||||
@@ -15,27 +15,12 @@ impl Delete {
|
|||||||
Ok(Delete { message_list })
|
Ok(Delete { message_list })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the maximum results
|
/// return the message list struct
|
||||||
pub fn set_max_results(&mut self, value: u32) {
|
pub fn message_list(&mut self) -> &mut MessageList {
|
||||||
self.message_list.set_max_results(value);
|
&mut self.message_list
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Report the maximum results value
|
/// Prepare the message list for delete to be completed on execute by batch_delete
|
||||||
pub fn max_results(&self) -> u32 {
|
|
||||||
self.message_list.max_results()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Add label to the labels collection
|
|
||||||
pub async fn add_labels(&mut self, credential: &str, labels: &[String]) -> Result<()> {
|
|
||||||
self.message_list.add_labels(credential, labels).await
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set the query string
|
|
||||||
pub fn set_query(&mut self, query: &str) {
|
|
||||||
self.message_list.set_query(query)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Run the trash cli
|
|
||||||
pub async fn prepare(&mut self, pages: u32) -> Result<()> {
|
pub async fn prepare(&mut self, pages: u32) -> Result<()> {
|
||||||
self.message_list.run(pages).await
|
self.message_list.run(pages).await
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user