jmap_metadata_types/lib.rs
1//! JMAP Object Metadata extension data types.
2//!
3//! Implements the data types defined in
4//! [draft-ietf-jmap-metadata-01](https://www.ietf.org/archive/id/draft-ietf-jmap-metadata-01.txt).
5//! Types only — no method handlers, no async, no network I/O.
6//!
7//! ## Module layout
8//!
9//! - [`metadata`] — [`Metadata`], [`Annotation`], [`ImapMetadata`],
10//! [`WebDavMetadata`] (§2)
11//! - [`capability`] — [`MetadataCapability`], [`JMAP_METADATA_URI`] (§1.2.1)
12//! - [`filter`] — [`MetadataFilterCondition`] (§3.4.1)
13//! - [`backend`] — [`MetadataProperty`] and `JmapObject` trait impls
14//!
15//! All public types are re-exported at the crate root.
16//!
17//! # Example
18//!
19//! ```rust
20//! use jmap_metadata_types::{Annotation, Metadata};
21//!
22//! let json = r#"{
23//! "@type": "Annotation",
24//! "id": "MD789",
25//! "relatedType": "Email",
26//! "relatedId": "EM456",
27//! "isPrivate": true,
28//! "acme.example.com:workflowState": "pending-review"
29//! }"#;
30//!
31//! let meta: Metadata = serde_json::from_str(json).unwrap();
32//! match meta {
33//! Metadata::Annotation(Annotation { ref related_type, ref extra, .. }) => {
34//! assert_eq!(related_type, "Email");
35//! assert_eq!(
36//! extra.get("acme.example.com:workflowState"),
37//! Some(&serde_json::Value::String("pending-review".into())),
38//! );
39//! }
40//! _ => panic!("expected Annotation variant"),
41//! }
42//! ```
43
44#![forbid(unsafe_code)]
45
46pub mod backend;
47pub mod capability;
48pub mod filter;
49pub mod metadata;
50
51pub use backend::MetadataProperty;
52pub use capability::{MetadataCapability, JMAP_METADATA_URI};
53pub use filter::MetadataFilterCondition;
54pub use metadata::{Annotation, ImapMetadata, Metadata, WebDavMetadata};