Skip to main content

edgequake_sdk/
config.rs

1//! Configuration types for the EdgeQuake SDK.
2
3use std::time::Duration;
4
5/// Client configuration with sensible defaults.
6#[derive(Clone, Debug)]
7pub struct ClientConfig {
8    pub base_url: String,
9    pub timeout: Duration,
10    pub connect_timeout: Duration,
11    pub max_retries: u32,
12    pub retry_backoff: Duration,
13    pub user_agent: String,
14}
15
16impl Default for ClientConfig {
17    fn default() -> Self {
18        Self {
19            base_url: "http://localhost:8080".to_string(),
20            timeout: Duration::from_secs(30),
21            connect_timeout: Duration::from_secs(5),
22            max_retries: 3,
23            retry_backoff: Duration::from_millis(500),
24            user_agent: format!("edgequake-rust/{}", env!("CARGO_PKG_VERSION")),
25        }
26    }
27}
28
29/// Authentication method.
30#[derive(Clone, Debug, Default)]
31pub enum Auth {
32    /// No authentication.
33    #[default]
34    None,
35    /// API key (sent as `Authorization: Bearer <key>`).
36    ApiKey(String),
37    /// JWT bearer token.
38    Bearer(String),
39}
40
41/// Multi-tenant context.
42#[derive(Clone, Debug, Default)]
43pub struct TenantContext {
44    pub tenant_id: Option<String>,
45    pub user_id: Option<String>,
46    pub workspace_id: Option<String>,
47}