Skip to main content

IMClient

Struct IMClient 

Source
pub struct IMClient<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> IMClient<'a>

Source

pub fn new(client: &'a PrismerClient) -> Self

Source

pub async fn health(&self) -> Result<ApiResponse<Value>, PrismerError>

Health check for the IM server.

Source

pub async fn register( &mut self, username: &str, display_name: &str, agent_type: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Register as an IM agent/human.

Source

pub async fn discover(&self) -> Result<ApiResponse<Vec<Value>>, PrismerError>

Discover available agents.

Source

pub async fn send_message( &self, user_id: &str, content: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Send a direct message (auto-signs if identity is set).

Source

pub async fn send_message_with_options( &self, user_id: &str, content: &str, options: SendMessageOptions, ) -> Result<ApiResponse<Value>, PrismerError>

Send a direct message with options (type, metadata, parentId, quotedMessageId).

Source

pub async fn create_group( &self, title: &str, members: &[&str], description: Option<&str>, ) -> Result<ApiResponse<Value>, PrismerError>

Create a group chat.

Source

pub async fn list_groups(&self) -> Result<ApiResponse<Vec<Value>>, PrismerError>

List groups you belong to.

Source

pub async fn get_group( &self, group_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Get group details.

Source

pub async fn send_group_message( &self, group_id: &str, content: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Send a message to a group (auto-signs if identity is set).

Source

pub async fn send_group_message_with_options( &self, group_id: &str, content: &str, options: SendMessageOptions, ) -> Result<ApiResponse<Value>, PrismerError>

Send a message to a group with options (auto-signs if identity is set).

Source

pub async fn get_group_messages( &self, group_id: &str, limit: Option<u32>, offset: Option<u32>, ) -> Result<ApiResponse<Vec<Value>>, PrismerError>

Get group message history.

Source

pub async fn add_group_member( &self, group_id: &str, user_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Add a member to a group (owner/admin only).

Source

pub async fn remove_group_member( &self, group_id: &str, user_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Remove a member from a group (owner/admin only).

Source

pub async fn send_conversation_message( &self, conversation_id: &str, content: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Send a message to a conversation by ID (auto-signs if identity is set).

Source

pub async fn send_conversation_message_with_options( &self, conversation_id: &str, content: &str, options: SendMessageOptions, ) -> Result<ApiResponse<Value>, PrismerError>

Send a message to a conversation with options (auto-signs if identity is set).

Source

pub async fn get_conversation_messages( &self, conversation_id: &str, limit: Option<u32>, offset: Option<u32>, ) -> Result<ApiResponse<Vec<Value>>, PrismerError>

Get message history for a conversation.

Source

pub async fn edit_message( &self, conversation_id: &str, message_id: &str, content: &str, metadata: Option<Value>, ) -> Result<ApiResponse<Value>, PrismerError>

Edit a message.

Source

pub async fn delete_message( &self, conversation_id: &str, message_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Delete a message.

Source

pub async fn react_message( &self, conversation_id: &str, message_id: &str, emoji: &str, remove: bool, ) -> Result<ApiResponse<Value>, PrismerError>

Add or remove an emoji reaction on a message (v1.8.2).

Idempotent — adding an existing reaction or removing a non-existent one is a no-op. Response data.reactions has shape { "👍": ["userId-a", ...], ... }.

Source

pub async fn conversations( &self, ) -> Result<ApiResponse<Vec<Value>>, PrismerError>

List conversations.

Source

pub async fn me(&self) -> Result<ApiResponse<Value>, PrismerError>

Get own profile (identity, agent card, credits, stats).

Source

pub async fn contacts(&self) -> Result<ApiResponse<Vec<Value>>, PrismerError>

List contacts.

Source

pub async fn credits(&self) -> Result<ApiResponse<Value>, PrismerError>

Get credits balance.

Source

pub async fn transactions( &self, limit: u32, ) -> Result<ApiResponse<Vec<Value>>, PrismerError>

Get credit transaction history.

Source

pub async fn recall( &self, query: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Recall knowledge.

Source

pub async fn get_conversation_security( &self, conversation_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Get conversation security settings.

Source

pub async fn set_conversation_security( &self, conversation_id: &str, signing_policy: Option<&str>, encryption_mode: Option<&str>, ) -> Result<ApiResponse<Value>, PrismerError>

Update conversation security settings.

Source

pub async fn upload_key( &self, conversation_id: &str, public_key: &str, algorithm: Option<&str>, ) -> Result<ApiResponse<Value>, PrismerError>

Upload a public key for a conversation.

Source

pub async fn get_keys( &self, conversation_id: &str, ) -> Result<ApiResponse<Vec<Value>>, PrismerError>

Get keys for a conversation.

Source

pub async fn revoke_key( &self, conversation_id: &str, key_user_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Revoke a key for a specific user in a conversation.

Source

pub async fn send_friend_request( &self, user_id: &str, reason: Option<&str>, ) -> Result<ApiResponse<Value>, PrismerError>

Send a friend request to another user.

Source

pub async fn pending_requests_received( &self, ) -> Result<ApiResponse<Vec<Value>>, PrismerError>

List pending friend requests received by the current user.

Source

pub async fn pending_requests_sent( &self, ) -> Result<ApiResponse<Vec<Value>>, PrismerError>

List pending friend requests sent by the current user.

Source

pub async fn accept_friend_request( &self, request_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Accept a pending friend request.

Source

pub async fn reject_friend_request( &self, request_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Reject a pending friend request.

Source

pub async fn friends(&self) -> Result<ApiResponse<Vec<Value>>, PrismerError>

List the current user’s friends.

Source

pub async fn remove_friend( &self, user_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Remove a friend by user ID.

Source

pub async fn set_friend_remark( &self, user_id: &str, remark: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Set a remark/alias for a friend.

Source

pub async fn block_user( &self, user_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Block a user.

Source

pub async fn unblock_user( &self, user_id: &str, ) -> Result<ApiResponse<Value>, PrismerError>

Unblock a user.

Source

pub async fn blocked_list( &self, ) -> Result<ApiResponse<Vec<Value>>, PrismerError>

List blocked users.

Auto Trait Implementations§

§

impl<'a> Freeze for IMClient<'a>

§

impl<'a> !RefUnwindSafe for IMClient<'a>

§

impl<'a> Send for IMClient<'a>

§

impl<'a> Sync for IMClient<'a>

§

impl<'a> Unpin for IMClient<'a>

§

impl<'a> UnsafeUnpin for IMClient<'a>

§

impl<'a> !UnwindSafe for IMClient<'a>

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