pub struct ClientBuilder { /* private fields */ }
Expand description
Builder for creating a Client
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
Set the base URL for the ekoDB server
§Example
use ekodb_client::Client;
let client = Client::builder()
.base_url("https://api.ekodb.net")
.api_key("your-api-key")
.build()?;
Sourcepub fn api_key(self, key: impl Into<String>) -> Self
pub fn api_key(self, key: impl Into<String>) -> Self
Set the API key for authentication
The API key will be exchanged for a JWT token automatically.
§Example
use ekodb_client::Client;
let client = Client::builder()
.base_url("https://api.ekodb.net")
.api_key("your-api-key")
.build()?;
Sourcepub fn api_token(self, token: impl Into<String>) -> Self
👎Deprecated since 0.1.0: Use api_key
instead
pub fn api_token(self, token: impl Into<String>) -> Self
api_key
insteadSet the API token for authentication (alias for api_key for backward compatibility)
Sourcepub fn max_retries(self, retries: usize) -> Self
pub fn max_retries(self, retries: usize) -> Self
Set the maximum number of retry attempts
Default: 3
Sourcepub fn should_retry(self, should_retry: bool) -> Self
pub fn should_retry(self, should_retry: bool) -> Self
Enable or disable automatic retries for rate limiting and transient errors
When enabled (default), the client will automatically retry requests that fail
due to rate limiting (429), service unavailable (503), timeouts, or connection errors.
The retry delay respects the server’s Retry-After
header for rate limits.
When disabled, all errors are returned immediately to the caller for manual handling.
Default: true
§Example
use ekodb_client::Client;
// Disable automatic retries
let client = Client::builder()
.base_url("https://api.ekodb.net")
.api_key("your-api-key")
.should_retry(false)
.build()?;
Trait Implementations§
Source§impl Default for ClientBuilder
impl Default for ClientBuilder
Source§fn default() -> ClientBuilder
fn default() -> ClientBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin 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