Struct HttpClient

Source
pub struct HttpClient { /* private fields */ }
Expand description

HTTP client for TACT protocol

Implementations§

Source§

impl HttpClient

Source

pub fn new(region: Region, version: ProtocolVersion) -> Result<Self>

Create a new HTTP client for the specified region and protocol version

Source

pub fn with_shared_pool(region: Region, version: ProtocolVersion) -> Self

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.

Source

pub fn with_client( client: Client, region: Region, version: ProtocolVersion, ) -> Self

Create a new HTTP client with custom reqwest client

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn base_url(&self) -> String

Get the base URL for the current configuration

Source

pub fn region(&self) -> Region

Get the current region

Source

pub fn version(&self) -> ProtocolVersion

Get the current protocol version

Source

pub fn set_region(&mut self, region: Region)

Set the region

Source

pub async fn get_versions(&self, product: &str) -> Result<Response>

Get versions manifest for a product (V1 protocol)

Source

pub async fn get_cdns(&self, product: &str) -> Result<Response>

Get CDN configuration for a product (V1 protocol)

Source

pub async fn get_bgdl(&self, product: &str) -> Result<Response>

Get BGDL manifest for a product (V1 protocol)

Source

pub async fn get_summary(&self) -> Result<Response>

Get product summary (V2 protocol)

Source

pub async fn get_product(&self, product: &str) -> Result<Response>

Get product details (V2 protocol)

Source

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

Source

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

Source

pub async fn get(&self, path: &str) -> Result<Response>

Make a raw GET request to a path

Source

pub async fn download_file( &self, cdn_host: &str, path: &str, hash: &str, ) -> Result<Response>

Download a file from CDN

Source

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 hostname
  • path - Path prefix for the CDN
  • hash - File hash
  • range - 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.

Source

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 hostname
  • path - Path prefix for the CDN
  • hash - File hash
  • ranges - 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.

Source

pub async fn get_versions_parsed( &self, product: &str, ) -> Result<Vec<VersionEntry>>

Get parsed versions manifest for a product

Source

pub async fn get_cdns_parsed(&self, product: &str) -> Result<Vec<CdnEntry>>

Get parsed CDN manifest for a product

Source

pub async fn get_product_versions_http_parsed( &self, product: &str, ) -> Result<Vec<VersionEntry>>

Get parsed product versions using modern HTTP endpoint

Source

pub async fn get_product_cdns_http_parsed( &self, product: &str, ) -> Result<Vec<CdnEntry>>

Get parsed CDN configuration using modern HTTP endpoint

Source

pub async fn get_bgdl_parsed(&self, product: &str) -> Result<Vec<BgdlEntry>>

Get parsed BGDL manifest for a product

Trait Implementations§

Source§

impl Clone for HttpClient

Source§

fn clone(&self) -> HttpClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HttpClient

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,