pub struct MatrixClient { /* private fields */ }
Expand description
A connection to a Matrix homeserver, using the hyper
crate.
Implementations§
Source§impl MatrixClient
impl MatrixClient
pub fn new_from_access_token( token: &str, url: &str, hdl: &Handle, ) -> impl Future<Item = Self, Error = MatrixError>
Sourcepub fn login_password(
username: &str,
password: &str,
url: &str,
hdl: &Handle,
) -> impl Future<Item = Self, Error = MatrixError>
pub fn login_password( username: &str, password: &str, url: &str, hdl: &Handle, ) -> impl Future<Item = Self, Error = MatrixError>
Log in to a Matrix homeserver with a username and password, and return a client object.
§Parameters
username
: the username of the account to use (NB: not a MXID)password
: the password of the account to useurl
: the URL of the homeserverhdl
: Tokio reactor handle
Sourcepub fn as_register_user(
&mut self,
user_id: String,
) -> impl Future<Item = (), Error = MatrixError>
pub fn as_register_user( &mut self, user_id: String, ) -> impl Future<Item = (), Error = MatrixError>
(for Application Services) Register a user with the given user_id
.
Sourcepub fn as_new(
url: String,
user_id: String,
as_token: String,
hdl: &Handle,
) -> MatrixResult<Self>
pub fn as_new( url: String, user_id: String, as_token: String, hdl: &Handle, ) -> MatrixResult<Self>
(for Application Services) Make a new AS client.
§Parameters
url
: homeserver URLuser_id
: user ID to impersonate (can be changed later, usingalter_user_id
)as_token
: application service tokenhdl
: Tokio reactor handle
Sourcepub fn as_alter_user_id(&mut self, user_id: String)
pub fn as_alter_user_id(&mut self, user_id: String)
(for Application Services) Alter the user ID which this client is masquerading as.
Sourcepub fn get_hyper(&self) -> MatrixHyper
pub fn get_hyper(&self) -> MatrixHyper
Convenience method that clones the MatrixClient’s underlying HTTP client. Useful if you don’t want to have to make your own HTTP client, and need one for some quick’n’dirty task.
Trait Implementations§
Source§impl Clone for MatrixClient
impl Clone for MatrixClient
Source§fn clone(&self) -> MatrixClient
fn clone(&self) -> MatrixClient
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Drop for MatrixClient
impl Drop for MatrixClient
Source§impl MatrixRequestable for MatrixClient
impl MatrixRequestable for MatrixClient
Source§type ResponseBody = Chunk
type ResponseBody = Chunk
The type of the HTTP response body.
Source§type ResponseBodyFuture = MxClientResponseBodyFuture
type ResponseBodyFuture = MxClientResponseBodyFuture
The type of the future returned as a HTTP response body. Read more
Source§type SendRequestFuture = MxClientSendRequestFuture
type SendRequestFuture = MxClientSendRequestFuture
The type of the future returned by
send_request()
. Read moreSource§fn get_access_token(&self) -> Cow<'_, str>
fn get_access_token(&self) -> Cow<'_, str>
Gets the client’s access token.
Source§fn get_user_id(&self) -> Cow<'_, str>
fn get_user_id(&self) -> Cow<'_, str>
Gets the client’s user ID.
Source§fn send_request(&mut self, req: Request<Vec<u8>>) -> Self::SendRequestFuture
fn send_request(&mut self, req: Request<Vec<u8>>) -> Self::SendRequestFuture
Send an arbitrary HTTP request to the Matrix homeserver.
Source§fn typed_api_call<T>(
&mut self,
req: Request<Vec<u8>>,
discard: bool,
) -> TypedApiResponse<T, Self::SendRequestFuture, Self::ResponseBodyFuture>where
T: DeserializeOwned + 'static,
fn typed_api_call<T>(
&mut self,
req: Request<Vec<u8>>,
discard: bool,
) -> TypedApiResponse<T, Self::SendRequestFuture, Self::ResponseBodyFuture>where
T: DeserializeOwned + 'static,
Send an arbitrary HTTP request to the Matrix homeserver, and deserialize the JSON response
to a value of type T. Read more
Auto Trait Implementations§
impl Freeze for MatrixClient
impl !RefUnwindSafe for MatrixClient
impl !Send for MatrixClient
impl !Sync for MatrixClient
impl Unpin for MatrixClient
impl !UnwindSafe for MatrixClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more