Skip to main content

HttpClientExt

Trait HttpClientExt 

Source
pub trait HttpClientExt: HttpClient {
    // Provided methods
    fn send_matrix_request<'a, R>(
        &'a self,
        homeserver_url: &str,
        access_token: SendAccessToken<'a>,
        path_builder_input: <R::PathBuilder as PathBuilder>::Input<'_>,
        request: R,
    ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + Send + 'a>>
       where R: OutgoingRequest,
             R::Authentication: AuthScheme<Input<'a> = SendAccessToken<'a>> { ... }
    fn send_customized_matrix_request<'a, R, F>(
        &'a self,
        homeserver_url: &str,
        access_token: SendAccessToken<'a>,
        path_builder_input: <R::PathBuilder as PathBuilder>::Input<'_>,
        request: R,
        customize: F,
    ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + Send + 'a>>
       where R: OutgoingRequest,
             R::Authentication: AuthScheme<Input<'a> = SendAccessToken<'a>>,
             F: FnOnce(&mut Request<Self::RequestBody>) -> Result<(), ResponseError<Self, R>> { ... }
    fn send_matrix_request_as<'a, R>(
        &'a self,
        homeserver_url: &str,
        access_token: SendAccessToken<'a>,
        path_builder_input: <R::PathBuilder as PathBuilder>::Input<'_>,
        identity: AppserviceUserIdentity<'a>,
        request: R,
    ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>>
       where R: OutgoingRequest,
             R::Authentication: AuthScheme<Input<'a> = SendAccessToken<'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>( &'a self, homeserver_url: &str, access_token: SendAccessToken<'a>, path_builder_input: <R::PathBuilder as PathBuilder>::Input<'_>, 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<'a>, path_builder_input: <R::PathBuilder as PathBuilder>::Input<'_>, request: R, customize: F, ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + Send + 'a>>
where R: OutgoingRequest, R::Authentication: AuthScheme<Input<'a> = SendAccessToken<'a>>, F: FnOnce(&mut Request<Self::RequestBody>) -> Result<(), ResponseError<Self, R>>,

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>( &'a self, homeserver_url: &str, access_token: SendAccessToken<'a>, path_builder_input: <R::PathBuilder as PathBuilder>::Input<'_>, identity: AppserviceUserIdentity<'a>, request: R, ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>>

Turn a strongly-typed matrix request into an http::Request, add user_id and/or device_id query parameters 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§