Client

Struct Client 

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

A high level SimpleX-Chat client which provides typed API methods with automatic command serialization and response deserialization.

Implementations§

Source§

impl Client

Source

pub fn disconnect(self)

Initiates a graceful shutdown for the underlying web socket connection. See simploxide_core::RawClient::disconnect for details.

Trait Implementations§

Source§

impl ClientApi for Client

Source§

type Error = ClientError

Source§

async fn send_raw(&self, command: String) -> Result<JsonObject, Self::Error>

Source§

fn api_create_my_address( &self, user_id: i64, ) -> impl Future<Output = Result<Arc<UserContactLinkCreatedResponse>, Self::Error>> + Send

Address commands Read more
Source§

fn api_delete_my_address( &self, user_id: i64, ) -> impl Future<Output = Result<Arc<UserContactLinkDeletedResponse>, Self::Error>> + Send

Address commands Read more
Source§

fn api_show_my_address( &self, user_id: i64, ) -> impl Future<Output = Result<Arc<UserContactLinkResponse>, Self::Error>> + Send

Address commands Read more
Source§

fn api_set_profile_address( &self, command: ApiSetProfileAddress, ) -> impl Future<Output = Result<Arc<UserProfileUpdatedResponse>, Self::Error>> + Send

Address commands Read more
Source§

fn api_set_address_settings( &self, user_id: i64, settings: AddressSettings, ) -> impl Future<Output = Result<Arc<UserContactLinkUpdatedResponse>, Self::Error>> + Send

Address commands Read more
Source§

fn api_send_messages( &self, command: ApiSendMessages, ) -> impl Future<Output = Result<Arc<NewChatItemsResponse>, Self::Error>> + Send

Message commands Read more
Source§

fn api_update_chat_item( &self, command: ApiUpdateChatItem, ) -> impl Future<Output = Result<ApiUpdateChatItemResponses, Self::Error>> + Send

Message commands Read more
Source§

fn api_delete_chat_item( &self, chat_ref: ChatRef, chat_item_ids: Vec<i64>, delete_mode: CIDeleteMode, ) -> impl Future<Output = Result<Arc<ChatItemsDeletedResponse>, Self::Error>> + Send

Message commands Read more
Source§

fn api_delete_member_chat_item( &self, group_id: i64, chat_item_ids: Vec<i64>, ) -> impl Future<Output = Result<Arc<ChatItemsDeletedResponse>, Self::Error>> + Send

Message commands Read more
Source§

fn api_chat_item_reaction( &self, command: ApiChatItemReaction, ) -> impl Future<Output = Result<Arc<ChatItemReactionResponse>, Self::Error>> + Send

Message commands Read more
Source§

fn receive_file( &self, command: ReceiveFile, ) -> impl Future<Output = Result<ReceiveFileResponses, Self::Error>> + Send

File commands Read more
Source§

fn cancel_file( &self, file_id: i64, ) -> impl Future<Output = Result<CancelFileResponses, Self::Error>> + Send

File commands Read more
Source§

fn api_add_member( &self, group_id: i64, contact_id: i64, member_role: GroupMemberRole, ) -> impl Future<Output = Result<Arc<SentGroupInvitationResponse>, Self::Error>> + Send

Group commands Read more
Source§

fn api_join_group( &self, group_id: i64, ) -> impl Future<Output = Result<Arc<UserAcceptedGroupSentResponse>, Self::Error>> + Send

Group commands Read more
Source§

fn api_accept_member( &self, group_id: i64, group_member_id: i64, member_role: GroupMemberRole, ) -> impl Future<Output = Result<Arc<MemberAcceptedResponse>, Self::Error>> + Send

Group commands Read more
Source§

fn api_members_role( &self, group_id: i64, group_member_ids: Vec<i64>, member_role: GroupMemberRole, ) -> impl Future<Output = Result<Arc<MembersRoleUserResponse>, Self::Error>> + Send

Group commands Read more
Source§

fn api_block_members_for_all( &self, command: ApiBlockMembersForAll, ) -> impl Future<Output = Result<Arc<MembersBlockedForAllUserResponse>, Self::Error>> + Send

Group commands Read more
Source§

fn api_remove_members( &self, command: ApiRemoveMembers, ) -> impl Future<Output = Result<Arc<UserDeletedMembersResponse>, Self::Error>> + Send

Group commands Read more
Source§

fn api_leave_group( &self, group_id: i64, ) -> impl Future<Output = Result<Arc<LeftMemberUserResponse>, Self::Error>> + Send

Group commands Read more
Source§

fn api_list_members( &self, group_id: i64, ) -> impl Future<Output = Result<Arc<GroupMembersResponse>, Self::Error>> + Send

Group commands Read more
Source§

fn api_new_group( &self, command: ApiNewGroup, ) -> impl Future<Output = Result<Arc<GroupCreatedResponse>, Self::Error>> + Send

Group commands Read more
Source§

fn api_update_group_profile( &self, group_id: i64, group_profile: GroupProfile, ) -> impl Future<Output = Result<Arc<GroupUpdatedResponse>, Self::Error>> + Send

Group commands Read more
Group link commands Read more
Group link commands Read more
Group link commands Read more
Group link commands Read more
Source§

fn api_add_contact( &self, command: ApiAddContact, ) -> impl Future<Output = Result<Arc<InvitationResponse>, Self::Error>> + Send

Connection commands Read more
Source§

fn api_connect_plan( &self, command: ApiConnectPlan, ) -> impl Future<Output = Result<Arc<ConnectionPlanResponse>, Self::Error>> + Send

Connection commands Read more
Source§

fn api_connect( &self, command: ApiConnect, ) -> impl Future<Output = Result<ApiConnectResponses, Self::Error>> + Send

Connection commands Read more
Source§

fn connect( &self, command: Connect, ) -> impl Future<Output = Result<ConnectResponses, Self::Error>> + Send

Connection commands Read more
Source§

fn api_accept_contact( &self, contact_req_id: i64, ) -> impl Future<Output = Result<Arc<AcceptingContactRequestResponse>, Self::Error>> + Send

Connection commands Read more
Source§

fn api_reject_contact( &self, contact_req_id: i64, ) -> impl Future<Output = Result<Arc<ContactRequestRejectedResponse>, Self::Error>> + Send

Connection commands Read more
Source§

fn api_list_contacts( &self, user_id: i64, ) -> impl Future<Output = Result<Arc<ContactsListResponse>, Self::Error>> + Send

Chat commands Read more
Source§

fn api_list_groups( &self, command: ApiListGroups, ) -> impl Future<Output = Result<Arc<GroupsListResponse>, Self::Error>> + Send

Chat commands Read more
Source§

fn api_delete_chat( &self, chat_ref: ChatRef, chat_delete_mode: ChatDeleteMode, ) -> impl Future<Output = Result<ApiDeleteChatResponses, Self::Error>> + Send

Chat commands Read more
Source§

fn show_active_user( &self, ) -> impl Future<Output = Result<Arc<ActiveUserResponse>, Self::Error>> + Send

User profile commands Read more
Source§

fn create_active_user( &self, new_user: NewUser, ) -> impl Future<Output = Result<Arc<ActiveUserResponse>, Self::Error>> + Send

User profile commands Read more
Source§

fn list_users( &self, ) -> impl Future<Output = Result<Arc<UsersListResponse>, Self::Error>> + Send

User profile commands Read more
Source§

fn api_set_active_user( &self, command: ApiSetActiveUser, ) -> impl Future<Output = Result<Arc<ActiveUserResponse>, Self::Error>> + Send

User profile commands Read more
Source§

fn api_delete_user( &self, command: ApiDeleteUser, ) -> impl Future<Output = Result<Arc<CmdOkResponse>, Self::Error>> + Send

User profile commands Read more
Source§

fn api_update_profile( &self, user_id: i64, profile: Profile, ) -> impl Future<Output = Result<ApiUpdateProfileResponses, Self::Error>> + Send

User profile commands Read more
Source§

fn api_set_contact_prefs( &self, contact_id: i64, preferences: Preferences, ) -> impl Future<Output = Result<Arc<ContactPrefsUpdatedResponse>, Self::Error>> + Send

User profile commands Read more
Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<RawClient> for Client

Source§

fn from(inner: RawClient) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Client

§

impl RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnwindSafe for Client

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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