pub trait Endpoint {
type Query: Serialize;
type Form: Serialize;
type Response: DeserializeOwned;
// Required methods
fn relative_path(&self) -> Cow<'_, str>;
fn check_status(&self, status: StatusCode) -> Option<ClientError>;
fn de_response<'life0, 'async_trait>(
&'life0 self,
res: Response,
) -> Pin<Box<dyn Future<Output = Result<Self::Response, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn query(&self) -> Option<&Self::Query> { ... }
fn form(&self) -> Option<&Self::Form> { ... }
fn multipart(&self) -> Option<Form> { ... }
fn method(&self) -> Method { ... }
}
Required Associated Types§
Required Methods§
Sourcefn relative_path(&self) -> Cow<'_, str>
fn relative_path(&self) -> Cow<'_, str>
The endpoint relative path. Must start with a /
Sourcefn check_status(&self, status: StatusCode) -> Option<ClientError>
fn check_status(&self, status: StatusCode) -> Option<ClientError>
Check the status code
Sourcefn de_response<'life0, 'async_trait>(
&'life0 self,
res: Response,
) -> Pin<Box<dyn Future<Output = Result<Self::Response, ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn de_response<'life0, 'async_trait>(
&'life0 self,
res: Response,
) -> Pin<Box<dyn Future<Output = Result<Self::Response, ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deserialize the response