#[non_exhaustive]pub enum SpacePatchOp {
AddRole(SpaceRole),
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(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 client-side
placeholder. The backend MUST mint its own server-assigned id
(the reference implementation uses a ULID) and surface it via
the per-op result. Clients SHOULD treat the placeholder as
opaque and rely on the returned id for subsequent references.
Backends that honor the client-supplied id break server-side
id minting and are spec-noncompliant.
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).
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 client-side
placeholder. The backend MUST mint its own server-assigned id
(the reference implementation uses a ULID) and surface it via
the per-op result. Clients SHOULD treat the placeholder as
opaque and rely on the returned id for subsequent references.
Backends that honor the client-supplied id break server-side
id minting and are spec-noncompliant.
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