Expand description
Shared JMAP wire types for RFC 8620.
Provides Id, UTCDate, State, JmapError,
JmapRequest, JmapResponse, Filter, ResultReference, and
the RFC 8620 §7 push types (StateChange, PushSubscription), and
the draft-atwood-jmap-object-uri-00 object reference JmapUri —
the primitives shared by all crates in the jmap-* family.
This crate is types-only: no method handlers, no async, no network I/O.
It is the root dependency for jmap-mail-types, jmap-chat-types, and
all server and client crates in the family.
All types implement serde::Serialize and serde::Deserialize with the
camelCase field names required by the JMAP wire format.
§Example
use jmap_types::JmapRequest;
let json = r#"{
"using": ["urn:ietf:params:jmap:core"],
"methodCalls": [["Mailbox/get", {"accountId": "a1"}, "c0"]]
}"#;
let req: JmapRequest = serde_json::from_str(json).unwrap();
assert_eq!(req.using[0], "urn:ietf:params:jmap:core");
assert_eq!(req.method_calls[0].name, "Mailbox/get");Macros§
- impl_
string_ enum - Implement an inherent
as_str(),serde::Serialize,serde::Deserialize,std::fmt::Display,From<&str>andFrom<String>for a string-backed enum with a catch-allOther(String)variant.
Structs§
- Added
Item - A single item added to a query result set (RFC 8620 §5.6).
- Changes
Response - RFC 8620 §5.2 —
Foo/changesresponse shape. - Copy
Response - RFC 8620 §5.4 —
Foo/copyresponse shape. - Date
- RFC 3339 date-time string with any timezone offset (RFC 8620 §1.4).
- Filter
Operator - Logical combination of filters (RFC 8620 §5.5).
- GetResponse
- RFC 8620 §5.1 —
Foo/getresponse shape. - Id
- Opaque non-empty server-assigned identifier (RFC 8620 §1.2).
- Invocation
- A JMAP method invocation (RFC 8620 §3.2).
- Jmap
Error - JMAP method-level error, serializable for inclusion in
methodResponses. - Jmap
Request - JMAP request envelope (RFC 8620 §3.3).
- Jmap
Response - JMAP response envelope (RFC 8620 §3.4).
- JmapUri
- A parsed
jmap:<type>:<accountId>:<objectId>URI. - Partial
Object - The partial object a server echoes in
/setcreated/updatedand/copycreated(RFC 8620 §5.3, §5.4). - Patch
Object - A JMAP
PatchObject(RFC 8620 §5.3) — a String → JSON map describing the changes to apply to a record during*/setupdate. - Push
Keys - The
keysobject of aPushSubscription(RFC 8620 §7.2). - Push
Subscription - A push subscription (RFC 8620 §7.2).
- Push
Verification - The object pushed to a new subscription’s URL (RFC 8620 §7.2.2).
- Query
Changes Response - RFC 8620 §5.6 —
Foo/queryChangesresponse shape. - Query
Response - RFC 8620 §5.5 —
Foo/queryresponse shape. - Reserved
Extras Key - Returned by
SetError::validate_extraswhenSetError::extracontains a key that collides with a typed-field wire-name (bd:JMAP-jfia.17). - Result
Reference - A reference to the result of a previous invocation in the same JMAP request batch. Used in method arguments with a “#” prefix on the JSON key (RFC 8620 §9).
- SetError
- A per-item error in a
/setresponse (notCreated,notUpdated,notDestroyedmaps) (RFC 8620 §5.3). - SetResponse
- RFC 8620 §5.3 —
Foo/setresponse shape. - State
- Opaque server state token (RFC 8620 §1.2).
- State
Change - A state change push notification (RFC 8620 §7.1).
- UTCDate
- RFC 3339 UTC timestamp string (RFC 8620 §1.4).
- Validation
Error - Error returned by the fallible constructors
Id::new_validated,UTCDate::new_validated, andState::new_validated.
Enums§
- Argument
- A JMAP method argument that can be either a direct value or a ResultReference.
- Filter
- A filter node: either a logical operator combining sub-filters, or a type-specific condition object (RFC 8620 §5.5).
- Jmap
UriError - Why a string or set of parts is not a valid
JmapUri. - Method
Error Type - The machine-readable
typeof aJmapError. - Operator
- Logical operator for combining filter conditions (RFC 8620 §5.5).
- SetError
Type - The machine-readable type for a
SetError(RFC 8620 §5.3 and RFC 8621). - Urgency
- The Web Push
Urgencyheader (RFC 8030 §5.3), shared by every crate that sends or classifies a push:urgency-option = ("very-low" / "low" / "normal" / "high"). Variants order “in order of increasing urgency”, somaxpicks the most urgent. “A push message without the Urgency header field defaults to a value of “normal”.“
Traits§
- GetObject
- Marker for object types that support
getandchangesoperations. - Jmap
Object - Marker trait for all JMAP object types.
- Query
Object - Marker for object types that support
queryandqueryChangesoperations. - SetObject
- Marker for object types that support
set(create/update/destroy) operations.
Functions§
- check_
property_ classification - Check the property classification of
Tagainstobj, a value with every field populated. - json_
type_ name - Name the top-level JSON type of
v(null,boolean,number,string,arrayorobject) for an error description.