pub struct ClientConfig {
pub base_url: String,
pub api_key: String,
pub management_token: String,
pub delivery_token: String,
pub environment: Option<String>,
pub timeout: Duration,
pub max_connections: usize,
pub region: Region,
}Expand description
Finalized configuration used by Contentstack clients.
This struct is typically constructed using ClientConfig::delivery or
ClientConfig::management.
Fields§
§base_url: StringThe base URL used for API requests.
api_key: StringYour Contentstack stack API key.
management_token: StringThe token used for Management API authentication.
delivery_token: StringThe token used for Delivery API authentication.
environment: Option<String>The publishing environment (e.g., “production”). Only used by the Delivery API.
timeout: DurationThe maximum duration to wait for a request to complete.
max_connections: usizeThe maximum number of concurrent connections allowed in the pool.
region: RegionThe geographical region for the API.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn delivery(
api_key: &str,
delivery_token: &str,
environment: &str,
opts: Option<ClientOptions>,
) -> Self
pub fn delivery( api_key: &str, delivery_token: &str, environment: &str, opts: Option<ClientOptions>, ) -> Self
Builds a ClientConfig configured for the Contentstack Delivery API.
Initializes a configuration object using the provided API key, delivery token,
and environment. If opts is None, default settings are applied (AWS NA region,
30-second timeout, 50 max connections).
§Arguments
api_key- Your stack’s API keydelivery_token- Your stack’s delivery token (read-only)environment- The name of the publishing environmentopts- Optional configuration overrides (ClientOptions)
§Examples
use contentstack_api_client_rs::client::config::ClientConfig;
let config = ClientConfig::delivery("api_key", "delivery_token", "production", None);
assert_eq!(config.environment.as_deref(), Some("production"));Sourcepub fn management(
api_key: &str,
management_token: &str,
opts: Option<ClientOptions>,
) -> Self
pub fn management( api_key: &str, management_token: &str, opts: Option<ClientOptions>, ) -> Self
Builds a ClientConfig for the Management API.
Defaults to AWS NA region (https://api.contentstack.io) if no
base_url or region override is provided. Management API requests
do not use an environment, so that field is left empty.
§Arguments
api_key- Your stack’s API keymanagement_token- Stack management tokenopts- Optional configuration overrides (region, timeout, max connections)
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more