Skip to main content

handle_changes

Function handle_changes 

Source
pub async fn handle_changes<O: JmapObject, B: JmapBackend>(
    backend: &B,
    caller: &B::CallerCtx,
    args: Value,
    using: &[String],
) -> Result<HandlerOutput, JmapError>
Expand description

Generic */changes handler (RFC 8620 §5.2).

using is the request’s capability list (crate::CallContext::using). When it includes urn:ietf:params:jmap:metadata, the optional ignoreMetadataOnlyChanges argument (draft-ietf-jmap-metadata-05 §3.3) is parsed, and must be a boolean; otherwise the backend is told to ignore metadata-only changes, because -05 §3 says such a request “MUST behave as if ignoreMetadataOnlyChanges were true”.

updatedProperties is ChangesResult::updated_properties (RFC 8621 §2.2, -05 §3.3), and null whenever updated is empty (-05 §3.3: “It is always present, and is null when updated is empty”). Backends that do not track per-property change detail MUST leave it None: an empty array would mean “nothing about the listed objects actually changed”.

§Errors

Method-level errors, returned as the JmapError:

  • invalidArguments if args is not an object or accountId is missing or not a valid Id. Also when sinceState is missing, maxChanges is not a positive integer, or (with the metadata capability) ignoreMetadataOnlyChanges is not a boolean.
  • accountNotFound if the backend reports no such account; serverFail (with a redacted description) if that check fails.
  • cannotCalculateChanges if the backend cannot compute changes from sinceState, including when it has more than maxChanges and no intermediate state; other backend failures map as BackendChangesError’s From impl does.