Utilize for GitBackend and trim end slashes in folder
parent: tbd commit: 4b440ef
1 | use ; |
2 | |
3 | use crate:: |
4 | , |
5 | , | Object
6 | , | ObjectBackend
7 | , | GiteratedOperation
8 | ; |
9 | |
10 | use |
11 | Commit, IssueLabel, Repository, RepositoryBranch, RepositoryBranchFilter, RepositoryDiff, |
12 | RepositoryFile, RepositoryIssue, RepositoryStatistics, 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 | /// Also returns the commit id of the rev. |
55 | /// |
56 | /// # Authentication |
57 | /// - Instance Authentication |
58 | /// - Validate request against the `issued_for` public key |
59 | /// - Validate User token against the user's instance's public key |
60 | /// # Authorization |
61 | /// - User Authorization |
62 | /// - Potential User permissions checks |
63 | |
64 | |
65 | pub rev: , |
66 | pub path: String, |
67 | |
68 | |
69 | |
70 | type Success = ; |
71 | type Failure = RepositoryError; |
72 | |
73 | |
74 | /// A request to get the last commit made to a file, using a starting point and the path. |
75 | /// |
76 | /// # Authentication |
77 | /// - Instance Authentication |
78 | /// - Validate request against the `issued_for` public key |
79 | /// - Validate User token against the user's instance's public key |
80 | /// # Authorization |
81 | /// - User Authorization |
82 | /// - Potential User permissions checks |
83 | |
84 | |
85 | /// ID of commit to start at |
86 | pub start_commit: String, |
87 | // Path of the file |
88 | pub path: String, |
89 | |
90 | |
91 | |
92 | type Success = Commit; |
93 | type Failure = RepositoryError; |
94 | |
95 | |
96 | /// A request to get the commit by the specified id. |
97 | /// |
98 | /// # Authentication |
99 | /// - Instance Authentication |
100 | /// - Validate request against the `issued_for` public key |
101 | /// - Validate User token against the user's instance's public key |
102 | /// # Authorization |
103 | /// - User Authorization |
104 | /// - Potential User permissions checks |
105 | |
106 | ; |
107 | |
108 | |
109 | type Success = Commit; |
110 | type Failure = RepositoryError; |
111 | |
112 | |
113 | /// A request to get the difference between two repository trees. |
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 | pub old_id: String, |
125 | pub new_id: String, |
126 | |
127 | |
128 | |
129 | type Success = RepositoryDiff; |
130 | type Failure = RepositoryError; |
131 | |
132 | |
133 | /// A request to get the difference between two repository trees as a unified git patch. |
134 | /// |
135 | /// # Authentication |
136 | /// - Instance Authentication |
137 | /// - Validate request against the `issued_for` public key |
138 | /// - Validate User token against the user's instance's public key |
139 | /// # Authorization |
140 | /// - User Authorization |
141 | /// - Potential User permissions checks |
142 | |
143 | |
144 | pub old_id: String, |
145 | pub new_id: String, |
146 | |
147 | |
148 | |
149 | type Success = String; |
150 | type Failure = RepositoryError; |
151 | |
152 | |
153 | /// A request to get the commit before the one with the passed id |
154 | /// |
155 | /// # Authentication |
156 | /// - Instance Authentication |
157 | /// - Validate request against the `issued_for` public key |
158 | /// - Validate User token against the user's instance's public key |
159 | /// # Authorization |
160 | /// - User Authorization |
161 | /// - Potential User permissions checks |
162 | |
163 | ; |
164 | |
165 | |
166 | type Success = Commit; |
167 | type Failure = RepositoryError; |
168 | |
169 | |
170 | |
171 | ; |
172 | |
173 | |
174 | type Success = u64; |
175 | type Failure = RepositoryError; |
176 | |
177 | |
178 | /// A request to get a repository's issues count. |
179 | /// |
180 | /// # Authentication |
181 | /// - Instance Authentication |
182 | /// - Validate request against the `issued_for` public key |
183 | /// - Validate User token against the user's instance's public key |
184 | /// # Authorization |
185 | /// - User Authorization |
186 | /// - Potential User permissions checks |
187 | |
188 | ; |
189 | |
190 | |
191 | type Success = ; |
192 | type Failure = RepositoryError; |
193 | |
194 | |
195 | /// A request to get a repository's issue labels. |
196 | /// |
197 | /// # Authentication |
198 | /// - Instance Authentication |
199 | /// - Validate request against the `issued_for` public key |
200 | /// - Validate User token against the user's instance's public key |
201 | /// # Authorization |
202 | /// - User Authorization |
203 | /// - Potential User permissions checks |
204 | |
205 | ; |
206 | |
207 | |
208 | type Success = ; |
209 | type Failure = RepositoryError; |
210 | |
211 | |
212 | /// A request to inspect the tree of a repository. |
213 | /// |
214 | /// # Authentication |
215 | /// - Instance Authentication |
216 | /// - Validate request against the `issued_for` public key |
217 | /// - Validate User token against the user's instance's public key |
218 | /// # Authorization |
219 | /// - User Authorization |
220 | /// - Potential User permissions checks |
221 | |
222 | |
223 | /// Whether to get extra metadata for every entry (file mode, size and last commit made to it). |
224 | pub extra_metadata: bool, |
225 | /// Revision of the repository to get (branch, commit id). |
226 | pub rev: , |
227 | /// If not given a path, it'll default to the base. |
228 | pub path: , |
229 | |
230 | |
231 | |
232 | type Success = ; |
233 | type Failure = RepositoryError; |
234 | |
235 | |
236 | /// A request to get the statistics of repository. |
237 | /// |
238 | /// # Authentication |
239 | /// - Instance Authentication |
240 | /// - Validate request against the `issued_for` public key |
241 | /// - Validate User token against the user's instance's public key |
242 | /// # Authorization |
243 | /// - User Authorization |
244 | /// - Potential User permissions checks |
245 | |
246 | |
247 | /// Revision of the repository to get (branch, commit id). |
248 | pub rev: , |
249 | |
250 | |
251 | |
252 | type Success = RepositoryStatistics; |
253 | type Failure = RepositoryError; |
254 | |
255 | |
256 | /// A request to get a list of branches in the repository. |
257 | /// Skips over references with invalid UTF-8 names. |
258 | /// |
259 | /// # Authentication |
260 | /// - Instance Authentication |
261 | /// - Validate request against the `issued_for` public key |
262 | /// - Validate User token against the user's instance's public key |
263 | /// # Authorization |
264 | /// - User Authorization |
265 | /// - Potential User permissions checks |
266 | |
267 | |
268 | pub filter: RepositoryBranchFilter, |
269 | pub range: (usize, usize), |
270 | |
271 | |
272 | |
273 | type Success = ; |
274 | type Failure = RepositoryError; |
275 | |
276 | |
277 | |
278 | pub async |
279 | &mut self, |
280 | extra_metadata: bool, |
281 | rev: , |
282 | path: , |
283 | operation_state: &S, |
284 | |
285 | self. |
286 | RepositoryInfoRequest |
287 | extra_metadata, |
288 | rev, |
289 | path, |
290 | , |
291 | operation_state, |
292 | |
293 | .await |
294 | |
295 | |
296 | pub async |
297 | &mut self, |
298 | id: String, |
299 | operation_state: &S, |
300 | |
301 | self. |
302 | RepositoryFileFromIdRequest, |
303 | operation_state, |
304 | |
305 | .await |
306 | |
307 | |
308 | pub async |
309 | &mut self, |
310 | rev: , |
311 | path: String, |
312 | operation_state: &S, |
313 | |
314 | self. |
315 | RepositoryFileFromPathRequest , |
316 | operation_state, |
317 | |
318 | .await |
319 | |
320 | |
321 | pub async |
322 | &mut self, |
323 | start_commit: String, |
324 | path: String, |
325 | operation_state: &S, |
326 | |
327 | self. |
328 | RepositoryLastCommitOfFileRequest , |
329 | operation_state, |
330 | |
331 | .await |
332 | |
333 | |
334 | pub async |
335 | &mut self, |
336 | id: String, |
337 | operation_state: &S, |
338 | |
339 | self. |
340 | RepositoryCommitFromIdRequest, |
341 | operation_state, |
342 | |
343 | .await |
344 | |
345 | |
346 | pub async |
347 | &mut self, |
348 | old_id: String, |
349 | new_id: String, |
350 | operation_state: &S, |
351 | |
352 | self. |
353 | RepositoryDiffRequest , |
354 | operation_state, |
355 | |
356 | .await |
357 | |
358 | |
359 | pub async |
360 | &mut self, |
361 | old_id: String, |
362 | new_id: String, |
363 | operation_state: &S, |
364 | |
365 | self. |
366 | RepositoryDiffPatchRequest , |
367 | operation_state, |
368 | |
369 | .await |
370 | |
371 | |
372 | pub async |
373 | &mut self, |
374 | id: String, |
375 | operation_state: &S, |
376 | |
377 | self. |
378 | RepositoryCommitBeforeRequest, |
379 | operation_state, |
380 | |
381 | .await |
382 | |
383 | |
384 | pub async |
385 | &mut self, |
386 | rev: , |
387 | operation_state: &S, |
388 | |
389 | self. |
390 | RepositoryStatisticsRequest , |
391 | operation_state, |
392 | |
393 | .await |
394 | |
395 | |
396 | pub async |
397 | &mut self, |
398 | filter: RepositoryBranchFilter, |
399 | range_start: usize, |
400 | range_end: usize, |
401 | operation_state: &S, |
402 | |
403 | self. |
404 | RepositoryBranchesRequest |
405 | filter, |
406 | range: , |
407 | , |
408 | operation_state, |
409 | |
410 | .await |
411 | |
412 | |
413 | // pub async fn issues_count(&mut self) -> Result<u64, OperationError<RepositoryError>> { |
414 | // self.request::<RepositoryIssuesCountRequest>(RepositoryIssuesCountRequest) |
415 | // .await |
416 | // } |
417 | |
418 | pub async |
419 | &mut self, |
420 | operation_state: &S, |
421 | |
422 | self. |
423 | .await |
424 | |
425 | |
426 | pub async |
427 | &mut self, |
428 | operation_state: &S, |
429 | |
430 | self. |
431 | .await |
432 | |
433 | |
434 | pub async |
435 | &mut self, |
436 | extra_metadata: bool, |
437 | rev: , |
438 | path: , |
439 | operation_state: &S, |
440 | |
441 | self. |
442 | RepositoryFileInspectRequest |
443 | extra_metadata, |
444 | rev: rev.map, |
445 | path: path.map, |
446 | , |
447 | operation_state, |
448 | |
449 | .await |
450 | |
451 | |
452 |