Skip to main content

Request

Struct Request 

Source
pub struct Request { /* private fields */ }
Expand description

Represents a message to send to a Zulip server.

Implementations§

Source§

impl Request

Source

pub const fn new() -> Self

Creates a new Request.

Source

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

Source

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

Source

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

Source

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

pub fn local_id(&self) -> Option<&str>

Gets the message local_id field.

For clients supporting local echo, a unique string-format identifier chosen freely by the client; the server will pass it back to the client without inspecting it, as described in the queue_id description.

Source§

impl Request

Source

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.

Source

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.

Source

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

Source

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.

Source

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.

Source

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

Source

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.

Source

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.

Source

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

Source

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.

Source

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.

Source

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.

Source

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

Source

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

Source

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

Source

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

Source

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 Clone for Request

Source§

fn clone(&self) -> Self

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 Request

Source§

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

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

impl Default for Request

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Request

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Request

Source§

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

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

impl Eq for Request

Source§

impl PartialEq for Request

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Request

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Request

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more