[][src]Trait ruma_api::OutgoingRequest

pub trait OutgoingRequest {
    type EndpointError: EndpointError;
    type IncomingResponse: TryFrom<Response<Vec<u8>>, Error = FromHttpResponseError<Self::EndpointError>>;

    pub const METADATA: Metadata;

    pub fn try_into_http_request(
        self,
        base_url: &str,
        access_token: Option<&str>
    ) -> Result<Request<Vec<u8>>, IntoHttpError>; }

A request type for a Matrix API endpoint. (trait used for sending requests)

Associated Types

type EndpointError: EndpointError[src]

A type capturing the expected error conditions the server can return.

type IncomingResponse: TryFrom<Response<Vec<u8>>, Error = FromHttpResponseError<Self::EndpointError>>[src]

Response type returned when the request is successful.

Loading content...

Associated Constants

pub const METADATA: Metadata[src]

Metadata about the endpoint.

Loading content...

Required methods

pub fn try_into_http_request(
    self,
    base_url: &str,
    access_token: Option<&str>
) -> Result<Request<Vec<u8>>, IntoHttpError>
[src]

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.

Loading content...

Implementors

Loading content...