capsula_api_types/
lib.rs

1//! Shared API type definitions for Capsula client and server
2//!
3//! This crate defines the common types used in the Capsula HTTP API to ensure
4//! compile-time compatibility between the client and server implementations.
5
6use serde::{Deserialize, Serialize};
7
8/// Information about a vault
9#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
10pub struct VaultInfo {
11    pub name: String,
12    pub run_count: i64,
13}
14
15/// Response from the vaults list endpoint
16#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
17pub struct VaultsResponse {
18    pub status: String,
19    pub vaults: Vec<VaultInfo>,
20}
21
22/// Response from the vault exists endpoint
23#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
24pub struct VaultExistsResponse {
25    pub status: String,
26    pub exists: bool,
27    pub vault: Option<VaultInfo>,
28}
29
30/// Response from the upload run endpoint
31#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
32pub struct UploadResponse {
33    pub status: String,
34    pub files_processed: u64,
35    pub total_bytes: u64,
36    pub pre_run_hooks: u64,
37    pub post_run_hooks: u64,
38}
39
40/// Generic error response
41#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
42pub struct ErrorResponse {
43    pub status: String,
44    pub error: String,
45}