Skip to main content

Conversation

Struct Conversation 

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

A conversation handle (DM or group).

Implementations§

Source§

impl Conversation

Source

pub fn id(&self) -> String

Hex-encoded group ID.

Source

pub fn conversation_type(&self) -> Option<ConversationType>

Conversation type (DM, Group, etc.).

Source

pub fn created_at_ns(&self) -> i64

Created-at timestamp in nanoseconds.

Source

pub fn is_active(&self) -> bool

Whether the conversation is active.

Source

pub fn membership_state(&self) -> Option<MembershipState>

Current membership state of this client in the conversation.

Source

pub fn dm_peer_inbox_id(&self) -> Option<String>

DM peer’s inbox ID. Returns None if not a DM.

Source

pub fn added_by_inbox_id(&self) -> Option<String>

Inbox ID of the member who added this client.

Source

pub fn name(&self) -> Option<String>

Get the group name.

Source

pub fn set_name(&self, value: &str) -> Result<()>

Set the group name.

Source

pub fn description(&self) -> Option<String>

Get the group description.

Source

pub fn set_description(&self, value: &str) -> Result<()>

Set the group description.

Source

pub fn image_url(&self) -> Option<String>

Get the group image URL.

Source

pub fn set_image_url(&self, value: &str) -> Result<()>

Set the group image URL.

Source

pub fn app_data(&self) -> Option<String>

Get app data string.

Source

pub fn set_app_data(&self, value: &str) -> Result<()>

Set app data (max 8192 bytes).

Source

pub fn paused_for_version(&self) -> Result<Option<String>>

Check if conversation is paused for a version upgrade.

Source

pub fn metadata(&self) -> Result<ConversationMetadata>

Get the conversation metadata (creator inbox ID + type).

Source

pub fn permissions(&self) -> Result<Permissions>

Get the group permissions (preset + full policy set).

Source

pub fn sync(&self) -> Result<()>

Sync this conversation with the network.

Source

pub fn send(&self, content: &[u8]) -> Result<String>

Send raw encoded content bytes. Returns the hex-encoded message ID.

Source

pub fn send_with(&self, content: &[u8], opts: &SendOptions) -> Result<String>

Send with options. Returns the hex-encoded message ID.

Source

pub fn send_optimistic(&self, content: &[u8]) -> Result<String>

Send optimistically (returns immediately, publishes in background).

Source

pub fn send_optimistic_with( &self, content: &[u8], opts: &SendOptions, ) -> Result<String>

Send optimistically with options.

Source

pub fn publish_messages(&self) -> Result<()>

Publish all queued (unpublished) messages.

Source

pub fn messages(&self) -> Result<Vec<Message>>

List all messages with default options.

Source

pub fn list_messages( &self, options: &ListMessagesOptions, ) -> Result<Vec<Message>>

List messages with filtering options.

Source

pub fn count_messages(&self, options: &ListMessagesOptions) -> i64

Count messages matching filter options.

Source

pub fn members(&self) -> Result<Vec<GroupMember>>

List members of this conversation.

Source

pub fn add_members_by_inbox_id(&self, inbox_ids: &[&str]) -> Result<()>

Add members by inbox IDs.

Source

pub fn remove_members_by_inbox_id(&self, inbox_ids: &[&str]) -> Result<()>

Remove members by inbox IDs.

Source

pub fn add_members_by_identity( &self, identifiers: &[AccountIdentifier], ) -> Result<()>

Add members by external identifiers (address + kind).

Source

pub fn remove_members_by_identity( &self, identifiers: &[AccountIdentifier], ) -> Result<()>

Remove members by external identifiers (address + kind).

Source

pub fn leave(&self) -> Result<()>

Leave this group conversation.

Source

pub fn consent_state(&self) -> Result<ConsentState>

Get the consent state for this conversation.

Set the consent state for this conversation.

Source

pub fn disappearing_settings(&self) -> Option<DisappearingSettings>

Get the current disappearing message settings.

Source

pub fn set_disappearing(&self, settings: DisappearingSettings) -> Result<()>

Set disappearing message settings.

Source

pub fn clear_disappearing(&self) -> Result<()>

Clear disappearing message settings.

Source

pub fn is_disappearing_enabled(&self) -> bool

Whether disappearing messages are enabled.

Source

pub fn set_permission_policy( &self, update_type: PermissionUpdateType, policy: PermissionPolicy, metadata_field: Option<MetadataField>, ) -> Result<()>

Set a permission policy on this conversation.

The metadata_field is only used when update_type is PermissionUpdateType::UpdateMetadata.

Source

pub fn last_message(&self) -> Result<Option<Message>>

Get the last message in this conversation, if any.

Source

pub fn add_admin(&self, inbox_id: &str) -> Result<()>

Add an admin.

Source

pub fn remove_admin(&self, inbox_id: &str) -> Result<()>

Remove an admin.

Source

pub fn add_super_admin(&self, inbox_id: &str) -> Result<()>

Add a super admin.

Source

pub fn remove_super_admin(&self, inbox_id: &str) -> Result<()>

Remove a super admin.

Source

pub fn admins(&self) -> Vec<String>

Admin inbox IDs.

Source

pub fn super_admins(&self) -> Vec<String>

Super admin inbox IDs.

Source

pub fn is_admin(&self, inbox_id: &str) -> bool

Check if the given inbox ID is an admin.

Source

pub fn is_super_admin(&self, inbox_id: &str) -> bool

Check if the given inbox ID is a super admin.

Source

pub fn duplicate_dms(&self) -> Result<Vec<Self>>

Find duplicate DM conversations for this DM.

Source

pub fn debug_info(&self) -> Result<ConversationDebugInfo>

Get debug information for this conversation.

Source

pub fn last_read_times(&self) -> Result<Vec<LastReadTime>>

Get per-inbox last-read timestamps.

Source

pub fn hmac_keys(&self) -> Result<Vec<HmacKeyEntry>>

Get HMAC keys for this conversation (including duplicate DMs).

Source§

impl Conversation

Source

pub fn send_text(&self, text: &str) -> Result<String>

Send a plain text message.

Source

pub fn send_markdown(&self, markdown: &str) -> Result<String>

Send a markdown message.

Source

pub fn send_reaction( &self, message_id: &str, emoji: &str, action: ReactionAction, ) -> Result<String>

Send an emoji reaction to a message.

Source

pub fn send_read_receipt(&self) -> Result<String>

Send a read receipt.

Source

pub fn send_text_reply(&self, reference_id: &str, text: &str) -> Result<String>

Send a text reply to a message.

Source

pub fn send_reply( &self, reference_id: &str, inner_content: &[u8], ) -> Result<String>

Send a reply with arbitrary encoded content.

Source

pub fn send_attachment(&self, attachment: &Attachment) -> Result<String>

Send an inline file attachment.

Source

pub fn send_remote_attachment(&self, ra: &RemoteAttachment) -> Result<String>

Send a remote (URL-hosted) encrypted attachment.

Source

pub fn send_text_optimistic(&self, text: &str) -> Result<String>

Optimistically send a plain text message (returns immediately).

Source

pub fn send_markdown_optimistic(&self, markdown: &str) -> Result<String>

Optimistically send a markdown message.

Source

pub fn send_reaction_optimistic( &self, message_id: &str, emoji: &str, action: ReactionAction, ) -> Result<String>

Optimistically send an emoji reaction.

Source

pub fn send_text_reply_optimistic( &self, reference_id: &str, text: &str, ) -> Result<String>

Optimistically send a text reply.

Trait Implementations§

Source§

impl Debug for Conversation

Source§

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

Formats the value using the given formatter. Read more

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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> Same for T

Source§

type Output = T

Should always be Self
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.
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