Skip to main content

Crate jmap_server

Crate jmap_server 

Source
Expand description

Backend-agnostic JMAP server framework (RFC 8620).

Provides request parsing, ResultReference resolution, HTTP response helpers, the Dispatcher machinery, shared backend infrastructure, and generic JMAP method handlers.

Re-exports§

pub use backend::AddedItem;
pub use backend::BackendChangesError;
pub use backend::ChangesResult;
pub use backend::JmapBackend;
pub use backend::QueryChangesResult;
pub use backend::QueryResult;
pub use handlers::handle_changes;
pub use handlers::handle_get;
pub use handlers::handle_query;
pub use handlers::handle_query_changes;

Modules§

backend
Shared backend infrastructure for all JMAP server crates.
handlers
Generic JMAP method handlers shared across all server crates.

Structs§

Dispatcher
Dispatches a JmapRequest to registered method handlers.
Id
Opaque non-empty server-assigned identifier (RFC 8620 §1.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).
RequestError
A request-level JMAP error response: HTTP status code + JMAP error body.
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).
State
Opaque server state token (RFC 8620 §1.2).
UTCDate
RFC 3339 UTC timestamp string (RFC 8620 §1.4).

Enums§

Argument
A JMAP method argument that can be either a direct value or a ResultReference.

Traits§

GetObject
Marker for object types that support get and changes operations.
JmapHandler
Implement this for each JMAP method handler.
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§

error_invocation
Wrap a method-level error as an error Invocation for methodResponses.
error_status
Map a JmapError type string to the appropriate HTTP status code.
extract_account_id
Extract accountId from a JMAP method arguments object.
not_found_json
Convert a slice of Ids to a JSON notFound value.
now_utc_string
Return the current UTC instant formatted as an RFC 3339 string.
parse_request
Parse and validate a JMAP request from a raw JSON value.
request_error
Convenience constructor: wrap a JmapError in a RequestError, deriving the HTTP status code automatically.
resolve_args
Resolve all #key ResultReference fields in args against prior_responses.
ser
Serialize any serde::Serialize type to a serde_json::Value, mapping serialization errors to JmapError::server_fail.

Type Aliases§

HandlerFuture
The return type for all JmapHandler implementations.
Invocation
A JMAP method invocation: [method_name, arguments, call_id].