areev 0.2.0

Rust SDK for the Areev knowledge database — gRPC and HTTP transports
Documentation
//! `System` resource — cluster-level operations (`health`, `stats`).

use serde_json::Value;

use crate::error::Result;
use crate::http::HttpClient;

/// Cluster-level system operations.
///
/// Access via [`crate::Areev::system`].
pub struct System<'a> {
    http: &'a HttpClient,
    memory_id: String,
}

impl<'a> System<'a> {
    /// Internal constructor — use [`crate::Areev::system`].
    pub(crate) fn new(http: &'a HttpClient, memory_id: String) -> Self {
        Self { http, memory_id }
    }

    /// Liveness check — returns the raw `{"status": "ok", …}` payload
    /// or propagates the server error.
    pub async fn health(&self) -> Result<Value> {
        self.http._get("/health", None).await
    }

    /// App configuration surfaced to clients (feature flags, public
    /// settings).
    pub async fn config(&self) -> Result<Value> {
        self.http._get("/config", None).await
    }

    /// Catalog of LLM models available to the caller's org.
    pub async fn models(&self) -> Result<Value> {
        self.http._get("/models", None).await
    }

    /// Memory-level statistics: grain counts, partitions, sizes.
    pub async fn stats(&self) -> Result<Value> {
        let path = format!("/memories/{}/stats", self.memory_id);
        self.http._get(&path, None).await
    }
}