#[non_exhaustive]pub struct MessageCreateInput<'a> {
pub client_id: Option<&'a str>,
pub chat_id: &'a Id,
pub body: &'a str,
pub body_type: BodyType,
pub sent_at: &'a UTCDate,
pub reply_to: Option<&'a Id>,
}Expand description
Input parameters for Message/set create.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.client_id: Option<&'a str>Caller-supplied creation key. When None — or Some("") — a ULID
is generated automatically. An empty Some("") is treated the same
as None, not as a rejection; callers must not assume the wire
echoes a caller-supplied empty string.
chat_id: &'a IdThe Chat this message belongs to.
body: &'a strMessage body text (interpreted per body_type).
Length is not checked on the client. The server enforces
ChatCapability::max_body_bytes (UTF-8
byte count for text/* body types, raw byte count otherwise);
oversize bodies surface as a server-side tooLarge
SetError on the created entry, not as a client-side
rejection.
body_type: BodyTypeMIME type for the message body.
sent_at: &'a UTCDateRFC 3339 timestamp.
UTCDate is a transparent newtype around
String and does not validate the RFC 3339 format at
construction time. A malformed value forwards to the server,
which rejects it with invalidArguments. Construct values via a
validating helper (e.g. chrono::DateTime::<Utc>::to_rfc3339)
rather than from arbitrary strings.
reply_to: Option<&'a Id>When Some, marks this message as a reply to the given message id.
Implementations§
Source§impl<'a> MessageCreateInput<'a>
impl<'a> MessageCreateInput<'a>
Sourcepub fn new(
chat_id: &'a Id,
body: &'a str,
body_type: BodyType,
sent_at: &'a UTCDate,
) -> Self
pub fn new( chat_id: &'a Id, body: &'a str, body_type: BodyType, sent_at: &'a UTCDate, ) -> Self
Create a MessageCreateInput with required fields; optional fields default to None.
Sourcepub fn with_client_id(self, id: &'a str) -> Self
pub fn with_client_id(self, id: &'a str) -> Self
Set the caller-supplied creation key (overrides the auto-generated ULID).
Sourcepub fn with_reply_to(self, id: &'a Id) -> Self
pub fn with_reply_to(self, id: &'a Id) -> Self
Set the message this one replies to.
Trait Implementations§
Source§impl<'a> Clone for MessageCreateInput<'a>
impl<'a> Clone for MessageCreateInput<'a>
Source§fn clone(&self) -> MessageCreateInput<'a>
fn clone(&self) -> MessageCreateInput<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more