1pub use suture_protocol::*;
5
6#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
7pub struct UserInfo {
8 pub username: String,
9 pub display_name: String,
10 pub role: String,
11 pub api_token: Option<String>,
12 pub created_at: i64,
13}
14
15#[derive(Debug, Clone, serde::Deserialize)]
16pub struct RegisterRequest {
17 pub username: String,
18 pub display_name: String,
19 pub role: Option<String>,
20}
21
22#[derive(Debug, serde::Serialize)]
23pub struct RegisterResponse {
24 pub success: bool,
25 pub error: Option<String>,
26 pub user: Option<UserInfo>,
27}
28
29#[derive(Debug, serde::Serialize)]
30pub struct ListUsersResponse {
31 pub success: bool,
32 pub error: Option<String>,
33 pub users: Vec<UserInfo>,
34}
35
36#[derive(Debug, serde::Serialize)]
37pub struct GetUserResponse {
38 pub success: bool,
39 pub error: Option<String>,
40 pub user: Option<UserInfo>,
41}
42
43#[derive(Debug, serde::Deserialize)]
44pub struct UpdateRoleRequest {
45 pub role: String,
46}
47
48#[derive(Debug, serde::Serialize)]
49pub struct UpdateRoleResponse {
50 pub success: bool,
51 pub error: Option<String>,
52}
53
54#[derive(Debug, serde::Serialize)]
55pub struct DeleteUserResponse {
56 pub success: bool,
57 pub error: Option<String>,
58}
59
60#[derive(Debug, serde::Serialize, serde::Deserialize)]
63pub struct MirrorSetupRequest {
64 pub repo_name: String,
65 pub upstream_url: String,
66 pub upstream_repo: String,
67}
68
69#[derive(Debug, serde::Serialize, serde::Deserialize)]
70pub struct MirrorSetupResponse {
71 pub success: bool,
72 pub error: Option<String>,
73 pub mirror_id: Option<i64>,
74}
75
76#[derive(Debug, serde::Serialize, serde::Deserialize)]
77pub struct MirrorSyncRequest {
78 #[serde(default)]
79 pub mirror_id: i64,
80 pub local_repo: Option<String>,
81 pub remote_url: Option<String>,
82}
83
84#[derive(Debug, serde::Serialize, serde::Deserialize)]
85pub struct MirrorSyncResponse {
86 pub success: bool,
87 pub error: Option<String>,
88 pub patches_synced: u64,
89 pub branches_synced: u64,
90}
91
92#[derive(Debug, serde::Serialize, serde::Deserialize)]
93pub struct MirrorStatusRequest {
94 pub mirror_id: Option<i64>,
95 pub repo_name: Option<String>,
96}
97
98#[derive(Debug, serde::Serialize, serde::Deserialize)]
99pub struct MirrorStatusEntry {
100 pub mirror_id: i64,
101 pub repo_name: String,
102 pub upstream_url: String,
103 pub upstream_repo: String,
104 pub last_sync: Option<u64>,
105 pub status: String,
106}
107
108#[derive(Debug, serde::Serialize, serde::Deserialize)]
109pub struct MirrorStatusResponse {
110 pub success: bool,
111 pub error: Option<String>,
112 pub mirrors: Vec<MirrorStatusEntry>,
113}
114
115#[derive(Debug, serde::Deserialize)]
116pub struct AddPeerRequest {
117 pub peer_url: String,
118 pub role: String,
119}
120
121#[derive(Debug, serde::Serialize)]
122pub struct AddPeerResponse {
123 pub success: bool,
124 pub peer_id: Option<i64>,
125 pub error: Option<String>,
126}
127
128#[derive(Debug, serde::Serialize)]
129pub struct RemovePeerResponse {
130 pub success: bool,
131 pub error: Option<String>,
132}
133
134#[derive(Debug, serde::Serialize)]
135pub struct ListPeersResponse {
136 pub peers: Vec<crate::storage::ReplicationPeer>,
137}
138
139#[derive(Debug, serde::Serialize)]
140pub struct ReplicationStatusResponse {
141 pub status: crate::storage::ReplicationStatus,
142}
143
144#[derive(Debug, serde::Serialize)]
145pub struct SyncResponse {
146 pub success: bool,
147 pub applied: usize,
148 pub error: Option<String>,
149}
150
151#[derive(Debug, serde::Deserialize)]
152pub struct CreateRepoRequest {
153 pub repo_id: String,
154}
155
156#[derive(Debug, serde::Deserialize)]
157pub struct CreateBranchRequest {
158 pub name: String,
159 pub target: String,
160}
161
162#[derive(Debug, serde::Deserialize)]
163pub struct LoginRequest {
164 pub username: String,
165 pub token: String,
166}
167
168#[derive(Debug, serde::Deserialize)]
169pub struct SearchParams {
170 pub q: String,
171}
172
173#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
174pub struct BatchPatchRequest {
175 pub repo_id: String,
176 pub patches: Vec<PatchProto>,
177 pub branches: Vec<BranchProto>,
178 pub blobs: Vec<BlobRef>,
179 pub signature: Option<Vec<u8>>,
180 pub force: bool,
181}
182
183#[derive(Debug, Clone, serde::Serialize)]
184pub struct TreeEntry {
185 pub path: String,
186 pub content_hash: String,
187}