client: Rename HttpClientExt methods to be much less likely to conflict with inherent methods

This commit is contained in:
Jonas Platte 2021-04-29 00:25:04 +02:00
parent e3beb208e5
commit 23799cb702
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -56,19 +56,19 @@ pub trait DefaultConstructibleHttpClient: HttpClient {
pub trait HttpClientExt: HttpClient { pub trait HttpClientExt: HttpClient {
/// Send a strongly-typed matrix request to get back a strongly-typed response. /// Send a strongly-typed matrix request to get back a strongly-typed response.
// TODO: `R: 'a` bound should not be needed // TODO: `R: 'a` bound should not be needed
fn send_request<'a, R: OutgoingRequest + 'a>( fn send_matrix_request<'a, R: OutgoingRequest + 'a>(
&'a self, &'a self,
homeserver_url: &str, homeserver_url: &str,
access_token: SendAccessToken<'_>, access_token: SendAccessToken<'_>,
request: R, request: R,
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>> { ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>> {
self.send_customized_request(homeserver_url, access_token, request, |_| Ok(())) self.send_customized_matrix_request(homeserver_url, access_token, request, |_| Ok(()))
} }
/// Turn a strongly-typed matrix request into an `http::Request`, customize it and send it to /// Turn a strongly-typed matrix request into an `http::Request`, customize it and send it to
/// get back a strongly-typed response. /// get back a strongly-typed response.
// TODO: `R: 'a` and `F: 'a` should not be needed // TODO: `R: 'a` and `F: 'a` should not be needed
fn send_customized_request<'a, R, F>( fn send_customized_matrix_request<'a, R, F>(
&'a self, &'a self,
homeserver_url: &str, homeserver_url: &str,
access_token: SendAccessToken<'_>, access_token: SendAccessToken<'_>,
@ -93,14 +93,14 @@ pub trait HttpClientExt: HttpClient {
/// ///
/// This method is meant to be used by application services when interacting with the /// This method is meant to be used by application services when interacting with the
/// client-server API. /// client-server API.
fn send_request_as<'a, R: OutgoingRequest + 'a>( fn send_matrix_request_as<'a, R: OutgoingRequest + 'a>(
&'a self, &'a self,
homeserver_url: &str, homeserver_url: &str,
access_token: SendAccessToken<'_>, access_token: SendAccessToken<'_>,
user_id: &'a UserId, user_id: &'a UserId,
request: R, request: R,
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>> { ) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>> {
self.send_customized_request( self.send_customized_matrix_request(
homeserver_url, homeserver_url,
access_token, access_token,
request, request,