pub struct ProtonClient<M = ReadOnly> { /* private fields */ }Expand description
IMAP client for Proton Mail via Proton Bridge.
The type parameter M controls which operations are available:
M | Read ops | Write ops |
|---|---|---|
ReadOnly | yes | no |
ReadWrite | yes | yes |
Implementations§
Source§impl<M> ProtonClient<M>
impl<M> ProtonClient<M>
pub const fn new(config: ImapConfig) -> Self
Source§impl<M: Send + Sync> ProtonClient<M>
impl<M: Send + Sync> ProtonClient<M>
Sourcepub async fn list_folders(&self) -> Result<Vec<String>>
pub async fn list_folders(&self) -> Result<Vec<String>>
Sourcepub async fn fetch_uid(&self, folder: &Folder, uid: u32) -> Result<Email>
pub async fn fetch_uid(&self, folder: &Folder, uid: u32) -> Result<Email>
Fetch a single email by UID from a folder.
§Errors
Returns an error if the connection, SELECT, or FETCH fails, or if the message body cannot be parsed.
Sourcepub async fn fetch_unseen(&self, folder: &Folder) -> Result<Vec<Email>>
pub async fn fetch_unseen(&self, folder: &Folder) -> Result<Vec<Email>>
Fetch all unseen emails from a folder.
§Errors
Returns an error if the connection, SELECT, or SEARCH fails.
Sourcepub async fn fetch_all(&self, folder: &Folder) -> Result<Vec<Email>>
pub async fn fetch_all(&self, folder: &Folder) -> Result<Vec<Email>>
Fetch all emails from a folder.
§Errors
Returns an error if the connection, SELECT, or SEARCH fails.
Sourcepub async fn fetch_last_n(
&self,
folder: &Folder,
n: usize,
) -> Result<Vec<Email>>
pub async fn fetch_last_n( &self, folder: &Folder, n: usize, ) -> Result<Vec<Email>>
Fetch the N most recent emails from a folder.
§Errors
Returns an error if the connection, SELECT, SEARCH, or FETCH fails.
Source§impl ProtonClient<ReadWrite>
impl ProtonClient<ReadWrite>
Sourcepub async fn move_to_folder(
&self,
uid: u32,
from: &Folder,
to: &Folder,
) -> Result<()>
pub async fn move_to_folder( &self, uid: u32, from: &Folder, to: &Folder, ) -> Result<()>
Move an email from one folder to another.
Selects from, copies the message to to, marks it
\Deleted in the source folder, and expunges.
§Errors
Returns an error if any IMAP command fails.
Auto Trait Implementations§
impl<M> Freeze for ProtonClient<M>
impl<M> RefUnwindSafe for ProtonClient<M>where
M: RefUnwindSafe,
impl<M> Send for ProtonClient<M>where
M: Send,
impl<M> Sync for ProtonClient<M>where
M: Sync,
impl<M> Unpin for ProtonClient<M>where
M: Unpin,
impl<M> UnwindSafe for ProtonClient<M>where
M: UnwindSafe,
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