Struct envelope::CommandEnvelope
zaun_community_protocol::envelope::CommandEnvelope · Struct
pub struct CommandEnvelope { … }{ "v", "type", "request_id", "community_id", "channel_id"?, "body" }.
Parse received text with super::parse_command; serialise with serde (client side).
body is the command’s body object exactly as received, for the command module to parse
by type and for the idempotency hash.
Fields
Section titled “Fields”v: u16
Section titled “v: u16”Envelope version.
kind: String
Section titled “kind: String”Command name.
request_id: Option<RequestId>
Section titled “request_id: Option<RequestId>”Correlation id; None (null) only for signal.* commands.
community_id: Option<CommunityId>
Section titled “community_id: Option<CommunityId>”The bound community, or the target of community.create / invite.redeem; else null.
channel_id: Option<ChannelId>
Section titled “channel_id: Option<ChannelId>”Present for channel-scoped commands.
body: Box<RawValue>
Section titled “body: Box<RawValue>”The body object, {} when empty.
Methods
Section titled “Methods”pub fn new<impl Into<String>>(kind: impl Into<String>, request_id: Option<RequestId>, community_id: Option<CommunityId>, channel_id: Option<ChannelId>, body: Box<RawValue>) -> SelfA command at PROTOCOL_VERSION.
is_signal
Section titled “is_signal”pub fn is_signal(&self) -> boolWhether this is an ephemeral signal (signal.*): no response, no idempotency record.
is_mutating
Section titled “is_mutating”pub fn is_mutating(&self) -> boolWhether the command is mutating, hence idempotency-recorded.
body_hash
Section titled “body_hash”pub fn body_hash(&self) -> BodyHashSHA3-256 of the body JSON text as received.
Trait implementations
Section titled “Trait implementations”Clone, Debug, Serialize