[−][src]Struct ruma_client::Client
A client for the Matrix client-server API.
Methods
impl Client<HttpConnector<GaiResolver>>
[src]
pub fn new(homeserver_url: Url, session: Option<Session>) -> Self
[src]
Creates a new client for making HTTP requests to the given homeserver.
impl Client<HttpsConnector<HttpConnector<GaiResolver>>>
[src]
pub fn https(homeserver_url: Url, session: Option<Session>) -> Self
[src]
Creates a new client for making HTTPS requests to the given homeserver.
impl<C> Client<C> where
C: Connect + Clone + Send + Sync + 'static,
[src]
C: Connect + Clone + Send + Sync + 'static,
pub fn custom(
hyper_client: HyperClient<C>,
homeserver_url: Url,
session: Option<Session>
) -> Self
[src]
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.
pub fn session(&self) -> Option<Session>
[src]
Get a copy of the current Session
, if any.
Useful for serializing and persisting the session to be restored later.
pub async fn log_in<'_>(
&'_ self,
user: String,
password: String,
device_id: Option<DeviceId>,
initial_device_display_name: Option<String>
) -> Result<Session, Error<Error>>
[src]
&'_ self,
user: String,
password: String,
device_id: Option<DeviceId>,
initial_device_display_name: Option<String>
) -> Result<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.
pub async fn register_guest<'_>(
&'_ self
) -> Result<Session, Error<UiaaResponse>>
[src]
&'_ self
) -> Result<Session, Error<UiaaResponse>>
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.
pub async fn register_user<'_>(
&'_ self,
username: Option<String>,
password: String
) -> Result<Session, Error<UiaaResponse>>
[src]
&'_ self,
username: Option<String>,
password: String
) -> Result<Session, Error<UiaaResponse>>
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.
pub fn sync(
&self,
filter: Option<Filter>,
since: Option<String>,
set_presence: SetPresence,
timeout: Option<Duration>
) -> impl Stream<Item = Result<Response, Error<Error>>> + TryStream<Ok = Response, Error = Error<Error>>
[src]
&self,
filter: Option<Filter>,
since: Option<String>,
set_presence: SetPresence,
timeout: Option<Duration>
) -> impl Stream<Item = Result<Response, Error<Error>>> + TryStream<Ok = Response, Error = 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 occurred in the whole lifetime of the logged-in users account and are visible to them.
pub fn request<Request: Endpoint>(
&self,
request: Request
) -> impl Future<Output = Result<Request::Response, Error<Request::ResponseError>>>
[src]
&self,
request: Request
) -> impl Future<Output = Result<Request::Response, Error<Request::ResponseError>>>
Makes a request to a Matrix API endpoint.
pub fn request_with_url_params<Request: Endpoint>(
&self,
request: Request,
params: Option<BTreeMap<String, String>>
) -> impl Future<Output = Result<Request::Response, Error<Request::ResponseError>>>
[src]
&self,
request: Request,
params: Option<BTreeMap<String, String>>
) -> impl Future<Output = Result<Request::Response, Error<Request::ResponseError>>>
Makes a request to a Matrix API endpoint including additional URL parameters.
Trait Implementations
impl<C> Clone for Client<C>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<C: Debug> Debug for Client<C>
[src]
Auto Trait Implementations
impl<C> !RefUnwindSafe for Client<C>
impl<C> Send for Client<C> where
C: Send + Sync,
C: Send + Sync,
impl<C> Sync for Client<C> where
C: Send + Sync,
C: Send + Sync,
impl<C> Unpin for Client<C>
impl<C> !UnwindSafe for Client<C>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,