[][src]Struct ruma_client::Client

pub struct Client<C>(_);

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]

pub fn custom(
    hyper_client: HyperClient<C>,
    homeserver_url: Url,
    session: Option<Session>
) -> Self
[src]

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]

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]

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]

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<IncomingResponse, Error<Error>>> + TryStream<Ok = IncomingResponse, Error = Error<Error>>
[src]

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 as Outgoing>::Incoming, Error<Request::ResponseError>>> where
    Request::Incoming: TryFrom<Request<Vec<u8>>, Error = FromHttpRequestError>,
    <Request::Response as Outgoing>::Incoming: TryFrom<Response<Vec<u8>>, Error = FromHttpResponseError<Request::ResponseError>>, 
[src]

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 as Outgoing>::Incoming, Error<Request::ResponseError>>> where
    Request::Incoming: TryFrom<Request<Vec<u8>>, Error = FromHttpRequestError>,
    <Request::Response as Outgoing>::Incoming: TryFrom<Response<Vec<u8>>, Error = FromHttpResponseError<Request::ResponseError>>, 
[src]

Makes a request to a Matrix API endpoint including additional URL parameters.

Trait Implementations

impl<C> Clone for Client<C>[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

impl<C> Sync for Client<C> where
    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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.