pub enum Command {
Show 93 variants
SessionHello(Hello),
CommunityCreate(Create),
CommunityGet(Get),
CommunityIconGet(IconGet),
CommunityRotations(Rotations),
CommunityUpdate(Update),
CommunityDescriptorPublish(DescriptorPublish),
CommunityLeave(Leave),
ChannelCreate(Create),
ChannelUpdate(Update),
ChannelDelete(Delete),
ChannelReorder(Reorder),
ChannelPermissionsUpdate(PermissionsUpdate),
MemberList(List),
MemberGet(Get),
MemberUpdate(Update),
MemberRolesUpdate(RolesUpdate),
MemberKick(Kick),
MemberBan(BanMember),
MemberUnban(Unban),
MemberBans(Bans),
MemberTimeout(Timeout),
MemberStatusSet(StatusSet),
RoleCreate(Create),
RoleUpdate(Update),
RoleDelete(Delete),
RoleReorder(Reorder),
MessageSend(Send),
MessageEdit(Edit),
MessageDelete(Delete),
MessageHistory(History),
ReactionAdd(ReactionAdd),
ReactionRemove(ReactionRemove),
AttachmentUpload(Upload),
AttachmentDownload(Download),
InviteCreate(Create),
InviteRedeem(Redeem),
InviteRevoke(Revoke),
InviteList(List),
InviteUses(Uses),
AuditList(List),
SyncSnapshot(Snapshot),
SyncEvents(Events),
SyncResume(Resume),
SyncAck(Ack),
MembershipRequest(Request),
MembershipApprove(Approve),
MembershipReject(Reject),
MembershipSuspend(Suspend),
MembershipRestore(Restore),
MembershipPending(Pending),
AdmissionPolicyGet(PolicyGet),
AdmissionPolicyUpdate(PolicyUpdate),
LockdownGet(Get),
LockdownEnable(Enable),
LockdownDisable(Disable),
ReportCreate(Create),
ReportList(List),
ReportGet(Get),
ReportReview(Review),
ReportResolve(Resolve),
VoiceJoin(Join),
VoiceLeave(Leave),
VoiceUpdate(Update),
VoiceSignal(Signal),
VoiceKeys(Keys),
VoiceModerate(Moderate),
SignalTyping(Typing),
SignalPresence(Presence),
PresenceList(List),
MigrationReauth(Reauth),
BotInstall(Install),
BotUpdate(Update),
BotGrant(Grant),
BotEnable(Enable),
BotDisable(Disable),
BotRemove(Remove),
BotRegister(Register),
BotConfigure(Configure),
BotList(List),
BotGet(Target),
CommandSet(Set),
CommandList(List),
InteractionCreate(Create),
InteractionRespond(Respond),
InteractionFollowup(Followup),
InteractionOriginalEdit(OriginalEdit),
InteractionOriginalDelete(OriginalDelete),
DmOpen(Open),
DmClose(Close),
DmList(List),
MemberSettingsGet(SettingsGet),
MemberSettingsUpdate(SettingsUpdate),
}Expand description
A decoded command body: one variant per command of §8 and §10.5.
Variants§
SessionHello(Hello)
session.hello
CommunityCreate(Create)
community.create
CommunityGet(Get)
community.get
CommunityIconGet(IconGet)
community.icon.get
CommunityRotations(Rotations)
community.rotations
CommunityUpdate(Update)
community.update
CommunityDescriptorPublish(DescriptorPublish)
community.descriptor.publish
CommunityLeave(Leave)
community.leave
ChannelCreate(Create)
channel.create
ChannelUpdate(Update)
channel.update
ChannelDelete(Delete)
channel.delete
ChannelReorder(Reorder)
channel.reorder
ChannelPermissionsUpdate(PermissionsUpdate)
channel.permissions.update
MemberList(List)
member.list
MemberGet(Get)
member.get
MemberUpdate(Update)
member.update
MemberRolesUpdate(RolesUpdate)
member.roles.update
MemberKick(Kick)
member.kick
MemberBan(BanMember)
member.ban
MemberUnban(Unban)
member.unban
MemberBans(Bans)
member.bans
MemberTimeout(Timeout)
member.timeout
MemberStatusSet(StatusSet)
member.status.set
RoleCreate(Create)
role.create
RoleUpdate(Update)
role.update
RoleDelete(Delete)
role.delete
RoleReorder(Reorder)
role.reorder
MessageSend(Send)
message.send
MessageEdit(Edit)
message.edit
MessageDelete(Delete)
message.delete
MessageHistory(History)
message.history
ReactionAdd(ReactionAdd)
reaction.add
ReactionRemove(ReactionRemove)
reaction.remove
AttachmentUpload(Upload)
attachment.upload
AttachmentDownload(Download)
attachment.download
InviteCreate(Create)
invite.create
InviteRedeem(Redeem)
invite.redeem
InviteRevoke(Revoke)
invite.revoke
InviteList(List)
invite.list
InviteUses(Uses)
invite.uses
AuditList(List)
audit.list
SyncSnapshot(Snapshot)
sync.snapshot
SyncEvents(Events)
sync.events
SyncResume(Resume)
sync.resume
SyncAck(Ack)
sync.ack
MembershipRequest(Request)
membership.request
MembershipApprove(Approve)
membership.approve
MembershipReject(Reject)
membership.reject
MembershipSuspend(Suspend)
membership.suspend
MembershipRestore(Restore)
membership.restore
MembershipPending(Pending)
membership.pending
AdmissionPolicyGet(PolicyGet)
admission.policy.get
AdmissionPolicyUpdate(PolicyUpdate)
admission.policy.update
LockdownGet(Get)
moderation.lockdown.get
LockdownEnable(Enable)
moderation.lockdown.enable
LockdownDisable(Disable)
moderation.lockdown.disable
ReportCreate(Create)
report.create
ReportList(List)
report.list
ReportGet(Get)
report.get
ReportReview(Review)
report.review
ReportResolve(Resolve)
report.resolve
VoiceJoin(Join)
voice.join
VoiceLeave(Leave)
voice.leave
VoiceUpdate(Update)
voice.update
VoiceSignal(Signal)
voice.signal
VoiceKeys(Keys)
voice.keys
VoiceModerate(Moderate)
voice.moderate
SignalTyping(Typing)
signal.typing
SignalPresence(Presence)
signal.presence
PresenceList(List)
presence.list
MigrationReauth(Reauth)
migration.reauth
BotInstall(Install)
bot.install
BotUpdate(Update)
bot.update
BotGrant(Grant)
bot.grant
BotEnable(Enable)
bot.enable
BotDisable(Disable)
bot.disable
BotRemove(Remove)
bot.remove
BotRegister(Register)
bot.register
BotConfigure(Configure)
bot.configure
BotList(List)
bot.list
BotGet(Target)
bot.get
CommandSet(Set)
command.set
CommandList(List)
command.list
InteractionCreate(Create)
interaction.create
InteractionRespond(Respond)
interaction.respond
InteractionFollowup(Followup)
interaction.followup
InteractionOriginalEdit(OriginalEdit)
interaction.original.edit
InteractionOriginalDelete(OriginalDelete)
interaction.original.delete
DmOpen(Open)
dm.open
DmClose(Close)
dm.close
DmList(List)
dm.list
MemberSettingsGet(SettingsGet)
member.settings.get
MemberSettingsUpdate(SettingsUpdate)
member.settings.update
Implementations§
Source§impl Command
impl Command
Sourcepub fn is_channel_scoped(&self) -> bool
pub fn is_channel_scoped(&self) -> bool
Whether 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.
Sourcepub const fn channel_id(&self) -> Option<ChannelId>
pub const fn channel_id(&self) -> Option<ChannelId>
The channel_id carried in the body, for commands whose §8/§10.5 body lists one.
When both the envelope and the body carry one they must be equal (envelope layer).
Sourcepub fn is_mutating(&self) -> bool
pub fn is_mutating(&self) -> bool
Whether the command is mutating, hence idempotency-recorded (§7.3); the same rule as
crate::envelope::is_mutating on the command’s wire name.
Sourcepub fn validate_at(&self, now_ms: u64) -> Result<(), BodyError>
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
As Command::validate, or BAD_REQUEST{field: "until"}.
Source§impl Command
impl Command
Source§impl Command
impl Command
Sourcepub fn parse(type_: &str, body: &str) -> Result<Self, BodyError>
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
type_unknown or in a §13 namespace →BodyError::UnsupportedCommand;- a §8.11 reserved command →
BodyError::UnsupportedFeaturenaming it; - a malformed body →
BodyError::BadRequest(with the top-level field when known); - a failed check → whatever
Command::validatereturns.