Skip to main content

jmap_types/
lib.rs

1//! Shared JMAP wire types for RFC 8620.
2//!
3//! Provides [`Id`], [`UTCDate`], [`State`], [`JmapError`],
4//! [`JmapRequest`], [`JmapResponse`], [`Filter`], and [`ResultReference`] —
5//! the primitives shared by all crates in the `jmap-*` family.
6//!
7//! This crate is types-only: no method handlers, no async, no network I/O.
8//! It is the root dependency for `jmap-mail-types`, `jmap-chat-types`, and
9//! all server and client crates in the family.
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_types::JmapRequest;
18//!
19//! let json = r#"{
20//!     "using": ["urn:ietf:params:jmap:core"],
21//!     "methodCalls": [["Mailbox/get", {"accountId": "a1"}, "c0"]]
22//! }"#;
23//!
24//! let req: JmapRequest = serde_json::from_str(json).unwrap();
25//! assert_eq!(req.using[0], "urn:ietf:params:jmap:core");
26//! assert_eq!(req.method_calls[0].0, "Mailbox/get");
27//! ```
28
29#![forbid(unsafe_code)]
30
31pub mod backend;
32pub mod error;
33pub mod id;
34pub mod query;
35pub mod resultref;
36pub mod wire;
37
38pub use backend::{GetObject, JmapObject, QueryObject, SetObject};
39pub use error::JmapError;
40pub use id::{Date, Id, State, UTCDate};
41pub use query::{Filter, FilterOperator, Operator};
42pub use resultref::{Argument, ResultReference};
43pub use wire::{Invocation, JmapRequest, JmapResponse};