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()?;Sourcepub fn serialization_format(self, format: SerializationFormat) -> Self
pub fn serialization_format(self, format: SerializationFormat) -> Self
Set the serialization format for client-server communication
Supports JSON (default, human-readable) and MessagePack (binary, faster). MessagePack can provide 2-3x performance improvement over JSON.
Default: JSON
§Example
use ekodb_client::{Client, SerializationFormat};
// Use MessagePack for better performance
let client = Client::builder()
.base_url("https://api.ekodb.net")
.api_key("your-api-key")
.serialization_format(SerializationFormat::MessagePack)
.build()?;