pub struct ClientBuilder { /* private fields */ }Expand description
Builder for IronflowClient with retry and rate-limit configuration.
§Examples
use ironflow_sdk::ClientBuilder;
let client = ClientBuilder::new("https://ironflow.example.com", "my-api-key")
.with_max_retries(5)
.with_rate_limit(false)
.build();Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new(base_url: &str, api_key: &str) -> Self
pub fn new(base_url: &str, api_key: &str) -> Self
Create a builder with defaults (3 retries, rate-limit enabled).
§Examples
use ironflow_sdk::ClientBuilder;
let builder = ClientBuilder::new("https://ironflow.example.com", "key");Sourcepub fn with_max_retries(self, n: u32) -> Self
pub fn with_max_retries(self, n: u32) -> Self
Set the maximum number of retry attempts.
§Examples
use ironflow_sdk::ClientBuilder;
let client = ClientBuilder::new("https://ironflow.example.com", "key")
.with_max_retries(5)
.build();Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the HTTP request timeout.
§Examples
use ironflow_sdk::ClientBuilder;
use std::time::Duration;
let client = ClientBuilder::new("https://ironflow.example.com", "key")
.with_timeout(Duration::from_secs(60))
.build();Sourcepub fn with_rate_limit(self, enabled: bool) -> Self
pub fn with_rate_limit(self, enabled: bool) -> Self
Enable or disable client-side rate limiting.
When enabled (the default), the client waits for the Retry-After
window to expire before sending the next request after a 429.
§Examples
use ironflow_sdk::ClientBuilder;
let client = ClientBuilder::new("https://ironflow.example.com", "key")
.with_rate_limit(false)
.build();Sourcepub fn build(self) -> IronflowClient
pub fn build(self) -> IronflowClient
Build the IronflowClient.
§Panics
Panics if the API key contains characters invalid for HTTP headers.
§Examples
use ironflow_sdk::ClientBuilder;
let client = ClientBuilder::new("https://ironflow.example.com", "key").build();Auto Trait Implementations§
impl Freeze for ClientBuilder
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin for ClientBuilder
impl UnwindSafe for ClientBuilder
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