#[non_exhaustive]pub enum SpacePatchOp {
AddRole(SpaceRole),
RemoveRole(Id),
UpdateRole {
id: Id,
patch: RolePatch,
},
AddMember {
user_id: Id,
role_ids: Vec<Id>,
},
RemoveMember(Id),
UpdateMember {
user_id: Id,
patch: MemberPatch,
},
AddChannel(ChannelCreate),
RemoveChannel(Id),
UpdateChannel {
id: Id,
patch: ChannelPatch,
},
AddCategory(Category),
RemoveCategory(Id),
UpdateCategory {
id: Id,
patch: CategoryPatch,
},
}Expand description
A single Space/set update mutation operation.
Server-side handlers parse the wire JSON patch object (which has 12
pluralized keys), then unfold each array entry into a separate
SpacePatchOp value. Each variant corresponds to one entry of one
wire key:
| Wire key (draft-atwood-jmap-chat-00 §Space/set) | Variant |
|---|---|
addRoles entry | SpacePatchOp::AddRole |
removeRoles entry | SpacePatchOp::RemoveRole |
updateRoles entry | SpacePatchOp::UpdateRole |
addMembers entry | SpacePatchOp::AddMember |
removeMembers entry | SpacePatchOp::RemoveMember |
updateMembers entry | SpacePatchOp::UpdateMember |
addChannels entry | SpacePatchOp::AddChannel |
removeChannels entry | SpacePatchOp::RemoveChannel |
updateChannels entry | SpacePatchOp::UpdateChannel |
addCategories entry | SpacePatchOp::AddCategory |
removeCategories entry | SpacePatchOp::RemoveCategory |
updateCategories entry | SpacePatchOp::UpdateCategory |
This is a Rust internal representation; it has no wire form of its own.
The wire form is the pluralized patch object as defined in the draft.
Round-trip JSON tests exist for the contained payload types
(SpaceRole, Category, ChannelCreate, RolePatch,
MemberPatch, ChannelPatch, CategoryPatch) — see this module’s
test section.
For Add* variants whose payload is a server-stored type with a
server-assigned id (SpaceRole, Category), the input value
carries a placeholder id; the server replaces it with a real id
before storing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AddRole(SpaceRole)
Add a new role to the Space (one entry from wire key addRoles).
The contained SpaceRole’s id is a placeholder; the server
replaces it with a ULID before storing.
RemoveRole(Id)
Remove a role from the Space (one entry from wire key removeRoles).
Members holding only the removed role are demoted to @everyone.
UpdateRole
Update an existing role (one entry from wire key updateRoles).
AddMember
Add a member to the Space (one entry from wire key addMembers).
user_id is the crate::ChatContact id; role_ids may be empty
(the member gets only @everyone).
RemoveMember(Id)
Remove a member from the Space (one entry from wire key removeMembers).
The owner cannot be removed.
UpdateMember
Update an existing member (one entry from wire key updateMembers).
AddChannel(ChannelCreate)
Add a channel to the Space (one entry from wire key addChannels).
The server creates a crate::Chat of kind: "channel" with the
new id and spaceId set.
RemoveChannel(Id)
Remove a channel from the Space (one entry from wire key removeChannels).
Cascades to all Messages in the channel.
UpdateChannel
Update an existing channel (one entry from wire key updateChannels).
AddCategory(Category)
Add a category to the Space (one entry from wire key addCategories).
The contained Category’s id is a placeholder; the server
replaces it with a ULID before storing.
RemoveCategory(Id)
Remove a category from the Space (one entry from wire key removeCategories).
Channels in the removed category move to uncategorizedChannelIds.
UpdateCategory
Update an existing category (one entry from wire key updateCategories).
Trait Implementations§
Source§impl Clone for SpacePatchOp
impl Clone for SpacePatchOp
Source§fn clone(&self) -> SpacePatchOp
fn clone(&self) -> SpacePatchOp
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpacePatchOp
impl Debug for SpacePatchOp
Source§impl PartialEq for SpacePatchOp
impl PartialEq for SpacePatchOp
Source§fn eq(&self, other: &SpacePatchOp) -> bool
fn eq(&self, other: &SpacePatchOp) -> bool
self and other values to be equal, and is used by ==.