tuta_poll/lib.rs
1//! A small library to poll mails from tutanota and possibly decrypt sender name, subject and body and mark them as read.
2//!
3//! ## Overview
4//! The library provides a high level client with the option to connect to a websocket to listen for new messages as well as a wrapper for the undocumented tuta api.
5//! The library can also decrypt sender name, subject and message body.
6//!
7//! ## Usage
8//!
9//! ### Config and Client
10//!
11//! ```ignore
12//! let config = tuta_poll::config::Account {
13//! "...@tuta.com",
14//! "some_password",
15//! watch_spam: true,
16//! show_name: true,
17//! show_subject: true,
18//! show_body: true,
19//! };
20//!
21//! let client = tuta_poll::client::Client::new(&config).await?;
22//! ```
23//!
24//! ### Get messages
25//! ```ignore
26//! use futures_util::pin_mut;
27//! use futures_util::StreamExt;
28//!
29//! let mails = client.get_mails();
30//! pin_mut!(mails);
31//! while let Some(mail) = mails.next().await {
32//! let mut mail = mail?;
33//! let decrypted_mail = client.decrypt(&mail).await;
34//! }
35//! ```
36//! ### Connect to websocket
37//!
38//! ```ignore
39//! let connector = client.get_websocket_connector()?;
40//!
41//! loop {
42//! let mut socket = connector.connect()?;
43//! while let Ok(has_new) = socket.has_new().await {
44//! if !has_new {
45//! continue;
46//! }
47//! let mails = client.get_mails();
48//! }
49//! }
50//! ```
51
52pub mod api;
53pub mod client;
54pub mod config;
55pub mod crypto;
56pub mod types;
57
58mod http_client;
59mod serialize;
60mod websocket;