Skip to main content

ebbmem_client_generated/apis/
health_api.rs

1/*
2 * Ebb Memory Engine API
3 *
4 * Production cognitive memory engine and multi-transport gateway for autonomous AI agents. Features continuous mass-dilated logarithmic decay, Hebbian co-activation networks, off-heap mmap storage, and unified enterprise security.  Canonical public HTTP contract for Ebb client SDKs. Generated from the hosted FastAPI application. Excludes internal and admin routes (`/api/v1/admin/_**`, `/metrics`, `/mcp`). Protected operations require `Authorization: Bearer <token>` (security scheme `HTTPBearer`). The same routes accept an optional `X-API-Key` header and `X-Ebb-Namespace` to select a namespace. Error responses use the `ErrorResponse` envelope (`code`, `message`, `details`) plus FastAPI's `HTTPValidationError` for 422.  SDK subset of the Ebb HTTP contract. Includes Memory, Tasks, Events, and Health. Omits admin, runtime config, provider probes, registration, password reset, and SSO.
5 *
6 * The version of the OpenAPI document: 0.2.0
7 * Contact: maintainers@spectrayan.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`health`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum HealthError {
22    Status400(models::ErrorResponse),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`ready`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum ReadyError {
30    Status400(models::ErrorResponse),
31    UnknownValue(serde_json::Value),
32}
33
34
35/// Liveness probe endpoint.
36pub async fn health(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<HealthError>> {
37
38    let uri_str = format!("{}/healthz", configuration.base_path);
39    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
40
41    if let Some(ref user_agent) = configuration.user_agent {
42        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
43    }
44
45    let req = req_builder.build()?;
46    let resp = configuration.client.execute(req).await?;
47
48    let status = resp.status();
49    let content_type = resp
50        .headers()
51        .get("content-type")
52        .and_then(|v| v.to_str().ok())
53        .unwrap_or("application/octet-stream");
54    let content_type = super::ContentType::from(content_type);
55
56    if !status.is_client_error() && !status.is_server_error() {
57        let content = resp.text().await?;
58        match content_type {
59            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
60            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
61            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
62        }
63    } else {
64        let content = resp.text().await?;
65        let entity: Option<HealthError> = serde_json::from_str(&content).ok();
66        Err(Error::ResponseError(ResponseContent { status, content, entity }))
67    }
68}
69
70/// Readiness probe endpoint.
71pub async fn ready(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ReadyError>> {
72
73    let uri_str = format!("{}/readyz", configuration.base_path);
74    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
75
76    if let Some(ref user_agent) = configuration.user_agent {
77        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
78    }
79
80    let req = req_builder.build()?;
81    let resp = configuration.client.execute(req).await?;
82
83    let status = resp.status();
84    let content_type = resp
85        .headers()
86        .get("content-type")
87        .and_then(|v| v.to_str().ok())
88        .unwrap_or("application/octet-stream");
89    let content_type = super::ContentType::from(content_type);
90
91    if !status.is_client_error() && !status.is_server_error() {
92        let content = resp.text().await?;
93        match content_type {
94            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
95            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
96            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
97        }
98    } else {
99        let content = resp.text().await?;
100        let entity: Option<ReadyError> = serde_json::from_str(&content).ok();
101        Err(Error::ResponseError(ResponseContent { status, content, entity }))
102    }
103}
104