Skip to main content

jmap_mail_types/
lib.rs

1//! RFC 8621 JMAP for Mail data types.
2//!
3//! Provides [`Email`], [`Mailbox`], [`Thread`], [`Identity`], [`EmailSubmission`],
4//! and [`SearchSnippet`] — the core object types defined by
5//! [RFC 8621](https://www.rfc-editor.org/rfc/rfc8621).
6//!
7//! This crate is types-only: no method handlers, no async, no network I/O.
8//! It sits between `jmap-types` (shared wire primitives) and `jmap-mail-server`
9//! (method handlers).
10//!
11//! All types implement [`serde::Serialize`] and [`serde::Deserialize`] with the
12//! camelCase field names required by the JMAP wire format.
13//!
14//! # Example
15//!
16//! ```rust
17//! use jmap_mail_types::Mailbox;
18//!
19//! let json = r#"{
20//!     "id": "mb1",
21//!     "name": "Inbox",
22//!     "role": "inbox",
23//!     "sortOrder": 10,
24//!     "totalEmails": 42,
25//!     "unreadEmails": 3,
26//!     "totalThreads": 20,
27//!     "unreadThreads": 2,
28//!     "myRights": {
29//!         "mayReadItems": true,
30//!         "mayAddItems": true,
31//!         "mayRemoveItems": true,
32//!         "maySetSeen": true,
33//!         "maySetKeywords": true,
34//!         "mayCreateChild": true,
35//!         "mayRename": true,
36//!         "mayDelete": false,
37//!         "maySubmit": false
38//!     },
39//!     "isSubscribed": true
40//! }"#;
41//!
42//! let mailbox: Mailbox = serde_json::from_str(json).unwrap();
43//! assert_eq!(mailbox.name, "Inbox");
44//! ```
45
46#![forbid(unsafe_code)]
47
48pub mod backend;
49pub mod email;
50pub mod identity;
51pub mod keyword;
52pub mod mailbox;
53pub mod query;
54pub mod snippet;
55pub mod submission;
56pub mod thread;
57pub mod vacation;
58
59#[cfg(feature = "mdn")]
60pub mod mdn;
61
62#[cfg(feature = "sieve")]
63pub mod sieve;
64#[cfg(feature = "sieve")]
65pub use sieve::{SieveAccountCapability, SieveCapability, SieveScript, JMAP_SIEVE_SCRIPTS_URI};
66
67#[cfg(feature = "sieve")]
68pub use backend::SieveScriptProperty;
69pub use backend::{
70    EmailProperty, EmailSubmissionProperty, IdentityProperty, MailboxProperty,
71    SearchSnippetProperty, ThreadProperty, VacationResponseProperty,
72};
73pub use email::{
74    Email, EmailAddress, EmailAddressGroup, EmailBodyPart, EmailBodyValue, EmailHeader,
75};
76pub use identity::Identity;
77pub use keyword::{Keyword, KeywordError};
78pub use mailbox::{Mailbox, MailboxFilterCondition, MailboxRights, MailboxRole};
79pub use query::{
80    ComparatorProperty, EmailComparator, EmailFilter, EmailFilterCondition, EmailSubmissionFilter,
81    Filter, FilterOperator, Operator,
82};
83pub use snippet::SearchSnippet;
84pub use submission::{
85    Address, Delivered, DeliveryStatus, Displayed, EmailSubmission, EmailSubmissionFilterCondition,
86    Envelope, UndoStatus,
87};
88pub use thread::Thread;
89pub use vacation::VacationResponse;