pub struct BrowsrClientConfig {
pub base_url: String,
pub api_key: Option<String>,
pub bearer_token: Option<String>,
pub timeout_secs: u64,
pub retry_attempts: u32,
pub headless: Option<bool>,
}Expand description
Configuration for the Browsr client.
Fields§
§base_url: StringBase URL of the Browsr server
api_key: Option<String>Optional API key for authentication
bearer_token: Option<String>Optional bearer token for authentication
timeout_secs: u64Request timeout in seconds (default: 60)
retry_attempts: u32Number of retry attempts for failed requests (default: 3)
headless: Option<bool>Default headless mode for browser sessions
Implementations§
Source§impl BrowsrClientConfig
impl BrowsrClientConfig
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Create a new config with the specified base URL.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create a config from environment variables.
BROWSR_BASE_URLorBROWSR_API_URL: Base URL (defaults tohttps://api.browsr.dev)BROWSR_API_KEY: Optional API keyBROWSR_BEARER_TOKEN: Optional JWT bearer tokenBROWSR_HOST/BROWSR_PORT: Alternative local server specification
Sourcepub fn with_api_key(self, api_key: impl Into<String>) -> Self
pub fn with_api_key(self, api_key: impl Into<String>) -> Self
Set the API key for authentication.
Sourcepub fn with_bearer_token(self, bearer_token: impl Into<String>) -> Self
pub fn with_bearer_token(self, bearer_token: impl Into<String>) -> Self
Set the bearer token for authentication.
Sourcepub fn with_timeout(self, timeout_secs: u64) -> Self
pub fn with_timeout(self, timeout_secs: u64) -> Self
Set the request timeout in seconds.
Sourcepub fn with_retries(self, retry_attempts: u32) -> Self
pub fn with_retries(self, retry_attempts: u32) -> Self
Set the number of retry attempts.
Sourcepub fn with_headless(self, headless: bool) -> Self
pub fn with_headless(self, headless: bool) -> Self
Set the default headless mode.
Sourcepub fn is_local(&self) -> bool
pub fn is_local(&self) -> bool
Check if the client is configured for local development (localhost).
Sourcepub fn build_http_client(&self) -> Result<Client, Error>
pub fn build_http_client(&self) -> Result<Client, Error>
Build a reqwest client with the configured settings.
Trait Implementations§
Source§impl Clone for BrowsrClientConfig
impl Clone for BrowsrClientConfig
Source§fn clone(&self) -> BrowsrClientConfig
fn clone(&self) -> BrowsrClientConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BrowsrClientConfig
impl Debug for BrowsrClientConfig
Source§impl Default for BrowsrClientConfig
impl Default for BrowsrClientConfig
Source§impl<'de> Deserialize<'de> for BrowsrClientConfig
impl<'de> Deserialize<'de> for BrowsrClientConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BrowsrClientConfig
impl RefUnwindSafe for BrowsrClientConfig
impl Send for BrowsrClientConfig
impl Sync for BrowsrClientConfig
impl Unpin for BrowsrClientConfig
impl UnsafeUnpin for BrowsrClientConfig
impl UnwindSafe for BrowsrClientConfig
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