Skip to main content

MatrixClient

Struct MatrixClient 

Source
pub struct MatrixClient { /* private fields */ }

Implementations§

Source§

impl MatrixClient

Source

pub fn new(homeserver: Url, auth: MatrixAuth) -> Self

Source

pub fn with_storage(self, storage: Arc<dyn IStorageProvider>) -> Self

Source

pub fn homeserver(&self) -> &Url

Source

pub async fn access_token(&self) -> Option<String>

Source

pub async fn auth(&self) -> MatrixAuth

Source

pub async fn set_auth(&self, auth: MatrixAuth)

Source

pub async fn add_preprocessor(&self, preprocessor: Arc<dyn IPreprocessor>)

Source

pub async fn add_filter(&self, filter: Arc<dyn IFilter>)

Source

pub async fn impersonate_user_id( &self, user_id: Option<impl Into<String>>, device_id: Option<impl Into<String>>, )

Source

pub async fn set_join_strategy(&self, strategy: Arc<dyn JoinRoomStrategy>)

Source

pub fn unstable_apis(&self) -> UnstableApis

Source

pub async fn get_identity_server_client( &self, identity_server_name: &str, ) -> Result<IdentityClient>

Source

pub async fn raw_json( &self, method: Method, endpoint: &str, body: Option<Value>, ) -> Result<Value>

Source

pub async fn do_request( &self, method: Method, endpoint: &str, query: Option<&BTreeMap<String, String>>, body: Option<&Value>, ) -> Result<Value>

Source§

impl MatrixClient

Source

pub async fn password_login( &self, username: &str, password: &str, device_name: Option<&str>, ) -> Result<MatrixAuth>

Source

pub async fn password_register( &self, localpart: &str, password: &str, device_name: Option<&str>, ) -> Result<MatrixAuth>

Source

pub async fn login_with_token(&self, auth: MatrixAuth)

Source§

impl MatrixClient

Source

pub async fn sync_once(&self, since: Option<&str>) -> Result<Vec<RoomEvent>>

Source

pub async fn start(&self) -> Result<()>

Source

pub fn stop(&self)

Source§

impl MatrixClient

Source

pub async fn get_user_id(&self) -> Result<String>

Source

pub async fn profile(&self, user_id: &str) -> Result<MatrixProfile>

Source

pub async fn set_display_name(&self, display_name: &str) -> Result<()>

Source

pub async fn set_avatar_url(&self, avatar_url: &str) -> Result<()>

Source

pub async fn get_presence_status(&self, user_id: &str) -> Result<Presence>

Source

pub async fn get_presence_status_for(&self, user_id: &str) -> Result<Presence>

Source

pub async fn set_presence_status( &self, status: Presence, status_msg: Option<&str>, ) -> Result<()>

Source

pub async fn whoami(&self) -> Result<Account>

Source

pub async fn get_who_am_i(&self) -> Result<Account>

Source

pub async fn get_user_profile(&self, user_id: &str) -> Result<MatrixProfile>

Source§

impl MatrixClient

Source

pub async fn get_joined_rooms(&self) -> Result<Vec<String>>

Source

pub async fn get_joined_room_members( &self, room_id: &str, ) -> Result<Vec<String>>

Source

pub async fn get_joined_room_members_with_profiles( &self, room_id: &str, ) -> Result<BTreeMap<String, JoinedMemberProfile>>

Source

pub async fn get_room_members( &self, room_id: &str, membership: Option<Membership>, not_membership: Option<Membership>, ) -> Result<Vec<MembershipEvent>>

Source

pub async fn get_all_room_members( &self, room_id: &str, at_token: Option<&str>, ) -> Result<Vec<MembershipEvent>>

Source

pub async fn get_room_members_by_membership( &self, room_id: &str, membership: Membership, at_token: Option<&str>, ) -> Result<Vec<MembershipEvent>>

Source

pub async fn get_room_members_without_membership( &self, room_id: &str, not_membership: Membership, at_token: Option<&str>, ) -> Result<Vec<MembershipEvent>>

Source

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

Source

pub async fn get_room_state(&self, room_id: &str) -> Result<Vec<Value>>

Source

pub async fn get_room_state_events( &self, room_id: &str, event_type: &str, state_key: &str, ) -> Result<Value>

Source

pub async fn get_room_create_event(&self, room_id: &str) -> Result<Value>

Source

pub async fn user_has_power_level_for( &self, user_id: &str, room_id: &str, event_type: &str, is_state: bool, ) -> Result<bool>

Source

pub async fn user_has_power_level_for_action( &self, user_id: &str, room_id: &str, action: PowerLevelAction, ) -> Result<bool>

Source

pub async fn calculate_power_level_change_bounds_on( &self, target_user_id: &str, room_id: &str, ) -> Result<PowerLevelBounds>

Source

pub async fn set_user_power_level( &self, user_id: &str, room_id: &str, new_level: i64, ) -> Result<()>

Source

pub async fn get_room_state_event( &self, room_id: &str, event_type: &str, state_key: &str, ) -> Result<Value>

Source

pub async fn get_room_state_event_content( &self, room_id: &str, event_type: &str, state_key: &str, ) -> Result<Value>

Source

pub async fn get_room_state_event_body( &self, room_id: &str, event_type: &str, state_key: &str, ) -> Result<Value>

Source

pub async fn send_state_event( &self, room_id: &str, event_type: &str, state_key: &str, content: &Value, ) -> Result<String>

Source§

impl MatrixClient

Source

pub async fn join_room(&self, room_id_or_alias: &str) -> Result<String>

Source

pub async fn create_space(&self, options: &CreateRoom) -> Result<String>

Source

pub async fn get_space(&self, room_id: &str) -> Result<Space>

Source

pub async fn leave_room( &self, room_id: &str, reason: Option<&str>, ) -> Result<()>

Source

pub async fn forget_room(&self, room_id: &str) -> Result<()>

Source

pub async fn invite_user(&self, user_id: &str, room_id: &str) -> Result<()>

Source

pub async fn kick_user( &self, user_id: &str, room_id: &str, reason: Option<&str>, ) -> Result<()>

Source

pub async fn ban_user( &self, user_id: &str, room_id: &str, reason: Option<&str>, ) -> Result<()>

Source

pub async fn unban_user(&self, user_id: &str, room_id: &str) -> Result<()>

Source

pub async fn upgrade_room( &self, room_id: &str, new_version: &str, ) -> Result<String>

Source

pub async fn get_room_upgrade_history( &self, room_id: &str, ) -> Result<Vec<Value>>

Source§

impl MatrixClient

Source

pub async fn send_message(&self, room_id: &str, body: &str) -> Result<String>

Source

pub async fn send_text(&self, room_id: &str, body: &str) -> Result<String>

Source

pub async fn send_html_text( &self, room_id: &str, body: &str, html: &str, ) -> Result<String>

Source

pub async fn send_notice(&self, room_id: &str, body: &str) -> Result<String>

Source

pub async fn send_html_notice( &self, room_id: &str, body: &str, html: &str, ) -> Result<String>

Source

pub async fn reply_text( &self, room_id: &str, event: &Event, text: &str, ) -> Result<String>

Source

pub async fn reply_html_text( &self, room_id: &str, event: &Event, html: &str, ) -> Result<String>

Source

pub async fn reply_notice( &self, room_id: &str, event: &Event, text: &str, ) -> Result<String>

Source

pub async fn reply_html_notice( &self, room_id: &str, event: &Event, html: &str, ) -> Result<String>

Source

pub async fn send_event( &self, room_id: &str, event_type: &str, content: &Value, ) -> Result<String>

Source

pub async fn send_raw_event( &self, room_id: &str, event_type: &str, content: &Value, txn_id: Option<&str>, ) -> Result<String>

Source

pub async fn redact_event( &self, room_id: &str, event_id: &str, reason: Option<&str>, ) -> Result<String>

Source

pub async fn send_read_receipt( &self, room_id: &str, event_id: &str, ) -> Result<()>

Source

pub async fn set_typing( &self, room_id: &str, user_id: &str, typing: bool, timeout: Option<u64>, ) -> Result<()>

Source

pub async fn get_event(&self, room_id: &str, event_id: &str) -> Result<Value>

Source§

impl MatrixClient

Source

pub async fn create_room(&self, options: &CreateRoom) -> Result<String>

Source

pub async fn create_room_alias(&self, alias: &str, room_id: &str) -> Result<()>

Source

pub async fn delete_room_alias(&self, alias: &str) -> Result<()>

Source

pub async fn lookup_room_alias( &self, alias: &str, ) -> Result<RoomDirectoryLookupResponse>

Source

pub async fn set_directory_visibility( &self, room_id: &str, visibility: &str, ) -> Result<()>

Source

pub async fn get_directory_visibility(&self, room_id: &str) -> Result<String>

Source

pub async fn resolve_room(&self, room_id_or_alias: &str) -> Result<String>

Source

pub async fn get_published_alias( &self, room_id_or_alias: &str, ) -> Result<Option<String>>

Source§

impl MatrixClient

Source

pub async fn set_account_data( &self, event_type: &str, content: &Value, ) -> Result<()>

Source

pub async fn get_account_data(&self, event_type: &str) -> Result<Value>

Source

pub async fn set_room_account_data( &self, room_id: &str, event_type: &str, content: &Value, ) -> Result<()>

Source

pub async fn get_room_account_data( &self, room_id: &str, event_type: &str, ) -> Result<Value>

Source

pub async fn get_openid_token(&self) -> Result<Value>

Source

pub async fn get_openid_connect_token(&self) -> Result<Value>

Source§

impl MatrixClient

Source

pub async fn get_own_devices(&self) -> Result<Vec<Value>>

Source

pub async fn get_user_devices(&self, user_ids: &[&str]) -> Result<Value>

Source

pub async fn upload_device_one_time_keys(&self, keys: &Value) -> Result<Value>

Source

pub async fn claim_one_time_keys( &self, devices: &Value, key_algorithm: Option<&str>, ) -> Result<Value>

Source

pub async fn check_one_time_key_counts(&self) -> Result<Value>

Source

pub async fn upload_fallback_key(&self, key: &Value) -> Result<Value>

Source

pub async fn send_to_devices( &self, event_type: &str, messages: &Value, ) -> Result<()>

Source

pub async fn get_key_backup_version(&self) -> Result<Option<Value>>

Source

pub async fn sign_and_create_key_backup_version( &self, info: &Value, ) -> Result<Value>

Source

pub async fn update_key_backup_version( &self, version: &str, info: &Value, ) -> Result<()>

Source

pub async fn enable_key_backup(&self, _info: &Value) -> Result<()>

Source

pub async fn disable_key_backup(&self) -> Result<()>

Source

pub async fn export_room_keys_for_session( &self, _room_id: &str, _session_id: &str, ) -> Result<Vec<Value>>

Source§

impl MatrixClient

Source

pub async fn get_server_versions(&self) -> Result<Value>

Source

pub async fn get_capabilities(&self) -> Result<Value>

Source

pub async fn does_server_support_version(&self, version: &str) -> Result<bool>

Source

pub async fn does_server_support_any_one_version( &self, versions: &[&str], ) -> Result<bool>

Source

pub async fn does_server_support_unstable_feature( &self, feature: &str, ) -> Result<bool>

Source

pub async fn get_raw_event( &self, room_id: &str, event_id: &str, ) -> Result<Value>

Source

pub async fn get_event_context( &self, room_id: &str, event_id: &str, ) -> Result<Value>

Source

pub async fn get_event_nearest_to_timestamp( &self, room_id: &str, ts: u64, dir: &str, ) -> Result<Value>

Source

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

Source

pub async fn upload_media( &self, bytes: Vec<u8>, content_type: &str, filename: Option<&str>, ) -> Result<MXCUrl>

Source

pub async fn upload_content( &self, bytes: Vec<u8>, content_type: Option<&str>, filename: Option<&str>, ) -> Result<String>

Source

pub async fn upload_content_from_url(&self, url: &str) -> Result<String>

Source

pub async fn download_media(&self, mxc: &MXCUrl) -> Result<Vec<u8>>

Source

pub async fn download_content( &self, mxc_url: &str, allow_remote: bool, ) -> Result<DownloadedContent>

Source

pub fn mxc_to_http( &self, mxc: &str, width: Option<u32>, height: Option<u32>, ) -> Option<String>

Source

pub fn mxc_to_http_thumbnail( &self, mxc: &str, width: u32, height: u32, method: &str, ) -> Option<String>

Trait Implementations§

Source§

impl Clone for MatrixClient

Source§

fn clone(&self) -> MatrixClient

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

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

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