pub struct HttpClient {
pub(crate) client: Client,
config: HttpConfig,
}Expand description
Enhanced HTTP client with retry logic and error classification
Fields§
§client: Client§config: HttpConfigImplementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new(config: HttpConfig) -> Result<Self, String>
pub fn new(config: HttpConfig) -> Result<Self, String>
Create a new HTTP client with default configuration
Sourcefn get_device_name() -> &'static str
fn get_device_name() -> &'static str
Get device name based on platform
Sourcepub fn build_auth_header(access_token: Option<&str>, device_id: &str) -> String
pub fn build_auth_header(access_token: Option<&str>, device_id: &str) -> String
Build the X-Emby-Authorization header value
Sourcepub fn classify_error(error: &Error) -> ErrorKind
pub fn classify_error(error: &Error) -> ErrorKind
Classify an error for retry logic
Sourcepub fn should_retry(error: &Error) -> bool
pub fn should_retry(error: &Error) -> bool
Check if a request should be retried based on the error
Sourcepub async fn request_with_retry(
&self,
request: Request,
) -> Result<Response, Error>
pub async fn request_with_retry( &self, request: Request, ) -> Result<Response, Error>
Make a request with automatic retry on network errors
Sourcepub async fn get_json_fast<T: DeserializeOwned>(
&self,
url: &str,
) -> Result<T, String>
pub async fn get_json_fast<T: DeserializeOwned>( &self, url: &str, ) -> Result<T, String>
Make a GET request and deserialize JSON with a short timeout and no retries.
Intended for the initial “connect to server” probe on the login screen: a wrong/unreachable URL must fail fast instead of burning through the default 30s-per-attempt timeout and exponential backoff retries.
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HttpClient
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin for HttpClient
impl !UnwindSafe for HttpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more