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
48#[macro_use]
49mod string_enum;
50
51pub mod backend;
52pub mod email;
53pub mod identity;
54pub mod keyword;
55pub mod mailbox;
56pub mod query;
57pub mod snippet;
58pub mod submission;
59pub mod thread;
60pub mod vacation;
61
62pub use backend::{
63    EmailProperty, EmailSubmissionProperty, IdentityProperty, MailboxProperty,
64    SearchSnippetProperty, ThreadProperty, VacationResponseProperty,
65};
66pub use email::{
67    Email, EmailAddress, EmailAddressGroup, EmailBodyPart, EmailBodyValue, EmailHeader,
68};
69pub use identity::Identity;
70pub use keyword::Keyword;
71pub use mailbox::{Mailbox, MailboxFilterCondition, MailboxRights, MailboxRole};
72pub use query::{
73    ComparatorProperty, EmailComparator, EmailFilter, EmailFilterCondition, EmailSubmissionFilter,
74    Filter, FilterOperator, Operator,
75};
76pub use snippet::SearchSnippet;
77pub use submission::{
78    Address, Delivered, DeliveryStatus, Displayed, EmailSubmission, EmailSubmissionFilterCondition,
79    Envelope, UndoStatus,
80};
81pub use thread::Thread;
82pub use vacation::VacationResponse;