[−][src]Struct melib::backends::jmap::rfc8620::Set
#set
Modifying the state of Foo objects on the server is done via the "Foo/set" method. This encompasses creating, updating, and destroying Foo records. This allows the server to sort out ordering and dependencies that may exist if doing multiple operations at once (for example, to ensure there is always a minimum number of a certain record type).
Fields
account_id: Id<Account>
o accountId: "Id"
The id of the account to use.
if_in_state: Option<State<OBJ>>
o ifInState: "String|null"
This is a state string as returned by the "Foo/get" method (representing the state of all objects of this type in the account). If supplied, the string must match the current state; otherwise, the method will be aborted and a "stateMismatch" error returned. If null, any changes will be applied to the current state.
create: Option<HashMap<Id<OBJ>, OBJ>>
o create: "Id[Foo]|null"
A map of a creation id (a temporary id set by the client) to Foo objects, or null if no objects are to be created.
The Foo object type definition may define default values for properties. Any such property may be omitted by the client.
The client MUST omit any properties that may only be set by the server (for example, the "id" property on most object types).
update: Option<HashMap<Id<OBJ>, Value>>
o update: "Id[PatchObject]|null"
A map of an id to a Patch object to apply to the current Foo object with that id, or null if no objects are to be updated.
A PatchObject is of type "String[*]" and represents an unordered set of patches. The keys are a path in JSON Pointer format [RFC6901], with an implicit leading "/" (i.e., prefix each key with "/" before applying the JSON Pointer evaluation algorithm).
All paths MUST also conform to the following restrictions; if there is any violation, the update MUST be rejected with an "invalidPatch" error:
-
The pointer MUST NOT reference inside an array (i.e., you MUST NOT insert/delete from an array; the array MUST be replaced in its entirety instead).
-
All parts prior to the last (i.e., the value after the final slash) MUST already exist on the object being patched.
-
There MUST NOT be two patches in the PatchObject where the pointer of one is the prefix of the pointer of the other, e.g., "alerts/1/offset" and "alerts".
The value associated with each pointer determines how to apply that patch:
-
If null, set to the default value if specified for this property; otherwise, remove the property from the patched object. If the key is not present in the parent, this a no-op.
-
Anything else: The value to set for this property (this may be a replacement or addition to the object being patched).
Any server-set properties MAY be included in the patch if their value is identical to the current server value (before applying the patches to the object). Otherwise, the update MUST be rejected with an "invalidProperties" SetError.
This patch definition is designed such that an entire Foo object is also a valid PatchObject. The client may choose to optimise network usage by just sending the diff or may send the whole object; the server processes it the same either way.
destroy: Option<Vec<Id<OBJ>>>
o destroy: "Id[]|null"
A list of ids for Foo objects to permanently delete, or null if no objects are to be destroyed.
Implementations
impl<OBJ: Object> Set<OBJ> where
OBJ: Debug + Serialize,
[src]
OBJ: Debug + Serialize,
pub fn new() -> Self
[src]
pub fn account_id(self, new_val: Id<Account>) -> Self
[src]
pub fn if_in_state(self, new_val: Option<State<OBJ>>) -> Self
[src]
o ifInState: "String|null"
This is a state string as returned by the "Foo/get" method (representing the state of all objects of this type in the account). If supplied, the string must match the current state; otherwise, the method will be aborted and a "stateMismatch" error returned. If null, any changes will be applied to the current state.
pub fn update(self, new_val: Option<HashMap<Id<OBJ>, Value>>) -> Self
[src]
Trait Implementations
impl<OBJ: Debug + Object> Debug for Set<OBJ> where
OBJ: Debug + Serialize,
[src]
OBJ: Debug + Serialize,
impl<'de, OBJ: Object> Deserialize<'de> for Set<OBJ> where
OBJ: Debug + Serialize,
OBJ: Deserialize<'de>,
[src]
OBJ: Debug + Serialize,
OBJ: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<OBJ: Object> Serialize for Set<OBJ> where
OBJ: Debug + Serialize,
OBJ: Serialize,
[src]
OBJ: Debug + Serialize,
OBJ: Serialize,
Auto Trait Implementations
impl<OBJ> RefUnwindSafe for Set<OBJ> where
OBJ: RefUnwindSafe,
OBJ: RefUnwindSafe,
impl<OBJ> Send for Set<OBJ> where
OBJ: Send,
OBJ: Send,
impl<OBJ> Sync for Set<OBJ> where
OBJ: Sync,
OBJ: Sync,
impl<OBJ> Unpin for Set<OBJ> where
OBJ: Unpin,
OBJ: Unpin,
impl<OBJ> UnwindSafe for Set<OBJ> where
OBJ: UnwindSafe,
OBJ: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,