Skip to main content

Command

Enum Command 

Source
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

Source

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.

Source

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).

Source

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.

Source

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

Source

pub const NAMES: &'static [&'static str]

Every command name, in specification order.

Source

pub const fn name(&self) -> &'static str

The wire name (type).

Source

pub fn validate(&self) -> Result<(), BodyError>

Runs the body’s state-free checks (§12 limits, ranges, spec rules).

§Errors

The first violated rule.

Source

pub fn visit<V: BodyVisitor>(&self, visitor: V) -> V::Output

Calls visitor with the typed body (to send a command known only at run time).

Source§

impl Command

Source

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

Trait Implementations§

Source§

impl Clone for Command

Source§

fn clone(&self) -> Command

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Command

Source§

fn eq(&self, other: &Command) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Command

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.