pub struct Request { /* private fields */ }Expand description
Represents a message to send to a Zulip server.
Implementations§
Source§impl Request
impl Request
Sourcepub const fn queue_id(&self) -> Option<Uuid>
pub const fn queue_id(&self) -> Option<Uuid>
Gets the message queue_id field.
For clients supporting local echo, the event queue ID for the client.
If passed, local_id is required. If the message is
successfully sent, the server will include local_id in the message event
that the client with this queue_id will receive notifying it of the new message
via GET /events. This lets the client know unambiguously
that it should replace the locally echoed message, rather than adding this new
message (which would be correct if the user had sent the new message from another
device).
Sourcepub fn set_queue_id<'a, U: Into<Uuid>, S: Into<Cow<'a, str>>>(
&mut self,
queue_id: U,
local_id: S,
)
pub fn set_queue_id<'a, U: Into<Uuid>, S: Into<Cow<'a, str>>>( &mut self, queue_id: U, local_id: S, )
Sets the message queue_id and local_id fields.
If set, the queue_id field requires setting the local_id field.
For clients supporting local echo, the event queue ID for the client.
If passed, local_id is required. If the message is
successfully sent, the server will include local_id in the message event
that the client with this queue_id will receive notifying it of the new message
via GET /events. This lets the client know unambiguously
that it should replace the locally echoed message, rather than adding this new
message (which would be correct if the user had sent the new message from another
device).
Sourcepub fn unset_queue_id(&mut self) -> (Option<Uuid>, Option<String>)
pub fn unset_queue_id(&mut self) -> (Option<Uuid>, Option<String>)
Unsets the message queue_id and local_id fields.
If set, the queue_id field requires setting the local_id field.
For clients supporting local echo, the event queue ID for the client.
If passed, local_id is required. If the message is
successfully sent, the server will include local_id in the message event
that the client with this queue_id will receive notifying it of the new message
via GET /events. This lets the client know unambiguously
that it should replace the locally echoed message, rather than adding this new
message (which would be correct if the user had sent the new message from another
device).
Sourcepub fn with_queue_id<'a, U: Into<Uuid>, S: Into<Cow<'a, str>>>(
self,
queue_id: U,
local_id: S,
) -> Self
pub fn with_queue_id<'a, U: Into<Uuid>, S: Into<Cow<'a, str>>>( self, queue_id: U, local_id: S, ) -> Self
Builder function that sets the message queue_id and local_id fields.
If set, the queue_id field requires setting the local_id field.
For clients supporting local echo, the event queue ID for the client.
If passed, local_id is required. If the message is
successfully sent, the server will include local_id in the message event
that the client with this queue_id will receive notifying it of the new message
via GET /events. This lets the client know unambiguously
that it should replace the locally echoed message, rather than adding this new
message (which would be correct if the user had sent the new message from another
device).
Source§impl Request
impl Request
Sourcepub const fn msg_type(&self) -> MessageType
pub const fn msg_type(&self) -> MessageType
Gets the Request msg_type.
The type of message to be sent.
"direct" for a direct message and "stream" or "channel" for a
channel message.
Changes: In Zulip 9.0 (feature level 248), "channel" was added as
an additional value for this parameter to request a channel message.
In Zulip 7.0 (feature level 174), "direct" was added as
the preferred way to request a direct message, deprecating the original
"private". While "private" is still supported for requesting direct
messages, clients are encouraged to use to the modern convention with
servers that support it, because support for "private" will eventually
be removed.
Sourcepub fn set_msg_type(&mut self, val: MessageType)
pub fn set_msg_type(&mut self, val: MessageType)
Sets the Request msg_type.
The type of message to be sent.
"direct" for a direct message and "stream" or "channel" for a
channel message.
Changes: In Zulip 9.0 (feature level 248), "channel" was added as
an additional value for this parameter to request a channel message.
In Zulip 7.0 (feature level 174), "direct" was added as
the preferred way to request a direct message, deprecating the original
"private". While "private" is still supported for requesting direct
messages, clients are encouraged to use to the modern convention with
servers that support it, because support for "private" will eventually
be removed.
Sourcepub fn with_msg_type(self, val: MessageType) -> Self
pub fn with_msg_type(self, val: MessageType) -> Self
Builder function that sets the Request msg_type.
The type of message to be sent.
"direct" for a direct message and "stream" or "channel" for a
channel message.
Changes: In Zulip 9.0 (feature level 248), "channel" was added as
an additional value for this parameter to request a channel message.
In Zulip 7.0 (feature level 174), "direct" was added as
the preferred way to request a direct message, deprecating the original
"private". While "private" is still supported for requesting direct
messages, clients are encouraged to use to the modern convention with
servers that support it, because support for "private" will eventually
be removed.
Source§impl Request
impl Request
Sourcepub fn to(&self) -> &MessageTo
pub fn to(&self) -> &MessageTo
Gets the Request to.
For channel messages, either the name or integer ID of the channel. For
direct messages, either a list containing integer user IDs or a list
containing string Zulip API email addresses.
Changes: Support for using user/channel IDs was added in Zulip 2.0.0.
Sourcepub fn set_to(&mut self, val: MessageTo)
pub fn set_to(&mut self, val: MessageTo)
Sets the Request to.
For channel messages, either the name or integer ID of the channel. For
direct messages, either a list containing integer user IDs or a list
containing string Zulip API email addresses.
Changes: Support for using user/channel IDs was added in Zulip 2.0.0.
Sourcepub fn with_to(self, val: MessageTo) -> Self
pub fn with_to(self, val: MessageTo) -> Self
Builder function that sets the Request to.
For channel messages, either the name or integer ID of the channel. For
direct messages, either a list containing integer user IDs or a list
containing string Zulip API email addresses.
Changes: Support for using user/channel IDs was added in Zulip 2.0.0.
Source§impl Request
impl Request
Sourcepub fn content(&self) -> &str
pub fn content(&self) -> &str
Gets the Request content.
The content of the message.
Clients should use the max_message_length returned by the
POST /register endpoint to determine
the maximum message size.
Sourcepub fn set_content<'a, C: Into<Cow<'a, str>>>(&mut self, val: C)
pub fn set_content<'a, C: Into<Cow<'a, str>>>(&mut self, val: C)
Sets the Request content.
The content of the message.
Clients should use the max_message_length returned by the
POST /register endpoint to determine
the maximum message size.
Sourcepub fn with_content<'a, C: Into<Cow<'a, str>>>(self, val: C) -> Self
pub fn with_content<'a, C: Into<Cow<'a, str>>>(self, val: C) -> Self
Builder function that sets the Request content.
The content of the message.
Clients should use the max_message_length returned by the
POST /register endpoint to determine
the maximum message size.
Source§impl Request
impl Request
Sourcepub fn topic(&self) -> Option<&str>
pub fn topic(&self) -> Option<&str>
Gets the Request topic.
The topic of the message.
Only required for channel messages
("type": "stream" or "type": "channel"), ignored otherwise.
Clients should use the max_topic_length returned by the
POST /register endpoint to determine
the maximum topic length.
Note: When "(no topic)" or the value of realm_empty_topic_display_name
found in the POST /register response is used for this
parameter, it is interpreted as an empty string.
When topics are required, this parameter can’t
be "(no topic)", an empty string, or the value of realm_empty_topic_display_name.
Changes: Before Zulip 10.0 (feature level 370), "(no topic)"
was not interpreted as an empty string.
Before Zulip 10.0 (feature level 334), empty string
was not a valid topic name for channel messages.
New in Zulip 2.0.0. Previous Zulip releases encoded
this as subject, which is currently a deprecated alias.
Sourcepub fn set_topic<'a, C: Into<Cow<'a, str>>>(&mut self, val: C)
pub fn set_topic<'a, C: Into<Cow<'a, str>>>(&mut self, val: C)
Sets the Request topic.
The topic of the message.
Only required for channel messages
("type": "stream" or "type": "channel"), ignored otherwise.
Clients should use the max_topic_length returned by the
POST /register endpoint to determine
the maximum topic length.
Note: When "(no topic)" or the value of realm_empty_topic_display_name
found in the POST /register response is used for this
parameter, it is interpreted as an empty string.
When topics are required, this parameter can’t
be "(no topic)", an empty string, or the value of realm_empty_topic_display_name.
Changes: Before Zulip 10.0 (feature level 370), "(no topic)"
was not interpreted as an empty string.
Before Zulip 10.0 (feature level 334), empty string
was not a valid topic name for channel messages.
New in Zulip 2.0.0. Previous Zulip releases encoded
this as subject, which is currently a deprecated alias.
Sourcepub fn unset_topic(&mut self) -> Option<String>
pub fn unset_topic(&mut self) -> Option<String>
Unsets the Request topic.
The topic of the message.
Only required for channel messages
("type": "stream" or "type": "channel"), ignored otherwise.
Clients should use the max_topic_length returned by the
POST /register endpoint to determine
the maximum topic length.
Note: When "(no topic)" or the value of realm_empty_topic_display_name
found in the POST /register response is used for this
parameter, it is interpreted as an empty string.
When topics are required, this parameter can’t
be "(no topic)", an empty string, or the value of realm_empty_topic_display_name.
Changes: Before Zulip 10.0 (feature level 370), "(no topic)"
was not interpreted as an empty string.
Before Zulip 10.0 (feature level 334), empty string
was not a valid topic name for channel messages.
New in Zulip 2.0.0. Previous Zulip releases encoded
this as subject, which is currently a deprecated alias.
Sourcepub fn with_topic<'a, C: Into<Cow<'a, str>>>(self, val: C) -> Self
pub fn with_topic<'a, C: Into<Cow<'a, str>>>(self, val: C) -> Self
Builder function that sets the Request topic.
The topic of the message.
Only required for channel messages
("type": "stream" or "type": "channel"), ignored otherwise.
Clients should use the max_topic_length returned by the
POST /register endpoint to determine
the maximum topic length.
Note: When "(no topic)" or the value of realm_empty_topic_display_name
found in the POST /register response is used for this
parameter, it is interpreted as an empty string.
When topics are required, this parameter can’t
be "(no topic)", an empty string, or the value of realm_empty_topic_display_name.
Changes: Before Zulip 10.0 (feature level 370), "(no topic)"
was not interpreted as an empty string.
Before Zulip 10.0 (feature level 334), empty string
was not a valid topic name for channel messages.
New in Zulip 2.0.0. Previous Zulip releases encoded
this as subject, which is currently a deprecated alias.
Source§impl Request
impl Request
Sourcepub const fn read_by_sender(&self) -> Option<bool>
pub const fn read_by_sender(&self) -> Option<bool>
Gets the Request read_by_sender.
Whether the message should be initially marked read by its
sender. If unspecified, the server uses a heuristic based
on the client name.
Changes: New in Zulip 8.0 (feature level 236).
Sourcepub fn set_read_by_sender(&mut self, val: bool)
pub fn set_read_by_sender(&mut self, val: bool)
Sets the Request read_by_sender.
Whether the message should be initially marked read by its
sender. If unspecified, the server uses a heuristic based
on the client name.
Changes: New in Zulip 8.0 (feature level 236).
Sourcepub fn unset_read_by_sender(&mut self) -> Option<bool>
pub fn unset_read_by_sender(&mut self) -> Option<bool>
Unsets the Request read_by_sender.
Whether the message should be initially marked read by its
sender. If unspecified, the server uses a heuristic based
on the client name.
Changes: New in Zulip 8.0 (feature level 236).
Sourcepub fn with_read_by_sender(self, val: bool) -> Self
pub fn with_read_by_sender(self, val: bool) -> Self
Builder function that sets the Request read_by_sender.
Whether the message should be initially marked read by its
sender. If unspecified, the server uses a heuristic based
on the client name.
Changes: New in Zulip 8.0 (feature level 236).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Request
impl<'de> Deserialize<'de> for Request
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Request
impl StructuralPartialEq for Request
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl UnwindSafe for Request
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.