Begin new protocol refactor
parent: tbd commit: 26651b1
1 | use HashMap; |
2 | |
3 | use DeserializeOwned; |
4 | use ; |
5 | |
6 | use crate Instance; |
7 | use crate RepositoryVisibility; |
8 | use crate Setting; |
9 | use crate |
10 | , |
11 | , | User
12 | ; |
13 | |
14 | use MessageTarget; |
15 | |
16 | /// A request to create a repository. |
17 | /// |
18 | /// # Authentication |
19 | /// - Instance Authentication |
20 | /// - Used to validate User token `issued_for` |
21 | /// - User Authentication |
22 | /// - Used to source owning user |
23 | /// - Used to authorize user token against user's instance |
24 | /// # Authorization |
25 | /// - Instance Authorization |
26 | /// - Used to authorize action using User token requiring a correct `issued_for` and valid issuance from user's instance |
27 | /// - User Authorization |
28 | /// - Potential User permissions checks |
29 | |
30 | |
31 | pub instance: , |
32 | pub name: String, |
33 | pub description: , |
34 | pub visibility: RepositoryVisibility, |
35 | pub default_branch: String, |
36 | pub owner: User, |
37 | |
38 | |
39 | |
40 | |
41 | self.instance.clone |
42 | |
43 | |
44 | |
45 | |
46 | ; |
47 | |
48 | /// A request to inspect the tree of a repository. |
49 | /// |
50 | /// # Authentication |
51 | /// - Instance Authentication |
52 | /// - Validate request against the `issued_for` public key |
53 | /// - Validate User token against the user's instance's public key |
54 | /// # Authorization |
55 | /// - User Authorization |
56 | /// - Potential User permissions checks |
57 | |
58 | |
59 | pub path: RepositoryTreeEntry, |
60 | |
61 | |
62 | |
63 | |
64 | None |
65 | |
66 | |
67 | |
68 | |
69 | |
70 | File |
71 | commit_metadata: Commit, |
72 | , |
73 | Folder |
74 | commit_metadata: Commit, |
75 | members: , |
76 | , |
77 | Invalid |
78 | path: RepositoryTreeEntry, |
79 | , |
80 | |
81 | |
82 | /// A request to get a repository's information. |
83 | /// |
84 | /// # Authentication |
85 | /// - Instance Authentication |
86 | /// - Validate request against the `issued_for` public key |
87 | /// - Validate User token against the user's instance's public key |
88 | /// # Authorization |
89 | /// - User Authorization |
90 | /// - Potential User permissions checks |
91 | |
92 | ; |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | pub count: u64, |
99 | |
100 | |
101 | /// A request to get a repository's issues count. |
102 | /// |
103 | /// # Authentication |
104 | /// - Instance Authentication |
105 | /// - Validate request against the `issued_for` public key |
106 | /// - Validate User token against the user's instance's public key |
107 | /// # Authorization |
108 | /// - User Authorization |
109 | /// - Potential User permissions checks |
110 | |
111 | ; |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | pub labels: , |
118 | |
119 | |
120 | |
121 | /// A request to get a repository's issue labels. |
122 | /// |
123 | /// # Authentication |
124 | /// - Instance Authentication |
125 | /// - Validate request against the `issued_for` public key |
126 | /// - Validate User token against the user's instance's public key |
127 | /// # Authorization |
128 | /// - User Authorization |
129 | /// - Potential User permissions checks |
130 | |
131 | ; |
132 | |
133 | |
134 | |
135 | |
136 | |
137 | pub issues: , |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | pub repository: Repository, |
144 | /// Whether to fetch extra metadata like the last commit made to file or size |
145 | pub extra_metadata: bool, |
146 | /// Rev (branch) being requested |
147 | pub rev: , |
148 | /// Tree path being requested |
149 | pub path: , |
150 | |
151 | |
152 | |
153 | |
154 | Some |
155 | |
156 | |
157 | |
158 | |
159 | |
160 | pub repository: Repository, |
161 | |
162 | |
163 | |
164 | |
165 | Some |
166 | |
167 | |
168 | |
169 | |
170 | |
171 | pub settings: , |
172 | |
173 | |
174 | |
175 | |
176 | let setting_member = self |
177 | .settings |
178 | .iter |
179 | .filter |
180 | .next?; |
181 | |
182 | ok | from_value .
183 | |
184 | |
185 | |
186 | |
187 | |
188 | pub repository: Repository, |
189 | pub settings: , |
190 | |
191 | |
192 | |
193 | |
194 | Some |
195 | |
196 | |
197 | |
198 | |
199 | |
200 | Self |
201 | repository: repository.to_owned, |
202 | settings: Default default, |
203 | |
204 | |
205 | |
206 | |
207 | self.settings.push |
208 | to_string, | name .
209 | unwrap, | to_string .
210 | ; |
211 | |
212 | |
213 | let setting_member = self |
214 | .settings |
215 | .iter |
216 | .filter |
217 | .next?; |
218 | |
219 | ok | from_str .
220 | |
221 | |
222 | |
223 | |
224 | |
225 | // IDK? |
226 | |
227 |