Struct ruma_client::Client[][src]

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

A client for the Matrix client-server API.

Implementations

Client-API specific functionality of Client.

This is supported on crate feature client-api only.

Log in with a username and password.

In contrast to send_request, this method stores the access token returned by the endpoint in this client, in addition to returning it.

This is supported on crate feature client-api only.

Register as a guest.

In contrast to send_request, this method stores the access token returned by the endpoint in this client, in addition to returning it.

This is supported on crate feature client-api only.

Register as a new user on this server.

In contrast to send_request, this method stores the access token returned by the endpoint in this client, in addition to 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.

This is supported on crate feature client-api only.

Convenience method that represents repeated calls to the sync_events endpoint as a stream.

Example:

use std::time::Duration;

let mut sync_stream = Box::pin(client.sync(
    None,
    next_batch_token,
    &PresenceState::Online,
    Some(Duration::from_secs(30)),
));
while let Some(response) = sync_stream.try_next().await? {
    // Do something with the data in the response...
}

Creates a new client using the given underlying HTTP client.

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

Get a copy of the current access_token, if any.

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

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

Makes a request to a Matrix API endpoint.

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

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

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

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more