pub struct ApiBase {
pub base_url: String,
pub timeout_seconds: u64,
pub max_retries: u32,
}Expand description
Base configuration for API clients
Centralizes HTTP client settings including base URL, timeouts, and retry logic. Designed to support different environments (dev, staging, prod) and provide consistent configuration across all API operations.
§Fields
base_url- The root URL for all API endpointstimeout_seconds- Request timeout in secondsmax_retries- Maximum number of retry attempts for failed requests
Fields§
§base_url: String§timeout_seconds: u64§max_retries: u32Implementations§
Source§impl ApiBase
impl ApiBase
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ApiBase with default configuration
§Returns
An ApiBase instance configured with:
- Base URL:
https://api.terminal-jarvis.dev - Timeout: 30 seconds
- Max retries: 3 attempts
Sourcepub fn with_base_url(self, base_url: &str) -> Self
pub fn with_base_url(self, base_url: &str) -> Self
Sourcepub fn with_timeout(self, timeout_seconds: u64) -> Self
pub fn with_timeout(self, timeout_seconds: u64) -> Self
Sourcepub fn with_max_retries(self, max_retries: u32) -> Self
pub fn with_max_retries(self, max_retries: u32) -> Self
Sourcepub fn endpoint_url(&self, path: &str) -> String
pub fn endpoint_url(&self, path: &str) -> String
Get the full URL for an endpoint
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ApiBase
impl RefUnwindSafe for ApiBase
impl Send for ApiBase
impl Sync for ApiBase
impl Unpin for ApiBase
impl UnwindSafe for ApiBase
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