Enum command::Command
zaun_community_protocol::command::Command · Enum
pub enum Command { … }A decoded command body: one variant per command of the protocol
Variants
Section titled “Variants”SessionHello(Hello)
Section titled “SessionHello(Hello)”session.hello
CommunityCreate(Create)
Section titled “CommunityCreate(Create)”community.create
CommunityGet(Get)
Section titled “CommunityGet(Get)”community.get
CommunityIconGet(IconGet)
Section titled “CommunityIconGet(IconGet)”community.icon.get
CommunityRotations(Rotations)
Section titled “CommunityRotations(Rotations)”community.rotations
CommunityUpdate(Update)
Section titled “CommunityUpdate(Update)”community.update
CommunityDescriptorPublish(DescriptorPublish)
Section titled “CommunityDescriptorPublish(DescriptorPublish)”community.descriptor.publish
CommunityLeave(Leave)
Section titled “CommunityLeave(Leave)”community.leave
ChannelCreate(Create)
Section titled “ChannelCreate(Create)”channel.create
ChannelUpdate(Update)
Section titled “ChannelUpdate(Update)”channel.update
ChannelDelete(Delete)
Section titled “ChannelDelete(Delete)”channel.delete
ChannelReorder(Reorder)
Section titled “ChannelReorder(Reorder)”channel.reorder
ChannelPermissionsUpdate(PermissionsUpdate)
Section titled “ChannelPermissionsUpdate(PermissionsUpdate)”channel.permissions.update
MemberList(List)
Section titled “MemberList(List)”member.list
MemberGet(Get)
Section titled “MemberGet(Get)”member.get
MemberUpdate(Update)
Section titled “MemberUpdate(Update)”member.update
MemberRolesUpdate(RolesUpdate)
Section titled “MemberRolesUpdate(RolesUpdate)”member.roles.update
MemberKick(Kick)
Section titled “MemberKick(Kick)”member.kick
MemberBan(BanMember)
Section titled “MemberBan(BanMember)”member.ban
MemberUnban(Unban)
Section titled “MemberUnban(Unban)”member.unban
MemberBans(Bans)
Section titled “MemberBans(Bans)”member.bans
MemberTimeout(Timeout)
Section titled “MemberTimeout(Timeout)”member.timeout
MemberStatusSet(StatusSet)
Section titled “MemberStatusSet(StatusSet)”member.status.set
RoleCreate(Create)
Section titled “RoleCreate(Create)”role.create
RoleUpdate(Update)
Section titled “RoleUpdate(Update)”role.update
RoleDelete(Delete)
Section titled “RoleDelete(Delete)”role.delete
RoleReorder(Reorder)
Section titled “RoleReorder(Reorder)”role.reorder
MessageSend(Send)
Section titled “MessageSend(Send)”message.send
MessageEdit(Edit)
Section titled “MessageEdit(Edit)”message.edit
MessageDelete(Delete)
Section titled “MessageDelete(Delete)”message.delete
MessageHistory(History)
Section titled “MessageHistory(History)”message.history
ReactionAdd(ReactionAdd)
Section titled “ReactionAdd(ReactionAdd)”reaction.add
ReactionRemove(ReactionRemove)
Section titled “ReactionRemove(ReactionRemove)”reaction.remove
AttachmentUpload(Upload)
Section titled “AttachmentUpload(Upload)”attachment.upload
AttachmentDownload(Download)
Section titled “AttachmentDownload(Download)”attachment.download
InviteCreate(Create)
Section titled “InviteCreate(Create)”invite.create
InviteRedeem(Redeem)
Section titled “InviteRedeem(Redeem)”invite.redeem
InviteRevoke(Revoke)
Section titled “InviteRevoke(Revoke)”invite.revoke
InviteList(List)
Section titled “InviteList(List)”invite.list
InviteUses(Uses)
Section titled “InviteUses(Uses)”invite.uses
AuditList(List)
Section titled “AuditList(List)”audit.list
SyncSnapshot(Snapshot)
Section titled “SyncSnapshot(Snapshot)”sync.snapshot
SyncEvents(Events)
Section titled “SyncEvents(Events)”sync.events
SyncResume(Resume)
Section titled “SyncResume(Resume)”sync.resume
SyncAck(Ack)
Section titled “SyncAck(Ack)”sync.ack
MembershipRequest(Request)
Section titled “MembershipRequest(Request)”membership.request
MembershipApprove(Approve)
Section titled “MembershipApprove(Approve)”membership.approve
MembershipReject(Reject)
Section titled “MembershipReject(Reject)”membership.reject
MembershipSuspend(Suspend)
Section titled “MembershipSuspend(Suspend)”membership.suspend
MembershipRestore(Restore)
Section titled “MembershipRestore(Restore)”membership.restore
MembershipPending(Pending)
Section titled “MembershipPending(Pending)”membership.pending
AdmissionPolicyGet(PolicyGet)
Section titled “AdmissionPolicyGet(PolicyGet)”admission.policy.get
AdmissionPolicyUpdate(PolicyUpdate)
Section titled “AdmissionPolicyUpdate(PolicyUpdate)”admission.policy.update
LockdownGet(Get)
Section titled “LockdownGet(Get)”moderation.lockdown.get
LockdownEnable(Enable)
Section titled “LockdownEnable(Enable)”moderation.lockdown.enable
LockdownDisable(Disable)
Section titled “LockdownDisable(Disable)”moderation.lockdown.disable
ReportCreate(Create)
Section titled “ReportCreate(Create)”report.create
ReportList(List)
Section titled “ReportList(List)”report.list
ReportGet(Get)
Section titled “ReportGet(Get)”report.get
ReportReview(Review)
Section titled “ReportReview(Review)”report.review
ReportResolve(Resolve)
Section titled “ReportResolve(Resolve)”report.resolve
VoiceJoin(Join)
Section titled “VoiceJoin(Join)”voice.join
VoiceLeave(Leave)
Section titled “VoiceLeave(Leave)”voice.leave
VoiceUpdate(Update)
Section titled “VoiceUpdate(Update)”voice.update
VoiceSignal(Signal)
Section titled “VoiceSignal(Signal)”voice.signal
VoiceKeys(Keys)
Section titled “VoiceKeys(Keys)”voice.keys
VoiceModerate(Moderate)
Section titled “VoiceModerate(Moderate)”voice.moderate
SignalTyping(Typing)
Section titled “SignalTyping(Typing)”signal.typing
SignalPresence(Presence)
Section titled “SignalPresence(Presence)”signal.presence
PresenceList(List)
Section titled “PresenceList(List)”presence.list
MigrationReauth(Reauth)
Section titled “MigrationReauth(Reauth)”migration.reauth
BotInstall(Install)
Section titled “BotInstall(Install)”bot.install
BotUpdate(Update)
Section titled “BotUpdate(Update)”bot.update
BotGrant(Grant)
Section titled “BotGrant(Grant)”bot.grant
BotEnable(Enable)
Section titled “BotEnable(Enable)”bot.enable
BotDisable(Disable)
Section titled “BotDisable(Disable)”bot.disable
BotRemove(Remove)
Section titled “BotRemove(Remove)”bot.remove
BotRegister(Register)
Section titled “BotRegister(Register)”bot.register
BotConfigure(Configure)
Section titled “BotConfigure(Configure)”bot.configure
BotList(List)
Section titled “BotList(List)”bot.list
BotGet(Target)
Section titled “BotGet(Target)”bot.get
CommandSet(Set)
Section titled “CommandSet(Set)”command.set
CommandList(List)
Section titled “CommandList(List)”command.list
InteractionCreate(Create)
Section titled “InteractionCreate(Create)”interaction.create
InteractionRespond(Respond)
Section titled “InteractionRespond(Respond)”interaction.respond
InteractionFollowup(Followup)
Section titled “InteractionFollowup(Followup)”interaction.followup
InteractionOriginalEdit(OriginalEdit)
Section titled “InteractionOriginalEdit(OriginalEdit)”interaction.original.edit
InteractionOriginalDelete(OriginalDelete)
Section titled “InteractionOriginalDelete(OriginalDelete)”interaction.original.delete
DmOpen(Open)
Section titled “DmOpen(Open)”dm.open
DmClose(Close)
Section titled “DmClose(Close)”dm.close
DmList(List)
Section titled “DmList(List)”dm.list
MemberSettingsGet(SettingsGet)
Section titled “MemberSettingsGet(SettingsGet)”member.settings.get
MemberSettingsUpdate(SettingsUpdate)
Section titled “MemberSettingsUpdate(SettingsUpdate)”member.settings.update
Methods
Section titled “Methods”is_channel_scoped
Section titled “is_channel_scoped”pub fn is_channel_scoped(&self) -> boolWhether the command needs a channel: the envelope’s channel_id or the body’s
(Command::channel_id). invite.create and sync.events name an optional or
stream-dependent channel in the body only and are not listed.
channel_id
Section titled “channel_id”pub const fn channel_id(&self) -> Option<ChannelId>The channel_id carried in the body, for commands whose the protocol/the protocol body lists one.
When both the envelope and the body carry one they must be equal (envelope layer).
is_mutating
Section titled “is_mutating”pub fn is_mutating(&self) -> boolWhether the command is mutating, hence idempotency-recorded; the same rule as
crate::envelope::is_mutating on the command’s wire name.
validate_at
Section titled “validate_at”pub fn validate_at(&self, now_ms: u64) -> Result<(), BodyError>Command::validate plus the bounds relative to the host’s clock: member.timeout
until ≤ now + 28 days and membership.suspend until ≤ now + 90 days.
SPEC: whether an until in the past is an error is not said; it is accepted here
(the engine treats it as already elapsed).
Errors
Section titled “Errors”As Command::validate, or BAD_REQUEST{field: "until"}.
pub const fn name(&self) -> &'static strThe wire name (type).
validate
Section titled “validate”pub fn validate(&self) -> Result<(), BodyError>Runs the body’s state-free checks.
Errors
Section titled “Errors”The first violated rule.
pub fn visit<V>(&self, visitor: V) -> <V as >::OutputCalls visitor with the typed body (to send a command known only at run time).
pub fn parse(type_: &str, body: &str) -> Result<Self, BodyError>Decodes body (the envelope’s raw body JSON) as the command type_ and runs its
state-free checks.
Errors
Section titled “Errors”type_unknown or in a the protocol namespace →BodyError::UnsupportedCommand;- a the protocol reserved command →
BodyError::UnsupportedFeaturenaming it; - a malformed body →
BodyError::BadRequest(with the top-level field when known); - a failed check → whatever
Command::validatereturns.
Trait implementations
Section titled “Trait implementations”Clone, Debug, PartialEq, StructuralPartialEq