pub struct ClientConfig {
pub api_key: Option<String>,
pub environment: Environment,
pub region: ApiRegion,
pub base_url: Option<String>,
pub recv_window: u32,
pub debug: bool,
pub timeout_ms: u64,
pub referer: Option<String>,
/* private fields */
}Expand description
Client configuration.
Fields§
§api_key: Option<String>API key (required for private endpoints).
environment: EnvironmentEnvironment (production, testnet, demo).
region: ApiRegionAPI region for production.
base_url: Option<String>Custom base URL (overrides environment/region).
recv_window: u32Request validity window in milliseconds.
debug: boolEnable request/response logging.
timeout_ms: u64Request timeout in milliseconds.
referer: Option<String>Referer header value.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn new(api_key: impl Into<String>, api_secret: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>, api_secret: impl Into<String>) -> Self
Create a new configuration with API credentials.
Sourcepub fn public_only() -> Self
pub fn public_only() -> Self
Create a configuration for public endpoints only (no authentication).
Sourcepub fn environment(self, env: Environment) -> Self
pub fn environment(self, env: Environment) -> Self
Set the environment.
Sourcepub fn recv_window(self, ms: u32) -> Self
pub fn recv_window(self, ms: u32) -> Self
Set the recv_window value.
Sourcepub fn timeout_ms(self, ms: u64) -> Self
pub fn timeout_ms(self, ms: u64) -> Self
Set request timeout.
Sourcepub fn get_rest_url(&self) -> &str
pub fn get_rest_url(&self) -> &str
Get the effective REST API base URL.
Sourcepub fn get_ws_public_url(&self, category: Category) -> String
pub fn get_ws_public_url(&self, category: Category) -> String
Get the WebSocket URL for public streams.
Sourcepub fn get_ws_private_url(&self) -> &'static str
pub fn get_ws_private_url(&self) -> &'static str
Get the WebSocket URL for private streams.
Sourcepub fn get_ws_trade_url(&self) -> &'static str
pub fn get_ws_trade_url(&self) -> &'static str
Get the WebSocket URL for trade API.
Sourcepub fn has_credentials(&self) -> bool
pub fn has_credentials(&self) -> bool
Check if authentication is configured.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
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 ClientConfig
impl Debug for ClientConfig
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnwindSafe for ClientConfig
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