Skip to main content

validate_chat_push

Function validate_chat_push 

Source
pub fn validate_chat_push(
    extra: &Map<String, Value>,
    caps: &HashMap<Id, ChatPushCapability>,
) -> Result<(), Box<SetError>>
Expand description

Check the chatPush property in a PushSubscription’s extra map before it is stored.

caps maps each account that advertises urn:ietf:params:jmap:chat:push to its account-level capability object. An absent or null chatPush, and a null entry for an account, are accepted.

§Errors

The first offending value gets an invalidProperties SetError naming it:

  • chatPush: the value is not an object.
  • chatPush/<accountId>: the account is not in caps, or the entry is not a ChatPushConfig. draft-atwood-jmap-chat-push-00 §PushSubscription Extension: “If a PushSubscription/set create or update includes a chatPush entry for an account whose accountCapabilities does not include urn:ietf:params:jmap:chat:push, the server MUST return an invalidProperties SetError whose properties names the offending entry (e.g., chatPush/<id>) and MUST NOT store the subscription change.”
  • chatPush/<accountId>/kinds: a value other than "direct", "group" or "channel".
  • chatPush/<accountId>/properties: a name that is not a ChatMessageEntry field the server supports.
  • chatPush/<accountId>/urgency and .../mentionUrgency: a value not in the account’s supportedUrgencyValues, including any value outside RFC 8030 §5.3, which no capability can list. draft-atwood-jmap-chat-push-00 §ChatPushConfig: “the server MUST return an invalidProperties SetError on PushSubscription/set whose properties names the offending path (e.g., chatPush/<id>/urgency)”.