Skip to main content

deepstore_server_client/
lib.rs

1//! Generated client for deepstore-server control plane API.
2//! Code is produced at build time by progenitor into `$OUT_DIR/codegen.rs`.
3
4include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
5
6impl Client {
7    /// Create an authenticated client using a bearer token.
8    pub fn new_authenticated(base_url: &str, token: &str, timeout: std::time::Duration) -> Self {
9        let mut headers = reqwest::header::HeaderMap::new();
10        headers.insert(
11            reqwest::header::AUTHORIZATION,
12            reqwest::header::HeaderValue::from_str(&format!("Bearer {}", token))
13                .expect("Invalid authorization token"),
14        );
15        let http_client = reqwest::Client::builder()
16            .default_headers(headers)
17            .timeout(timeout)
18            .build()
19            .expect("Failed to build HTTP client");
20        Self::new_with_client(base_url, http_client)
21    }
22}