Trait Client

Source
pub trait Client {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn base_endpoint(&self, path: &str) -> Result<Url, ApiError<Self::Error>>;
    fn send(
        &self,
        request_builder: Builder,
        body: Vec<u8>,
    ) -> Result<Response<Bytes>, ApiError<Self::Error>>;
}
Expand description

Http api trait for cargo-api.

§Credits

Inspired by Ben Boeckel’s blog post titled “Designing Rust bindings for REST APIs”.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn base_endpoint(&self, path: &str) -> Result<Url, ApiError<Self::Error>>

Source

fn send( &self, request_builder: Builder, body: Vec<u8>, ) -> Result<Response<Bytes>, ApiError<Self::Error>>

Implementors§