Trait mas_matrix::HomeserverConnection

source ·
pub trait HomeserverConnection: Send + Sync {
    type Error;

Show 13 methods // Required methods fn homeserver(&self) -> &str; fn query_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<MatrixUser, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn provision_user<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ProvisionRequest, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn is_localpart_available<'life0, 'life1, 'async_trait>( &'life0 self, localpart: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn create_device<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, device_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn delete_device<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, device_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn sync_devices<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, devices: HashSet<String>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, erase: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn reactivate_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_displayname<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, displayname: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn unset_displayname<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn allow_cross_signing_reset<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided method fn mxid(&self, localpart: &str) -> String { ... }
}

Required Associated Types§

source

type Error

The error type returned by all methods.

Required Methods§

source

fn homeserver(&self) -> &str

Get the homeserver URL.

source

fn query_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<MatrixUser, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Query the state of a user on the homeserver.

§Parameters
  • mxid - The Matrix ID of the user to query.
§Errors

Returns an error if the homeserver is unreachable or the user does not exist.

source

fn provision_user<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ProvisionRequest, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provision a user on the homeserver.

§Parameters
§Errors

Returns an error if the homeserver is unreachable or the user could not be provisioned.

source

fn is_localpart_available<'life0, 'life1, 'async_trait>( &'life0 self, localpart: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether a given username is available on the homeserver.

§Parameters
  • localpart - The localpart to check.
§Errors

Returns an error if the homeserver is unreachable.

source

fn create_device<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, device_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a device for a user on the homeserver.

§Parameters
  • mxid - The Matrix ID of the user to create a device for.
  • device_id - The device ID to create.
§Errors

Returns an error if the homeserver is unreachable or the device could not be created.

source

fn delete_device<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, device_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a device for a user on the homeserver.

§Parameters
  • mxid - The Matrix ID of the user to delete a device for.
  • device_id - The device ID to delete.
§Errors

Returns an error if the homeserver is unreachable or the device could not be deleted.

source

fn sync_devices<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, devices: HashSet<String>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sync the list of devices of a user with the homeserver.

§Parameters
  • mxid - The Matrix ID of the user to sync the devices for.
  • devices - The list of devices to sync.
§Errors

Returns an error if the homeserver is unreachable or the devices could not be synced.

source

fn delete_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, erase: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a user on the homeserver.

§Parameters
  • mxid - The Matrix ID of the user to delete.
  • erase - Whether to ask the homeserver to erase the user’s data.
§Errors

Returns an error if the homeserver is unreachable or the user could not be deleted.

source

fn reactivate_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reactivate a user on the homeserver.

§Parameters
  • mxid - The Matrix ID of the user to reactivate.
§Errors

Returns an error if the homeserver is unreachable or the user could not be reactivated.

source

fn set_displayname<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, displayname: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set the displayname of a user on the homeserver.

§Parameters
  • mxid - The Matrix ID of the user to set the displayname for.
  • displayname - The displayname to set.
§Errors

Returns an error if the homeserver is unreachable or the displayname could not be set.

source

fn unset_displayname<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Unset the displayname of a user on the homeserver.

§Parameters
  • mxid - The Matrix ID of the user to unset the displayname for.
§Errors

Returns an error if the homeserver is unreachable or the displayname could not be unset.

source

fn allow_cross_signing_reset<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Temporarily allow a user to reset their cross-signing keys.

§Parameters
  • mxid - The Matrix ID of the user to allow cross-signing key reset
§Errors

Returns an error if the homeserver is unreachable or the cross-signing reset could not be allowed.

Provided Methods§

source

fn mxid(&self, localpart: &str) -> String

Get the Matrix ID of the user with the given localpart.

§Parameters
  • localpart - The localpart of the user.

Implementations on Foreign Types§

source§

impl<T: HomeserverConnection + Send + Sync + ?Sized> HomeserverConnection for &T

§

type Error = <T as HomeserverConnection>::Error

source§

fn homeserver(&self) -> &str

source§

fn query_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<MatrixUser, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn provision_user<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ProvisionRequest, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn is_localpart_available<'life0, 'life1, 'async_trait>( &'life0 self, localpart: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn create_device<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, device_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

fn delete_device<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, device_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

fn sync_devices<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, devices: HashSet<String>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn delete_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, erase: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn reactivate_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn set_displayname<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, displayname: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

fn unset_displayname<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn allow_cross_signing_reset<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

impl<T: HomeserverConnection + ?Sized> HomeserverConnection for Arc<T>

§

type Error = <T as HomeserverConnection>::Error

source§

fn homeserver(&self) -> &str

source§

fn query_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<MatrixUser, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn provision_user<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ProvisionRequest, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn is_localpart_available<'life0, 'life1, 'async_trait>( &'life0 self, localpart: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn create_device<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, device_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

fn delete_device<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, device_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

fn sync_devices<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, devices: HashSet<String>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn delete_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, erase: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn reactivate_user<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn set_displayname<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, mxid: &'life1 str, displayname: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

fn unset_displayname<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn allow_cross_signing_reset<'life0, 'life1, 'async_trait>( &'life0 self, mxid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§