pub struct ClientOptions {
pub base_url: Option<String>,
pub timeout: Option<Duration>,
pub max_connections: Option<usize>,
pub region: Option<Region>,
}Expand description
Configuration options for initializing a ClientConfig.
Provides overrides for the default API endpoints, connection settings, and timeouts.
§Examples
use std::time::Duration;
use contentstack_api_client_rs::{ClientOptions, Region};
let opts = ClientOptions {
base_url: Some("https://custom-cdn.contentstack.com".to_string()),
timeout: Some(Duration::from_secs(60)),
max_connections: Some(100),
region: Some(Region::AwsEu),
};Fields§
§base_url: Option<String>Custom base URL for the API requests. If not provided, defaults to the region’s URL.
timeout: Option<Duration>The maximum duration to wait for a request to complete. Defaults to 30 seconds.
max_connections: Option<usize>The maximum number of concurrent connections allowed. Defaults to 50.
region: Option<Region>The geographical region for the Contentstack API. Defaults to AWS North America.
Implementations§
Source§impl ClientOptions
impl ClientOptions
Sourcepub fn get_defaults(client_type: ClientType) -> ClientOptions
pub fn get_defaults(client_type: ClientType) -> ClientOptions
Returns the default configuration options for the given client type.
The defaults are configured to use the AWS North America region, a 30-second timeout, and a maximum of 50 concurrent connections.
§Arguments
client_type- The type of client (Delivery or Management).
§Examples
use contentstack_api_client_rs::client::config::{ClientOptions, ClientType};
let defaults = ClientOptions::get_defaults(ClientType::Delivery);
assert_eq!(defaults.max_connections, Some(50));Trait Implementations§
Source§impl Clone for ClientOptions
impl Clone for ClientOptions
Source§fn clone(&self) -> ClientOptions
fn clone(&self) -> ClientOptions
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 ClientOptions
impl Debug for ClientOptions
Source§impl Default for ClientOptions
impl Default for ClientOptions
Source§fn default() -> ClientOptions
fn default() -> ClientOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ClientOptions
impl RefUnwindSafe for ClientOptions
impl Send for ClientOptions
impl Sync for ClientOptions
impl Unpin for ClientOptions
impl UnsafeUnpin for ClientOptions
impl UnwindSafe for ClientOptions
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