Skip to main content

PostBinary

Trait PostBinary 

Source
pub trait PostBinary:
    Post
    + Serialize
    + Sync
    + Send {
    // Provided method
    fn get_response_bytes(
        &self,
        client: &Client,
        base_url: &str,
        api_key: &str,
    ) -> impl Future<Output = Result<Vec<u8>, OapiError>> + Send + Sync { ... }
}
Expand description

Trait for POST requests whose response body is binary rather than JSON.

Endpoints such as POST /audio/speech return the raw audio bytes instead of a JSON object, so the body is returned as raw bytes.

Provided Methods§

Source

fn get_response_bytes( &self, client: &Client, base_url: &str, api_key: &str, ) -> impl Future<Output = Result<Vec<u8>, OapiError>> + Send + Sync

Sends a POST request with a JSON body and returns the raw response body bytes.

The client is supplied by the caller; see crate::rest::default_client for a sensible default.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§