areev 0.2.0

Rust SDK for the Areev knowledge database — gRPC and HTTP transports
Documentation
//! `Provenance` resource — recall provenance records (which grains fed a
//! recall, with scoring signals; EU AI Act Art. 12 transparency).
//!
//! Mirrors the Python SDK's `client.provenance.*` surface.
//!
//! Provenance reads carry recalled-content references and are excluded
//! from the SDK's request-body logging.

use serde_json::Value;

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

/// Recall-provenance reads.
///
/// Access via [`crate::Areev::provenance`].
pub struct Provenance<'a> {
    http: &'a HttpClient,
    memory_id: String,
}

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

    fn p(&self, suffix: &str) -> String {
        format!("/memories/{}/provenance{}", self.memory_id, suffix)
    }

    /// List provenance records for recent recalls. `filters` is added as
    /// query parameters.
    pub async fn list(&self, filters: Option<&Value>) -> Result<Value> {
        self.http._get_sensitive(&self.p(""), filters).await
    }

    /// Provenance for a single recall by id.
    pub async fn get(&self, recall_id: &str) -> Result<Value> {
        self.http
            ._get_sensitive(&self.p(&format!("/{recall_id}")), None)
            .await
    }

    /// Aggregate provenance summary across recalls. `filters` is added as
    /// query parameters.
    pub async fn summary(&self, filters: Option<&Value>) -> Result<Value> {
        self.http._get_sensitive(&self.p("/summary"), filters).await
    }
}