Trait ruma::client::HttpClientExt
source · pub trait HttpClientExt: HttpClient {
// Provided methods
fn send_matrix_request<'a, R>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
for_versions: &[MatrixVersion],
request: R,
) -> Pin<Box<dyn Future<Output = Result<<R as OutgoingRequest>::IncomingResponse, Error<Self::Error, <R as OutgoingRequest>::EndpointError>>> + Send + 'a>>
where R: OutgoingRequest + 'a { ... }
fn send_customized_matrix_request<'a, R, F>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
for_versions: &[MatrixVersion],
request: R,
customize: F,
) -> Pin<Box<dyn Future<Output = Result<<R as OutgoingRequest>::IncomingResponse, Error<Self::Error, <R as OutgoingRequest>::EndpointError>>> + Send + 'a>>
where R: OutgoingRequest + 'a,
F: FnOnce(&mut Request<Self::RequestBody>) -> Result<(), Error<Self::Error, <R as OutgoingRequest>::EndpointError>> + 'a { ... }
fn send_matrix_request_as<'a, R>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
for_versions: &[MatrixVersion],
user_id: &'a UserId,
request: R,
) -> Pin<Box<dyn Future<Output = Result<<R as OutgoingRequest>::IncomingResponse, Error<Self::Error, <R as OutgoingRequest>::EndpointError>>> + 'a>>
where R: OutgoingRequest + 'a { ... }
}
Available on crate feature
client
only.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§
sourcefn send_matrix_request<'a, R>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
for_versions: &[MatrixVersion],
request: R,
) -> Pin<Box<dyn Future<Output = Result<<R as OutgoingRequest>::IncomingResponse, Error<Self::Error, <R as OutgoingRequest>::EndpointError>>> + Send + 'a>>where
R: OutgoingRequest + 'a,
fn send_matrix_request<'a, R>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
for_versions: &[MatrixVersion],
request: R,
) -> Pin<Box<dyn Future<Output = Result<<R as OutgoingRequest>::IncomingResponse, Error<Self::Error, <R as OutgoingRequest>::EndpointError>>> + Send + 'a>>where
R: OutgoingRequest + 'a,
Send a strongly-typed matrix request to get back a strongly-typed response.
sourcefn send_customized_matrix_request<'a, R, F>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
for_versions: &[MatrixVersion],
request: R,
customize: F,
) -> Pin<Box<dyn Future<Output = Result<<R as OutgoingRequest>::IncomingResponse, Error<Self::Error, <R as OutgoingRequest>::EndpointError>>> + Send + 'a>>where
R: OutgoingRequest + 'a,
F: FnOnce(&mut Request<Self::RequestBody>) -> Result<(), Error<Self::Error, <R as OutgoingRequest>::EndpointError>> + 'a,
fn send_customized_matrix_request<'a, R, F>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
for_versions: &[MatrixVersion],
request: R,
customize: F,
) -> Pin<Box<dyn Future<Output = Result<<R as OutgoingRequest>::IncomingResponse, Error<Self::Error, <R as OutgoingRequest>::EndpointError>>> + Send + 'a>>where
R: OutgoingRequest + 'a,
F: FnOnce(&mut Request<Self::RequestBody>) -> Result<(), Error<Self::Error, <R as OutgoingRequest>::EndpointError>> + 'a,
Turn a strongly-typed matrix request into an http::Request
, customize it and send it to
get back a strongly-typed response.
sourcefn send_matrix_request_as<'a, R>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
for_versions: &[MatrixVersion],
user_id: &'a UserId,
request: R,
) -> Pin<Box<dyn Future<Output = Result<<R as OutgoingRequest>::IncomingResponse, Error<Self::Error, <R as OutgoingRequest>::EndpointError>>> + 'a>>where
R: OutgoingRequest + 'a,
fn send_matrix_request_as<'a, R>(
&'a self,
homeserver_url: &str,
access_token: SendAccessToken<'_>,
for_versions: &[MatrixVersion],
user_id: &'a UserId,
request: R,
) -> Pin<Box<dyn Future<Output = Result<<R as OutgoingRequest>::IncomingResponse, Error<Self::Error, <R as OutgoingRequest>::EndpointError>>> + 'a>>where
R: OutgoingRequest + 'a,
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.
Object Safety§
This trait is not object safe.