agentbin_core/
metadata.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct AgentInfo {
8 pub model: Option<String>,
9 pub provider: Option<String>,
10 pub tool: Option<String>,
11}
12
13#[derive(Debug, Clone, Default, Serialize, Deserialize)]
15pub struct Metadata {
16 pub title: Option<String>,
17 pub description: Option<String>,
18 #[serde(default)]
19 pub tags: Vec<String>,
20 pub agent: Option<AgentInfo>,
21 pub trigger: Option<String>,
22 #[serde(default)]
23 pub custom: HashMap<String, String>,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct VersionMeta {
29 pub version: u32,
30 pub filename: String,
31 pub content_type: String,
32 pub size_bytes: u64,
33 pub uploaded_at: DateTime<Utc>,
34 pub uploaded_by: String,
35 pub expires_at: Option<DateTime<Utc>>,
36 pub metadata: Metadata,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41pub struct UploadRecord {
42 pub uid: String,
43 pub owner: String,
44 pub collection: Option<String>,
45 pub latest_version: u32,
46 pub created_at: DateTime<Utc>,
47 #[serde(default, skip_serializing_if = "Option::is_none")]
48 pub slug: Option<String>,
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
53pub struct CollectionMember {
54 pub uid: String,
55 pub added_at: DateTime<Utc>,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60pub struct CollectionRecord {
61 pub name: String,
62 pub members: Vec<CollectionMember>,
63 pub created_at: DateTime<Utc>,
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68pub struct UserRecord {
69 pub public_key: String,
70 pub display_name: Option<String>,
71 pub is_admin: bool,
72 pub created_at: DateTime<Utc>,
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77pub struct UsersConfig {
78 pub users: HashMap<String, UserRecord>,
79}