pub trait Endpoint {
    type QueryParams: Serialize;
    type RequestBody: Serialize;
    type ResponseBody: DeserializeOwned + Debug;

    // Required method
    fn path(&self) -> Cow<'_, str>;

    // Provided methods
    fn headers(&self) -> HttpRequestHeaders { ... }
    fn query(&self) -> Option<Self::QueryParams> { ... }
    fn request_body(&self) -> Option<Self::RequestBody> { ... }
    fn request_method(&self) -> Method { ... }
    fn request_strategy(&self) -> RequestStrategy { ... }
    fn auth_strategy(&self) -> AuthStrategy { ... }
    fn request_url(&self, environment: Environment) -> Url { ... }
}

Required Associated Types§

source

type QueryParams: Serialize

The query parameters the endpoint accepts.

source

type RequestBody: Serialize

The request body the endpoint accepts.

source

type ResponseBody: DeserializeOwned + Debug

The response body the endpoint returns.

Required Methods§

source

fn path(&self) -> Cow<'_, str>

The path of the endpoint. Not including the base URL.

Provided Methods§

source

fn headers(&self) -> HttpRequestHeaders

The headers to send with the request.

source

fn query(&self) -> Option<Self::QueryParams>

The query parameters to send with the request.

source

fn request_body(&self) -> Option<Self::RequestBody>

The request body to send with the request.

source

fn request_method(&self) -> Method

The HTTP method to use for the request.

source

fn request_strategy(&self) -> RequestStrategy

The request strategy to use.

source

fn auth_strategy(&self) -> AuthStrategy

The authorization strategy to use.

source

fn request_url(&self, environment: Environment) -> Url

The URL to send the request to. DO NOT OVERRIDE THIS METHOD.

Implementors§