#[non_exhaustive]pub enum SpacePatchOp {
AddRole(RoleCreate),
RemoveRole(Id),
UpdateRole {
id: Id,
patch: RolePatch,
},
AddMember(MemberCreate),
RemoveMember(Id),
UpdateMember {
user_id: Id,
patch: MemberPatch,
},
AddChannel(ChannelCreate),
RemoveChannel(Id),
UpdateChannel {
id: Id,
patch: ChannelPatch,
},
AddCategory(CategoryCreate),
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
(RoleCreate, CategoryCreate, ChannelCreate, RolePatch,
MemberPatch, ChannelPatch, CategoryPatch) — see this module’s
test section.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AddRole(RoleCreate)
Add a new role to the Space (one entry from wire key addRoles).
The entry carries no id: the backend mints the server-assigned
id (draft: “Server assigns ULIDs”) and surfaces it via the per-op
result.
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(MemberCreate)
Add a member to the Space (one entry from wire key addMembers).
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).
Fields
patch: MemberPatchThe member fields to change.
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).
Fields
patch: ChannelPatchThe channel fields to change.
AddCategory(CategoryCreate)
Add a category to the Space (one entry from wire key addCategories).
The entry carries no id: the backend mints the server-assigned
id (draft: “Server assigns ULIDs”) and surfaces it via the per-op
result. When CategoryCreate::position is None the backend
picks the stored crate::Category’s position.
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 more