pub struct MatrixClient { /* private fields */ }Implementations§
Source§impl MatrixClient
impl MatrixClient
pub fn new(homeserver: Url, auth: MatrixAuth) -> Self
pub fn with_storage(self, storage: Arc<dyn IStorageProvider>) -> Self
pub fn homeserver(&self) -> &Url
pub async fn access_token(&self) -> Option<String>
pub async fn auth(&self) -> MatrixAuth
pub async fn set_auth(&self, auth: MatrixAuth)
pub async fn add_preprocessor(&self, preprocessor: Arc<dyn IPreprocessor>)
pub async fn add_filter(&self, filter: Arc<dyn IFilter>)
pub async fn impersonate_user_id( &self, user_id: Option<impl Into<String>>, device_id: Option<impl Into<String>>, )
pub async fn set_join_strategy(&self, strategy: Arc<dyn JoinRoomStrategy>)
pub fn unstable_apis(&self) -> UnstableApis
pub async fn get_identity_server_client( &self, identity_server_name: &str, ) -> Result<IdentityClient>
pub async fn raw_json( &self, method: Method, endpoint: &str, body: Option<Value>, ) -> Result<Value>
pub async fn do_request( &self, method: Method, endpoint: &str, query: Option<&BTreeMap<String, String>>, body: Option<&Value>, ) -> Result<Value>
Source§impl MatrixClient
impl MatrixClient
pub async fn password_login( &self, username: &str, password: &str, device_name: Option<&str>, ) -> Result<MatrixAuth>
pub async fn password_register( &self, localpart: &str, password: &str, device_name: Option<&str>, ) -> Result<MatrixAuth>
pub async fn login_with_token(&self, auth: MatrixAuth)
Source§impl MatrixClient
impl MatrixClient
Source§impl MatrixClient
impl MatrixClient
pub async fn get_user_id(&self) -> Result<String>
pub async fn profile(&self, user_id: &str) -> Result<MatrixProfile>
pub async fn set_display_name(&self, display_name: &str) -> Result<()>
pub async fn set_avatar_url(&self, avatar_url: &str) -> Result<()>
pub async fn get_presence_status(&self, user_id: &str) -> Result<Presence>
pub async fn get_presence_status_for(&self, user_id: &str) -> Result<Presence>
pub async fn set_presence_status( &self, status: Presence, status_msg: Option<&str>, ) -> Result<()>
pub async fn whoami(&self) -> Result<Account>
pub async fn get_who_am_i(&self) -> Result<Account>
pub async fn get_user_profile(&self, user_id: &str) -> Result<MatrixProfile>
Source§impl MatrixClient
impl MatrixClient
pub async fn get_joined_rooms(&self) -> Result<Vec<String>>
pub async fn get_joined_room_members( &self, room_id: &str, ) -> Result<Vec<String>>
pub async fn get_joined_room_members_with_profiles( &self, room_id: &str, ) -> Result<BTreeMap<String, JoinedMemberProfile>>
pub async fn get_room_members( &self, room_id: &str, membership: Option<Membership>, not_membership: Option<Membership>, ) -> Result<Vec<MembershipEvent>>
pub async fn get_all_room_members( &self, room_id: &str, at_token: Option<&str>, ) -> Result<Vec<MembershipEvent>>
pub async fn get_room_members_by_membership( &self, room_id: &str, membership: Membership, at_token: Option<&str>, ) -> Result<Vec<MembershipEvent>>
pub async fn get_room_members_without_membership( &self, room_id: &str, not_membership: Membership, at_token: Option<&str>, ) -> Result<Vec<MembershipEvent>>
pub async fn get_room_members_at( &self, room_id: &str, membership: Option<Membership>, not_membership: Option<Membership>, at_token: Option<&str>, ) -> Result<Vec<MembershipEvent>>
pub async fn get_room_state(&self, room_id: &str) -> Result<Vec<Value>>
pub async fn get_room_state_events( &self, room_id: &str, event_type: &str, state_key: &str, ) -> Result<Value>
pub async fn get_room_create_event(&self, room_id: &str) -> Result<Value>
pub async fn user_has_power_level_for( &self, user_id: &str, room_id: &str, event_type: &str, is_state: bool, ) -> Result<bool>
pub async fn user_has_power_level_for_action( &self, user_id: &str, room_id: &str, action: PowerLevelAction, ) -> Result<bool>
pub async fn calculate_power_level_change_bounds_on( &self, target_user_id: &str, room_id: &str, ) -> Result<PowerLevelBounds>
pub async fn set_user_power_level( &self, user_id: &str, room_id: &str, new_level: i64, ) -> Result<()>
pub async fn get_room_state_event( &self, room_id: &str, event_type: &str, state_key: &str, ) -> Result<Value>
pub async fn get_room_state_event_content( &self, room_id: &str, event_type: &str, state_key: &str, ) -> Result<Value>
pub async fn get_room_state_event_body( &self, room_id: &str, event_type: &str, state_key: &str, ) -> Result<Value>
pub async fn send_state_event( &self, room_id: &str, event_type: &str, state_key: &str, content: &Value, ) -> Result<String>
Source§impl MatrixClient
impl MatrixClient
pub async fn join_room(&self, room_id_or_alias: &str) -> Result<String>
pub async fn create_space(&self, options: &CreateRoom) -> Result<String>
pub async fn get_space(&self, room_id: &str) -> Result<Space>
pub async fn leave_room( &self, room_id: &str, reason: Option<&str>, ) -> Result<()>
pub async fn forget_room(&self, room_id: &str) -> Result<()>
pub async fn invite_user(&self, user_id: &str, room_id: &str) -> Result<()>
pub async fn kick_user( &self, user_id: &str, room_id: &str, reason: Option<&str>, ) -> Result<()>
pub async fn ban_user( &self, user_id: &str, room_id: &str, reason: Option<&str>, ) -> Result<()>
pub async fn unban_user(&self, user_id: &str, room_id: &str) -> Result<()>
pub async fn upgrade_room( &self, room_id: &str, new_version: &str, ) -> Result<String>
pub async fn get_room_upgrade_history( &self, room_id: &str, ) -> Result<Vec<Value>>
Source§impl MatrixClient
impl MatrixClient
pub async fn send_message(&self, room_id: &str, body: &str) -> Result<String>
pub async fn send_text(&self, room_id: &str, body: &str) -> Result<String>
pub async fn send_html_text( &self, room_id: &str, body: &str, html: &str, ) -> Result<String>
pub async fn send_notice(&self, room_id: &str, body: &str) -> Result<String>
pub async fn send_html_notice( &self, room_id: &str, body: &str, html: &str, ) -> Result<String>
pub async fn reply_text( &self, room_id: &str, event: &Event, text: &str, ) -> Result<String>
pub async fn reply_html_text( &self, room_id: &str, event: &Event, html: &str, ) -> Result<String>
pub async fn reply_notice( &self, room_id: &str, event: &Event, text: &str, ) -> Result<String>
pub async fn reply_html_notice( &self, room_id: &str, event: &Event, html: &str, ) -> Result<String>
pub async fn send_event( &self, room_id: &str, event_type: &str, content: &Value, ) -> Result<String>
pub async fn send_raw_event( &self, room_id: &str, event_type: &str, content: &Value, txn_id: Option<&str>, ) -> Result<String>
pub async fn redact_event( &self, room_id: &str, event_id: &str, reason: Option<&str>, ) -> Result<String>
pub async fn send_read_receipt( &self, room_id: &str, event_id: &str, ) -> Result<()>
pub async fn set_typing( &self, room_id: &str, user_id: &str, typing: bool, timeout: Option<u64>, ) -> Result<()>
pub async fn get_event(&self, room_id: &str, event_id: &str) -> Result<Value>
Source§impl MatrixClient
impl MatrixClient
pub async fn create_room(&self, options: &CreateRoom) -> Result<String>
pub async fn create_room_alias(&self, alias: &str, room_id: &str) -> Result<()>
pub async fn delete_room_alias(&self, alias: &str) -> Result<()>
pub async fn lookup_room_alias( &self, alias: &str, ) -> Result<RoomDirectoryLookupResponse>
pub async fn set_directory_visibility( &self, room_id: &str, visibility: &str, ) -> Result<()>
pub async fn get_directory_visibility(&self, room_id: &str) -> Result<String>
pub async fn resolve_room(&self, room_id_or_alias: &str) -> Result<String>
pub async fn get_published_alias( &self, room_id_or_alias: &str, ) -> Result<Option<String>>
Source§impl MatrixClient
impl MatrixClient
pub async fn set_account_data( &self, event_type: &str, content: &Value, ) -> Result<()>
pub async fn get_account_data(&self, event_type: &str) -> Result<Value>
pub async fn set_room_account_data( &self, room_id: &str, event_type: &str, content: &Value, ) -> Result<()>
pub async fn get_room_account_data( &self, room_id: &str, event_type: &str, ) -> Result<Value>
pub async fn get_openid_token(&self) -> Result<Value>
pub async fn get_openid_connect_token(&self) -> Result<Value>
Source§impl MatrixClient
impl MatrixClient
pub async fn get_own_devices(&self) -> Result<Vec<Value>>
pub async fn get_user_devices(&self, user_ids: &[&str]) -> Result<Value>
pub async fn upload_device_one_time_keys(&self, keys: &Value) -> Result<Value>
pub async fn claim_one_time_keys( &self, devices: &Value, key_algorithm: Option<&str>, ) -> Result<Value>
pub async fn check_one_time_key_counts(&self) -> Result<Value>
pub async fn upload_fallback_key(&self, key: &Value) -> Result<Value>
pub async fn send_to_devices( &self, event_type: &str, messages: &Value, ) -> Result<()>
pub async fn get_key_backup_version(&self) -> Result<Option<Value>>
pub async fn sign_and_create_key_backup_version( &self, info: &Value, ) -> Result<Value>
pub async fn update_key_backup_version( &self, version: &str, info: &Value, ) -> Result<()>
pub async fn enable_key_backup(&self, _info: &Value) -> Result<()>
pub async fn disable_key_backup(&self) -> Result<()>
pub async fn export_room_keys_for_session( &self, _room_id: &str, _session_id: &str, ) -> Result<Vec<Value>>
Source§impl MatrixClient
impl MatrixClient
pub async fn get_server_versions(&self) -> Result<Value>
pub async fn get_capabilities(&self) -> Result<Value>
pub async fn does_server_support_version(&self, version: &str) -> Result<bool>
pub async fn does_server_support_any_one_version( &self, versions: &[&str], ) -> Result<bool>
pub async fn does_server_support_unstable_feature( &self, feature: &str, ) -> Result<bool>
pub async fn get_raw_event( &self, room_id: &str, event_id: &str, ) -> Result<Value>
pub async fn get_event_context( &self, room_id: &str, event_id: &str, ) -> Result<Value>
pub async fn get_event_nearest_to_timestamp( &self, room_id: &str, ts: u64, dir: &str, ) -> Result<Value>
pub async fn get_relations_for_event( &self, room_id: &str, event_id: &str, rel_type: Option<&str>, event_type: Option<&str>, ) -> Result<Value>
Source§impl MatrixClient
impl MatrixClient
pub async fn upload_media( &self, bytes: Vec<u8>, content_type: &str, filename: Option<&str>, ) -> Result<MXCUrl>
pub async fn upload_content( &self, bytes: Vec<u8>, content_type: Option<&str>, filename: Option<&str>, ) -> Result<String>
pub async fn upload_content_from_url(&self, url: &str) -> Result<String>
pub async fn download_media(&self, mxc: &MXCUrl) -> Result<Vec<u8>>
pub async fn download_content( &self, mxc_url: &str, allow_remote: bool, ) -> Result<DownloadedContent>
pub fn mxc_to_http( &self, mxc: &str, width: Option<u32>, height: Option<u32>, ) -> Option<String>
pub fn mxc_to_http_thumbnail( &self, mxc: &str, width: u32, height: u32, method: &str, ) -> Option<String>
Trait Implementations§
Source§impl Clone for MatrixClient
impl Clone for MatrixClient
Source§fn clone(&self) -> MatrixClient
fn clone(&self) -> MatrixClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MatrixClient
impl !RefUnwindSafe for MatrixClient
impl Send for MatrixClient
impl Sync for MatrixClient
impl Unpin for MatrixClient
impl UnsafeUnpin for MatrixClient
impl !UnwindSafe for MatrixClient
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
Mutably borrows from an owned value. Read more