Struct ruma_client::Client[][src]

pub struct Client<C>(_);
Expand description

A client for the Matrix client-server API.

Implementations

impl<C> Client<C>[src]

pub fn with_http_client(
    http_client: C,
    homeserver_url: String,
    access_token: Option<String>
) -> Self
[src]

Creates a new client using the given underlying HTTP client.

This allows the user to configure the details of HTTP as desired.

pub fn access_token(&self) -> Option<String>[src]

Get a copy of the current access_token, if any.

Useful for serializing and persisting the session to be restored later.

impl<C: DefaultConstructibleHttpClient> Client<C>[src]

pub fn new(homeserver_url: String, access_token: Option<String>) -> Self[src]

Creates a new client based on a default-constructed hyper HTTP client.

impl<C: HttpClient> Client<C>[src]

pub async fn send_request<R: OutgoingRequest>(
    &self,
    request: R
) -> ResponseResult<C, R>
[src]

Makes a request to a Matrix API endpoint.

pub async fn send_customized_request<R, F>(
    &self,
    request: R,
    customize: F
) -> ResponseResult<C, R> where
    R: OutgoingRequest,
    F: FnOnce(&mut Request<C::RequestBody>) -> Result<(), ResponseError<C, R>>, 
[src]

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

pub async fn send_request_as<R: OutgoingRequest>(
    &self,
    user_id: &UserId,
    request: R
) -> ResponseResult<C, R>
[src]

Makes a request to a Matrix API endpoint as a virtual user.

This method is meant to be used by application services when interacting with the client-server API.

Trait Implementations

impl<C: Clone> Clone for Client<C>[src]

fn clone(&self) -> Client<C>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<C: Debug> Debug for Client<C>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<C> RefUnwindSafe for Client<C> where
    C: RefUnwindSafe

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> where
    C: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.