pub struct BaseClient { /* private fields */ }
Expand description

A no IO Client implementation.

This Client is a state machine that receives responses and events and accordingly updates its state.

Implementations

Create a new default client.

Create a new client.

Arguments
  • config - An optional session if the user already has one from a previous login call.

Get the user login session.

If the client is currently logged in, this will return a Session object which can later be given to BaseClient::restore_login.

Returns a session object if the client is logged in. Otherwise returns None.

Get a reference to the store.

Is the client logged in.

Receive a login response and update the session of the client.

Arguments
  • response - A successful login response that contains our access token and device ID.

Restore a previously logged in session.

Arguments
  • session - An session that the user already has from a previous login call.

Get the current, if any, sync token of the client. This will be None if the client didn’t sync at least once.

Receive a response from a sync call.

Arguments
  • response - The response that we received after a successful sync.

Receive a get member events response and convert it to a deserialized MembersResponse

Arguments
  • room_id - The room id this response belongs to.

  • response - The raw response that was received from the server.

Receive a successful filter upload response, the filter id will be stored under the given name in the store.

The filter id can later be retrieved with the get_filter method.

Arguments
  • filter_name - The name that should be used to persist the filter id in the store.

  • response - The successful filter upload response containing the filter id.

Get the filter id of a previously uploaded filter.

Note: A filter will first need to be uploaded and persisted using receive_filter_upload.

Arguments
  • filter_name - The name of the filter that was previously used to persist the filter.

Get a to-device request that will share a room key with users in a room.

Get the room with the given room id.

Arguments
  • room_id - The id of the room that should be fetched.

Get the olm machine.

Get the push rules.

Gets the push rules from changes if they have been updated, otherwise get them from the store. As a fallback, uses Ruleset::server_default if the user is logged in.

Get the push context for the given room.

Tries to get the data from changes or the up to date room_info. Loads the data from the store otherwise.

Returns None if some data couldn’t be found. This should only happen in brand new rooms, while we process its state.

Update the push context for the given room.

Updates the context data from changes or room_info.

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

Returns the “default value” for a type. 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

Calls U::from(self).

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

Should always be Self

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