pub trait JmapHandler<CallerCtx>: Send + Sync {
// Required method
fn call(
&self,
method: String,
call_id: String,
args: Value,
caller: CallerCtx,
) -> HandlerFuture;
}Expand description
Implement this for each JMAP method handler.
CallerCtx is whatever your auth layer produces — an Identity, a session
token, (), etc. The dispatcher passes it through unchanged.
§/set response contract
Handlers for /set methods (RFC 8620 §5.3) that create objects MUST include
an "id" field (type string) in each entry of the "created" map. The
dispatcher reads this field to accumulate createdIds in the response.
Entries without an "id" field are silently skipped — the dispatcher cannot
retroactively error a method call that already returned success.
Required Methods§
Sourcefn call(
&self,
method: String,
call_id: String,
args: Value,
caller: CallerCtx,
) -> HandlerFuture
fn call( &self, method: String, call_id: String, args: Value, caller: CallerCtx, ) -> HandlerFuture
method is the registered method name for this call. A single handler
instance may be registered under multiple names (e.g. both "Foo/get" and
"Bar/get"); this parameter lets the handler distinguish between them.
call_id is the client-supplied identifier for this invocation (RFC 8620 §3.3).
Handlers may use it for logging or correlation but need not echo it —
the dispatcher echoes it in the response automatically.