distri_types/configuration/
registry.rs1use serde::{Deserialize, Serialize};
2use uuid::Uuid;
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct RegistryPackageResponse {
7 pub package: String,
8 pub version: String,
9 pub artifact: serde_json::Value,
10 pub tarball: String, pub checksum: String,
12 pub download_url: String,
13 pub metadata: RegistryPackageMetadata,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18pub struct RegistryPackageMetadata {
19 pub created_at: chrono::DateTime<chrono::Utc>,
20 pub is_yanked: bool,
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize)]
25pub struct RegistryPackageVersion {
26 pub id: Uuid,
27 pub package_id: Uuid,
28 pub version: String,
29 pub artifact: serde_json::Value,
30 pub tarball: String, pub checksum: String,
32 pub is_yanked: bool,
33 pub created_at: chrono::DateTime<chrono::Utc>,
34 pub updated_at: chrono::DateTime<chrono::Utc>,
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
39pub struct RegistryPackage {
40 pub id: Uuid,
41 pub name: String,
42 pub description: Option<String>,
43 pub owner_id: Uuid,
44 pub created_at: chrono::DateTime<chrono::Utc>,
45 pub updated_at: chrono::DateTime<chrono::Utc>,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct RegistryPackageDetail {
51 pub id: Uuid,
52 pub name: String,
53 pub description: Option<String>,
54 pub owner_id: Uuid,
55 pub created_at: chrono::DateTime<chrono::Utc>,
56 pub updated_at: chrono::DateTime<chrono::Utc>,
57 pub versions: Vec<RegistryPackageVersion>,
58 pub latest_version: Option<String>,
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63pub struct RegistrySearchQuery {
64 pub q: Option<String>,
65 pub page: Option<i64>,
66 pub limit: Option<i64>,
67 pub sort: Option<String>,
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72pub struct RegistrySearchResults {
73 pub packages: Vec<RegistryPackage>,
74 pub total: i64,
75 pub page: i64,
76 pub limit: i64,
77 pub total_pages: i64,
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82pub struct RegistryPublishRequest {
83 pub name: String,
84 pub version: String,
85 pub artifact: serde_json::Value,
86 pub tarball: String, }
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
91pub struct RegistryPublishResponse {
92 pub message: String,
93 pub package_id: Uuid,
94 pub version_id: Uuid,
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99pub struct RegistryYankRequest {
100 pub yanked: bool,
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
105pub struct RegistryYankResponse {
106 pub message: String,
107 pub version: String,
108 pub yanked: bool,
109}
110
111#[derive(Debug, Clone, Serialize, Deserialize)]
113pub struct RegistryApiError {
114 pub error: String,
115 pub message: String,
116}
117
118#[derive(Debug, Clone, Serialize, Deserialize)]
120pub struct RegistryUserInfo {
121 pub id: Uuid,
122 pub email: String,
123 pub name: Option<String>,
124 pub email_verified: bool,
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129pub struct RegistryLoginRequest {
130 pub email: String,
131 pub password: String,
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize)]
136pub struct RegistryLoginResponse {
137 pub message: String,
138 pub token: String,
139 pub user: RegistryUserInfo,
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
144pub struct RegistryRegisterRequest {
145 pub email: String,
146 pub password: String,
147 pub name: Option<String>,
148}