carp_cli/api/
types.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4/// Agent metadata returned by the API
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Agent {
7    pub name: String,
8    pub version: String,
9    pub description: String,
10    pub author: String,
11    pub created_at: DateTime<Utc>,
12    pub updated_at: DateTime<Utc>,
13    pub download_count: u64,
14    pub tags: Vec<String>,
15    pub readme: Option<String>,
16    pub homepage: Option<String>,
17    pub repository: Option<String>,
18    pub license: Option<String>,
19}
20
21/// Search results from the API
22#[derive(Debug, Serialize, Deserialize)]
23pub struct SearchResponse {
24    pub agents: Vec<Agent>,
25    pub total: usize,
26    pub page: usize,
27    pub per_page: usize,
28}
29
30/// Agent download information
31#[derive(Debug, Serialize, Deserialize)]
32pub struct AgentDownload {
33    pub name: String,
34    pub version: String,
35    pub download_url: String,
36    pub checksum: String,
37    pub size: u64,
38}
39
40/// Request for publishing an agent
41#[derive(Debug, Serialize, Deserialize)]
42pub struct PublishRequest {
43    pub name: String,
44    pub version: String,
45    pub description: String,
46    pub readme: Option<String>,
47    pub homepage: Option<String>,
48    pub repository: Option<String>,
49    pub license: Option<String>,
50    pub tags: Vec<String>,
51}
52
53/// Response from publishing an agent
54#[derive(Debug, Serialize, Deserialize)]
55pub struct PublishResponse {
56    pub success: bool,
57    pub message: String,
58    pub agent: Option<Agent>,
59}
60
61/// API error response
62#[derive(Debug, Serialize, Deserialize)]
63pub struct ApiError {
64    pub error: String,
65    pub message: String,
66    pub details: Option<serde_json::Value>,
67}
68
69/// Authentication request
70#[derive(Debug, Serialize, Deserialize)]
71pub struct AuthRequest {
72    pub username: String,
73    pub password: String,
74}
75
76/// Authentication response
77#[derive(Debug, Serialize, Deserialize)]
78pub struct AuthResponse {
79    pub token: String,
80    pub expires_at: DateTime<Utc>,
81}