pub trait HttpClientExt: HttpClient {
    // Provided methods
    fn send_matrix_request<'a, R: OutgoingRequest + 'a>(
        &'a self,
        homeserver_url: &str,
        access_token: SendAccessToken<'_>,
        for_versions: &[MatrixVersion],
        request: R
    ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + Send + '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 = ResponseResult<Self, R>> + Send + '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<'_>,
        for_versions: &[MatrixVersion],
        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§

source

fn send_matrix_request<'a, R: OutgoingRequest + 'a>( &'a self, homeserver_url: &str, access_token: SendAccessToken<'_>, for_versions: &[MatrixVersion], request: R ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + Send + 'a>>

Send a strongly-typed matrix request to get back a strongly-typed response.

source

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 = ResponseResult<Self, R>> + Send + 'a>>
where R: OutgoingRequest + 'a, F: FnOnce(&mut Request<Self::RequestBody>) -> Result<(), ResponseError<Self, R>> + 'a,

Turn a strongly-typed matrix request into an http::Request, customize it and send it to get back a strongly-typed response.

source

fn send_matrix_request_as<'a, R: OutgoingRequest + 'a>( &'a self, homeserver_url: &str, access_token: SendAccessToken<'_>, for_versions: &[MatrixVersion], user_id: &'a UserId, request: R ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + '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.

Implementors§