Skip to main content

parse_max_changes

Function parse_max_changes 

Source
pub fn parse_max_changes(
    value: Option<&Value>,
) -> Result<Option<u64>, JmapError>
Expand description

Parse the optional maxChanges argument of /changes and /queryChanges. RFC 8620 §5.2: “If supplied by the client, the value MUST be a positive integer greater than 0. If a value outside of this range is given, the server MUST reject the call with an “invalidArguments” error.“ §5.6 gives no range of its own, so the same rule applies to /queryChanges.

Pass the raw argument as taken from the args map (args.get(..) or args.remove(..).as_ref()). Absent or null yields Ok(None).

§Errors

Returns invalidArguments ("maxChanges must be a positive integer") for 0, negative numbers, non-integers, and non-number values.