1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! # HTTP Client Module
//!
//! Provides HTTP client infrastructure for communicating with the Zhipu AI API,
//! including request dispatch, response parsing, connection pooling, automatic
//! retries, and comprehensive error handling.
//!
//! # Core Components
//!
//! - [`http`] — HTTP client implementation supporting POST/GET/DELETE requests,
//! connection reuse, exponential-backoff retries, and sensitive-data masking
//! - [`error`] — Unified error type [`ZaiError`] covering API, network,
//! serialization, validation, and retry-exhausted errors
//! - [`wss`] — WebSocket Secure connection support (for real-time audio/video)
//!
//! # Retry Strategy
//!
//! The HTTP client ships a configurable retry mechanism:
//!
//! - **Exponential backoff** — default; delay doubles after each attempt
//! - **Fixed delay** — constant interval between retries
//! - **Random jitter** — adds randomness on top of backoff to avoid thundering
//! herds
//! - **Configurable limits** — max retries and overall timeout are customizable
//!
//! ```rust,ignore
//! use zai_rs::client::http::HttpClientConfig;
//! use std::time::Duration;
//!
//! let config = HttpClientConfig::builder()
//! .max_retries(5)
//! .timeout(Duration::from_secs(120))
//! .build();
//! ```
//!
//! # Security
//!
//! - API keys are automatically masked in logs via
//! [`mask_sensitive_info`](error::mask_sensitive_info)
//! - Structured logging of requests/responses through `tracing`
//! - Bearer token authentication on every request
pub use *;
pub use *;