pub struct Config {
pub base_url: Url,
pub timeout_secs: u64,
pub user_agent: String,
pub enable_logging: bool,
}Expand description
Client configuration
Configuration options for the Noah SDK client, including base URL, timeout, user agent, and logging settings.
§Examples
use noah_sdk::{Config, Environment};
// Default configuration
let config = Config::new(Environment::Sandbox);
// Custom configuration
let config = Config::new(Environment::Production)
.with_timeout(60)
.with_user_agent("my-app/1.0".to_string())
.with_logging(true);Fields§
§base_url: UrlBase URL for API requests
timeout_secs: u64Request timeout in seconds
user_agent: StringUser agent string
enable_logging: boolEnable request/response logging
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(environment: Environment) -> Self
pub fn new(environment: Environment) -> Self
Create a new configuration with default values
Creates a configuration with:
- Base URL from the environment
- 30 second timeout
- Default user agent (includes SDK version)
- Logging disabled
§Arguments
environment- The environment to use (Sandbox, Production, or Custom)
§Examples
use noah_sdk::{Config, Environment};
let config = Config::new(Environment::Sandbox);Sourcepub fn with_timeout(self, timeout_secs: u64) -> Self
pub fn with_timeout(self, timeout_secs: u64) -> Self
Sourcepub fn with_user_agent(self, user_agent: String) -> Self
pub fn with_user_agent(self, user_agent: String) -> Self
Sourcepub fn with_logging(self, enable: bool) -> Self
pub fn with_logging(self, enable: bool) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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