Skip to main content

stakpak_api/stakpak/
mod.rs

1//! Stakpak API Client
2//!
3//! Provides access to Stakpak's non-inference APIs:
4//! - Sessions and checkpoints (via new `/v1/sessions` endpoints)
5//! - MCP tool calls (memory, docs search, Slack)
6//! - Billing and account
7//! - Rulebooks
8
9mod client;
10mod knowledge;
11mod models;
12pub mod storage;
13
14pub use client::StakpakApiClient;
15pub use knowledge::KnowledgeApiError;
16pub use models::*;
17
18/// Configuration for StakpakApiClient
19#[derive(Clone, Debug)]
20pub struct StakpakApiConfig {
21    /// API key for authentication
22    pub api_key: String,
23    /// API endpoint URL (default: https://apiv2.stakpak.dev)
24    pub api_endpoint: String,
25}
26
27impl StakpakApiConfig {
28    /// Create new config with API key
29    pub fn new(api_key: impl Into<String>) -> Self {
30        Self {
31            api_key: api_key.into(),
32            api_endpoint: "https://apiv2.stakpak.dev".to_string(),
33        }
34    }
35
36    /// Set API endpoint
37    pub fn with_endpoint(mut self, endpoint: impl Into<String>) -> Self {
38        self.api_endpoint = endpoint.into();
39        self
40    }
41}
42
43impl Default for StakpakApiConfig {
44    fn default() -> Self {
45        Self::new(std::env::var("STAKPAK_API_KEY").unwrap_or_default())
46    }
47}