1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[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#[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#[derive(Debug, Serialize, Deserialize)]
32pub struct AgentDownload {
33 pub agent_id: String,
34 pub name: String,
35 pub author: String,
36 pub version: String,
37 pub download_url: String,
38 pub file_size: u64,
39 pub checksum: String,
40 pub content_type: String,
41 pub definition: serde_json::Value,
42}
43
44#[derive(Debug, Serialize, Deserialize)]
46pub struct PublishRequest {
47 pub name: String,
48 pub version: String,
49 pub description: String,
50 pub readme: Option<String>,
51 pub homepage: Option<String>,
52 pub repository: Option<String>,
53 pub license: Option<String>,
54 pub tags: Vec<String>,
55}
56
57#[derive(Debug, Serialize, Deserialize)]
59pub struct PublishResponse {
60 pub success: bool,
61 pub message: String,
62 pub agent: Option<Agent>,
63}
64
65#[derive(Debug, Serialize, Deserialize)]
67pub struct ApiError {
68 pub error: String,
69 pub message: String,
70 pub details: Option<serde_json::Value>,
71}
72
73#[derive(Debug, Serialize, Deserialize)]
75pub struct AuthRequest {
76 pub username: String,
77 pub password: String,
78}
79
80#[derive(Debug, Serialize, Deserialize)]
82pub struct AuthResponse {
83 pub token: String,
84 pub expires_at: DateTime<Utc>,
85}
86
87#[derive(Debug, Serialize, Deserialize)]
89pub struct UploadAgentRequest {
90 pub name: String,
91 pub description: String,
92 pub content: String,
93 pub version: Option<String>,
94 pub tags: Vec<String>,
95 pub homepage: Option<String>,
96 pub repository: Option<String>,
97 pub license: Option<String>,
98}
99
100#[derive(Debug, Serialize, Deserialize)]
102pub struct UploadAgentResponse {
103 pub success: bool,
104 pub message: String,
105 pub agent: Option<Agent>,
106 pub validation_errors: Option<Vec<ValidationError>>,
107}
108
109#[derive(Debug, Serialize, Deserialize)]
111pub struct ValidationError {
112 pub field: String,
113 pub message: String,
114}
115
116#[derive(Debug, Serialize, Deserialize)]
118pub struct HealthResponse {
119 pub status: String,
120 pub service: String,
121 pub environment: String,
122 pub message: String,
123 pub agent_count: Option<i64>,
124 pub timestamp: String,
125 pub error: Option<String>,
126}