pub trait Endpoint {
// Required method
fn path(&self) -> Cow<'static, str>;
// Provided methods
fn ignore_errors(&self) -> bool { ... }
fn method(&self) -> Method { ... }
fn headers(&self) -> Result<Option<HeaderMap>, HeaderError> { ... }
fn query_params(&self) -> Option<QueryParamPairs> { ... }
fn url(&self) -> String { ... }
fn body(&self) -> Result<Option<(Cow<'static, str>, Vec<u8>)>, BodyError> { ... }
fn deserialize<T: DeserializeOwned>(
&self,
response: Response<Bytes>,
) -> Result<T, BodyError> { ... }
}Expand description
A trait for providing the necessary information for a single REST API endpoint
Required Methods§
Provided Methods§
Sourcefn ignore_errors(&self) -> bool
fn ignore_errors(&self) -> bool
Ignores any errors returned by the API.
Sourcefn headers(&self) -> Result<Option<HeaderMap>, HeaderError>
fn headers(&self) -> Result<Option<HeaderMap>, HeaderError>
Any additional headers for the endpoint.
Sourcefn query_params(&self) -> Option<QueryParamPairs>
fn query_params(&self) -> Option<QueryParamPairs>
The query parameters for the endpoint.
Sourcefn body(&self) -> Result<Option<(Cow<'static, str>, Vec<u8>)>, BodyError>
fn body(&self) -> Result<Option<(Cow<'static, str>, Vec<u8>)>, BodyError>
The body for the endpoint.
Returns the Content-Encoding header for the data as well as the data itself.
Sourcefn deserialize<T: DeserializeOwned>(
&self,
response: Response<Bytes>,
) -> Result<T, BodyError>
fn deserialize<T: DeserializeOwned>( &self, response: Response<Bytes>, ) -> Result<T, BodyError>
Deserialize the response bytes.
Defaults to using serde_json::from_slice.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".