Skip to main content

handle_message_query_changes

Function handle_message_query_changes 

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

Handle a Message/queryChanges method call (draft-atwood-jmap-chat-00 §Message).

args is the RFC 8620 §5.6 /queryChanges request shape (accountId, optional filter, optional sort, sinceQueryState, optional maxChanges, optional upToId, optional calculateTotal); the returned Value is the §5.6 /queryChanges response shape (accountId, oldQueryState, newQueryState, optional total, removed, added).

A query scoped to one Chat the caller cannot view fails with cannotCalculateChanges, so the client re-runs Message/query, which returns nothing for that Chat (see handle_message_query).

using is the request’s capability list (pass jmap_server::CallContext::using); without urn:ietf:params:jmap:metadata a draft-ietf-jmap-metadata-05 §3.6 filter condition is unsupportedFilter (-05 §3). A filter with a JMAP Search where is checked as for handle_message_query and then answered with cannotCalculateChanges (jmap-search §Query Changes).

Returns (response_args, extra_invocations). The extra list is always empty.

§Errors

Returns a method-level JmapError:

  • invalidArguments when accountId is missing or not a valid Id, sinceQueryState is missing, or filter, sort, maxChanges or upToId is malformed;
  • accountNotFound when the backend does not know accountId;
  • unsupportedFilter when the filter does not decode as a Message filter, or holds a draft-ietf-jmap-metadata-05 §3.6 condition without urn:ietf:params:jmap:metadata in using;
  • unsupportedFilter, too, as for handle_message_query, which also gives the where errors;
  • cannotCalculateChanges when the filter has a JMAP Search where or names a Chat the caller cannot view;
  • unsupportedSort when sort names a property this server does not define;
  • cannotCalculateChanges when the backend cannot compute the changes since sinceQueryState;
  • serverFail when the backend fails, or any other RFC 8620 §5.6 error the backend returns.