Skip to main content

Crate jmap_types

Crate jmap_types 

Source
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> and From<String> for a string-backed enum with a catch-all Other(String) variant.

Structs§

AddedItem
A single item added to a query result set (RFC 8620 §5.6).
ChangesResponse
RFC 8620 §5.2 — Foo/changes response shape.
CopyResponse
RFC 8620 §5.4 — Foo/copy response shape.
Date
RFC 3339 date-time string with any timezone offset (RFC 8620 §1.4).
FilterOperator
Logical combination of filters (RFC 8620 §5.5).
GetResponse
RFC 8620 §5.1 — Foo/get response shape.
Id
Opaque non-empty server-assigned identifier (RFC 8620 §1.2).
Invocation
A JMAP method invocation (RFC 8620 §3.2).
JmapError
JMAP method-level error, serializable for inclusion in methodResponses.
JmapRequest
JMAP request envelope (RFC 8620 §3.3).
JmapResponse
JMAP response envelope (RFC 8620 §3.4).
JmapUri
A parsed jmap:<type>:<accountId>:<objectId> URI.
PartialObject
The partial object a server echoes in /set created / updated and /copy created (RFC 8620 §5.3, §5.4).
PatchObject
A JMAP PatchObject (RFC 8620 §5.3) — a String → JSON map describing the changes to apply to a record during */set update.
PushKeys
The keys object of a PushSubscription (RFC 8620 §7.2).
PushSubscription
A push subscription (RFC 8620 §7.2).
PushVerification
The object pushed to a new subscription’s URL (RFC 8620 §7.2.2).
QueryChangesResponse
RFC 8620 §5.6 — Foo/queryChanges response shape.
QueryResponse
RFC 8620 §5.5 — Foo/query response shape.
ReservedExtrasKey
Returned by SetError::validate_extras when SetError::extra contains a key that collides with a typed-field wire-name (bd:JMAP-jfia.17).
ResultReference
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 /set response (notCreated, notUpdated, notDestroyed maps) (RFC 8620 §5.3).
SetResponse
RFC 8620 §5.3 — Foo/set response shape.
State
Opaque server state token (RFC 8620 §1.2).
StateChange
A state change push notification (RFC 8620 §7.1).
UTCDate
RFC 3339 UTC timestamp string (RFC 8620 §1.4).
ValidationError
Error returned by the fallible constructors Id::new_validated, UTCDate::new_validated, and State::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).
JmapUriError
Why a string or set of parts is not a valid JmapUri.
MethodErrorType
The machine-readable type of a JmapError.
Operator
Logical operator for combining filter conditions (RFC 8620 §5.5).
SetErrorType
The machine-readable type for a SetError (RFC 8620 §5.3 and RFC 8621).
Urgency
The Web Push Urgency header (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”, so max picks 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 get and changes operations.
JmapObject
Marker trait for all JMAP object types.
QueryObject
Marker for object types that support query and queryChanges operations.
SetObject
Marker for object types that support set (create/update/destroy) operations.

Functions§

check_property_classification
Check the property classification of T against obj, a value with every field populated.
json_type_name
Name the top-level JSON type of v (null, boolean, number, string, array or object) for an error description.