pub struct HttpClient { /* private fields */ }
Expand description
HTTP client for TACT protocol
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new(region: Region, version: ProtocolVersion) -> Result<Self>
pub fn new(region: Region, version: ProtocolVersion) -> Result<Self>
Create a new HTTP client for the specified region and protocol version
Create a new HTTP client using the global connection pool
This provides better performance than new()
by reusing connections across
multiple HttpClient instances. Recommended for production use.
Sourcepub fn with_client(
client: Client,
region: Region,
version: ProtocolVersion,
) -> Self
pub fn with_client( client: Client, region: Region, version: ProtocolVersion, ) -> Self
Create a new HTTP client with custom reqwest client
Sourcepub fn with_max_retries(self, max_retries: u32) -> Self
pub fn with_max_retries(self, max_retries: u32) -> Self
Set the maximum number of retries for failed requests
Default is 0 (no retries) to maintain backward compatibility. Only network and connection errors are retried, not parsing errors.
Sourcepub fn with_initial_backoff_ms(self, initial_backoff_ms: u64) -> Self
pub fn with_initial_backoff_ms(self, initial_backoff_ms: u64) -> Self
Set the initial backoff duration in milliseconds
Default is 100ms. This is the base delay before the first retry.
Sourcepub fn with_max_backoff_ms(self, max_backoff_ms: u64) -> Self
pub fn with_max_backoff_ms(self, max_backoff_ms: u64) -> Self
Set the maximum backoff duration in milliseconds
Default is 10,000ms (10 seconds). Backoff will not exceed this value.
Sourcepub fn with_backoff_multiplier(self, backoff_multiplier: f64) -> Self
pub fn with_backoff_multiplier(self, backoff_multiplier: f64) -> Self
Set the backoff multiplier
Default is 2.0. The backoff duration is multiplied by this value after each retry.
Sourcepub fn with_jitter_factor(self, jitter_factor: f64) -> Self
pub fn with_jitter_factor(self, jitter_factor: f64) -> Self
Set the jitter factor (0.0 to 1.0)
Default is 0.1 (10% jitter). Adds randomness to prevent thundering herd.
Sourcepub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
pub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
Set a custom user agent string
If not set, reqwest’s default user agent will be used.
Sourcepub fn version(&self) -> ProtocolVersion
pub fn version(&self) -> ProtocolVersion
Get the current protocol version
Sourcepub fn set_region(&mut self, region: Region)
pub fn set_region(&mut self, region: Region)
Set the region
Sourcepub async fn get_versions(&self, product: &str) -> Result<Response>
pub async fn get_versions(&self, product: &str) -> Result<Response>
Get versions manifest for a product (V1 protocol)
Sourcepub async fn get_cdns(&self, product: &str) -> Result<Response>
pub async fn get_cdns(&self, product: &str) -> Result<Response>
Get CDN configuration for a product (V1 protocol)
Sourcepub async fn get_bgdl(&self, product: &str) -> Result<Response>
pub async fn get_bgdl(&self, product: &str) -> Result<Response>
Get BGDL manifest for a product (V1 protocol)
Sourcepub async fn get_summary(&self) -> Result<Response>
pub async fn get_summary(&self) -> Result<Response>
Get product summary (V2 protocol)
Sourcepub async fn get_product(&self, product: &str) -> Result<Response>
pub async fn get_product(&self, product: &str) -> Result<Response>
Get product details (V2 protocol)
Sourcepub async fn get_product_versions_http(&self, product: &str) -> Result<Response>
pub async fn get_product_versions_http(&self, product: &str) -> Result<Response>
Get product versions using modern HTTP endpoint (V2 protocol) Uses the primary endpoint: https://us.version.battle.net/wow/versions
Sourcepub async fn get_product_cdns_http(&self, product: &str) -> Result<Response>
pub async fn get_product_cdns_http(&self, product: &str) -> Result<Response>
Get CDN information using modern HTTP endpoint (V2 protocol) Uses the primary endpoint: https://us.version.battle.net/wow/cdns
Sourcepub async fn download_file(
&self,
cdn_host: &str,
path: &str,
hash: &str,
) -> Result<Response>
pub async fn download_file( &self, cdn_host: &str, path: &str, hash: &str, ) -> Result<Response>
Download a file from CDN
Sourcepub async fn download_file_range(
&self,
cdn_host: &str,
path: &str,
hash: &str,
range: (u64, Option<u64>),
) -> Result<Response>
pub async fn download_file_range( &self, cdn_host: &str, path: &str, hash: &str, range: (u64, Option<u64>), ) -> Result<Response>
Download a file from CDN with HTTP range request for partial content
§Arguments
cdn_host
- CDN hostnamepath
- Path prefix for the CDNhash
- File hashrange
- Byte range to download (e.g., (0, Some(1023)) for first 1024 bytes)
§Returns
Returns a response with the requested byte range. The response will have status 206 (Partial Content) if the range is supported, or status 200 (OK) with full content if range requests are not supported.
Sourcepub async fn download_file_multirange(
&self,
cdn_host: &str,
path: &str,
hash: &str,
ranges: &[(u64, Option<u64>)],
) -> Result<Response>
pub async fn download_file_multirange( &self, cdn_host: &str, path: &str, hash: &str, ranges: &[(u64, Option<u64>)], ) -> Result<Response>
Download multiple ranges from a file in a single request
§Arguments
cdn_host
- CDN hostnamepath
- Path prefix for the CDNhash
- File hashranges
- Multiple byte ranges to download
§Note
Multi-range requests return multipart/byteranges content type that needs special parsing. Use with caution - not all CDN servers support this.
Sourcepub async fn get_versions_parsed(
&self,
product: &str,
) -> Result<Vec<VersionEntry>>
pub async fn get_versions_parsed( &self, product: &str, ) -> Result<Vec<VersionEntry>>
Get parsed versions manifest for a product
Sourcepub async fn get_cdns_parsed(&self, product: &str) -> Result<Vec<CdnEntry>>
pub async fn get_cdns_parsed(&self, product: &str) -> Result<Vec<CdnEntry>>
Get parsed CDN manifest for a product
Sourcepub async fn get_product_versions_http_parsed(
&self,
product: &str,
) -> Result<Vec<VersionEntry>>
pub async fn get_product_versions_http_parsed( &self, product: &str, ) -> Result<Vec<VersionEntry>>
Get parsed product versions using modern HTTP endpoint
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more