@@ -25,13 +25,18 @@ pub struct ErrorResponse {
25
25
pub obsolete_client : bool ,
26
26
}
27
27
28
- /// OAuth2 credentials
28
+ /// OAuth2 credentials.
29
+ /// get /api/v8/application/{client_name}/credentials
29
30
#[ derive( Debug , Deserialize ) ]
30
31
pub struct Credentials {
31
32
pub application_id : String ,
32
33
pub secret : String ,
33
34
}
34
35
36
+ /// get /api/v8/users/{user_id}
37
+ /// get /api/v8/users/current
38
+ /// post /api/v8/users/basic_info_by_usernames
39
+ /// post /api/v8/users/basic_info_by_emails
35
40
#[ derive( Debug , Deserialize ) ]
36
41
pub struct User {
37
42
pub id : u32 ,
@@ -40,7 +45,8 @@ pub struct User {
40
45
pub administrator : bool ,
41
46
}
42
47
43
- /// Organization information.
48
+ /// get /api/v8/org.json
49
+ /// get /api/v8/org/{organization_slug}.json
44
50
#[ derive( Debug , Serialize , Deserialize , JsonSchema ) ]
45
51
pub struct Organization {
46
52
pub name : String ,
@@ -50,21 +56,26 @@ pub struct Organization {
50
56
pub pinned : bool ,
51
57
}
52
58
53
- /// Information for a course.
59
+ /// get /api/v8/core/org/{organization_slug}/courses
54
60
#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
55
61
pub struct Course {
56
62
pub id : u32 ,
57
63
pub name : String ,
58
64
pub title : String ,
59
65
pub description : Option < String > ,
66
+ /// /api/v8/core/courses/{course_id}
60
67
pub details_url : String ,
68
+ /// /api/v8/core/courses/{course_id}/unlock
61
69
pub unlock_url : String ,
70
+ /// /api/v8/core/courses/{course_id}/reviews
62
71
pub reviews_url : String ,
72
+ /// Typically empty.
63
73
pub comet_url : String ,
64
74
pub spyware_urls : Vec < String > ,
65
75
}
66
76
67
- /// Data for a course.
77
+ /// get /api/v8/courses/{course_id}
78
+ /// get /api/v8/org/{organization_slug}/courses/{course_name}
68
79
#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
69
80
pub struct CourseData {
70
81
pub name : String ,
@@ -83,9 +94,11 @@ pub struct CourseData {
83
94
pub organization_id : Option < u32 > ,
84
95
pub disabled_status : Option < String > ,
85
96
pub title : Option < String > ,
97
+ /// Typically empty.
86
98
pub material_url : Option < String > ,
87
99
pub course_template_id : Option < u32 > ,
88
100
pub hide_submission_results : bool ,
101
+ /// Typically empty.
89
102
pub external_scoreboard_url : Option < String > ,
90
103
pub organization_slug : Option < String > ,
91
104
}
@@ -106,7 +119,7 @@ struct CourseDetailsInner {
106
119
pub exercises : Vec < Exercise > ,
107
120
}
108
121
109
- /// Details for a course.
122
+ /// get /api/v8/core/courses/{course_id}
110
123
#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
111
124
#[ serde( from = "CourseDetailsWrapper" ) ]
112
125
pub struct CourseDetails {
@@ -136,7 +149,9 @@ pub struct Exercise {
136
149
pub soft_deadline : Option < String > ,
137
150
pub soft_deadline_description : Option < String > ,
138
151
pub checksum : String ,
152
+ /// /api/v8/core/exercises/{exercise_id}/submissions
139
153
pub return_url : String ,
154
+ /// /api/v8/core/exercises/{exercise_id}/download
140
155
pub zip_url : String ,
141
156
pub returnable : bool ,
142
157
pub requires_review : bool ,
@@ -149,12 +164,14 @@ pub struct Exercise {
149
164
pub valgrind_strategy : String ,
150
165
pub code_review_requests_enabled : bool ,
151
166
pub run_tests_locally_action_enabled : bool ,
167
+ /// Typically null.
152
168
pub latest_submission_url : Option < String > ,
153
169
pub latest_submission_id : Option < u32 > ,
170
+ /// /api/v8/core/exercises/{exercise_id}/solution/download
154
171
pub solution_zip_url : Option < String > ,
155
172
}
156
173
157
- /// Exercise for a course.
174
+ /// get /api/v8/courses/{course_id}/exercises
158
175
#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
159
176
pub struct CourseExercise {
160
177
pub id : u32 ,
@@ -169,6 +186,7 @@ pub struct CourseExercise {
169
186
pub unlocked : bool ,
170
187
}
171
188
189
+ /// get /api/v8/org/{organization_slug}/courses/{course_name}/exercises
172
190
#[ derive( Debug , Deserialize ) ]
173
191
pub struct CourseDataExercise {
174
192
pub id : u32 ,
@@ -188,6 +206,16 @@ pub struct ExercisePoint {
188
206
pub requires_review : bool ,
189
207
}
190
208
209
+ /// get /api/v8/courses/{course_id}/points
210
+ /// get /api/v8/courses/{course_id}/exercises/{exercise_name}/points
211
+ /// get /api/v8/courses/{course_id}/exercises/{exercise_name}/users/{user_id}/
212
+ /// get /api/v8/courses/{course_id}/exercises/{exercise_name}/users/current/points
213
+ /// get /api/v8/courses/{course_id}/users/{user_id}/points
214
+ /// get /api/v8/courses/{course_id}/users/current/points
215
+ /// get /api/v8/org/{organization_slug}/courses/{course_name}/points
216
+ /// get /api/v8/org/{organization_slug}/courses/{course_name}/exercises/{exercise_name}/points
217
+ /// get /api/v8/org/{organization_slug}/courses/{course_name}/users/{user_id}/points
218
+ /// get /api/v8/org/{organization_slug}/courses/{course_name}/users/current/points
191
219
#[ derive( Debug , Deserialize ) ]
192
220
pub struct CourseDataExercisePoint {
193
221
awarded_point : AwardedPoint ,
@@ -204,7 +232,7 @@ pub struct AwardedPoint {
204
232
created_at : DateTime < FixedOffset > ,
205
233
}
206
234
207
- /// Details for an exercise.
235
+ /// get /api/v8/core/exercises/{exercise_id}
208
236
#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
209
237
pub struct ExerciseDetails {
210
238
pub course_name : String ,
@@ -218,6 +246,12 @@ pub struct ExerciseDetails {
218
246
pub submissions : Vec < ExerciseSubmission > ,
219
247
}
220
248
249
+ /// get /api/v8/core/exercises/details
250
+ #[ derive( Debug , Deserialize ) ]
251
+ pub ( crate ) struct ExercisesDetailsWrapper {
252
+ pub exercises : Vec < ExercisesDetails > ,
253
+ }
254
+
221
255
#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
222
256
pub struct ExercisesDetails {
223
257
pub id : u32 ,
@@ -226,7 +260,16 @@ pub struct ExercisesDetails {
226
260
pub checksum : String ,
227
261
}
228
262
229
- /// Exercise submission.
263
+ /// get /api/v8/courses/{course_id}/submissions
264
+ /// get /api/v8/courses/{course_id}/users/{user_id}/submissions
265
+ /// get /api/v8/courses/{course_id}/users/current/submissions
266
+ /// get api/v8/exercises/{exercise_id}/users/{user_id}/submissions
267
+ /// get api/v8/exercises/{exercise_id}/users/current/submissions
268
+ /// get /api/v8/org/{organization_slug}/courses/{course_name}/submissions
269
+ /// get /api/v8/org/{organization_slug}/courses/{course_name}/users/{user_id}/submissions
270
+ /// get /api/v8/org/{organization_slug}/courses/{course_name}/users/current/submissions
271
+ /// get api/v8/exercises/{exercise_id}/users/{user_id}/submissions
272
+ /// get api/v8/exercises/{exercise_id}/users/current/submissions
230
273
#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
231
274
pub struct Submission {
232
275
pub id : u32 ,
@@ -264,21 +307,27 @@ pub struct ExerciseSubmission {
264
307
pub created_at : DateTime < FixedOffset > ,
265
308
pub all_tests_passed : bool ,
266
309
pub points : Option < String > ,
310
+ /// /api/v8/core/submissions/{submission_id}/download
267
311
pub submitted_zip_url : String ,
312
+ /// https://tmc.mooc.fi/paste/{paste_code}
268
313
pub paste_url : Option < String > ,
269
314
pub processing_time : Option < u32 > ,
270
315
pub reviewed : bool ,
271
316
pub requests_review : bool ,
272
317
}
273
318
274
- /// Exercise submission.
319
+ /// post /api/v8/core/exercises/{exercise_id}/submissions
275
320
#[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
276
321
pub struct NewSubmission {
322
+ /// https://tmc.mooc.fi/api/v8/core/submissions/{submission_id}
277
323
pub show_submission_url : String ,
324
+ /// https://tmc.mooc.fi/paste/{paste_code}
278
325
pub paste_url : String , // use Option and serde_with::string_empty_as_none ?
326
+ /// https://tmc.mooc.fi/submissions/{submission_id}
279
327
pub submission_url : String ,
280
328
}
281
329
330
+ /// get /api/v8/core/submission/{submission_id}
282
331
#[ derive( Debug , Deserialize , Serialize ) ]
283
332
#[ serde( untagged) ] // TODO: tag
284
333
pub enum SubmissionProcessingStatus {
@@ -300,7 +349,6 @@ pub enum SandboxStatus {
300
349
ProcessingOnSandbox ,
301
350
}
302
351
303
- /// Finished submission.
304
352
#[ derive( Debug , Deserialize , Serialize , PartialEq , Eq , JsonSchema ) ]
305
353
pub struct SubmissionFinished {
306
354
pub api_version : u32 ,
@@ -312,17 +360,21 @@ pub struct SubmissionFinished {
312
360
pub status : SubmissionStatus ,
313
361
pub points : Vec < String > ,
314
362
pub valgrind : Option < String > ,
363
+ /// https://tmc.mooc.fi/submissions/{submission_id}}
315
364
pub submission_url : String ,
365
+ /// https://tmc.mooc.fi/exercises/{exercise_id}/solution
316
366
pub solution_url : Option < String > ,
317
367
pub submitted_at : String ,
318
368
pub processing_time : Option < u32 > ,
319
369
pub reviewed : bool ,
320
370
pub requests_review : bool ,
371
+ /// https://tmc.mooc.fi/paste/{paste_code}
321
372
pub paste_url : Option < String > ,
322
373
pub message_for_paste : Option < String > ,
323
374
pub missing_review_points : Vec < String > ,
324
375
pub test_cases : Option < Vec < TestCase > > ,
325
376
pub feedback_questions : Option < Vec < SubmissionFeedbackQuestion > > ,
377
+ /// /api/v8/core/submissions/{submission_id}/feedback
326
378
pub feedback_answer_url : Option < String > ,
327
379
pub error : Option < String > ,
328
380
pub validations : Option < StyleValidationResult > ,
@@ -338,7 +390,7 @@ pub enum SubmissionStatus {
338
390
Hidden ,
339
391
}
340
392
341
- /// Response to feedback.
393
+ /// post /api/v8/core/submissions/{submission_id}/ feedback
342
394
#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
343
395
pub struct SubmissionFeedbackResponse {
344
396
pub api_version : u32 ,
@@ -431,7 +483,7 @@ impl<'de> Visitor<'de> for SubmissionFeedbackKindVisitor {
431
483
}
432
484
}
433
485
434
- /// Code review.
486
+ /// get /api/v8/core/courses/{course_id}/reviews
435
487
#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
436
488
pub struct Review {
437
489
pub submission_id : u32 ,
@@ -442,19 +494,14 @@ pub struct Review {
442
494
pub review_body : String ,
443
495
pub points : Vec < String > ,
444
496
pub points_not_awarded : Vec < String > ,
497
+ /// https://tmc.mooc.fi/submissions/{submission_id}/reviews
445
498
pub url : String ,
499
+ /// /api/v8/core/courses/{course_id}/reviews/{review_id}
446
500
pub update_url : String ,
447
501
pub created_at : DateTime < FixedOffset > ,
448
502
pub updated_at : DateTime < FixedOffset > ,
449
503
}
450
504
451
- /// Updated exercises.
452
- #[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
453
- pub struct UpdateResult {
454
- pub created : Vec < Exercise > ,
455
- pub updated : Vec < Exercise > ,
456
- }
457
-
458
505
#[ cfg( test) ]
459
506
#[ allow( clippy:: clippy:: unwrap_used) ]
460
507
mod test {
0 commit comments