pub trait HttpClient {
type Body: Serialize;
type ApiUrl: AsRef<str>;
type ApiKey: AsRef<str>;
// Required methods
fn api_url(&self) -> &Self::ApiUrl;
fn api_key(&self) -> &Self::ApiKey;
fn body(&self) -> &Self::Body;
// Provided methods
fn http_config(&self) -> Arc<HttpClientConfig> { ... }
fn post(&self) -> impl Future<Output = ZaiResult<Response>> + Send { ... }
fn get(&self) -> impl Future<Output = ZaiResult<Response>> + Send { ... }
}Expand description
Trait for HTTP clients that communicate with the Zhipu AI API.
Required Associated Types§
Required Methods§
fn api_url(&self) -> &Self::ApiUrl
fn api_key(&self) -> &Self::ApiKey
fn body(&self) -> &Self::Body
Provided Methods§
Sourcefn http_config(&self) -> Arc<HttpClientConfig>
fn http_config(&self) -> Arc<HttpClientConfig>
Get HTTP client configuration for this request
Override this method to provide custom configuration. Default implementation returns default configuration.
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.