Add authentication back into the operation states
parent: tbd commit: 97a26fd
1 | use ; |
2 | |
3 | use crate:: |
4 | , |
5 | , | Object
6 | , | ObjectBackend
7 | , | GiteratedOperation
8 | ; |
9 | |
10 | use |
11 | Commit, IssueLabel, Repository, RepositoryDiff, RepositoryFile, RepositoryIssue, |
12 | RepositoryTreeEntry, RepositoryView, |
13 | ; |
14 | |
15 | /// A request to get a repository's information. |
16 | /// |
17 | /// # Authentication |
18 | /// - Instance Authentication |
19 | /// - Validate request against the `issued_for` public key |
20 | /// - Validate User token against the user's instance's public key |
21 | /// # Authorization |
22 | /// - User Authorization |
23 | /// - Potential User permissions checks |
24 | |
25 | |
26 | pub extra_metadata: bool, |
27 | pub rev: , |
28 | pub path: , |
29 | |
30 | |
31 | |
32 | type Success = RepositoryView; |
33 | type Failure = RepositoryError; |
34 | |
35 | |
36 | /// A request to get a file from a repository using the given id. |
37 | /// |
38 | /// # Authentication |
39 | /// - Instance Authentication |
40 | /// - Validate request against the `issued_for` public key |
41 | /// - Validate User token against the user's instance's public key |
42 | /// # Authorization |
43 | /// - User Authorization |
44 | /// - Potential User permissions checks |
45 | |
46 | ; |
47 | |
48 | |
49 | type Success = RepositoryFile; |
50 | type Failure = RepositoryError; |
51 | |
52 | |
53 | /// A request to get a file from a repository using the given relative path. |
54 | /// |
55 | /// # Authentication |
56 | /// - Instance Authentication |
57 | /// - Validate request against the `issued_for` public key |
58 | /// - Validate User token against the user's instance's public key |
59 | /// # Authorization |
60 | /// - User Authorization |
61 | /// - Potential User permissions checks |
62 | |
63 | |
64 | pub rev: , |
65 | pub path: String, |
66 | |
67 | |
68 | |
69 | type Success = RepositoryFile; |
70 | type Failure = RepositoryError; |
71 | |
72 | |
73 | /// A request to get the difference between two repository trees. |
74 | /// |
75 | /// # Authentication |
76 | /// - Instance Authentication |
77 | /// - Validate request against the `issued_for` public key |
78 | /// - Validate User token against the user's instance's public key |
79 | /// # Authorization |
80 | /// - User Authorization |
81 | /// - Potential User permissions checks |
82 | |
83 | |
84 | pub old_id: String, |
85 | pub new_id: String, |
86 | |
87 | |
88 | |
89 | type Success = RepositoryDiff; |
90 | type Failure = RepositoryError; |
91 | |
92 | |
93 | /// A request to get the difference between two repository trees as a unified git patch. |
94 | /// |
95 | /// # Authentication |
96 | /// - Instance Authentication |
97 | /// - Validate request against the `issued_for` public key |
98 | /// - Validate User token against the user's instance's public key |
99 | /// # Authorization |
100 | /// - User Authorization |
101 | /// - Potential User permissions checks |
102 | |
103 | |
104 | pub old_id: String, |
105 | pub new_id: String, |
106 | |
107 | |
108 | |
109 | type Success = String; |
110 | type Failure = RepositoryError; |
111 | |
112 | |
113 | /// A request to get the commit before the one with the passed id |
114 | /// |
115 | /// # Authentication |
116 | /// - Instance Authentication |
117 | /// - Validate request against the `issued_for` public key |
118 | /// - Validate User token against the user's instance's public key |
119 | /// # Authorization |
120 | /// - User Authorization |
121 | /// - Potential User permissions checks |
122 | |
123 | ; |
124 | |
125 | |
126 | type Success = Commit; |
127 | type Failure = RepositoryError; |
128 | |
129 | |
130 | |
131 | ; |
132 | |
133 | |
134 | type Success = u64; |
135 | type Failure = RepositoryError; |
136 | |
137 | |
138 | /// A request to get a repository's issues count. |
139 | /// |
140 | /// # Authentication |
141 | /// - Instance Authentication |
142 | /// - Validate request against the `issued_for` public key |
143 | /// - Validate User token against the user's instance's public key |
144 | /// # Authorization |
145 | /// - User Authorization |
146 | /// - Potential User permissions checks |
147 | |
148 | ; |
149 | |
150 | |
151 | type Success = ; |
152 | type Failure = RepositoryError; |
153 | |
154 | |
155 | /// A request to get a repository's issue labels. |
156 | /// |
157 | /// # Authentication |
158 | /// - Instance Authentication |
159 | /// - Validate request against the `issued_for` public key |
160 | /// - Validate User token against the user's instance's public key |
161 | /// # Authorization |
162 | /// - User Authorization |
163 | /// - Potential User permissions checks |
164 | |
165 | ; |
166 | |
167 | |
168 | type Success = ; |
169 | type Failure = RepositoryError; |
170 | |
171 | |
172 | /// A request to inspect the tree of a repository. |
173 | /// |
174 | /// # Authentication |
175 | /// - Instance Authentication |
176 | /// - Validate request against the `issued_for` public key |
177 | /// - Validate User token against the user's instance's public key |
178 | /// # Authorization |
179 | /// - User Authorization |
180 | /// - Potential User permissions checks |
181 | |
182 | |
183 | /// Whether to get extra metadata for every entry (file mode, size and last commit made to it). |
184 | pub extra_metadata: bool, |
185 | /// Revision of the repository to get (branch, commit id). |
186 | pub rev: , |
187 | /// If not given a path, it'll default to the base. |
188 | pub path: , |
189 | |
190 | |
191 | |
192 | type Success = ; |
193 | type Failure = RepositoryError; |
194 | |
195 | |
196 | |
197 | pub async |
198 | &mut self, |
199 | extra_metadata: bool, |
200 | rev: , |
201 | path: , |
202 | operation_state: &S, |
203 | |
204 | self. |
205 | RepositoryInfoRequest |
206 | extra_metadata, |
207 | rev, |
208 | path, |
209 | , |
210 | operation_state, |
211 | |
212 | .await |
213 | |
214 | |
215 | pub async |
216 | &mut self, |
217 | id: String, |
218 | operation_state: &S, |
219 | |
220 | self. |
221 | RepositoryFileFromIdRequest, |
222 | operation_state, |
223 | |
224 | .await |
225 | |
226 | |
227 | pub async |
228 | &mut self, |
229 | rev: , |
230 | path: String, |
231 | operation_state: &S, |
232 | |
233 | self. |
234 | RepositoryFileFromPathRequest , |
235 | operation_state, |
236 | |
237 | .await |
238 | |
239 | |
240 | pub async |
241 | &mut self, |
242 | old_id: String, |
243 | new_id: String, |
244 | operation_state: &S, |
245 | |
246 | self. |
247 | RepositoryDiffRequest , |
248 | operation_state, |
249 | |
250 | .await |
251 | |
252 | |
253 | pub async |
254 | &mut self, |
255 | old_id: String, |
256 | new_id: String, |
257 | operation_state: &S, |
258 | |
259 | self. |
260 | RepositoryDiffPatchRequest , |
261 | operation_state, |
262 | |
263 | .await |
264 | |
265 | |
266 | pub async |
267 | &mut self, |
268 | id: String, |
269 | operation_state: &S, |
270 | |
271 | self. |
272 | RepositoryCommitBeforeRequest, |
273 | operation_state, |
274 | |
275 | .await |
276 | |
277 | |
278 | // pub async fn issues_count(&mut self) -> Result<u64, OperationError<RepositoryError>> { |
279 | // self.request::<RepositoryIssuesCountRequest>(RepositoryIssuesCountRequest) |
280 | // .await |
281 | // } |
282 | |
283 | pub async |
284 | &mut self, |
285 | operation_state: &S, |
286 | |
287 | self. |
288 | .await |
289 | |
290 | |
291 | pub async |
292 | &mut self, |
293 | operation_state: &S, |
294 | |
295 | self. |
296 | .await |
297 | |
298 | |
299 | pub async |
300 | &mut self, |
301 | extra_metadata: bool, |
302 | rev: , |
303 | path: , |
304 | operation_state: &S, |
305 | |
306 | self. |
307 | RepositoryFileInspectRequest |
308 | extra_metadata, |
309 | rev: rev.map, |
310 | path: path.map, |
311 | , |
312 | operation_state, |
313 | |
314 | .await |
315 | |
316 | |
317 |