Trait http_endpoint::Endpoint [−][src]
pub trait Endpoint { type Input; type Output; type Error: Error + From<HttpError> + From<Self::ConversionError> + 'static; type ConversionError: Error; type ApiError: Error; fn path(input: &Self::Input) -> Str; fn parse(body: &[u8]) -> Result<Self::Output, Self::ConversionError>; fn parse_err(body: &[u8]) -> Result<Self::ApiError, Vec<u8>>; fn base_url() -> Option<Str> { ... } fn method() -> Method { ... } fn query(input: &Self::Input) -> Result<Option<Str>, Self::ConversionError> { ... } fn headers(
input: &Self::Input
) -> Result<Option<HeaderMap>, Self::ConversionError> { ... } fn body(input: &Self::Input) -> Result<Option<Bytes>, Self::ConversionError> { ... } }
Expand description
A trait describing an HTTP endpoint.
An endpoint for our intents and purposes is basically a path and an
HTTP request method (e.g., GET or POST). The path will be combined
with an “authority” (scheme, host, and port) into a full URL. Query
parameters are supported as well.
An endpoint is used by the Trader
who invokes the various methods.
Associated Types
Required methods
Provided methods
fn base_url() -> Option<Str>
[src]
fn base_url() -> Option<Str>
[src]Retrieve the base URL to use.
By default no URL is provided for the endpoint, in which case it is the client’s responsibility to supply one.