Struct ruma_client::Client
source · pub struct Client<C: Connect>(_);
Expand description
A client for the Matrix client-server API.
Implementations
sourceimpl Client<HttpConnector>
impl Client<HttpConnector>
sourceimpl<C> Client<C>where
C: Connect + 'static,
impl<C> Client<C>where
C: Connect + 'static,
sourcepub fn custom(
hyper_client: HyperClient<C>,
homeserver_url: Url,
session: Option<Session>
) -> Self
pub fn custom(
hyper_client: HyperClient<C>,
homeserver_url: Url,
session: Option<Session>
) -> Self
Creates a new client using the given hyper::Client
.
This allows the user to configure the details of HTTP as desired.
sourcepub fn log_in(
&self,
user: String,
password: String,
device_id: Option<String>
) -> impl Future<Item = Session, Error = Error>
pub fn log_in(
&self,
user: String,
password: String,
device_id: Option<String>
) -> impl Future<Item = Session, Error = Error>
Log in with a username and password.
In contrast to api::r0::session::login::call(), this method stores the session data returned by the endpoint in this client, instead of returning it.
sourcepub fn register_guest(&self) -> impl Future<Item = Session, Error = Error>
pub fn register_guest(&self) -> impl Future<Item = Session, Error = Error>
Register as a guest. In contrast to api::r0::account::register::call(), this method stores the session data returned by the endpoint in this client, instead of returning it.
sourcepub fn register_user(
&self,
username: Option<String>,
password: String
) -> impl Future<Item = Session, Error = Error>
pub fn register_user(
&self,
username: Option<String>,
password: String
) -> impl Future<Item = Session, Error = Error>
Register as a new user on this server.
In contrast to api::r0::account::register::call(), this method stores the session data returned by the endpoint in this client, instead of returning it.
The username is the local part of the returned user_id. If it is omitted from this request, the server will generate one.
sourcepub fn sync(
&self,
filter: Option<Filter>,
since: Option<String>,
set_presence: bool
) -> impl Stream<Item = Response, Error = Error>
pub fn sync(
&self,
filter: Option<Filter>,
since: Option<String>,
set_presence: bool
) -> impl Stream<Item = Response, Error = Error>
Convenience method that represents repeated calls to the sync_events endpoint as a stream.
If the since parameter is None, the first Item might take a significant time to arrive and be deserialized, because it contains all events that have occured in the whole lifetime of the logged-in users account and are visible to them.