Automatically populate the target instance field from the request using MessageTarget trait
parent: tbd commit: 37da513
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 repository: Repository, |
60 | pub path: RepositoryTreeEntry, |
61 | |
62 | |
63 | |
64 | |
65 | Some |
66 | |
67 | |
68 | |
69 | |
70 | |
71 | File |
72 | commit_metadata: Commit, |
73 | , |
74 | Folder |
75 | commit_metadata: Commit, |
76 | members: , |
77 | , |
78 | Invalid |
79 | path: RepositoryTreeEntry, |
80 | , |
81 | |
82 | |
83 | /// A request to get a repository's information. |
84 | /// |
85 | /// # Authentication |
86 | /// - Instance Authentication |
87 | /// - Validate request against the `issued_for` public key |
88 | /// - Validate User token against the user's instance's public key |
89 | /// # Authorization |
90 | /// - User Authorization |
91 | /// - Potential User permissions checks |
92 | |
93 | ; |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | pub count: u64, |
100 | |
101 | |
102 | /// A request to get a repository's issues count. |
103 | /// |
104 | /// # Authentication |
105 | /// - Instance Authentication |
106 | /// - Validate request against the `issued_for` public key |
107 | /// - Validate User token against the user's instance's public key |
108 | /// # Authorization |
109 | /// - User Authorization |
110 | /// - Potential User permissions checks |
111 | |
112 | ; |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | pub labels: , |
119 | |
120 | |
121 | |
122 | |
123 | pub name: String, |
124 | pub color: String, |
125 | |
126 | |
127 | /// A request to get a repository's issue labels. |
128 | /// |
129 | /// # Authentication |
130 | /// - Instance Authentication |
131 | /// - Validate request against the `issued_for` public key |
132 | /// - Validate User token against the user's instance's public key |
133 | /// # Authorization |
134 | /// - User Authorization |
135 | /// - Potential User permissions checks |
136 | |
137 | ; |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | pub issues: , |
144 | |
145 | |
146 | /// A request to get a repository's issues. |
147 | /// |
148 | /// # Authentication |
149 | /// - Instance Authentication |
150 | /// - Validate request against the `issued_for` public key |
151 | /// - Validate User token against the user's instance's public key |
152 | /// # Authorization |
153 | /// - User Authorization |
154 | /// - Potential User permissions checks |
155 | |
156 | |
157 | pub author: User, |
158 | pub id: u64, |
159 | pub title: String, |
160 | pub contents: String, |
161 | pub labels: , |
162 | |
163 | |
164 | |
165 | |
166 | pub repository: Repository, |
167 | /// Whether to fetch extra metadata like the last commit made to file or size |
168 | pub extra_metadata: bool, |
169 | /// Rev (branch) being requested |
170 | pub rev: , |
171 | /// Tree path being requested |
172 | pub path: , |
173 | |
174 | |
175 | |
176 | |
177 | Some |
178 | |
179 | |
180 | |
181 | |
182 | |
183 | pub repository: Repository, |
184 | |
185 | |
186 | |
187 | |
188 | Some |
189 | |
190 | |
191 | |
192 | |
193 | |
194 | pub settings: , |
195 | |
196 | |
197 | |
198 | |
199 | let setting_member = self |
200 | .settings |
201 | .iter |
202 | .filter |
203 | .next?; |
204 | |
205 | ok | from_value .
206 | |
207 | |
208 | |
209 | |
210 | |
211 | pub repository: Repository, |
212 | pub settings: , |
213 | |
214 | |
215 | |
216 | |
217 | Some |
218 | |
219 | |
220 | |
221 | |
222 | |
223 | Self |
224 | repository: repository.to_owned, |
225 | settings: Default default, |
226 | |
227 | |
228 | |
229 | |
230 | self.settings.push |
231 | to_string, | name .
232 | unwrap, | to_string .
233 | ; |
234 | |
235 | |
236 | let setting_member = self |
237 | .settings |
238 | .iter |
239 | .filter |
240 | .next?; |
241 | |
242 | ok | from_str .
243 | |
244 | |
245 | |
246 | |
247 | |
248 | // IDK? |
249 | |
250 |