Trait ruma_client::http_client::HttpClientExt [−][src]
pub trait HttpClientExt: HttpClient { fn send_matrix_request<'a, R: OutgoingRequest + 'a>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
request: R
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>> { ... } fn send_customized_matrix_request<'a, R, F>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
request: R,
customize: F
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>>
where
R: OutgoingRequest + 'a,
F: FnOnce(&mut Request<Self::RequestBody>) -> Result<(), ResponseError<Self, R>> + 'a, { ... } fn send_matrix_request_as<'a, R: OutgoingRequest + 'a>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
user_id: &'a UserId,
request: R
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>> { ... } }
Expand description
Convenience functionality on top of HttpClient
.
If you want to build your own matrix client type instead of using ruma_client::Client
, this
trait should make that relatively easy.
Provided methods
fn send_matrix_request<'a, R: OutgoingRequest + 'a>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
request: R
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>>
[src]
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
request: R
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>>
Expand description
Send a strongly-typed matrix request to get back a strongly-typed response.
fn send_customized_matrix_request<'a, R, F>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
request: R,
customize: F
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>> where
R: OutgoingRequest + 'a,
F: FnOnce(&mut Request<Self::RequestBody>) -> Result<(), ResponseError<Self, R>> + 'a,
[src]
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
request: R,
customize: F
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>> where
R: OutgoingRequest + 'a,
F: FnOnce(&mut Request<Self::RequestBody>) -> Result<(), ResponseError<Self, R>> + 'a,
Expand description
Turn a strongly-typed matrix request into an http::Request
, customize it and send it to
get back a strongly-typed response.
fn send_matrix_request_as<'a, R: OutgoingRequest + 'a>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
user_id: &'a UserId,
request: R
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>>
[src]
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
user_id: &'a UserId,
request: R
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>>
Expand description
Turn a strongly-typed matrix request into an http::Request
, add a user_id
query
parameter to it and send it to get back a strongly-typed response.
This method is meant to be used by application services when interacting with the client-server API.