logo
pub struct Client<C>(_);
Available on crate feature client-api only.
Expand description

A client for the Matrix client-server API.

Implementations

Creates a new client builder.

Get a copy of the current access_token, if any.

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

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.

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.

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.

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.

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...
}

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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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

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