Make old operations use new types
parent: tbd commit: b22dd12
1 | use ; |
2 | |
3 | use crate:: |
4 | , |
5 | , |
6 | , | Object
7 | , | ObjectBackend
8 | , | GiteratedOperation
9 | ; |
10 | |
11 | use |
12 | Commit, Repository, RepositoryBranch, RepositoryBranchFilter, RepositoryDiff, RepositoryFile, |
13 | RepositoryStatistics, RepositoryTag, RepositoryTreeEntry, RepositoryView, |
14 | ; |
15 | |
16 | /// A request to get a repository's information. |
17 | /// |
18 | /// # Authentication |
19 | /// - Instance Authentication |
20 | /// - Validate request against the `issued_for` public key |
21 | /// - Validate User token against the user's instance's public key |
22 | /// # Authorization |
23 | /// - User Authorization |
24 | /// - Potential User permissions checks |
25 | |
26 | |
27 | pub extra_metadata: bool, |
28 | pub rev: , |
29 | pub path: , |
30 | |
31 | |
32 | |
33 | type Success = RepositoryView; |
34 | type Failure = RepositoryError; |
35 | |
36 | |
37 | /// A request to get a file from a repository using the given id. |
38 | /// |
39 | /// # Authentication |
40 | /// - Instance Authentication |
41 | /// - Validate request against the `issued_for` public key |
42 | /// - Validate User token against the user's instance's public key |
43 | /// # Authorization |
44 | /// - User Authorization |
45 | /// - Potential User permissions checks |
46 | |
47 | ; |
48 | |
49 | |
50 | type Success = RepositoryFile; |
51 | type Failure = RepositoryError; |
52 | |
53 | |
54 | /// A request to get a file from a repository using the given relative path. |
55 | /// Also returns the commit id of the rev. |
56 | /// |
57 | /// # Authentication |
58 | /// - Instance Authentication |
59 | /// - Validate request against the `issued_for` public key |
60 | /// - Validate User token against the user's instance's public key |
61 | /// # Authorization |
62 | /// - User Authorization |
63 | /// - Potential User permissions checks |
64 | |
65 | |
66 | pub rev: , |
67 | pub path: String, |
68 | |
69 | |
70 | |
71 | type Success = ; |
72 | type Failure = RepositoryError; |
73 | |
74 | |
75 | /// A request to get the last commit made to a file, using a starting point and the path. |
76 | /// |
77 | /// # Authentication |
78 | /// - Instance Authentication |
79 | /// - Validate request against the `issued_for` public key |
80 | /// - Validate User token against the user's instance's public key |
81 | /// # Authorization |
82 | /// - User Authorization |
83 | /// - Potential User permissions checks |
84 | |
85 | |
86 | /// ID of commit to start at |
87 | pub start_commit: String, |
88 | // Path of the file |
89 | pub path: String, |
90 | |
91 | |
92 | |
93 | type Success = Commit; |
94 | type Failure = RepositoryError; |
95 | |
96 | |
97 | /// A request to get the commit by the specified id. |
98 | /// |
99 | /// # Authentication |
100 | /// - Instance Authentication |
101 | /// - Validate request against the `issued_for` public key |
102 | /// - Validate User token against the user's instance's public key |
103 | /// # Authorization |
104 | /// - User Authorization |
105 | /// - Potential User permissions checks |
106 | |
107 | ; |
108 | |
109 | |
110 | type Success = Commit; |
111 | type Failure = RepositoryError; |
112 | |
113 | |
114 | /// A request to get the difference between two repository trees. |
115 | /// |
116 | /// # Authentication |
117 | /// - Instance Authentication |
118 | /// - Validate request against the `issued_for` public key |
119 | /// - Validate User token against the user's instance's public key |
120 | /// # Authorization |
121 | /// - User Authorization |
122 | /// - Potential User permissions checks |
123 | |
124 | |
125 | pub old_id: String, |
126 | pub new_id: String, |
127 | |
128 | |
129 | |
130 | type Success = RepositoryDiff; |
131 | type Failure = RepositoryError; |
132 | |
133 | |
134 | /// A request to get the difference between two repository trees as a unified git patch. |
135 | /// |
136 | /// # Authentication |
137 | /// - Instance Authentication |
138 | /// - Validate request against the `issued_for` public key |
139 | /// - Validate User token against the user's instance's public key |
140 | /// # Authorization |
141 | /// - User Authorization |
142 | /// - Potential User permissions checks |
143 | |
144 | |
145 | pub old_id: String, |
146 | pub new_id: String, |
147 | |
148 | |
149 | |
150 | type Success = String; |
151 | type Failure = RepositoryError; |
152 | |
153 | |
154 | /// A request to get the commit before the one with the passed id |
155 | /// |
156 | /// # Authentication |
157 | /// - Instance Authentication |
158 | /// - Validate request against the `issued_for` public key |
159 | /// - Validate User token against the user's instance's public key |
160 | /// # Authorization |
161 | /// - User Authorization |
162 | /// - Potential User permissions checks |
163 | |
164 | ; |
165 | |
166 | |
167 | type Success = Commit; |
168 | type Failure = RepositoryError; |
169 | |
170 | |
171 | |
172 | ; |
173 | |
174 | |
175 | type Success = u64; |
176 | type Failure = RepositoryError; |
177 | |
178 | |
179 | /// A request to get a repository's issue tags. |
180 | /// |
181 | /// # Authentication |
182 | /// - Instance Authentication |
183 | /// - Validate request against the `issued_for` public key |
184 | /// - Validate User token against the user's instance's public key |
185 | /// # Authorization |
186 | /// - User Authorization |
187 | /// - Potential User permissions checks |
188 | |
189 | ; |
190 | |
191 | |
192 | type Success = ; |
193 | type Failure = RepositoryError; |
194 | |
195 | |
196 | /// A request to get a repository's issues. |
197 | /// |
198 | /// # Authentication |
199 | /// - Instance Authentication |
200 | /// - Validate request against the `issued_for` public key |
201 | /// - Validate User token against the user's instance's public key |
202 | /// # Authorization |
203 | /// - User Authorization |
204 | /// - Potential User permissions checks |
205 | |
206 | ; |
207 | |
208 | |
209 | type Success = ; |
210 | type Failure = RepositoryError; |
211 | |
212 | |
213 | /// A request to inspect the tree of a repository. |
214 | /// |
215 | /// # Authentication |
216 | /// - Instance Authentication |
217 | /// - Validate request against the `issued_for` public key |
218 | /// - Validate User token against the user's instance's public key |
219 | /// # Authorization |
220 | /// - User Authorization |
221 | /// - Potential User permissions checks |
222 | |
223 | |
224 | /// Whether to get extra metadata for every entry (file mode, size and last commit made to it). |
225 | pub extra_metadata: bool, |
226 | /// Revision of the repository to get (branch, commit id). |
227 | pub rev: , |
228 | /// If not given a path, it'll default to the base. |
229 | pub path: , |
230 | |
231 | |
232 | |
233 | type Success = ; |
234 | type Failure = RepositoryError; |
235 | |
236 | |
237 | /// A request to get the statistics of repository. |
238 | /// |
239 | /// # Authentication |
240 | /// - Instance Authentication |
241 | /// - Validate request against the `issued_for` public key |
242 | /// - Validate User token against the user's instance's public key |
243 | /// # Authorization |
244 | /// - User Authorization |
245 | /// - Potential User permissions checks |
246 | |
247 | |
248 | /// Revision of the repository to get (branch, commit id). |
249 | pub rev: , |
250 | |
251 | |
252 | |
253 | type Success = RepositoryStatistics; |
254 | type Failure = RepositoryError; |
255 | |
256 | |
257 | /// A request to get a list of branches in the repository. |
258 | /// Also returns the total amount of branches after the filter is applied. |
259 | /// |
260 | /// Optional search parameter that'll search through the filtered branches |
261 | /// |
262 | /// Skips over references with invalid UTF-8 names. |
263 | /// |
264 | /// # Authentication |
265 | /// - Instance Authentication |
266 | /// - Validate request against the `issued_for` public key |
267 | /// - Validate User token against the user's instance's public key |
268 | /// # Authorization |
269 | /// - User Authorization |
270 | /// - Potential User permissions checks |
271 | |
272 | |
273 | pub filter: RepositoryBranchFilter, |
274 | pub range: (usize, usize), |
275 | // pub sort: Option<???> |
276 | pub search: , |
277 | |
278 | |
279 | |
280 | type Success = ; |
281 | type Failure = RepositoryError; |
282 | |
283 | |
284 | /// A request to get a specific branch using its name |
285 | /// |
286 | /// # Authentication |
287 | /// - Instance Authentication |
288 | /// - Validate request against the `issued_for` public key |
289 | /// - Validate User token against the user's instance's public key |
290 | /// # Authorization |
291 | /// - User Authorization |
292 | /// - Potential User permissions checks |
293 | |
294 | |
295 | pub name: String, |
296 | |
297 | |
298 | |
299 | type Success = RepositoryBranch; |
300 | type Failure = RepositoryError; |
301 | |
302 | |
303 | /// A request to get a list of tags in the repository. |
304 | /// Also returns the total amount of tags. |
305 | /// |
306 | /// Optional search parameter that'll search through the tags |
307 | /// |
308 | /// # Authentication |
309 | /// - Instance Authentication |
310 | /// - Validate request against the `issued_for` public key |
311 | /// - Validate User token against the user's instance's public key |
312 | /// # Authorization |
313 | /// - User Authorization |
314 | /// - Potential User permissions checks |
315 | |
316 | |
317 | // pub filter: Option<???>, |
318 | pub range: (usize, usize), |
319 | // pub sort: Option<???>, |
320 | pub search: , |
321 | |
322 | |
323 | |
324 | type Success = ; |
325 | type Failure = RepositoryError; |
326 | |
327 | |
328 | /// A request to get a single tag by name. |
329 | /// |
330 | /// # Authentication |
331 | /// - Instance Authentication |
332 | /// - Validate request against the `issued_for` public key |
333 | /// - Validate User token against the user's instance's public key |
334 | /// # Authorization |
335 | /// - User Authorization |
336 | /// - Potential User permissions checks |
337 | |
338 | |
339 | pub name: String, |
340 | |
341 | |
342 | |
343 | type Success = RepositoryTag; |
344 | type Failure = RepositoryError; |
345 | |
346 | |
347 | |
348 | pub async |
349 | &mut self, |
350 | extra_metadata: bool, |
351 | rev: , |
352 | path: , |
353 | operation_state: &S, |
354 | |
355 | self. |
356 | RepositoryInfoRequest |
357 | extra_metadata, |
358 | rev, |
359 | path, |
360 | , |
361 | operation_state, |
362 | |
363 | .await |
364 | |
365 | |
366 | pub async |
367 | &mut self, |
368 | id: String, |
369 | operation_state: &S, |
370 | |
371 | self. |
372 | RepositoryFileFromIdRequest, |
373 | operation_state, |
374 | |
375 | .await |
376 | |
377 | |
378 | pub async |
379 | &mut self, |
380 | rev: , |
381 | path: String, |
382 | operation_state: &S, |
383 | |
384 | self. |
385 | RepositoryFileFromPathRequest , |
386 | operation_state, |
387 | |
388 | .await |
389 | |
390 | |
391 | pub async |
392 | &mut self, |
393 | start_commit: String, |
394 | path: String, |
395 | operation_state: &S, |
396 | |
397 | self. |
398 | RepositoryLastCommitOfFileRequest , |
399 | operation_state, |
400 | |
401 | .await |
402 | |
403 | |
404 | pub async |
405 | &mut self, |
406 | id: String, |
407 | operation_state: &S, |
408 | |
409 | self. |
410 | RepositoryCommitFromIdRequest, |
411 | operation_state, |
412 | |
413 | .await |
414 | |
415 | |
416 | pub async |
417 | &mut self, |
418 | old_id: String, |
419 | new_id: String, |
420 | operation_state: &S, |
421 | |
422 | self. |
423 | RepositoryDiffRequest , |
424 | operation_state, |
425 | |
426 | .await |
427 | |
428 | |
429 | pub async |
430 | &mut self, |
431 | old_id: String, |
432 | new_id: String, |
433 | operation_state: &S, |
434 | |
435 | self. |
436 | RepositoryDiffPatchRequest , |
437 | operation_state, |
438 | |
439 | .await |
440 | |
441 | |
442 | pub async |
443 | &mut self, |
444 | id: String, |
445 | operation_state: &S, |
446 | |
447 | self. |
448 | RepositoryCommitBeforeRequest, |
449 | operation_state, |
450 | |
451 | .await |
452 | |
453 | |
454 | pub async |
455 | &mut self, |
456 | rev: , |
457 | operation_state: &S, |
458 | |
459 | self. |
460 | RepositoryStatisticsRequest , |
461 | operation_state, |
462 | |
463 | .await |
464 | |
465 | |
466 | pub async |
467 | &mut self, |
468 | filter: RepositoryBranchFilter, |
469 | range_start: usize, |
470 | range_end: usize, |
471 | search: , |
472 | operation_state: &S, |
473 | |
474 | self. |
475 | RepositoryBranchesRequest |
476 | filter, |
477 | range: , |
478 | search, |
479 | , |
480 | operation_state, |
481 | |
482 | .await |
483 | |
484 | |
485 | pub async |
486 | &mut self, |
487 | name: &str, |
488 | operation_state: &S, |
489 | |
490 | self. |
491 | RepositoryBranchRequest |
492 | name: name.to_string, |
493 | , |
494 | operation_state, |
495 | |
496 | .await |
497 | |
498 | |
499 | pub async |
500 | &mut self, |
501 | range_start: usize, |
502 | range_end: usize, |
503 | search: , |
504 | operation_state: &S, |
505 | |
506 | self. |
507 | RepositoryTagsRequest |
508 | range: , |
509 | search, |
510 | , |
511 | operation_state, |
512 | |
513 | .await |
514 | |
515 | |
516 | pub async |
517 | &mut self, |
518 | name: &str, |
519 | operation_state: &S, |
520 | |
521 | self. |
522 | RepositoryTagRequest |
523 | name: name.to_string, |
524 | , |
525 | operation_state, |
526 | |
527 | .await |
528 | |
529 | |
530 | // pub async fn issues_count(&mut self) -> Result<u64, OperationError<RepositoryError>> { |
531 | // self.request::<RepositoryIssuesCountRequest>(RepositoryIssuesCountRequest) |
532 | // .await |
533 | // } |
534 | |
535 | pub async |
536 | &mut self, |
537 | operation_state: &S, |
538 | |
539 | self. |
540 | .await |
541 | |
542 | |
543 | pub async |
544 | &mut self, |
545 | operation_state: &S, |
546 | |
547 | self. |
548 | .await |
549 | |
550 | |
551 | pub async |
552 | &mut self, |
553 | extra_metadata: bool, |
554 | rev: , |
555 | path: , |
556 | operation_state: &S, |
557 | |
558 | self. |
559 | RepositoryFileInspectRequest |
560 | extra_metadata, |
561 | rev: rev.map, |
562 | path: path.map, |
563 | , |
564 | operation_state, |
565 | |
566 | .await |
567 | |
568 | |
569 |