Trait cargo_api::api::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§