Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient: Send + Sync {
    type Error: Send + Error;

    // Required methods
    fn get<T>(
        &self,
        url: Url,
        credentials: &BmcCredentials,
        etag: Option<ODataETag>,
        custom_headers: &HeaderMap,
    ) -> impl Future<Output = Result<T, Self::Error>> + Send
       where T: DeserializeOwned + Send + Sync;
    fn post<B, T>(
        &self,
        url: Url,
        body: &B,
        credentials: &BmcCredentials,
        custom_headers: &HeaderMap,
    ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
       where B: Serialize + Send + Sync,
             T: DeserializeOwned + Send + Sync;
    fn patch<B, T>(
        &self,
        url: Url,
        etag: ODataETag,
        body: &B,
        credentials: &BmcCredentials,
        custom_headers: &HeaderMap,
    ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
       where B: Serialize + Send + Sync,
             T: DeserializeOwned + Send + Sync;
    fn delete<T>(
        &self,
        url: Url,
        credentials: &BmcCredentials,
        custom_headers: &HeaderMap,
    ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
       where T: DeserializeOwned + Send + Sync;
    fn sse<T>(
        &self,
        url: Url,
        credentials: &BmcCredentials,
        custom_headers: &HeaderMap,
    ) -> impl Future<Output = Result<Pin<Box<dyn TryStream<Ok = T, Error = Self::Error, Item = Result<T, Self::Error>> + Send>>, Self::Error>> + Send
       where T: for<'a> Deserialize<'a> + Send + 'static;
}

Required Associated Types§

Required Methods§

Source

fn get<T>( &self, url: Url, credentials: &BmcCredentials, etag: Option<ODataETag>, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<T, Self::Error>> + Send
where T: DeserializeOwned + Send + Sync,

Perform an HTTP GET request with optional conditional headers.

Source

fn post<B, T>( &self, url: Url, body: &B, credentials: &BmcCredentials, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send

Perform an HTTP POST request.

Source

fn patch<B, T>( &self, url: Url, etag: ODataETag, body: &B, credentials: &BmcCredentials, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send

Perform an HTTP PATCH request.

Source

fn delete<T>( &self, url: Url, credentials: &BmcCredentials, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<ModificationResponse<T>, Self::Error>> + Send
where T: DeserializeOwned + Send + Sync,

Perform an HTTP DELETE request.

Source

fn sse<T>( &self, url: Url, credentials: &BmcCredentials, custom_headers: &HeaderMap, ) -> impl Future<Output = Result<Pin<Box<dyn TryStream<Ok = T, Error = Self::Error, Item = Result<T, Self::Error>> + Send>>, Self::Error>> + Send
where T: for<'a> Deserialize<'a> + Send + 'static,

Open an SSE stream

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.

Implementors§