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 models;
11pub mod storage;
12
13pub use client::StakpakApiClient;
14pub use models::*;
15
16/// Configuration for StakpakApiClient
17#[derive(Clone, Debug)]
18pub struct StakpakApiConfig {
19    /// API key for authentication
20    pub api_key: String,
21    /// API endpoint URL (default: https://apiv2.stakpak.dev)
22    pub api_endpoint: String,
23}
24
25impl StakpakApiConfig {
26    /// Create new config with API key
27    pub fn new(api_key: impl Into<String>) -> Self {
28        Self {
29            api_key: api_key.into(),
30            api_endpoint: "https://apiv2.stakpak.dev".to_string(),
31        }
32    }
33
34    /// Set API endpoint
35    pub fn with_endpoint(mut self, endpoint: impl Into<String>) -> Self {
36        self.api_endpoint = endpoint.into();
37        self
38    }
39}
40
41impl Default for StakpakApiConfig {
42    fn default() -> Self {
43        Self::new(std::env::var("STAKPAK_API_KEY").unwrap_or_default())
44    }
45}