Skip to main content

Module conditional

Module conditional 

Source
Expand description

draft-ietf-jmap-conditional-02 wire types: the capability, the ifUnchangedBy and atomic Foo/set arguments, and the stateMismatch, atomicFailure and cannotApplyAtomically method errors.

The two new error codes are &str constants used with JmapError::custom, like other extension codes: they decode to MethodErrorType::Other, and no MethodErrorType variant is added (docs/design/DECISIONS.md decision 7). Their extra properties live in JmapError::extra, read and written by the constructors and readers here.

§Example

use jmap_types::JmapError;
use jmap_types::conditional::{AtomicFailure, ATOMIC_FAILURE};

let err = JmapError::state_mismatch_failed(vec![jmap_types::Id::from("f42")]);
assert_eq!(
    serde_json::to_value(&err).unwrap(),
    serde_json::json!({"type": "stateMismatch", "failed": ["f42"]})
);

let err = JmapError::atomic_failure(AtomicFailure::default());
assert_eq!(err.error_type.as_str(), ATOMIC_FAILURE);

Structs§

AtomicFailure
The details of an atomicFailure error (§4.2): the Foo/set-shaped notCreated, notUpdated and notDestroyed maps, each optional (“A server MAY report only the first failure it encounters”).
ConditionalCapability
The Session capability object (§2.1): “The value of this property MUST be an empty object.” Unknown members are kept in extra.
ConditionalSetArgs
The two §3 Foo/set arguments, for a client to merge into a Foo/set call. Defaults (empty ifUnchangedBy, atomic false) are not written.

Constants§

ATOMIC_FAILURE
The atomicFailure method error (§4.2, §8.2): an atomic Foo/set could not commit all its changes, so it made none.
CANNOT_APPLY_ATOMICALLY
The cannotApplyAtomically method error (§4.3, §8.3): the server cannot commit this Foo/set as a unit, so it made no change.
JMAP_CONDITIONAL_URI
The capability URI (§2.1, §8.1).

Type Aliases§

IfUnchangedBy
The ifUnchangedBy argument (§3): "Id[PatchObject|null]".