Trait ruma_api::OutgoingRequest [−][src]
pub trait OutgoingRequest: Sized { type EndpointError: EndpointError; type IncomingResponse: IncomingResponse<EndpointError = Self::EndpointError>; const METADATA: Metadata; fn try_into_http_request<T: Default + BufMut>(
self,
base_url: &str,
access_token: SendAccessToken<'_>
) -> Result<Request<T>, IntoHttpError>; }
Expand description
A request type for a Matrix API endpoint, used for sending requests.
Associated Types
A type capturing the expected error conditions the server can return.
type IncomingResponse: IncomingResponse<EndpointError = Self::EndpointError>
type IncomingResponse: IncomingResponse<EndpointError = Self::EndpointError>
Response type returned when the request is successful.
Associated Constants
Required methods
fn try_into_http_request<T: Default + BufMut>(
self,
base_url: &str,
access_token: SendAccessToken<'_>
) -> Result<Request<T>, IntoHttpError>
fn try_into_http_request<T: Default + BufMut>(
self,
base_url: &str,
access_token: SendAccessToken<'_>
) -> Result<Request<T>, IntoHttpError>
Tries to convert this request into an http::Request
.
This method should only fail when called on endpoints that require authentication. It may also fail with a serialization error in case of bugs in Ruma though.
The endpoints path will be appended to the given base_url
, for example
https://matrix.org
. Since all paths begin with a slash, it is not necessary for the
base_url
to have a trailing slash. If it has one however, it will be ignored.