pub trait CallEndpoint {
type Args;
type Response;
// Required methods
fn method() -> Method;
fn build_path(args: &Self::Args) -> String;
fn request_body(args: &Self::Args) -> Option<Result<Vec<u8>, ClientError>>;
fn parse_response(bytes: &[u8]) -> Result<Self::Response, ClientError>;
}Expand description
Describes how to call a specific endpoint: what arguments it needs, how to build the URL, and how to parse the response.
Required Associated Types§
Required Methods§
Sourcefn build_path(args: &Self::Args) -> String
fn build_path(args: &Self::Args) -> String
Build the URL path by substituting captures into the pattern.
Sourcefn request_body(args: &Self::Args) -> Option<Result<Vec<u8>, ClientError>>
fn request_body(args: &Self::Args) -> Option<Result<Vec<u8>, ClientError>>
Serialize the request body, if any.
Sourcefn parse_response(bytes: &[u8]) -> Result<Self::Response, ClientError>
fn parse_response(bytes: &[u8]) -> Result<Self::Response, ClientError>
Deserialize the response body.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.