codehood-cli 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codehood/__init__.py +0 -0
- codehood/__main__.py +4 -0
- codehood/actions/__init__.py +0 -0
- codehood/actions/base.py +119 -0
- codehood/actions/resources.py +30 -0
- codehood/api/__init__.py +0 -0
- codehood/api/base.py +256 -0
- codehood/api/generate.py +1370 -0
- codehood/api/generated.py +3818 -0
- codehood/api/openapi.py +134 -0
- codehood/api/pages.py +53 -0
- codehood/cli/__init__.py +64 -0
- codehood/cli/api.py +422 -0
- codehood/cli/attendance.py +136 -0
- codehood/cli/auth.py +106 -0
- codehood/cli/base.py +42 -0
- codehood/cli/chill.py +52 -0
- codehood/cli/exam.py +107 -0
- codehood/cli/grades.py +185 -0
- codehood/cli/init.py +161 -0
- codehood/cli/push.py +609 -0
- codehood/cli/show.py +77 -0
- codehood/cli/uitils.py +26 -0
- codehood/functional.py +40 -0
- codehood/globs.py +71 -0
- codehood/grades.py +74 -0
- codehood/hypothesis.py +274 -0
- codehood/models/__init__.py +0 -0
- codehood/models/base.py +15 -0
- codehood/models/repo.py +187 -0
- codehood/models/validators.py +177 -0
- codehood/push/__init__.py +225 -0
- codehood/push/base.py +216 -0
- codehood/push/calendar.py +664 -0
- codehood/push/errors.py +136 -0
- codehood/push/exam.py +636 -0
- codehood/push/exclude.py +60 -0
- codehood/push/grades.py +455 -0
- codehood/push/hook.py +48 -0
- codehood/push/links.py +614 -0
- codehood/push/ours.py +78 -0
- codehood/push/plan.py +1981 -0
- codehood/push/project.py +272 -0
- codehood/push/question.py +338 -0
- codehood/push/report.py +244 -0
- codehood/push/repository.py +326 -0
- codehood/push/resource.py +576 -0
- codehood/push/run.py +1275 -0
- codehood/push/unconsumed.py +208 -0
- codehood/push/wire.py +222 -0
- codehood/py.typed +0 -0
- codehood/repo/__init__.py +62 -0
- codehood/repo/_config.py +28 -0
- codehood/repo/_layout.py +132 -0
- codehood/repo/_scaffold.py +244 -0
- codehood/repo/diff.py +71 -0
- codehood/repo/file_tracker.py +124 -0
- codehood/theme.py +101 -0
- codehood/widgets/__init__.py +0 -0
- codehood/widgets/mascot.py +76 -0
- codehood/widgets/questions/__init__.py +65 -0
- codehood/widgets/questions/base.py +119 -0
- codehood/widgets/questions/controls.py +194 -0
- codehood/widgets/questions/fill_in.py +81 -0
- codehood/widgets/questions/responses.py +137 -0
- codehood/widgets/questions/simple.py +117 -0
- codehood_cli-0.5.0.dist-info/METADATA +294 -0
- codehood_cli-0.5.0.dist-info/RECORD +71 -0
- codehood_cli-0.5.0.dist-info/WHEEL +4 -0
- codehood_cli-0.5.0.dist-info/entry_points.txt +4 -0
- codehood_cli-0.5.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,3818 @@
|
|
|
1
|
+
# This file is AUTO-GENERATED. DO NOT EDIT!
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Literal
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
from pydantic import ConfigDict, Field, TypeAdapter
|
|
9
|
+
|
|
10
|
+
from ..models.base import Model
|
|
11
|
+
from .base import (
|
|
12
|
+
CodehoodAPIError,
|
|
13
|
+
auth_headers,
|
|
14
|
+
get_client,
|
|
15
|
+
header_params,
|
|
16
|
+
query_params,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class BlobMissingInput(Model):
|
|
21
|
+
hashes: list[str]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class BlobMissingResult(Model):
|
|
25
|
+
missing: list[str]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class CalendarEventCreate(Model):
|
|
29
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
30
|
+
|
|
31
|
+
kind: Literal["REGULAR", "HOLIDAY", "CANCELLED"] | None = None
|
|
32
|
+
title: str
|
|
33
|
+
description: str | None = None
|
|
34
|
+
week: int
|
|
35
|
+
rev: str | None = None
|
|
36
|
+
repositories: list[str] | None = None
|
|
37
|
+
time_slot: str = Field(alias="timeSlot")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ClaimGradingJobsRequest(Model):
|
|
41
|
+
workers: list[str]
|
|
42
|
+
limit: int | None = None
|
|
43
|
+
discipline: str | None = None
|
|
44
|
+
course: str | None = None
|
|
45
|
+
exam: str | None = None
|
|
46
|
+
questions: list[str] | None = None
|
|
47
|
+
lease: int | None = None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class CourseAttendanceResponseStudentsItem(Model):
|
|
51
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
52
|
+
|
|
53
|
+
username: str
|
|
54
|
+
name: str
|
|
55
|
+
email: str
|
|
56
|
+
school_id: str | None = Field(alias="schoolId")
|
|
57
|
+
status: Literal["ACTIVE", "DROPPED"]
|
|
58
|
+
cells: dict[str, Literal["present", "absent", "before-enrollment"]]
|
|
59
|
+
present: int
|
|
60
|
+
total: int
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class CourseCreate(Model):
|
|
64
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
65
|
+
|
|
66
|
+
description: str | None = None
|
|
67
|
+
discipline: str
|
|
68
|
+
edition: str
|
|
69
|
+
instructor: str | None = None
|
|
70
|
+
rev: str | None = None
|
|
71
|
+
start_date: str = Field(alias="startDate")
|
|
72
|
+
end_date: str = Field(alias="endDate")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class CourseGradesResponseStudentsItemShape(Model):
|
|
76
|
+
kind: Literal["empty"]
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class CourseGradesResponseStudentsItemShape2(Model):
|
|
80
|
+
kind: Literal["in-progress"]
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class CourseGradesResponseStudentsItemShape3(Model):
|
|
84
|
+
kind: Literal["missed"]
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class CourseGradesResponseStudentsItemShape4(Model):
|
|
88
|
+
kind: Literal["pending"]
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class CourseGradesResponseStudentsItemShape5(Model):
|
|
92
|
+
kind: Literal["total"]
|
|
93
|
+
total: float
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class DataCode(Model):
|
|
97
|
+
type: Literal["CODE"]
|
|
98
|
+
content: str
|
|
99
|
+
language: str
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class DataLink(Model):
|
|
103
|
+
type: Literal["LINK"]
|
|
104
|
+
url: str
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class DataMd(Model):
|
|
108
|
+
type: Literal["MD"]
|
|
109
|
+
content: str
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class Deleted(Model):
|
|
113
|
+
success: bool
|
|
114
|
+
message: str
|
|
115
|
+
deleted: bool
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class Discipline(Model):
|
|
119
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
120
|
+
|
|
121
|
+
slug: str
|
|
122
|
+
name: str
|
|
123
|
+
created_at: str = Field(alias="createdAt")
|
|
124
|
+
updated_at: str = Field(alias="updatedAt")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class DisciplineCreate(Model):
|
|
128
|
+
slug: str
|
|
129
|
+
name: str
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class Duration(Model):
|
|
133
|
+
hours: int | None = None
|
|
134
|
+
minutes: int | None = None
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class Edition(Model):
|
|
138
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
139
|
+
|
|
140
|
+
slug: str
|
|
141
|
+
name: str
|
|
142
|
+
start_date: str = Field(alias="startDate")
|
|
143
|
+
end_date: str = Field(alias="endDate")
|
|
144
|
+
created_at: str = Field(alias="createdAt")
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class EditionCreate(Model):
|
|
148
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
149
|
+
|
|
150
|
+
slug: str
|
|
151
|
+
name: str
|
|
152
|
+
start_date: str = Field(alias="startDate")
|
|
153
|
+
end_date: str = Field(alias="endDate")
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class Event(Model):
|
|
157
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
158
|
+
|
|
159
|
+
week: int
|
|
160
|
+
time_slot: str = Field(alias="timeSlot")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class EventsItem(Model):
|
|
164
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
165
|
+
|
|
166
|
+
week: int
|
|
167
|
+
title: str
|
|
168
|
+
start_at: str = Field(alias="startAt")
|
|
169
|
+
time_slot: str = Field(alias="timeSlot")
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class ExamAttachmentsItem(Model):
|
|
173
|
+
name: str
|
|
174
|
+
format: str
|
|
175
|
+
text: str | None = None
|
|
176
|
+
origin: str | None = None
|
|
177
|
+
label: str | None = None
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class ExamCreateAttachmentsItem(Model):
|
|
181
|
+
name: str
|
|
182
|
+
format: str
|
|
183
|
+
text: str | None = None
|
|
184
|
+
origin: str | None = None
|
|
185
|
+
label: str | None = None
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class ExamCreateQuestionsItem(Model):
|
|
189
|
+
slug: str
|
|
190
|
+
version: str | None = None
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class ExamQuestionsItem(Model):
|
|
194
|
+
slug: str
|
|
195
|
+
version: str | None
|
|
196
|
+
weight: float
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class ExamsItem(Model):
|
|
200
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
201
|
+
|
|
202
|
+
slug: str
|
|
203
|
+
title: str
|
|
204
|
+
scheduled_at: str | None = Field(alias="scheduledAt")
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class FailGradingJobRequest(Model):
|
|
208
|
+
error: str
|
|
209
|
+
retry: bool
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class FailGradingJobResponse(Model):
|
|
213
|
+
state: Literal["QUEUED", "CLAIMED", "DONE", "FAILED", "CANCELLED"]
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
class GradeReleaseRefusedShape(Model):
|
|
217
|
+
code: str
|
|
218
|
+
message: str | None = None
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
class HealthResponse(Model):
|
|
222
|
+
status: Literal["ok"]
|
|
223
|
+
database: Literal["ok"]
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class Instructor(Model):
|
|
227
|
+
name: str
|
|
228
|
+
username: str
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
class ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem(Model):
|
|
232
|
+
name: str
|
|
233
|
+
format: str
|
|
234
|
+
text: str | None = None
|
|
235
|
+
label: str | None = None
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class ListQuestionResponseItemsItem2QuestionFillInBlanksItemNumeric(Model):
|
|
239
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
240
|
+
|
|
241
|
+
id: str
|
|
242
|
+
type: Literal["numeric"]
|
|
243
|
+
unit: str | None = None
|
|
244
|
+
domain: Literal["integer", "decimal", "fraction"]
|
|
245
|
+
decimal_places: int | None = Field(default=None, alias="decimalPlaces")
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class ListQuestionResponseItemsItem2QuestionMultipleChoiceChoicesItem(Model):
|
|
249
|
+
id: str
|
|
250
|
+
text: str
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
class ListQuestionResponseItemsItem2QuestionShortAnswerPreAcceptItem(Model):
|
|
254
|
+
pattern: str
|
|
255
|
+
feedback: str | None = None
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class ListQuestionResponseItemsItemQuestionCodeRubricItem(Model):
|
|
259
|
+
value: float | None = None
|
|
260
|
+
binding: Literal["manual"]
|
|
261
|
+
text: str
|
|
262
|
+
feedback: str | None = None
|
|
263
|
+
comment: str | None = None
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class ListQuestionResponseItemsItemQuestionMultipleChoiceChoicesItem(Model):
|
|
267
|
+
id: str | None = None
|
|
268
|
+
text: str
|
|
269
|
+
score: float | None = None
|
|
270
|
+
feedback: str | None = None
|
|
271
|
+
comment: str | None = None
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class ListQuestionResponseItemsItemQuestionMultipleSelectionChoicesItem(Model):
|
|
275
|
+
id: str | None = None
|
|
276
|
+
text: str
|
|
277
|
+
correct: bool
|
|
278
|
+
feedback: str | None = None
|
|
279
|
+
comment: str | None = None
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
class ListQuestionResponseItemsItemQuestionOrderingAcceptItem(Model):
|
|
283
|
+
lines: list[list[int | str]]
|
|
284
|
+
feedback: str | None = None
|
|
285
|
+
comment: str | None = None
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
class ListQuestionResponseItemsItemQuestionShortAnswerAcceptItem(Model):
|
|
289
|
+
pattern: str
|
|
290
|
+
feedback: str | None = None
|
|
291
|
+
comment: str | None = None
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
class ListQuestionResponseItemsItemQuestionTrueFalseChoicesItem(Model):
|
|
295
|
+
id: str | None = None
|
|
296
|
+
text: str
|
|
297
|
+
correct: bool
|
|
298
|
+
marker: str | None = None
|
|
299
|
+
feedback: str | None = None
|
|
300
|
+
comment: str | None = None
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
class LoginRequest(Model):
|
|
304
|
+
login: str
|
|
305
|
+
password: str
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
class LoginResponse(Model):
|
|
309
|
+
token: str
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
class LogoutResponse(Model):
|
|
313
|
+
success: bool
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
class PublicTestsItem(Model):
|
|
317
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
318
|
+
|
|
319
|
+
format: str
|
|
320
|
+
text: str
|
|
321
|
+
first_line: int = Field(alias="firstLine")
|
|
322
|
+
example: bool
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
class ReadRollCallResponseShape(Model):
|
|
326
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
327
|
+
|
|
328
|
+
source: Literal["CODE", "MANUAL"]
|
|
329
|
+
joined: Literal["ENROLLMENT", "ACCOUNT", None] | None
|
|
330
|
+
note: str | None
|
|
331
|
+
shared_with: list[str] = Field(alias="sharedWith")
|
|
332
|
+
created_at: str = Field(alias="createdAt")
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
class RenewGradingJobRequest(Model):
|
|
336
|
+
lease: int | None = None
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
class RenewGradingJobResponse(Model):
|
|
340
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
341
|
+
|
|
342
|
+
lease_until: str = Field(alias="leaseUntil")
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
class ReportGradingJobResponse(Model):
|
|
346
|
+
state: Literal["QUEUED", "CLAIMED", "DONE", "FAILED", "CANCELLED"]
|
|
347
|
+
status: Literal[
|
|
348
|
+
"PENDING_GRADE",
|
|
349
|
+
"WILL_NOT_GRADE",
|
|
350
|
+
"GRADED_AUTOMATICALLY",
|
|
351
|
+
"GRADED_MANUALLY",
|
|
352
|
+
"PRETEST_FAILED",
|
|
353
|
+
]
|
|
354
|
+
score: float | None = None
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
class RepositoriesItem(Model):
|
|
358
|
+
slug: str
|
|
359
|
+
title: str
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
class Repository(Model):
|
|
363
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
364
|
+
|
|
365
|
+
slug: str
|
|
366
|
+
title: str
|
|
367
|
+
head: str | None
|
|
368
|
+
tree: str | None
|
|
369
|
+
message: str | None
|
|
370
|
+
committed_at: str | None = Field(alias="committedAt")
|
|
371
|
+
clone_url: str = Field(alias="cloneUrl")
|
|
372
|
+
created_at: str = Field(alias="createdAt")
|
|
373
|
+
updated_at: str = Field(alias="updatedAt")
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
class RepositoryCreate(Model):
|
|
377
|
+
slug: str
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
class RepositoryDeleted(Model):
|
|
381
|
+
deleted: bool
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
class ResourceCreateDataFile(Model):
|
|
385
|
+
filename: str
|
|
386
|
+
type: Literal["FILE"]
|
|
387
|
+
hash: str
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
class ResourceDataFile(Model):
|
|
391
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
392
|
+
|
|
393
|
+
link: str
|
|
394
|
+
mime_type: str = Field(alias="mimeType")
|
|
395
|
+
filename: str
|
|
396
|
+
type: Literal["FILE"]
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
class RubricItem(Model):
|
|
400
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
401
|
+
|
|
402
|
+
key: str
|
|
403
|
+
group: str | None
|
|
404
|
+
text: str
|
|
405
|
+
value: str
|
|
406
|
+
comment: str | None
|
|
407
|
+
feedback: str | None
|
|
408
|
+
position: int
|
|
409
|
+
retired_at: str | None = Field(alias="retiredAt")
|
|
410
|
+
uses: int
|
|
411
|
+
updated_at: str | None = Field(alias="updatedAt")
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
class RubricItemCreate(Model):
|
|
415
|
+
key: str | None = None
|
|
416
|
+
group: str | None = None
|
|
417
|
+
text: str
|
|
418
|
+
value: str
|
|
419
|
+
comment: str | None = None
|
|
420
|
+
feedback: str | None = None
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
class RubricItemDeleted(Model):
|
|
424
|
+
deleted: bool
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
class RubricItemPut(Model):
|
|
428
|
+
group: str | None = None
|
|
429
|
+
text: str
|
|
430
|
+
value: str
|
|
431
|
+
comment: str | None = None
|
|
432
|
+
feedback: str | None = None
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
class RubricItemUpdate(Model):
|
|
436
|
+
group: str | None = None
|
|
437
|
+
text: str | None = None
|
|
438
|
+
value: str | None = None
|
|
439
|
+
comment: str | None = None
|
|
440
|
+
feedback: str | None = None
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
class RubricPreview(Model):
|
|
444
|
+
passes: int
|
|
445
|
+
released: int
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
class RubricPreviewRequestDeleteItem(Model):
|
|
449
|
+
op: Literal["deleteItem"]
|
|
450
|
+
key: str
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class RubricRenameGroup(Model):
|
|
454
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
455
|
+
|
|
456
|
+
from_: str = Field(alias="from")
|
|
457
|
+
to: str
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class RubricRenameResult(Model):
|
|
461
|
+
renamed: int
|
|
462
|
+
warnings: list[str]
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
class RubricUpdate(Model):
|
|
466
|
+
base: str
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
class Start(Model):
|
|
470
|
+
hour: int
|
|
471
|
+
minute: int
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
class TestsItem(Model):
|
|
475
|
+
format: str
|
|
476
|
+
text: str | None = None
|
|
477
|
+
origin: str | None = None
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
class Tolerance(Model):
|
|
481
|
+
absolute: float | None = None
|
|
482
|
+
relative: float | None = None
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
class UpdateCalendarEventRequest(Model):
|
|
486
|
+
kind: Literal["REGULAR", "HOLIDAY", "CANCELLED"] | None = None
|
|
487
|
+
title: str | None = None
|
|
488
|
+
description: str | None = None
|
|
489
|
+
rev: str | None = None
|
|
490
|
+
repositories: list[str] | None = None
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
class UpdateCourseRequest(Model):
|
|
494
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
495
|
+
|
|
496
|
+
description: str | None = None
|
|
497
|
+
start_date: str | None = Field(default=None, alias="startDate")
|
|
498
|
+
end_date: str | None = Field(default=None, alias="endDate")
|
|
499
|
+
rev: str | None = None
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
class UpdateDisciplineRequest(Model):
|
|
503
|
+
name: str | None = None
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
class UpdateEditionRequest(Model):
|
|
507
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
508
|
+
|
|
509
|
+
name: str | None = None
|
|
510
|
+
start_date: str | None = Field(default=None, alias="startDate")
|
|
511
|
+
end_date: str | None = Field(default=None, alias="endDate")
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
class UpdateRollCallRequestShape(Model):
|
|
515
|
+
note: str | None = None
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
class UpdateUserRequest(Model):
|
|
519
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
520
|
+
|
|
521
|
+
name: str | None = None
|
|
522
|
+
email: str | None = None
|
|
523
|
+
github_id: str | None = Field(default=None, alias="githubId")
|
|
524
|
+
school_id: str | None = Field(default=None, alias="schoolId")
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
class User(Model):
|
|
528
|
+
username: str
|
|
529
|
+
name: str
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
class UserCreate(Model):
|
|
533
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
534
|
+
|
|
535
|
+
email: str
|
|
536
|
+
name: str
|
|
537
|
+
username: str
|
|
538
|
+
role: Literal["STUDENT", "INSTRUCTOR", "ADMIN"]
|
|
539
|
+
github_id: str | None = Field(default=None, alias="githubId")
|
|
540
|
+
school_id: str | None = Field(default=None, alias="schoolId")
|
|
541
|
+
password: str
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
class ValuesItem(Model):
|
|
545
|
+
username: str
|
|
546
|
+
value: float | str
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
class Course(Model):
|
|
550
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
551
|
+
|
|
552
|
+
description: str | None
|
|
553
|
+
discipline: DisciplineCreate
|
|
554
|
+
edition: DisciplineCreate
|
|
555
|
+
instructor: Instructor
|
|
556
|
+
enrollment_count: int = Field(alias="enrollmentCount")
|
|
557
|
+
rev: str | None
|
|
558
|
+
start_date: str = Field(alias="startDate")
|
|
559
|
+
end_date: str = Field(alias="endDate")
|
|
560
|
+
created_at: str = Field(alias="createdAt")
|
|
561
|
+
updated_at: str = Field(alias="updatedAt")
|
|
562
|
+
joined_at: str = Field(alias="joinedAt")
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
class CourseAttendanceResponse(Model):
|
|
566
|
+
events: list[EventsItem]
|
|
567
|
+
students: list[CourseAttendanceResponseStudentsItem]
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
class CourseGradesResponseStudentsItem(Model):
|
|
571
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
572
|
+
|
|
573
|
+
username: str
|
|
574
|
+
name: str
|
|
575
|
+
email: str
|
|
576
|
+
school_id: str | None = Field(alias="schoolId")
|
|
577
|
+
github_id: str | None = Field(alias="githubId")
|
|
578
|
+
status: Literal["ACTIVE", "DROPPED"]
|
|
579
|
+
results: dict[
|
|
580
|
+
str,
|
|
581
|
+
CourseGradesResponseStudentsItemShape5
|
|
582
|
+
| CourseGradesResponseStudentsItemShape4
|
|
583
|
+
| CourseGradesResponseStudentsItemShape2
|
|
584
|
+
| CourseGradesResponseStudentsItemShape3
|
|
585
|
+
| CourseGradesResponseStudentsItemShape,
|
|
586
|
+
]
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
class Exam(Model):
|
|
590
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
591
|
+
|
|
592
|
+
slug: str
|
|
593
|
+
type: Literal["PRACTICE", "QUIZ", "EXAM"]
|
|
594
|
+
status: Literal["DRAFT", "ARCHIVED", "SCHEDULED", "ONGOING", "COMPLETED"]
|
|
595
|
+
title: str
|
|
596
|
+
description: str | None
|
|
597
|
+
preamble: str | None
|
|
598
|
+
format: Literal["PLAINTEXT", "MARKDOWN", "HTML"]
|
|
599
|
+
scheduled_at: str | None = Field(alias="scheduledAt")
|
|
600
|
+
duration: Duration | None
|
|
601
|
+
extra_time: Duration | None = Field(alias="extraTime")
|
|
602
|
+
allow_code_run: bool | None = Field(alias="allowCodeRun")
|
|
603
|
+
answer_history: bool | None = Field(alias="answerHistory")
|
|
604
|
+
grades_released_at: str | None = Field(alias="gradesReleasedAt")
|
|
605
|
+
author: str
|
|
606
|
+
rev: str | None
|
|
607
|
+
tags: list[str]
|
|
608
|
+
questions: list[ExamQuestionsItem]
|
|
609
|
+
created_at: str = Field(alias="createdAt")
|
|
610
|
+
updated_at: str = Field(alias="updatedAt")
|
|
611
|
+
attachments: list[ExamAttachmentsItem] | None = None
|
|
612
|
+
files: dict[str, str] | None = None
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
class ExamCreate(Model):
|
|
616
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
617
|
+
|
|
618
|
+
slug: str
|
|
619
|
+
type: Literal["PRACTICE", "QUIZ", "EXAM"] | None = None
|
|
620
|
+
status: Literal["DRAFT", "ARCHIVED", "SCHEDULED", "ONGOING", "COMPLETED"] | None = (
|
|
621
|
+
None
|
|
622
|
+
)
|
|
623
|
+
title: str
|
|
624
|
+
description: str | None = None
|
|
625
|
+
preamble: str | None = None
|
|
626
|
+
format: Literal["PLAINTEXT", "MARKDOWN", "HTML"] | None = None
|
|
627
|
+
scheduled_at: str | None = Field(default=None, alias="scheduledAt")
|
|
628
|
+
duration: Duration | None = None
|
|
629
|
+
allow_code_run: bool | None = Field(default=None, alias="allowCodeRun")
|
|
630
|
+
rev: str | None = None
|
|
631
|
+
tags: list[str] | None = None
|
|
632
|
+
questions: list[ExamCreateQuestionsItem] | None = None
|
|
633
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
634
|
+
files: dict[str, str] | None = None
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
class GradeColumn(Model):
|
|
638
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
639
|
+
|
|
640
|
+
slug: str
|
|
641
|
+
title: str
|
|
642
|
+
kind: Literal["NUMBER", "LABEL"]
|
|
643
|
+
position: int
|
|
644
|
+
released_at: str | None = Field(alias="releasedAt")
|
|
645
|
+
rev: str | None
|
|
646
|
+
values: list[ValuesItem]
|
|
647
|
+
created_at: str = Field(alias="createdAt")
|
|
648
|
+
updated_at: str = Field(alias="updatedAt")
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
class GradeColumnCreate(Model):
|
|
652
|
+
slug: str
|
|
653
|
+
title: str
|
|
654
|
+
kind: Literal["NUMBER", "LABEL"]
|
|
655
|
+
position: int
|
|
656
|
+
rev: str | None = None
|
|
657
|
+
values: list[ValuesItem]
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
class ListDisciplineResponse(Model):
|
|
661
|
+
items: list[Discipline]
|
|
662
|
+
next: str | None
|
|
663
|
+
prev: str | None
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
class ListEditionResponse(Model):
|
|
667
|
+
items: list[Edition]
|
|
668
|
+
next: str | None
|
|
669
|
+
prev: str | None
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
class ListQuestionResponseItemsItem2QuestionCode(Model):
|
|
673
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
674
|
+
|
|
675
|
+
attachments: (
|
|
676
|
+
list[ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem] | None
|
|
677
|
+
) = None
|
|
678
|
+
id: str | None = None
|
|
679
|
+
uuid: str | None = None
|
|
680
|
+
title: str | None = None
|
|
681
|
+
stem: str
|
|
682
|
+
epilogue: str | None = None
|
|
683
|
+
tags: list[str] | None = None
|
|
684
|
+
locale: str | None = None
|
|
685
|
+
weight: float | None = None
|
|
686
|
+
type: Literal["code"]
|
|
687
|
+
template: str | None = None
|
|
688
|
+
language: str | None = None
|
|
689
|
+
file: str | None = None
|
|
690
|
+
public_tests: list[PublicTestsItem] | None = Field(
|
|
691
|
+
default=None, alias="publicTests"
|
|
692
|
+
)
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
class ListQuestionResponseItemsItem2QuestionEssay(Model):
|
|
696
|
+
attachments: (
|
|
697
|
+
list[ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem] | None
|
|
698
|
+
) = None
|
|
699
|
+
id: str | None = None
|
|
700
|
+
uuid: str | None = None
|
|
701
|
+
title: str | None = None
|
|
702
|
+
stem: str
|
|
703
|
+
epilogue: str | None = None
|
|
704
|
+
tags: list[str] | None = None
|
|
705
|
+
locale: str | None = None
|
|
706
|
+
weight: float | None = None
|
|
707
|
+
type: Literal["essay"]
|
|
708
|
+
content: Literal["code", "text", "plain"] | None = None
|
|
709
|
+
highlight: str | None = None
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
class ListQuestionResponseItemsItem2QuestionFillInBlanksItemMultipleChoice(Model):
|
|
713
|
+
id: str
|
|
714
|
+
type: Literal["multiple-choice"]
|
|
715
|
+
choices: list[ListQuestionResponseItemsItem2QuestionMultipleChoiceChoicesItem]
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
class ListQuestionResponseItemsItem2QuestionFillInBlanksItemShortAnswer(Model):
|
|
719
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
720
|
+
|
|
721
|
+
id: str
|
|
722
|
+
type: Literal["short-answer"]
|
|
723
|
+
unmatched: Literal["manual", "incorrect"]
|
|
724
|
+
pre_accept: (
|
|
725
|
+
list[str | ListQuestionResponseItemsItem2QuestionShortAnswerPreAcceptItem]
|
|
726
|
+
| None
|
|
727
|
+
) = Field(default=None, alias="preAccept")
|
|
728
|
+
pre_reject: (
|
|
729
|
+
list[str | ListQuestionResponseItemsItem2QuestionShortAnswerPreAcceptItem]
|
|
730
|
+
| None
|
|
731
|
+
) = Field(default=None, alias="preReject")
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
class ListQuestionResponseItemsItem2QuestionMultipleChoice(Model):
|
|
735
|
+
attachments: (
|
|
736
|
+
list[ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem] | None
|
|
737
|
+
) = None
|
|
738
|
+
id: str | None = None
|
|
739
|
+
uuid: str | None = None
|
|
740
|
+
title: str | None = None
|
|
741
|
+
stem: str
|
|
742
|
+
epilogue: str | None = None
|
|
743
|
+
tags: list[str] | None = None
|
|
744
|
+
locale: str | None = None
|
|
745
|
+
weight: float | None = None
|
|
746
|
+
type: Literal["multiple-choice"]
|
|
747
|
+
shuffle: bool | Literal["inherit"] | None = None
|
|
748
|
+
grading: Literal["partial", "symmetric", "inherit"] | None = None
|
|
749
|
+
choices: list[ListQuestionResponseItemsItem2QuestionMultipleChoiceChoicesItem]
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
class ListQuestionResponseItemsItem2QuestionMultipleSelection(Model):
|
|
753
|
+
attachments: (
|
|
754
|
+
list[ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem] | None
|
|
755
|
+
) = None
|
|
756
|
+
id: str | None = None
|
|
757
|
+
uuid: str | None = None
|
|
758
|
+
title: str | None = None
|
|
759
|
+
stem: str
|
|
760
|
+
epilogue: str | None = None
|
|
761
|
+
tags: list[str] | None = None
|
|
762
|
+
locale: str | None = None
|
|
763
|
+
weight: float | None = None
|
|
764
|
+
type: Literal["multiple-selection"]
|
|
765
|
+
shuffle: bool | Literal["inherit"] | None = None
|
|
766
|
+
grading: Literal["partial", "all-or-nothing", "symmetric", "inherit"] | None = None
|
|
767
|
+
choices: list[ListQuestionResponseItemsItem2QuestionMultipleChoiceChoicesItem]
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
class ListQuestionResponseItemsItem2QuestionNumeric(Model):
|
|
771
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
772
|
+
|
|
773
|
+
attachments: (
|
|
774
|
+
list[ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem] | None
|
|
775
|
+
) = None
|
|
776
|
+
id: str | None = None
|
|
777
|
+
uuid: str | None = None
|
|
778
|
+
title: str | None = None
|
|
779
|
+
stem: str
|
|
780
|
+
epilogue: str | None = None
|
|
781
|
+
tags: list[str] | None = None
|
|
782
|
+
locale: str | None = None
|
|
783
|
+
weight: float | None = None
|
|
784
|
+
type: Literal["numeric"]
|
|
785
|
+
unit: str | None = None
|
|
786
|
+
domain: Literal["integer", "decimal", "fraction"]
|
|
787
|
+
decimal_places: int | None = Field(default=None, alias="decimalPlaces")
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
class ListQuestionResponseItemsItem2QuestionOrdering(Model):
|
|
791
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
792
|
+
|
|
793
|
+
attachments: (
|
|
794
|
+
list[ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem] | None
|
|
795
|
+
) = None
|
|
796
|
+
id: str | None = None
|
|
797
|
+
uuid: str | None = None
|
|
798
|
+
title: str | None = None
|
|
799
|
+
stem: str
|
|
800
|
+
epilogue: str | None = None
|
|
801
|
+
tags: list[str] | None = None
|
|
802
|
+
locale: str | None = None
|
|
803
|
+
weight: float | None = None
|
|
804
|
+
type: Literal["ordering"]
|
|
805
|
+
content: Literal["code", "text"]
|
|
806
|
+
highlight: str | None = None
|
|
807
|
+
indentation: Literal["fixed", "lenient", "strict"] | None = None
|
|
808
|
+
unmatched: Literal["manual", "incorrect"]
|
|
809
|
+
normalizations: list[Literal["dedent", "skip-blanks"]] | None = None
|
|
810
|
+
max_level: int | None = Field(default=None, alias="maxLevel")
|
|
811
|
+
pool: list[list[int | str]]
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
class ListQuestionResponseItemsItem2QuestionShortAnswer(Model):
|
|
815
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
816
|
+
|
|
817
|
+
attachments: (
|
|
818
|
+
list[ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem] | None
|
|
819
|
+
) = None
|
|
820
|
+
id: str | None = None
|
|
821
|
+
uuid: str | None = None
|
|
822
|
+
title: str | None = None
|
|
823
|
+
stem: str
|
|
824
|
+
epilogue: str | None = None
|
|
825
|
+
tags: list[str] | None = None
|
|
826
|
+
locale: str | None = None
|
|
827
|
+
weight: float | None = None
|
|
828
|
+
type: Literal["short-answer"]
|
|
829
|
+
diacritics: Literal["fold", "keep"] | None = None
|
|
830
|
+
unmatched: Literal["manual", "incorrect"]
|
|
831
|
+
pre_accept: (
|
|
832
|
+
list[str | ListQuestionResponseItemsItem2QuestionShortAnswerPreAcceptItem]
|
|
833
|
+
| None
|
|
834
|
+
) = Field(default=None, alias="preAccept")
|
|
835
|
+
pre_reject: (
|
|
836
|
+
list[str | ListQuestionResponseItemsItem2QuestionShortAnswerPreAcceptItem]
|
|
837
|
+
| None
|
|
838
|
+
) = Field(default=None, alias="preReject")
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
class ListQuestionResponseItemsItem2QuestionTrueFalse(Model):
|
|
842
|
+
attachments: (
|
|
843
|
+
list[ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem] | None
|
|
844
|
+
) = None
|
|
845
|
+
id: str | None = None
|
|
846
|
+
uuid: str | None = None
|
|
847
|
+
title: str | None = None
|
|
848
|
+
stem: str
|
|
849
|
+
epilogue: str | None = None
|
|
850
|
+
tags: list[str] | None = None
|
|
851
|
+
locale: str | None = None
|
|
852
|
+
weight: float | None = None
|
|
853
|
+
type: Literal["true-false"]
|
|
854
|
+
shuffle: bool | Literal["inherit"] | None = None
|
|
855
|
+
grading: (
|
|
856
|
+
Literal["partial", "no-mistakes", "all-or-nothing", "symmetric", "inherit"]
|
|
857
|
+
| None
|
|
858
|
+
) = None
|
|
859
|
+
choices: list[ListQuestionResponseItemsItem2QuestionMultipleChoiceChoicesItem]
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
class ListQuestionResponseItemsItemQuestionCode(Model):
|
|
863
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
864
|
+
|
|
865
|
+
field_schema: str | None = Field(default=None, alias="$schema")
|
|
866
|
+
id: str | None = None
|
|
867
|
+
uuid: str | None = None
|
|
868
|
+
title: str | None = None
|
|
869
|
+
author: str | None = None
|
|
870
|
+
stem: str
|
|
871
|
+
epilogue: str | None = None
|
|
872
|
+
comment: str | None = None
|
|
873
|
+
locale: str | None = None
|
|
874
|
+
tags: list[str] | None = None
|
|
875
|
+
weight: float | None = None
|
|
876
|
+
meta: dict[str, object | None] | None = None
|
|
877
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
878
|
+
type: Literal["code"]
|
|
879
|
+
language: str | None = None
|
|
880
|
+
file: str | None = None
|
|
881
|
+
tests: list[TestsItem] | None = None
|
|
882
|
+
rubric: list[ListQuestionResponseItemsItemQuestionCodeRubricItem] | None = None
|
|
883
|
+
template: str | None = None
|
|
884
|
+
answer_key: str | None = Field(default=None, alias="answerKey")
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
class ListQuestionResponseItemsItemQuestionEssay(Model):
|
|
888
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
889
|
+
|
|
890
|
+
field_schema: str | None = Field(default=None, alias="$schema")
|
|
891
|
+
id: str | None = None
|
|
892
|
+
uuid: str | None = None
|
|
893
|
+
title: str | None = None
|
|
894
|
+
author: str | None = None
|
|
895
|
+
stem: str
|
|
896
|
+
epilogue: str | None = None
|
|
897
|
+
comment: str | None = None
|
|
898
|
+
locale: str | None = None
|
|
899
|
+
tags: list[str] | None = None
|
|
900
|
+
weight: float | None = None
|
|
901
|
+
meta: dict[str, object | None] | None = None
|
|
902
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
903
|
+
type: Literal["essay"]
|
|
904
|
+
content: Literal["code", "text", "plain"] | None = None
|
|
905
|
+
highlight: str | None = None
|
|
906
|
+
answer_key: str | None = Field(default=None, alias="answerKey")
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
class ListQuestionResponseItemsItemQuestionFillInBlanksItemMultipleChoice(Model):
|
|
910
|
+
id: str
|
|
911
|
+
type: Literal["multiple-choice"]
|
|
912
|
+
choices: list[ListQuestionResponseItemsItemQuestionMultipleChoiceChoicesItem]
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
class ListQuestionResponseItemsItemQuestionFillInBlanksItemNumeric(Model):
|
|
916
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
917
|
+
|
|
918
|
+
answer: float | str
|
|
919
|
+
unit: str | None = None
|
|
920
|
+
domain: Literal["integer", "decimal", "fraction"] | None = None
|
|
921
|
+
decimal_places: int | None = Field(default=None, alias="decimalPlaces")
|
|
922
|
+
tolerance: Tolerance | None = None
|
|
923
|
+
id: str
|
|
924
|
+
type: Literal["numeric"]
|
|
925
|
+
incorrect_feedback: str | None = Field(default=None, alias="incorrectFeedback")
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
class ListQuestionResponseItemsItemQuestionFillInBlanksItemShortAnswer(Model):
|
|
929
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
930
|
+
|
|
931
|
+
accept: (
|
|
932
|
+
list[str | ListQuestionResponseItemsItemQuestionShortAnswerAcceptItem] | None
|
|
933
|
+
) = None
|
|
934
|
+
reject: (
|
|
935
|
+
list[str | ListQuestionResponseItemsItemQuestionShortAnswerAcceptItem] | None
|
|
936
|
+
) = None
|
|
937
|
+
pre_accept: (
|
|
938
|
+
list[str | ListQuestionResponseItemsItemQuestionShortAnswerAcceptItem] | None
|
|
939
|
+
) = Field(default=None, alias="preAccept")
|
|
940
|
+
pre_reject: (
|
|
941
|
+
list[str | ListQuestionResponseItemsItemQuestionShortAnswerAcceptItem] | None
|
|
942
|
+
) = Field(default=None, alias="preReject")
|
|
943
|
+
id: str
|
|
944
|
+
type: Literal["short-answer"]
|
|
945
|
+
incorrect_feedback: str | None = Field(default=None, alias="incorrectFeedback")
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
class ListQuestionResponseItemsItemQuestionMultipleChoice(Model):
|
|
949
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
950
|
+
|
|
951
|
+
field_schema: str | None = Field(default=None, alias="$schema")
|
|
952
|
+
id: str | None = None
|
|
953
|
+
uuid: str | None = None
|
|
954
|
+
title: str | None = None
|
|
955
|
+
author: str | None = None
|
|
956
|
+
stem: str
|
|
957
|
+
epilogue: str | None = None
|
|
958
|
+
comment: str | None = None
|
|
959
|
+
locale: str | None = None
|
|
960
|
+
tags: list[str] | None = None
|
|
961
|
+
weight: float | None = None
|
|
962
|
+
meta: dict[str, object | None] | None = None
|
|
963
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
964
|
+
type: Literal["multiple-choice"]
|
|
965
|
+
choices: list[ListQuestionResponseItemsItemQuestionMultipleChoiceChoicesItem]
|
|
966
|
+
grading: Literal["partial", "symmetric", "inherit"] | None = None
|
|
967
|
+
shuffle: bool | Literal["inherit"] | None = None
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
class ListQuestionResponseItemsItemQuestionMultipleSelection(Model):
|
|
971
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
972
|
+
|
|
973
|
+
field_schema: str | None = Field(default=None, alias="$schema")
|
|
974
|
+
id: str | None = None
|
|
975
|
+
uuid: str | None = None
|
|
976
|
+
title: str | None = None
|
|
977
|
+
author: str | None = None
|
|
978
|
+
stem: str
|
|
979
|
+
epilogue: str | None = None
|
|
980
|
+
comment: str | None = None
|
|
981
|
+
locale: str | None = None
|
|
982
|
+
tags: list[str] | None = None
|
|
983
|
+
weight: float | None = None
|
|
984
|
+
meta: dict[str, object | None] | None = None
|
|
985
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
986
|
+
type: Literal["multiple-selection"]
|
|
987
|
+
choices: list[ListQuestionResponseItemsItemQuestionMultipleSelectionChoicesItem]
|
|
988
|
+
grading: Literal["partial", "all-or-nothing", "symmetric", "inherit"] | None = None
|
|
989
|
+
shuffle: bool | Literal["inherit"] | None = None
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
class ListQuestionResponseItemsItemQuestionNumeric(Model):
|
|
993
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
994
|
+
|
|
995
|
+
field_schema: str | None = Field(default=None, alias="$schema")
|
|
996
|
+
id: str | None = None
|
|
997
|
+
uuid: str | None = None
|
|
998
|
+
title: str | None = None
|
|
999
|
+
author: str | None = None
|
|
1000
|
+
stem: str
|
|
1001
|
+
epilogue: str | None = None
|
|
1002
|
+
comment: str | None = None
|
|
1003
|
+
locale: str | None = None
|
|
1004
|
+
tags: list[str] | None = None
|
|
1005
|
+
weight: float | None = None
|
|
1006
|
+
meta: dict[str, object | None] | None = None
|
|
1007
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
1008
|
+
answer: float | str
|
|
1009
|
+
unit: str | None = None
|
|
1010
|
+
domain: Literal["integer", "decimal", "fraction"] | None = None
|
|
1011
|
+
decimal_places: int | None = Field(default=None, alias="decimalPlaces")
|
|
1012
|
+
tolerance: Tolerance | None = None
|
|
1013
|
+
type: Literal["numeric"]
|
|
1014
|
+
incorrect_feedback: str | None = Field(default=None, alias="incorrectFeedback")
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
class ListQuestionResponseItemsItemQuestionOrdering(Model):
|
|
1018
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1019
|
+
|
|
1020
|
+
field_schema: str | None = Field(default=None, alias="$schema")
|
|
1021
|
+
id: str | None = None
|
|
1022
|
+
uuid: str | None = None
|
|
1023
|
+
title: str | None = None
|
|
1024
|
+
author: str | None = None
|
|
1025
|
+
stem: str
|
|
1026
|
+
epilogue: str | None = None
|
|
1027
|
+
comment: str | None = None
|
|
1028
|
+
locale: str | None = None
|
|
1029
|
+
tags: list[str] | None = None
|
|
1030
|
+
weight: float | None = None
|
|
1031
|
+
meta: dict[str, object | None] | None = None
|
|
1032
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
1033
|
+
type: Literal["ordering"]
|
|
1034
|
+
lines: list[list[int | str]]
|
|
1035
|
+
extra: list[list[int | str]] | None = None
|
|
1036
|
+
accept: list[ListQuestionResponseItemsItemQuestionOrderingAcceptItem] | None = None
|
|
1037
|
+
reject: list[ListQuestionResponseItemsItemQuestionOrderingAcceptItem] | None = None
|
|
1038
|
+
content: Literal["code", "text"]
|
|
1039
|
+
highlight: str | None = None
|
|
1040
|
+
indentation: Literal["fixed", "lenient", "strict"] | None = None
|
|
1041
|
+
unmatched: Literal["manual", "incorrect"] | None = None
|
|
1042
|
+
incorrect_feedback: str | None = Field(default=None, alias="incorrectFeedback")
|
|
1043
|
+
normalizations: list[Literal["dedent", "skip-blanks"]] | None = None
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
class ListQuestionResponseItemsItemQuestionShortAnswer(Model):
|
|
1047
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1048
|
+
|
|
1049
|
+
field_schema: str | None = Field(default=None, alias="$schema")
|
|
1050
|
+
id: str | None = None
|
|
1051
|
+
uuid: str | None = None
|
|
1052
|
+
title: str | None = None
|
|
1053
|
+
author: str | None = None
|
|
1054
|
+
stem: str
|
|
1055
|
+
epilogue: str | None = None
|
|
1056
|
+
comment: str | None = None
|
|
1057
|
+
locale: str | None = None
|
|
1058
|
+
tags: list[str] | None = None
|
|
1059
|
+
weight: float | None = None
|
|
1060
|
+
meta: dict[str, object | None] | None = None
|
|
1061
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
1062
|
+
accept: (
|
|
1063
|
+
list[str | ListQuestionResponseItemsItemQuestionShortAnswerAcceptItem] | None
|
|
1064
|
+
) = None
|
|
1065
|
+
reject: (
|
|
1066
|
+
list[str | ListQuestionResponseItemsItemQuestionShortAnswerAcceptItem] | None
|
|
1067
|
+
) = None
|
|
1068
|
+
pre_accept: (
|
|
1069
|
+
list[str | ListQuestionResponseItemsItemQuestionShortAnswerAcceptItem] | None
|
|
1070
|
+
) = Field(default=None, alias="preAccept")
|
|
1071
|
+
pre_reject: (
|
|
1072
|
+
list[str | ListQuestionResponseItemsItemQuestionShortAnswerAcceptItem] | None
|
|
1073
|
+
) = Field(default=None, alias="preReject")
|
|
1074
|
+
type: Literal["short-answer"]
|
|
1075
|
+
diacritics: Literal["fold", "keep"] | None = None
|
|
1076
|
+
unmatched: Literal["manual", "incorrect"] | None = None
|
|
1077
|
+
incorrect_feedback: str | None = Field(default=None, alias="incorrectFeedback")
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
class ListQuestionResponseItemsItemQuestionTrueFalse(Model):
|
|
1081
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1082
|
+
|
|
1083
|
+
field_schema: str | None = Field(default=None, alias="$schema")
|
|
1084
|
+
id: str | None = None
|
|
1085
|
+
uuid: str | None = None
|
|
1086
|
+
title: str | None = None
|
|
1087
|
+
author: str | None = None
|
|
1088
|
+
stem: str
|
|
1089
|
+
epilogue: str | None = None
|
|
1090
|
+
comment: str | None = None
|
|
1091
|
+
locale: str | None = None
|
|
1092
|
+
tags: list[str] | None = None
|
|
1093
|
+
weight: float | None = None
|
|
1094
|
+
meta: dict[str, object | None] | None = None
|
|
1095
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
1096
|
+
type: Literal["true-false"]
|
|
1097
|
+
choices: list[ListQuestionResponseItemsItemQuestionTrueFalseChoicesItem]
|
|
1098
|
+
grading: (
|
|
1099
|
+
Literal["partial", "no-mistakes", "all-or-nothing", "symmetric", "inherit"]
|
|
1100
|
+
| None
|
|
1101
|
+
) = None
|
|
1102
|
+
shuffle: bool | Literal["inherit"] | None = None
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
class ListUserResponse(Model):
|
|
1106
|
+
items: list[User]
|
|
1107
|
+
next: str | None
|
|
1108
|
+
prev: str | None
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
class ReadRollCallResponse(Model):
|
|
1112
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1113
|
+
|
|
1114
|
+
week: int
|
|
1115
|
+
time_slot: str = Field(alias="timeSlot")
|
|
1116
|
+
acts_as_invite: bool = Field(alias="actsAsInvite")
|
|
1117
|
+
closes_at: str = Field(alias="closesAt")
|
|
1118
|
+
attendances: dict[str, ReadRollCallResponseShape]
|
|
1119
|
+
created_at: str = Field(alias="createdAt")
|
|
1120
|
+
updated_at: str = Field(alias="updatedAt")
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
class RepositoryListResponse(Model):
|
|
1124
|
+
items: list[Repository]
|
|
1125
|
+
next: str | None
|
|
1126
|
+
prev: str | None
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
class Resource(Model):
|
|
1130
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1131
|
+
|
|
1132
|
+
slug: str
|
|
1133
|
+
title: str
|
|
1134
|
+
description: str | None
|
|
1135
|
+
data: DataLink | ResourceDataFile | DataCode | DataMd
|
|
1136
|
+
event: Event | None
|
|
1137
|
+
rev: str | None
|
|
1138
|
+
created_at: str = Field(alias="createdAt")
|
|
1139
|
+
updated_at: str = Field(alias="updatedAt")
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
class ResourceCreate(Model):
|
|
1143
|
+
slug: str
|
|
1144
|
+
title: str
|
|
1145
|
+
rev: str | None = None
|
|
1146
|
+
description: str | None = None
|
|
1147
|
+
event: Event | None = None
|
|
1148
|
+
data: DataLink | ResourceCreateDataFile | DataCode | DataMd
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
class Rubric(Model):
|
|
1152
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1153
|
+
|
|
1154
|
+
base: str
|
|
1155
|
+
source_version: str | None = Field(alias="sourceVersion")
|
|
1156
|
+
initial: bool
|
|
1157
|
+
review: int
|
|
1158
|
+
updated_at: str | None = Field(alias="updatedAt")
|
|
1159
|
+
items: list[RubricItem]
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
class RubricPreviewRequestUpdate(Model):
|
|
1163
|
+
op: Literal["update"]
|
|
1164
|
+
data: RubricUpdate
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
class RubricPreviewRequestUpdateItem(Model):
|
|
1168
|
+
op: Literal["updateItem"]
|
|
1169
|
+
key: str
|
|
1170
|
+
data: RubricItemUpdate
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
class RubricSplit(Model):
|
|
1174
|
+
children: list[RubricItemCreate]
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
class TimeSlot(Model):
|
|
1178
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1179
|
+
|
|
1180
|
+
slug: str
|
|
1181
|
+
title: str | None
|
|
1182
|
+
day: Literal[
|
|
1183
|
+
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"
|
|
1184
|
+
]
|
|
1185
|
+
start: Start
|
|
1186
|
+
duration: Duration
|
|
1187
|
+
created_at: str = Field(alias="createdAt")
|
|
1188
|
+
updated_at: str = Field(alias="updatedAt")
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
class TimeSlotAtCalendarEvent(Model):
|
|
1192
|
+
slug: str
|
|
1193
|
+
day: Literal[
|
|
1194
|
+
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"
|
|
1195
|
+
]
|
|
1196
|
+
start: Start
|
|
1197
|
+
duration: Duration
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
class TimeSlotCreate(Model):
|
|
1201
|
+
slug: str
|
|
1202
|
+
title: str | None = None
|
|
1203
|
+
day: Literal[
|
|
1204
|
+
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"
|
|
1205
|
+
]
|
|
1206
|
+
start: Start
|
|
1207
|
+
duration: Duration
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
class UpdateExamRequest(Model):
|
|
1211
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1212
|
+
|
|
1213
|
+
type: Literal["PRACTICE", "QUIZ", "EXAM"] | None = None
|
|
1214
|
+
status: Literal["DRAFT", "ARCHIVED", "SCHEDULED", "ONGOING", "COMPLETED"] | None = (
|
|
1215
|
+
None
|
|
1216
|
+
)
|
|
1217
|
+
title: str | None = None
|
|
1218
|
+
description: str | None = None
|
|
1219
|
+
preamble: str | None = None
|
|
1220
|
+
format: Literal["PLAINTEXT", "MARKDOWN", "HTML"] | None = None
|
|
1221
|
+
scheduled_at: str | None = Field(default=None, alias="scheduledAt")
|
|
1222
|
+
duration: Duration | None = None
|
|
1223
|
+
allow_code_run: bool | None = Field(default=None, alias="allowCodeRun")
|
|
1224
|
+
rev: str | None = None
|
|
1225
|
+
tags: list[str] | None = None
|
|
1226
|
+
questions: list[ExamCreateQuestionsItem] | None = None
|
|
1227
|
+
extra_time: Duration | None = Field(default=None, alias="extraTime")
|
|
1228
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
1229
|
+
files: dict[str, str] | None = None
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
class UpdateGradeColumnRequest(Model):
|
|
1233
|
+
title: str | None = None
|
|
1234
|
+
kind: Literal["NUMBER", "LABEL"] | None = None
|
|
1235
|
+
position: int | None = None
|
|
1236
|
+
rev: str | None = None
|
|
1237
|
+
values: list[ValuesItem] | None = None
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
class UpdateResourceRequest(Model):
|
|
1241
|
+
title: str | None = None
|
|
1242
|
+
rev: str | None = None
|
|
1243
|
+
description: str | None = None
|
|
1244
|
+
event: Event | None = None
|
|
1245
|
+
data: DataLink | ResourceCreateDataFile | DataCode | DataMd | None = None
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
class UpdateRollCallRequest(Model):
|
|
1249
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1250
|
+
|
|
1251
|
+
acts_as_invite: bool | None = Field(default=None, alias="actsAsInvite")
|
|
1252
|
+
attendances: dict[str, UpdateRollCallRequestShape | None] | None = None
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
class UpdateTimeslotRequest(Model):
|
|
1256
|
+
title: str | None = None
|
|
1257
|
+
day: (
|
|
1258
|
+
Literal[
|
|
1259
|
+
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"
|
|
1260
|
+
]
|
|
1261
|
+
| None
|
|
1262
|
+
) = None
|
|
1263
|
+
start: Start | None = None
|
|
1264
|
+
duration: Duration | None = None
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
class CalendarEvent(Model):
|
|
1268
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1269
|
+
|
|
1270
|
+
kind: Literal["REGULAR", "HOLIDAY", "CANCELLED"]
|
|
1271
|
+
title: str
|
|
1272
|
+
description: str | None
|
|
1273
|
+
start_at: str = Field(alias="startAt")
|
|
1274
|
+
week: int
|
|
1275
|
+
time_slot: TimeSlotAtCalendarEvent = Field(alias="timeSlot")
|
|
1276
|
+
rev: str | None
|
|
1277
|
+
repositories: list[RepositoriesItem]
|
|
1278
|
+
created_at: str = Field(alias="createdAt")
|
|
1279
|
+
updated_at: str = Field(alias="updatedAt")
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
class CourseGradesResponse(Model):
|
|
1283
|
+
exams: list[ExamsItem]
|
|
1284
|
+
students: list[CourseGradesResponseStudentsItem]
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
class ListCourseResponse(Model):
|
|
1288
|
+
items: list[Course]
|
|
1289
|
+
next: str | None
|
|
1290
|
+
prev: str | None
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
class ListExamResponse(Model):
|
|
1294
|
+
items: list[Exam]
|
|
1295
|
+
next: str | None
|
|
1296
|
+
prev: str | None
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
class ListGradeColumnResponse(Model):
|
|
1300
|
+
items: list[GradeColumn]
|
|
1301
|
+
next: str | None
|
|
1302
|
+
prev: str | None
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
class ListQuestionResponseItemsItem2QuestionFillIn(Model):
|
|
1306
|
+
attachments: (
|
|
1307
|
+
list[ListQuestionResponseItemsItem2QuestionCodeAttachmentsItem] | None
|
|
1308
|
+
) = None
|
|
1309
|
+
id: str | None = None
|
|
1310
|
+
uuid: str | None = None
|
|
1311
|
+
title: str | None = None
|
|
1312
|
+
stem: str
|
|
1313
|
+
epilogue: str | None = None
|
|
1314
|
+
tags: list[str] | None = None
|
|
1315
|
+
locale: str | None = None
|
|
1316
|
+
weight: float | None = None
|
|
1317
|
+
type: Literal["fill-in"]
|
|
1318
|
+
shuffle: bool | Literal["inherit"] | None = None
|
|
1319
|
+
grading: (
|
|
1320
|
+
Literal["partial", "no-mistakes", "all-or-nothing", "symmetric", "inherit"]
|
|
1321
|
+
| None
|
|
1322
|
+
) = None
|
|
1323
|
+
diacritics: Literal["fold", "keep"] | None = None
|
|
1324
|
+
blanks: list[
|
|
1325
|
+
ListQuestionResponseItemsItem2QuestionFillInBlanksItemMultipleChoice
|
|
1326
|
+
| ListQuestionResponseItemsItem2QuestionFillInBlanksItemShortAnswer
|
|
1327
|
+
| ListQuestionResponseItemsItem2QuestionFillInBlanksItemNumeric
|
|
1328
|
+
]
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
class ListQuestionResponseItemsItemQuestionFillIn(Model):
|
|
1332
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1333
|
+
|
|
1334
|
+
field_schema: str | None = Field(default=None, alias="$schema")
|
|
1335
|
+
id: str | None = None
|
|
1336
|
+
uuid: str | None = None
|
|
1337
|
+
title: str | None = None
|
|
1338
|
+
author: str | None = None
|
|
1339
|
+
stem: str
|
|
1340
|
+
epilogue: str | None = None
|
|
1341
|
+
comment: str | None = None
|
|
1342
|
+
locale: str | None = None
|
|
1343
|
+
tags: list[str] | None = None
|
|
1344
|
+
weight: float | None = None
|
|
1345
|
+
meta: dict[str, object | None] | None = None
|
|
1346
|
+
attachments: list[ExamCreateAttachmentsItem] | None = None
|
|
1347
|
+
type: Literal["fill-in"]
|
|
1348
|
+
blanks: list[
|
|
1349
|
+
ListQuestionResponseItemsItemQuestionFillInBlanksItemMultipleChoice
|
|
1350
|
+
| ListQuestionResponseItemsItemQuestionFillInBlanksItemShortAnswer
|
|
1351
|
+
| ListQuestionResponseItemsItemQuestionFillInBlanksItemNumeric
|
|
1352
|
+
]
|
|
1353
|
+
grading: (
|
|
1354
|
+
Literal["partial", "no-mistakes", "all-or-nothing", "symmetric", "inherit"]
|
|
1355
|
+
| None
|
|
1356
|
+
) = None
|
|
1357
|
+
shuffle: bool | Literal["inherit"] | None = None
|
|
1358
|
+
diacritics: Literal["fold", "keep"] | None = None
|
|
1359
|
+
unmatched: Literal["manual", "incorrect"] | None = None
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
class ListResourceResponse(Model):
|
|
1363
|
+
items: list[Resource]
|
|
1364
|
+
next: str | None
|
|
1365
|
+
prev: str | None
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
class ListRollCallResponse(Model):
|
|
1369
|
+
items: list[ReadRollCallResponse]
|
|
1370
|
+
next: str | None
|
|
1371
|
+
prev: str | None
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
class ListTimeslotResponse(Model):
|
|
1375
|
+
items: list[TimeSlot]
|
|
1376
|
+
next: str | None
|
|
1377
|
+
prev: str | None
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
class JobsItem(Model):
|
|
1381
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1382
|
+
|
|
1383
|
+
submission: str
|
|
1384
|
+
kind: Literal["SUBMIT", "FINAL"]
|
|
1385
|
+
worker: str
|
|
1386
|
+
question: (
|
|
1387
|
+
ListQuestionResponseItemsItemQuestionMultipleChoice
|
|
1388
|
+
| ListQuestionResponseItemsItemQuestionMultipleSelection
|
|
1389
|
+
| ListQuestionResponseItemsItemQuestionTrueFalse
|
|
1390
|
+
| ListQuestionResponseItemsItemQuestionNumeric
|
|
1391
|
+
| ListQuestionResponseItemsItemQuestionShortAnswer
|
|
1392
|
+
| ListQuestionResponseItemsItemQuestionEssay
|
|
1393
|
+
| ListQuestionResponseItemsItemQuestionFillIn
|
|
1394
|
+
| ListQuestionResponseItemsItemQuestionOrdering
|
|
1395
|
+
| ListQuestionResponseItemsItemQuestionCode
|
|
1396
|
+
)
|
|
1397
|
+
exam: str
|
|
1398
|
+
course: str
|
|
1399
|
+
student: str
|
|
1400
|
+
answer: str
|
|
1401
|
+
lease_until: str = Field(alias="leaseUntil")
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
class ListCalendarEventResponse(Model):
|
|
1405
|
+
items: list[CalendarEvent]
|
|
1406
|
+
next: str | None
|
|
1407
|
+
prev: str | None
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
class ListQuestionResponseItemsItem(Model):
|
|
1411
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1412
|
+
|
|
1413
|
+
slug: str
|
|
1414
|
+
status: Literal["DRAFT", "PUBLISHED", "HIDDEN", "ARCHIVED"]
|
|
1415
|
+
version: str
|
|
1416
|
+
rev: str | None
|
|
1417
|
+
created_at: str = Field(alias="createdAt")
|
|
1418
|
+
updated_at: str = Field(alias="updatedAt")
|
|
1419
|
+
question: (
|
|
1420
|
+
ListQuestionResponseItemsItemQuestionMultipleChoice
|
|
1421
|
+
| ListQuestionResponseItemsItemQuestionMultipleSelection
|
|
1422
|
+
| ListQuestionResponseItemsItemQuestionTrueFalse
|
|
1423
|
+
| ListQuestionResponseItemsItemQuestionNumeric
|
|
1424
|
+
| ListQuestionResponseItemsItemQuestionShortAnswer
|
|
1425
|
+
| ListQuestionResponseItemsItemQuestionEssay
|
|
1426
|
+
| ListQuestionResponseItemsItemQuestionFillIn
|
|
1427
|
+
| ListQuestionResponseItemsItemQuestionOrdering
|
|
1428
|
+
| ListQuestionResponseItemsItemQuestionCode
|
|
1429
|
+
)
|
|
1430
|
+
public_id: str = Field(alias="publicId")
|
|
1431
|
+
files: dict[str, str] | None = None
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
class ListQuestionResponseItemsItem2(Model):
|
|
1435
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1436
|
+
|
|
1437
|
+
slug: str
|
|
1438
|
+
status: Literal["DRAFT", "PUBLISHED", "HIDDEN", "ARCHIVED"]
|
|
1439
|
+
version: str
|
|
1440
|
+
rev: str | None
|
|
1441
|
+
created_at: str = Field(alias="createdAt")
|
|
1442
|
+
updated_at: str = Field(alias="updatedAt")
|
|
1443
|
+
question: (
|
|
1444
|
+
ListQuestionResponseItemsItem2QuestionMultipleChoice
|
|
1445
|
+
| ListQuestionResponseItemsItem2QuestionMultipleSelection
|
|
1446
|
+
| ListQuestionResponseItemsItem2QuestionTrueFalse
|
|
1447
|
+
| ListQuestionResponseItemsItem2QuestionNumeric
|
|
1448
|
+
| ListQuestionResponseItemsItem2QuestionShortAnswer
|
|
1449
|
+
| ListQuestionResponseItemsItem2QuestionEssay
|
|
1450
|
+
| ListQuestionResponseItemsItem2QuestionFillIn
|
|
1451
|
+
| ListQuestionResponseItemsItem2QuestionOrdering
|
|
1452
|
+
| ListQuestionResponseItemsItem2QuestionCode
|
|
1453
|
+
)
|
|
1454
|
+
|
|
1455
|
+
|
|
1456
|
+
class QuestionCreate(Model):
|
|
1457
|
+
slug: str
|
|
1458
|
+
status: Literal["DRAFT", "PUBLISHED", "HIDDEN", "ARCHIVED"]
|
|
1459
|
+
version: str
|
|
1460
|
+
rev: str | None = None
|
|
1461
|
+
question: (
|
|
1462
|
+
ListQuestionResponseItemsItemQuestionMultipleChoice
|
|
1463
|
+
| ListQuestionResponseItemsItemQuestionMultipleSelection
|
|
1464
|
+
| ListQuestionResponseItemsItemQuestionTrueFalse
|
|
1465
|
+
| ListQuestionResponseItemsItemQuestionNumeric
|
|
1466
|
+
| ListQuestionResponseItemsItemQuestionShortAnswer
|
|
1467
|
+
| ListQuestionResponseItemsItemQuestionEssay
|
|
1468
|
+
| ListQuestionResponseItemsItemQuestionFillIn
|
|
1469
|
+
| ListQuestionResponseItemsItemQuestionOrdering
|
|
1470
|
+
| ListQuestionResponseItemsItemQuestionCode
|
|
1471
|
+
)
|
|
1472
|
+
files: dict[str, str] | None = None
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
class UpdateQuestionRequest(Model):
|
|
1476
|
+
status: Literal["DRAFT", "PUBLISHED", "HIDDEN", "ARCHIVED"] | None = None
|
|
1477
|
+
version: str | None = None
|
|
1478
|
+
rev: str | None = None
|
|
1479
|
+
question: (
|
|
1480
|
+
ListQuestionResponseItemsItemQuestionMultipleChoice
|
|
1481
|
+
| ListQuestionResponseItemsItemQuestionMultipleSelection
|
|
1482
|
+
| ListQuestionResponseItemsItemQuestionTrueFalse
|
|
1483
|
+
| ListQuestionResponseItemsItemQuestionNumeric
|
|
1484
|
+
| ListQuestionResponseItemsItemQuestionShortAnswer
|
|
1485
|
+
| ListQuestionResponseItemsItemQuestionEssay
|
|
1486
|
+
| ListQuestionResponseItemsItemQuestionFillIn
|
|
1487
|
+
| ListQuestionResponseItemsItemQuestionOrdering
|
|
1488
|
+
| ListQuestionResponseItemsItemQuestionCode
|
|
1489
|
+
| None
|
|
1490
|
+
) = None
|
|
1491
|
+
files: dict[str, str] | None = None
|
|
1492
|
+
|
|
1493
|
+
|
|
1494
|
+
class ClaimGradingJobsResponse(Model):
|
|
1495
|
+
jobs: list[JobsItem]
|
|
1496
|
+
|
|
1497
|
+
|
|
1498
|
+
class ListQuestionResponse(Model):
|
|
1499
|
+
items: list[ListQuestionResponseItemsItem | ListQuestionResponseItemsItem2]
|
|
1500
|
+
next: str | None
|
|
1501
|
+
prev: str | None
|
|
1502
|
+
|
|
1503
|
+
|
|
1504
|
+
class GradeReleaseRefused(CodehoodAPIError):
|
|
1505
|
+
class Payload(Model):
|
|
1506
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1507
|
+
|
|
1508
|
+
type: Literal["error"]
|
|
1509
|
+
code: Literal["invalid-data"]
|
|
1510
|
+
status: Literal[409]
|
|
1511
|
+
message: str
|
|
1512
|
+
timestamp: str
|
|
1513
|
+
errors: dict[str, list[GradeReleaseRefusedShape]]
|
|
1514
|
+
reason: Literal["not-an-exam", "not-closed", "exception-open", "pending"]
|
|
1515
|
+
pending_answers: int = Field(alias="pendingAnswers")
|
|
1516
|
+
open_exceptions: int = Field(alias="openExceptions")
|
|
1517
|
+
|
|
1518
|
+
payload: Payload
|
|
1519
|
+
|
|
1520
|
+
@property
|
|
1521
|
+
def type(self) -> Literal["error"]:
|
|
1522
|
+
return self.payload.type
|
|
1523
|
+
|
|
1524
|
+
@property
|
|
1525
|
+
def code(self) -> Literal["invalid-data"]:
|
|
1526
|
+
return self.payload.code
|
|
1527
|
+
|
|
1528
|
+
@property
|
|
1529
|
+
def message(self) -> str:
|
|
1530
|
+
return self.payload.message
|
|
1531
|
+
|
|
1532
|
+
@property
|
|
1533
|
+
def timestamp(self) -> str:
|
|
1534
|
+
return self.payload.timestamp
|
|
1535
|
+
|
|
1536
|
+
@property
|
|
1537
|
+
def errors(self) -> dict[str, list[GradeReleaseRefusedShape]]:
|
|
1538
|
+
return self.payload.errors
|
|
1539
|
+
|
|
1540
|
+
@property
|
|
1541
|
+
def reason(
|
|
1542
|
+
self,
|
|
1543
|
+
) -> Literal["not-an-exam", "not-closed", "exception-open", "pending"]:
|
|
1544
|
+
return self.payload.reason
|
|
1545
|
+
|
|
1546
|
+
@property
|
|
1547
|
+
def pending_answers(self) -> int:
|
|
1548
|
+
return self.payload.pending_answers
|
|
1549
|
+
|
|
1550
|
+
@property
|
|
1551
|
+
def open_exceptions(self) -> int:
|
|
1552
|
+
return self.payload.open_exceptions
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
class HealthError(CodehoodAPIError):
|
|
1556
|
+
class Payload(Model):
|
|
1557
|
+
status: Literal["error"]
|
|
1558
|
+
database: Literal["unreachable"]
|
|
1559
|
+
|
|
1560
|
+
payload: Payload
|
|
1561
|
+
|
|
1562
|
+
@property
|
|
1563
|
+
def database(self) -> Literal["unreachable"]:
|
|
1564
|
+
return self.payload.database
|
|
1565
|
+
|
|
1566
|
+
|
|
1567
|
+
class InvalidCredentials(CodehoodAPIError):
|
|
1568
|
+
class Payload(Model):
|
|
1569
|
+
type: Literal["error"]
|
|
1570
|
+
code: Literal["not-allowed"]
|
|
1571
|
+
status: Literal[401]
|
|
1572
|
+
message: str
|
|
1573
|
+
action: str
|
|
1574
|
+
timestamp: str | None
|
|
1575
|
+
|
|
1576
|
+
payload: Payload
|
|
1577
|
+
|
|
1578
|
+
@property
|
|
1579
|
+
def type(self) -> Literal["error"]:
|
|
1580
|
+
return self.payload.type
|
|
1581
|
+
|
|
1582
|
+
@property
|
|
1583
|
+
def code(self) -> Literal["not-allowed"]:
|
|
1584
|
+
return self.payload.code
|
|
1585
|
+
|
|
1586
|
+
@property
|
|
1587
|
+
def message(self) -> str:
|
|
1588
|
+
return self.payload.message
|
|
1589
|
+
|
|
1590
|
+
@property
|
|
1591
|
+
def action(self) -> str:
|
|
1592
|
+
return self.payload.action
|
|
1593
|
+
|
|
1594
|
+
@property
|
|
1595
|
+
def timestamp(self) -> str | None:
|
|
1596
|
+
return self.payload.timestamp
|
|
1597
|
+
|
|
1598
|
+
|
|
1599
|
+
class PreconditionFailed(CodehoodAPIError):
|
|
1600
|
+
class Payload(Model):
|
|
1601
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
1602
|
+
|
|
1603
|
+
type: Literal["error"]
|
|
1604
|
+
code: Literal["precondition-failed"]
|
|
1605
|
+
status: Literal[412]
|
|
1606
|
+
message: str
|
|
1607
|
+
timestamp: str
|
|
1608
|
+
updated_at: str | None = Field(alias="updatedAt")
|
|
1609
|
+
|
|
1610
|
+
payload: Payload
|
|
1611
|
+
|
|
1612
|
+
@property
|
|
1613
|
+
def type(self) -> Literal["error"]:
|
|
1614
|
+
return self.payload.type
|
|
1615
|
+
|
|
1616
|
+
@property
|
|
1617
|
+
def code(self) -> Literal["precondition-failed"]:
|
|
1618
|
+
return self.payload.code
|
|
1619
|
+
|
|
1620
|
+
@property
|
|
1621
|
+
def message(self) -> str:
|
|
1622
|
+
return self.payload.message
|
|
1623
|
+
|
|
1624
|
+
@property
|
|
1625
|
+
def timestamp(self) -> str:
|
|
1626
|
+
return self.payload.timestamp
|
|
1627
|
+
|
|
1628
|
+
@property
|
|
1629
|
+
def updated_at(self) -> str | None:
|
|
1630
|
+
return self.payload.updated_at
|
|
1631
|
+
|
|
1632
|
+
|
|
1633
|
+
def blob_missing(
|
|
1634
|
+
*, body: BlobMissingInput, client: httpx.Client | None = None
|
|
1635
|
+
) -> BlobMissingResult:
|
|
1636
|
+
"""
|
|
1637
|
+
List the hashes the server has no blob for.
|
|
1638
|
+
"""
|
|
1639
|
+
client = client if client is not None else get_client()
|
|
1640
|
+
response = client.post(
|
|
1641
|
+
"/api/blob/missing",
|
|
1642
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1643
|
+
headers=auth_headers(client),
|
|
1644
|
+
)
|
|
1645
|
+
if response.status_code == 200:
|
|
1646
|
+
return BlobMissingResult.model_validate(response.json())
|
|
1647
|
+
response.raise_for_status()
|
|
1648
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
def claim_grading_jobs(
|
|
1652
|
+
*, body: ClaimGradingJobsRequest, client: httpx.Client | None = None
|
|
1653
|
+
) -> ClaimGradingJobsResponse:
|
|
1654
|
+
"""
|
|
1655
|
+
Claim grading jobs
|
|
1656
|
+
"""
|
|
1657
|
+
client = client if client is not None else get_client()
|
|
1658
|
+
response = client.post(
|
|
1659
|
+
"/api/grading-jobs/claim",
|
|
1660
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1661
|
+
headers=auth_headers(client),
|
|
1662
|
+
)
|
|
1663
|
+
if response.status_code == 200:
|
|
1664
|
+
return ClaimGradingJobsResponse.model_validate(response.json())
|
|
1665
|
+
response.raise_for_status()
|
|
1666
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
def course_attendance(
|
|
1670
|
+
*, discipline: str, course: str, client: httpx.Client | None = None
|
|
1671
|
+
) -> CourseAttendanceResponse:
|
|
1672
|
+
"""
|
|
1673
|
+
View the attendance of every student
|
|
1674
|
+
"""
|
|
1675
|
+
client = client if client is not None else get_client()
|
|
1676
|
+
response = client.get(
|
|
1677
|
+
"/api/course/{discipline}/{course}/attendance".format(
|
|
1678
|
+
discipline=discipline, course=course
|
|
1679
|
+
),
|
|
1680
|
+
headers=auth_headers(client),
|
|
1681
|
+
)
|
|
1682
|
+
if response.status_code == 200:
|
|
1683
|
+
return CourseAttendanceResponse.model_validate(response.json())
|
|
1684
|
+
response.raise_for_status()
|
|
1685
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1686
|
+
|
|
1687
|
+
|
|
1688
|
+
def course_grades(
|
|
1689
|
+
*, discipline: str, course: str, client: httpx.Client | None = None
|
|
1690
|
+
) -> CourseGradesResponse:
|
|
1691
|
+
"""
|
|
1692
|
+
View the exam results of every student
|
|
1693
|
+
"""
|
|
1694
|
+
client = client if client is not None else get_client()
|
|
1695
|
+
response = client.get(
|
|
1696
|
+
"/api/course/{discipline}/{course}/grades".format(
|
|
1697
|
+
discipline=discipline, course=course
|
|
1698
|
+
),
|
|
1699
|
+
headers=auth_headers(client),
|
|
1700
|
+
)
|
|
1701
|
+
if response.status_code == 200:
|
|
1702
|
+
return CourseGradesResponse.model_validate(response.json())
|
|
1703
|
+
response.raise_for_status()
|
|
1704
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
def create_calendar_event(
|
|
1708
|
+
*,
|
|
1709
|
+
discipline: str,
|
|
1710
|
+
course: str,
|
|
1711
|
+
body: CalendarEventCreate,
|
|
1712
|
+
client: httpx.Client | None = None,
|
|
1713
|
+
) -> CalendarEvent:
|
|
1714
|
+
"""
|
|
1715
|
+
Creates a new Calendar Event.
|
|
1716
|
+
"""
|
|
1717
|
+
client = client if client is not None else get_client()
|
|
1718
|
+
response = client.post(
|
|
1719
|
+
"/api/course/{discipline}/{course}/calendar-event".format(
|
|
1720
|
+
discipline=discipline, course=course
|
|
1721
|
+
),
|
|
1722
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1723
|
+
headers=auth_headers(client),
|
|
1724
|
+
)
|
|
1725
|
+
if response.status_code == 200:
|
|
1726
|
+
return CalendarEvent.model_validate(response.json())
|
|
1727
|
+
response.raise_for_status()
|
|
1728
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1729
|
+
|
|
1730
|
+
|
|
1731
|
+
def create_course(*, body: CourseCreate, client: httpx.Client | None = None) -> Course:
|
|
1732
|
+
"""
|
|
1733
|
+
Creates a new Course.
|
|
1734
|
+
"""
|
|
1735
|
+
client = client if client is not None else get_client()
|
|
1736
|
+
response = client.post(
|
|
1737
|
+
"/api/course",
|
|
1738
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1739
|
+
headers=auth_headers(client),
|
|
1740
|
+
)
|
|
1741
|
+
if response.status_code == 200:
|
|
1742
|
+
return Course.model_validate(response.json())
|
|
1743
|
+
response.raise_for_status()
|
|
1744
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
def create_discipline(
|
|
1748
|
+
*, body: DisciplineCreate, client: httpx.Client | None = None
|
|
1749
|
+
) -> Discipline:
|
|
1750
|
+
"""
|
|
1751
|
+
Creates a new Discipline.
|
|
1752
|
+
"""
|
|
1753
|
+
client = client if client is not None else get_client()
|
|
1754
|
+
response = client.post(
|
|
1755
|
+
"/api/discipline",
|
|
1756
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1757
|
+
headers=auth_headers(client),
|
|
1758
|
+
)
|
|
1759
|
+
if response.status_code == 200:
|
|
1760
|
+
return Discipline.model_validate(response.json())
|
|
1761
|
+
response.raise_for_status()
|
|
1762
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
def create_edition(
|
|
1766
|
+
*, body: EditionCreate, client: httpx.Client | None = None
|
|
1767
|
+
) -> Edition:
|
|
1768
|
+
"""
|
|
1769
|
+
Creates a new Edition.
|
|
1770
|
+
"""
|
|
1771
|
+
client = client if client is not None else get_client()
|
|
1772
|
+
response = client.post(
|
|
1773
|
+
"/api/edition",
|
|
1774
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1775
|
+
headers=auth_headers(client),
|
|
1776
|
+
)
|
|
1777
|
+
if response.status_code == 200:
|
|
1778
|
+
return Edition.model_validate(response.json())
|
|
1779
|
+
response.raise_for_status()
|
|
1780
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
def create_exam(
|
|
1784
|
+
*,
|
|
1785
|
+
discipline: str,
|
|
1786
|
+
course: str,
|
|
1787
|
+
body: ExamCreate,
|
|
1788
|
+
client: httpx.Client | None = None,
|
|
1789
|
+
) -> Exam:
|
|
1790
|
+
"""
|
|
1791
|
+
Creates a new Exam.
|
|
1792
|
+
"""
|
|
1793
|
+
client = client if client is not None else get_client()
|
|
1794
|
+
response = client.post(
|
|
1795
|
+
"/api/course/{discipline}/{course}/exam".format(
|
|
1796
|
+
discipline=discipline, course=course
|
|
1797
|
+
),
|
|
1798
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1799
|
+
headers=auth_headers(client),
|
|
1800
|
+
)
|
|
1801
|
+
if response.status_code == 200:
|
|
1802
|
+
return Exam.model_validate(response.json())
|
|
1803
|
+
response.raise_for_status()
|
|
1804
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1805
|
+
|
|
1806
|
+
|
|
1807
|
+
def create_grade_column(
|
|
1808
|
+
*,
|
|
1809
|
+
discipline: str,
|
|
1810
|
+
course: str,
|
|
1811
|
+
body: GradeColumnCreate,
|
|
1812
|
+
client: httpx.Client | None = None,
|
|
1813
|
+
) -> GradeColumn:
|
|
1814
|
+
"""
|
|
1815
|
+
Creates a new Grade Column.
|
|
1816
|
+
"""
|
|
1817
|
+
client = client if client is not None else get_client()
|
|
1818
|
+
response = client.post(
|
|
1819
|
+
"/api/course/{discipline}/{course}/grade-column".format(
|
|
1820
|
+
discipline=discipline, course=course
|
|
1821
|
+
),
|
|
1822
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1823
|
+
headers=auth_headers(client),
|
|
1824
|
+
)
|
|
1825
|
+
if response.status_code == 200:
|
|
1826
|
+
return GradeColumn.model_validate(response.json())
|
|
1827
|
+
response.raise_for_status()
|
|
1828
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1829
|
+
|
|
1830
|
+
|
|
1831
|
+
def create_question(
|
|
1832
|
+
*,
|
|
1833
|
+
discipline: str,
|
|
1834
|
+
course: str,
|
|
1835
|
+
body: QuestionCreate,
|
|
1836
|
+
client: httpx.Client | None = None,
|
|
1837
|
+
) -> ListQuestionResponseItemsItem | ListQuestionResponseItemsItem2:
|
|
1838
|
+
"""
|
|
1839
|
+
Creates a new Question.
|
|
1840
|
+
"""
|
|
1841
|
+
client = client if client is not None else get_client()
|
|
1842
|
+
response = client.post(
|
|
1843
|
+
"/api/course/{discipline}/{course}/question".format(
|
|
1844
|
+
discipline=discipline, course=course
|
|
1845
|
+
),
|
|
1846
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1847
|
+
headers=auth_headers(client),
|
|
1848
|
+
)
|
|
1849
|
+
if response.status_code == 200:
|
|
1850
|
+
return TypeAdapter(
|
|
1851
|
+
ListQuestionResponseItemsItem | ListQuestionResponseItemsItem2
|
|
1852
|
+
).validate_python(response.json())
|
|
1853
|
+
response.raise_for_status()
|
|
1854
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
def create_resource(
|
|
1858
|
+
*,
|
|
1859
|
+
discipline: str,
|
|
1860
|
+
course: str,
|
|
1861
|
+
body: ResourceCreate,
|
|
1862
|
+
client: httpx.Client | None = None,
|
|
1863
|
+
) -> Resource:
|
|
1864
|
+
"""
|
|
1865
|
+
Creates a new Resource.
|
|
1866
|
+
"""
|
|
1867
|
+
client = client if client is not None else get_client()
|
|
1868
|
+
response = client.post(
|
|
1869
|
+
"/api/course/{discipline}/{course}/resource".format(
|
|
1870
|
+
discipline=discipline, course=course
|
|
1871
|
+
),
|
|
1872
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1873
|
+
headers=auth_headers(client),
|
|
1874
|
+
)
|
|
1875
|
+
if response.status_code == 200:
|
|
1876
|
+
return Resource.model_validate(response.json())
|
|
1877
|
+
response.raise_for_status()
|
|
1878
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1879
|
+
|
|
1880
|
+
|
|
1881
|
+
def create_timeslot(
|
|
1882
|
+
*,
|
|
1883
|
+
discipline: str,
|
|
1884
|
+
course: str,
|
|
1885
|
+
body: TimeSlotCreate,
|
|
1886
|
+
client: httpx.Client | None = None,
|
|
1887
|
+
) -> TimeSlot:
|
|
1888
|
+
"""
|
|
1889
|
+
Creates a new TimeSlot.
|
|
1890
|
+
"""
|
|
1891
|
+
client = client if client is not None else get_client()
|
|
1892
|
+
response = client.post(
|
|
1893
|
+
"/api/course/{discipline}/{course}/time-slot".format(
|
|
1894
|
+
discipline=discipline, course=course
|
|
1895
|
+
),
|
|
1896
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1897
|
+
headers=auth_headers(client),
|
|
1898
|
+
)
|
|
1899
|
+
if response.status_code == 200:
|
|
1900
|
+
return TimeSlot.model_validate(response.json())
|
|
1901
|
+
response.raise_for_status()
|
|
1902
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1903
|
+
|
|
1904
|
+
|
|
1905
|
+
def create_user(*, body: UserCreate, client: httpx.Client | None = None) -> User:
|
|
1906
|
+
"""
|
|
1907
|
+
Creates a new User.
|
|
1908
|
+
"""
|
|
1909
|
+
client = client if client is not None else get_client()
|
|
1910
|
+
response = client.post(
|
|
1911
|
+
"/api/user",
|
|
1912
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
1913
|
+
headers=auth_headers(client),
|
|
1914
|
+
)
|
|
1915
|
+
if response.status_code == 200:
|
|
1916
|
+
return User.model_validate(response.json())
|
|
1917
|
+
response.raise_for_status()
|
|
1918
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
def delete_calendar_event(
|
|
1922
|
+
*,
|
|
1923
|
+
discipline: str,
|
|
1924
|
+
course: str,
|
|
1925
|
+
week: str,
|
|
1926
|
+
time_slot: str,
|
|
1927
|
+
if_match: str | None = None,
|
|
1928
|
+
client: httpx.Client | None = None,
|
|
1929
|
+
) -> Deleted:
|
|
1930
|
+
"""
|
|
1931
|
+
Delete a single Calendar Event by primary key.
|
|
1932
|
+
"""
|
|
1933
|
+
client = client if client is not None else get_client()
|
|
1934
|
+
response = client.delete(
|
|
1935
|
+
"/api/course/{discipline}/{course}/calendar-event/{week}/{timeSlot}".format(
|
|
1936
|
+
discipline=discipline, course=course, week=week, timeSlot=time_slot
|
|
1937
|
+
),
|
|
1938
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
1939
|
+
)
|
|
1940
|
+
if response.status_code == 412:
|
|
1941
|
+
raise PreconditionFailed(
|
|
1942
|
+
response.status_code,
|
|
1943
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
1944
|
+
)
|
|
1945
|
+
if response.status_code == 200:
|
|
1946
|
+
return Deleted.model_validate(response.json())
|
|
1947
|
+
response.raise_for_status()
|
|
1948
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1949
|
+
|
|
1950
|
+
|
|
1951
|
+
def delete_course(
|
|
1952
|
+
*,
|
|
1953
|
+
discipline: str,
|
|
1954
|
+
course: str,
|
|
1955
|
+
if_match: str | None = None,
|
|
1956
|
+
client: httpx.Client | None = None,
|
|
1957
|
+
) -> Deleted:
|
|
1958
|
+
"""
|
|
1959
|
+
Delete a single Course by primary key.
|
|
1960
|
+
"""
|
|
1961
|
+
client = client if client is not None else get_client()
|
|
1962
|
+
response = client.delete(
|
|
1963
|
+
"/api/course/{discipline}/{course}".format(
|
|
1964
|
+
discipline=discipline, course=course
|
|
1965
|
+
),
|
|
1966
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
1967
|
+
)
|
|
1968
|
+
if response.status_code == 412:
|
|
1969
|
+
raise PreconditionFailed(
|
|
1970
|
+
response.status_code,
|
|
1971
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
1972
|
+
)
|
|
1973
|
+
if response.status_code == 200:
|
|
1974
|
+
return Deleted.model_validate(response.json())
|
|
1975
|
+
response.raise_for_status()
|
|
1976
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
def delete_discipline(
|
|
1980
|
+
*, slug: str, if_match: str | None = None, client: httpx.Client | None = None
|
|
1981
|
+
) -> Deleted:
|
|
1982
|
+
"""
|
|
1983
|
+
Delete a single Discipline by primary key.
|
|
1984
|
+
"""
|
|
1985
|
+
client = client if client is not None else get_client()
|
|
1986
|
+
response = client.delete(
|
|
1987
|
+
"/api/discipline/{slug}".format(slug=slug),
|
|
1988
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
1989
|
+
)
|
|
1990
|
+
if response.status_code == 412:
|
|
1991
|
+
raise PreconditionFailed(
|
|
1992
|
+
response.status_code,
|
|
1993
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
1994
|
+
)
|
|
1995
|
+
if response.status_code == 200:
|
|
1996
|
+
return Deleted.model_validate(response.json())
|
|
1997
|
+
response.raise_for_status()
|
|
1998
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
1999
|
+
|
|
2000
|
+
|
|
2001
|
+
def delete_edition(*, slug: str, client: httpx.Client | None = None) -> Deleted:
|
|
2002
|
+
"""
|
|
2003
|
+
Delete a single Edition by primary key.
|
|
2004
|
+
"""
|
|
2005
|
+
client = client if client is not None else get_client()
|
|
2006
|
+
response = client.delete(
|
|
2007
|
+
"/api/edition/{slug}".format(slug=slug), headers=auth_headers(client)
|
|
2008
|
+
)
|
|
2009
|
+
if response.status_code == 200:
|
|
2010
|
+
return Deleted.model_validate(response.json())
|
|
2011
|
+
response.raise_for_status()
|
|
2012
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
def delete_exam(
|
|
2016
|
+
*,
|
|
2017
|
+
discipline: str,
|
|
2018
|
+
course: str,
|
|
2019
|
+
slug: str,
|
|
2020
|
+
if_match: str | None = None,
|
|
2021
|
+
client: httpx.Client | None = None,
|
|
2022
|
+
) -> Deleted:
|
|
2023
|
+
"""
|
|
2024
|
+
Delete a single Exam by primary key.
|
|
2025
|
+
"""
|
|
2026
|
+
client = client if client is not None else get_client()
|
|
2027
|
+
response = client.delete(
|
|
2028
|
+
"/api/course/{discipline}/{course}/exam/{slug}".format(
|
|
2029
|
+
discipline=discipline, course=course, slug=slug
|
|
2030
|
+
),
|
|
2031
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
2032
|
+
)
|
|
2033
|
+
if response.status_code == 412:
|
|
2034
|
+
raise PreconditionFailed(
|
|
2035
|
+
response.status_code,
|
|
2036
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
2037
|
+
)
|
|
2038
|
+
if response.status_code == 200:
|
|
2039
|
+
return Deleted.model_validate(response.json())
|
|
2040
|
+
response.raise_for_status()
|
|
2041
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2042
|
+
|
|
2043
|
+
|
|
2044
|
+
def delete_grade_column(
|
|
2045
|
+
*,
|
|
2046
|
+
discipline: str,
|
|
2047
|
+
course: str,
|
|
2048
|
+
slug: str,
|
|
2049
|
+
if_match: str | None = None,
|
|
2050
|
+
client: httpx.Client | None = None,
|
|
2051
|
+
) -> Deleted:
|
|
2052
|
+
"""
|
|
2053
|
+
Delete a single Grade Column by primary key.
|
|
2054
|
+
"""
|
|
2055
|
+
client = client if client is not None else get_client()
|
|
2056
|
+
response = client.delete(
|
|
2057
|
+
"/api/course/{discipline}/{course}/grade-column/{slug}".format(
|
|
2058
|
+
discipline=discipline, course=course, slug=slug
|
|
2059
|
+
),
|
|
2060
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
2061
|
+
)
|
|
2062
|
+
if response.status_code == 412:
|
|
2063
|
+
raise PreconditionFailed(
|
|
2064
|
+
response.status_code,
|
|
2065
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
2066
|
+
)
|
|
2067
|
+
if response.status_code == 200:
|
|
2068
|
+
return Deleted.model_validate(response.json())
|
|
2069
|
+
response.raise_for_status()
|
|
2070
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
def delete_question(
|
|
2074
|
+
*,
|
|
2075
|
+
discipline: str,
|
|
2076
|
+
course: str,
|
|
2077
|
+
slug: str,
|
|
2078
|
+
if_match: str | None = None,
|
|
2079
|
+
client: httpx.Client | None = None,
|
|
2080
|
+
) -> Deleted:
|
|
2081
|
+
"""
|
|
2082
|
+
Delete a single Question by primary key.
|
|
2083
|
+
"""
|
|
2084
|
+
client = client if client is not None else get_client()
|
|
2085
|
+
response = client.delete(
|
|
2086
|
+
"/api/course/{discipline}/{course}/question/{slug}".format(
|
|
2087
|
+
discipline=discipline, course=course, slug=slug
|
|
2088
|
+
),
|
|
2089
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
2090
|
+
)
|
|
2091
|
+
if response.status_code == 412:
|
|
2092
|
+
raise PreconditionFailed(
|
|
2093
|
+
response.status_code,
|
|
2094
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
2095
|
+
)
|
|
2096
|
+
if response.status_code == 200:
|
|
2097
|
+
return Deleted.model_validate(response.json())
|
|
2098
|
+
response.raise_for_status()
|
|
2099
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
def delete_resource(
|
|
2103
|
+
*,
|
|
2104
|
+
discipline: str,
|
|
2105
|
+
course: str,
|
|
2106
|
+
slug: str,
|
|
2107
|
+
if_match: str | None = None,
|
|
2108
|
+
client: httpx.Client | None = None,
|
|
2109
|
+
) -> Deleted:
|
|
2110
|
+
"""
|
|
2111
|
+
Delete a single Resource by primary key.
|
|
2112
|
+
"""
|
|
2113
|
+
client = client if client is not None else get_client()
|
|
2114
|
+
response = client.delete(
|
|
2115
|
+
"/api/course/{discipline}/{course}/resource/{slug}".format(
|
|
2116
|
+
discipline=discipline, course=course, slug=slug
|
|
2117
|
+
),
|
|
2118
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
2119
|
+
)
|
|
2120
|
+
if response.status_code == 412:
|
|
2121
|
+
raise PreconditionFailed(
|
|
2122
|
+
response.status_code,
|
|
2123
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
2124
|
+
)
|
|
2125
|
+
if response.status_code == 200:
|
|
2126
|
+
return Deleted.model_validate(response.json())
|
|
2127
|
+
response.raise_for_status()
|
|
2128
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
def delete_roll_call(
|
|
2132
|
+
*,
|
|
2133
|
+
discipline: str,
|
|
2134
|
+
course: str,
|
|
2135
|
+
week: str,
|
|
2136
|
+
time_slot: str,
|
|
2137
|
+
if_match: str | None = None,
|
|
2138
|
+
client: httpx.Client | None = None,
|
|
2139
|
+
) -> Deleted:
|
|
2140
|
+
"""
|
|
2141
|
+
Delete a single Roll Call by primary key.
|
|
2142
|
+
"""
|
|
2143
|
+
client = client if client is not None else get_client()
|
|
2144
|
+
response = client.delete(
|
|
2145
|
+
"/api/course/{discipline}/{course}/roll-call/{week}/{timeSlot}".format(
|
|
2146
|
+
discipline=discipline, course=course, week=week, timeSlot=time_slot
|
|
2147
|
+
),
|
|
2148
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
2149
|
+
)
|
|
2150
|
+
if response.status_code == 412:
|
|
2151
|
+
raise PreconditionFailed(
|
|
2152
|
+
response.status_code,
|
|
2153
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
2154
|
+
)
|
|
2155
|
+
if response.status_code == 200:
|
|
2156
|
+
return Deleted.model_validate(response.json())
|
|
2157
|
+
response.raise_for_status()
|
|
2158
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2159
|
+
|
|
2160
|
+
|
|
2161
|
+
def delete_timeslot(
|
|
2162
|
+
*,
|
|
2163
|
+
discipline: str,
|
|
2164
|
+
course: str,
|
|
2165
|
+
slug: str,
|
|
2166
|
+
if_match: str | None = None,
|
|
2167
|
+
client: httpx.Client | None = None,
|
|
2168
|
+
) -> Deleted:
|
|
2169
|
+
"""
|
|
2170
|
+
Delete a single TimeSlot by primary key.
|
|
2171
|
+
"""
|
|
2172
|
+
client = client if client is not None else get_client()
|
|
2173
|
+
response = client.delete(
|
|
2174
|
+
"/api/course/{discipline}/{course}/time-slot/{slug}".format(
|
|
2175
|
+
discipline=discipline, course=course, slug=slug
|
|
2176
|
+
),
|
|
2177
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
2178
|
+
)
|
|
2179
|
+
if response.status_code == 412:
|
|
2180
|
+
raise PreconditionFailed(
|
|
2181
|
+
response.status_code,
|
|
2182
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
2183
|
+
)
|
|
2184
|
+
if response.status_code == 200:
|
|
2185
|
+
return Deleted.model_validate(response.json())
|
|
2186
|
+
response.raise_for_status()
|
|
2187
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2188
|
+
|
|
2189
|
+
|
|
2190
|
+
def delete_user(*, username: str, client: httpx.Client | None = None) -> Deleted:
|
|
2191
|
+
"""
|
|
2192
|
+
Delete a single User by primary key.
|
|
2193
|
+
"""
|
|
2194
|
+
client = client if client is not None else get_client()
|
|
2195
|
+
response = client.delete(
|
|
2196
|
+
"/api/user/{username}".format(username=username), headers=auth_headers(client)
|
|
2197
|
+
)
|
|
2198
|
+
if response.status_code == 200:
|
|
2199
|
+
return Deleted.model_validate(response.json())
|
|
2200
|
+
response.raise_for_status()
|
|
2201
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2202
|
+
|
|
2203
|
+
|
|
2204
|
+
def exam_release(
|
|
2205
|
+
*, discipline: str, course: str, slug: str, client: httpx.Client | None = None
|
|
2206
|
+
) -> Exam:
|
|
2207
|
+
"""
|
|
2208
|
+
Release the grades of an exam to its students.
|
|
2209
|
+
"""
|
|
2210
|
+
client = client if client is not None else get_client()
|
|
2211
|
+
response = client.post(
|
|
2212
|
+
"/api/course/{discipline}/{course}/exam/{slug}/release".format(
|
|
2213
|
+
discipline=discipline, course=course, slug=slug
|
|
2214
|
+
),
|
|
2215
|
+
headers=auth_headers(client),
|
|
2216
|
+
)
|
|
2217
|
+
if response.status_code == 409:
|
|
2218
|
+
raise GradeReleaseRefused(
|
|
2219
|
+
response.status_code,
|
|
2220
|
+
GradeReleaseRefused.Payload.model_validate(response.json()),
|
|
2221
|
+
)
|
|
2222
|
+
if response.status_code == 200:
|
|
2223
|
+
return Exam.model_validate(response.json())
|
|
2224
|
+
response.raise_for_status()
|
|
2225
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2226
|
+
|
|
2227
|
+
|
|
2228
|
+
def fail_grading_job(
|
|
2229
|
+
*, submission: str, body: FailGradingJobRequest, client: httpx.Client | None = None
|
|
2230
|
+
) -> FailGradingJobResponse:
|
|
2231
|
+
"""
|
|
2232
|
+
Give up a grading job
|
|
2233
|
+
"""
|
|
2234
|
+
client = client if client is not None else get_client()
|
|
2235
|
+
response = client.post(
|
|
2236
|
+
"/api/grading-jobs/{submission}/fail".format(submission=submission),
|
|
2237
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
2238
|
+
headers=auth_headers(client),
|
|
2239
|
+
)
|
|
2240
|
+
if response.status_code == 200:
|
|
2241
|
+
return FailGradingJobResponse.model_validate(response.json())
|
|
2242
|
+
response.raise_for_status()
|
|
2243
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
def health(*, client: httpx.Client | None = None) -> HealthResponse:
|
|
2247
|
+
"""
|
|
2248
|
+
Liveness/readiness probe
|
|
2249
|
+
"""
|
|
2250
|
+
client = client if client is not None else get_client()
|
|
2251
|
+
response = client.get("/api/health")
|
|
2252
|
+
if response.status_code == 503:
|
|
2253
|
+
raise HealthError(
|
|
2254
|
+
response.status_code, HealthError.Payload.model_validate(response.json())
|
|
2255
|
+
)
|
|
2256
|
+
if response.status_code == 200:
|
|
2257
|
+
return HealthResponse.model_validate(response.json())
|
|
2258
|
+
response.raise_for_status()
|
|
2259
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2260
|
+
|
|
2261
|
+
|
|
2262
|
+
def list_calendar_event(
|
|
2263
|
+
*,
|
|
2264
|
+
discipline: str,
|
|
2265
|
+
course: str,
|
|
2266
|
+
from_: str | None = None,
|
|
2267
|
+
to: str | None = None,
|
|
2268
|
+
kinds: list[Literal["REGULAR", "HOLIDAY", "CANCELLED"]] | None = None,
|
|
2269
|
+
weeks: list[int] | None = None,
|
|
2270
|
+
limit: int | None = None,
|
|
2271
|
+
client: httpx.Client | None = None,
|
|
2272
|
+
) -> ListCalendarEventResponse:
|
|
2273
|
+
"""
|
|
2274
|
+
Find multiple Calendar Events.
|
|
2275
|
+
"""
|
|
2276
|
+
client = client if client is not None else get_client()
|
|
2277
|
+
response = client.get(
|
|
2278
|
+
"/api/course/{discipline}/{course}/calendar-event".format(
|
|
2279
|
+
discipline=discipline, course=course
|
|
2280
|
+
),
|
|
2281
|
+
params=query_params(
|
|
2282
|
+
{"from": from_, "to": to, "kinds": kinds, "weeks": weeks, "limit": limit}
|
|
2283
|
+
),
|
|
2284
|
+
headers=auth_headers(client),
|
|
2285
|
+
)
|
|
2286
|
+
if response.status_code == 200:
|
|
2287
|
+
return ListCalendarEventResponse.model_validate(response.json())
|
|
2288
|
+
response.raise_for_status()
|
|
2289
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
def list_course(
|
|
2293
|
+
*,
|
|
2294
|
+
instructor: str | None = None,
|
|
2295
|
+
discipline: str | None = None,
|
|
2296
|
+
edition: str | None = None,
|
|
2297
|
+
limit: int | None = None,
|
|
2298
|
+
after: str | None = None,
|
|
2299
|
+
before: str | None = None,
|
|
2300
|
+
client: httpx.Client | None = None,
|
|
2301
|
+
) -> ListCourseResponse:
|
|
2302
|
+
"""
|
|
2303
|
+
Find multiple Courses.
|
|
2304
|
+
"""
|
|
2305
|
+
client = client if client is not None else get_client()
|
|
2306
|
+
response = client.get(
|
|
2307
|
+
"/api/course",
|
|
2308
|
+
params=query_params(
|
|
2309
|
+
{
|
|
2310
|
+
"instructor": instructor,
|
|
2311
|
+
"discipline": discipline,
|
|
2312
|
+
"edition": edition,
|
|
2313
|
+
"limit": limit,
|
|
2314
|
+
"after": after,
|
|
2315
|
+
"before": before,
|
|
2316
|
+
}
|
|
2317
|
+
),
|
|
2318
|
+
headers=auth_headers(client),
|
|
2319
|
+
)
|
|
2320
|
+
if response.status_code == 200:
|
|
2321
|
+
return ListCourseResponse.model_validate(response.json())
|
|
2322
|
+
response.raise_for_status()
|
|
2323
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
def list_discipline(
|
|
2327
|
+
*,
|
|
2328
|
+
slugs: list[str] | None = None,
|
|
2329
|
+
limit: int | None = None,
|
|
2330
|
+
after: str | None = None,
|
|
2331
|
+
before: str | None = None,
|
|
2332
|
+
client: httpx.Client | None = None,
|
|
2333
|
+
) -> ListDisciplineResponse:
|
|
2334
|
+
"""
|
|
2335
|
+
Find multiple Disciplines.
|
|
2336
|
+
"""
|
|
2337
|
+
client = client if client is not None else get_client()
|
|
2338
|
+
response = client.get(
|
|
2339
|
+
"/api/discipline",
|
|
2340
|
+
params=query_params(
|
|
2341
|
+
{"slugs": slugs, "limit": limit, "after": after, "before": before}
|
|
2342
|
+
),
|
|
2343
|
+
headers=auth_headers(client),
|
|
2344
|
+
)
|
|
2345
|
+
if response.status_code == 200:
|
|
2346
|
+
return ListDisciplineResponse.model_validate(response.json())
|
|
2347
|
+
response.raise_for_status()
|
|
2348
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2349
|
+
|
|
2350
|
+
|
|
2351
|
+
def list_edition(
|
|
2352
|
+
*,
|
|
2353
|
+
slugs: list[str] | None = None,
|
|
2354
|
+
active: bool | None = None,
|
|
2355
|
+
limit: int | None = None,
|
|
2356
|
+
after: str | None = None,
|
|
2357
|
+
before: str | None = None,
|
|
2358
|
+
client: httpx.Client | None = None,
|
|
2359
|
+
) -> ListEditionResponse:
|
|
2360
|
+
"""
|
|
2361
|
+
Find multiple Editions.
|
|
2362
|
+
"""
|
|
2363
|
+
client = client if client is not None else get_client()
|
|
2364
|
+
response = client.get(
|
|
2365
|
+
"/api/edition",
|
|
2366
|
+
params=query_params(
|
|
2367
|
+
{
|
|
2368
|
+
"slugs": slugs,
|
|
2369
|
+
"active": active,
|
|
2370
|
+
"limit": limit,
|
|
2371
|
+
"after": after,
|
|
2372
|
+
"before": before,
|
|
2373
|
+
}
|
|
2374
|
+
),
|
|
2375
|
+
headers=auth_headers(client),
|
|
2376
|
+
)
|
|
2377
|
+
if response.status_code == 200:
|
|
2378
|
+
return ListEditionResponse.model_validate(response.json())
|
|
2379
|
+
response.raise_for_status()
|
|
2380
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2381
|
+
|
|
2382
|
+
|
|
2383
|
+
def list_exam(
|
|
2384
|
+
*,
|
|
2385
|
+
discipline: str,
|
|
2386
|
+
course: str,
|
|
2387
|
+
exams: list[str] | None = None,
|
|
2388
|
+
statuses: list[Literal["DRAFT", "ARCHIVED", "SCHEDULED", "ONGOING", "COMPLETED"]]
|
|
2389
|
+
| None = None,
|
|
2390
|
+
types: list[Literal["PRACTICE", "QUIZ", "EXAM"]] | None = None,
|
|
2391
|
+
tags: list[str] | None = None,
|
|
2392
|
+
client: httpx.Client | None = None,
|
|
2393
|
+
) -> ListExamResponse:
|
|
2394
|
+
"""
|
|
2395
|
+
Find multiple Exams.
|
|
2396
|
+
"""
|
|
2397
|
+
client = client if client is not None else get_client()
|
|
2398
|
+
response = client.get(
|
|
2399
|
+
"/api/course/{discipline}/{course}/exam".format(
|
|
2400
|
+
discipline=discipline, course=course
|
|
2401
|
+
),
|
|
2402
|
+
params=query_params(
|
|
2403
|
+
{"exams": exams, "statuses": statuses, "types": types, "tags": tags}
|
|
2404
|
+
),
|
|
2405
|
+
headers=auth_headers(client),
|
|
2406
|
+
)
|
|
2407
|
+
if response.status_code == 200:
|
|
2408
|
+
return ListExamResponse.model_validate(response.json())
|
|
2409
|
+
response.raise_for_status()
|
|
2410
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2411
|
+
|
|
2412
|
+
|
|
2413
|
+
def list_grade_column(
|
|
2414
|
+
*, discipline: str, course: str, client: httpx.Client | None = None
|
|
2415
|
+
) -> ListGradeColumnResponse:
|
|
2416
|
+
"""
|
|
2417
|
+
Find multiple Grade Columns.
|
|
2418
|
+
"""
|
|
2419
|
+
client = client if client is not None else get_client()
|
|
2420
|
+
response = client.get(
|
|
2421
|
+
"/api/course/{discipline}/{course}/grade-column".format(
|
|
2422
|
+
discipline=discipline, course=course
|
|
2423
|
+
),
|
|
2424
|
+
headers=auth_headers(client),
|
|
2425
|
+
)
|
|
2426
|
+
if response.status_code == 200:
|
|
2427
|
+
return ListGradeColumnResponse.model_validate(response.json())
|
|
2428
|
+
response.raise_for_status()
|
|
2429
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2430
|
+
|
|
2431
|
+
|
|
2432
|
+
def list_question(
|
|
2433
|
+
*,
|
|
2434
|
+
discipline: str,
|
|
2435
|
+
course: str,
|
|
2436
|
+
slugs: list[str] | None = None,
|
|
2437
|
+
statuses: list[Literal["DRAFT", "PUBLISHED", "HIDDEN", "ARCHIVED"]] | None = None,
|
|
2438
|
+
types: list[
|
|
2439
|
+
Literal[
|
|
2440
|
+
"multiple-choice",
|
|
2441
|
+
"multiple-selection",
|
|
2442
|
+
"true-false",
|
|
2443
|
+
"essay",
|
|
2444
|
+
"numeric",
|
|
2445
|
+
"short-answer",
|
|
2446
|
+
"fill-in",
|
|
2447
|
+
"ordering",
|
|
2448
|
+
"code",
|
|
2449
|
+
]
|
|
2450
|
+
]
|
|
2451
|
+
| None = None,
|
|
2452
|
+
tags: list[str] | None = None,
|
|
2453
|
+
public: bool | None = None,
|
|
2454
|
+
limit: int | None = None,
|
|
2455
|
+
after: str | None = None,
|
|
2456
|
+
before: str | None = None,
|
|
2457
|
+
client: httpx.Client | None = None,
|
|
2458
|
+
) -> ListQuestionResponse:
|
|
2459
|
+
"""
|
|
2460
|
+
Find multiple Questions.
|
|
2461
|
+
"""
|
|
2462
|
+
client = client if client is not None else get_client()
|
|
2463
|
+
response = client.get(
|
|
2464
|
+
"/api/course/{discipline}/{course}/question".format(
|
|
2465
|
+
discipline=discipline, course=course
|
|
2466
|
+
),
|
|
2467
|
+
params=query_params(
|
|
2468
|
+
{
|
|
2469
|
+
"slugs": slugs,
|
|
2470
|
+
"statuses": statuses,
|
|
2471
|
+
"types": types,
|
|
2472
|
+
"tags": tags,
|
|
2473
|
+
"public": public,
|
|
2474
|
+
"limit": limit,
|
|
2475
|
+
"after": after,
|
|
2476
|
+
"before": before,
|
|
2477
|
+
}
|
|
2478
|
+
),
|
|
2479
|
+
headers=auth_headers(client),
|
|
2480
|
+
)
|
|
2481
|
+
if response.status_code == 200:
|
|
2482
|
+
return ListQuestionResponse.model_validate(response.json())
|
|
2483
|
+
response.raise_for_status()
|
|
2484
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2485
|
+
|
|
2486
|
+
|
|
2487
|
+
def list_resource(
|
|
2488
|
+
*,
|
|
2489
|
+
discipline: str,
|
|
2490
|
+
course: str,
|
|
2491
|
+
types: list[Literal["LINK", "FILE", "CODE", "MD"]] | None = None,
|
|
2492
|
+
slugs: list[str] | None = None,
|
|
2493
|
+
client: httpx.Client | None = None,
|
|
2494
|
+
) -> ListResourceResponse:
|
|
2495
|
+
"""
|
|
2496
|
+
Find multiple Resources.
|
|
2497
|
+
"""
|
|
2498
|
+
client = client if client is not None else get_client()
|
|
2499
|
+
response = client.get(
|
|
2500
|
+
"/api/course/{discipline}/{course}/resource".format(
|
|
2501
|
+
discipline=discipline, course=course
|
|
2502
|
+
),
|
|
2503
|
+
params=query_params({"types": types, "slugs": slugs}),
|
|
2504
|
+
headers=auth_headers(client),
|
|
2505
|
+
)
|
|
2506
|
+
if response.status_code == 200:
|
|
2507
|
+
return ListResourceResponse.model_validate(response.json())
|
|
2508
|
+
response.raise_for_status()
|
|
2509
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2510
|
+
|
|
2511
|
+
|
|
2512
|
+
def list_roll_call(
|
|
2513
|
+
*, discipline: str, course: str, client: httpx.Client | None = None
|
|
2514
|
+
) -> ListRollCallResponse:
|
|
2515
|
+
"""
|
|
2516
|
+
Find multiple Roll Calls.
|
|
2517
|
+
"""
|
|
2518
|
+
client = client if client is not None else get_client()
|
|
2519
|
+
response = client.get(
|
|
2520
|
+
"/api/course/{discipline}/{course}/roll-call".format(
|
|
2521
|
+
discipline=discipline, course=course
|
|
2522
|
+
),
|
|
2523
|
+
headers=auth_headers(client),
|
|
2524
|
+
)
|
|
2525
|
+
if response.status_code == 200:
|
|
2526
|
+
return ListRollCallResponse.model_validate(response.json())
|
|
2527
|
+
response.raise_for_status()
|
|
2528
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2529
|
+
|
|
2530
|
+
|
|
2531
|
+
def list_timeslot(
|
|
2532
|
+
*,
|
|
2533
|
+
discipline: str,
|
|
2534
|
+
course: str,
|
|
2535
|
+
days: list[
|
|
2536
|
+
Literal[
|
|
2537
|
+
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"
|
|
2538
|
+
]
|
|
2539
|
+
]
|
|
2540
|
+
| None = None,
|
|
2541
|
+
client: httpx.Client | None = None,
|
|
2542
|
+
) -> ListTimeslotResponse:
|
|
2543
|
+
"""
|
|
2544
|
+
Find multiple Time Slots.
|
|
2545
|
+
"""
|
|
2546
|
+
client = client if client is not None else get_client()
|
|
2547
|
+
response = client.get(
|
|
2548
|
+
"/api/course/{discipline}/{course}/time-slot".format(
|
|
2549
|
+
discipline=discipline, course=course
|
|
2550
|
+
),
|
|
2551
|
+
params=query_params({"days": days}),
|
|
2552
|
+
headers=auth_headers(client),
|
|
2553
|
+
)
|
|
2554
|
+
if response.status_code == 200:
|
|
2555
|
+
return ListTimeslotResponse.model_validate(response.json())
|
|
2556
|
+
response.raise_for_status()
|
|
2557
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2558
|
+
|
|
2559
|
+
|
|
2560
|
+
def list_user(
|
|
2561
|
+
*,
|
|
2562
|
+
usernames: list[str] | None = None,
|
|
2563
|
+
limit: int | None = None,
|
|
2564
|
+
after: str | None = None,
|
|
2565
|
+
before: str | None = None,
|
|
2566
|
+
client: httpx.Client | None = None,
|
|
2567
|
+
) -> ListUserResponse:
|
|
2568
|
+
"""
|
|
2569
|
+
Find multiple Users.
|
|
2570
|
+
"""
|
|
2571
|
+
client = client if client is not None else get_client()
|
|
2572
|
+
response = client.get(
|
|
2573
|
+
"/api/user",
|
|
2574
|
+
params=query_params(
|
|
2575
|
+
{"usernames": usernames, "limit": limit, "after": after, "before": before}
|
|
2576
|
+
),
|
|
2577
|
+
headers=auth_headers(client),
|
|
2578
|
+
)
|
|
2579
|
+
if response.status_code == 200:
|
|
2580
|
+
return ListUserResponse.model_validate(response.json())
|
|
2581
|
+
response.raise_for_status()
|
|
2582
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2583
|
+
|
|
2584
|
+
|
|
2585
|
+
def login(*, body: LoginRequest, client: httpx.Client | None = None) -> LoginResponse:
|
|
2586
|
+
client = client if client is not None else get_client()
|
|
2587
|
+
response = client.post(
|
|
2588
|
+
"/api/auth/login", json=body.model_dump(mode="json", by_alias=True)
|
|
2589
|
+
)
|
|
2590
|
+
if response.status_code == 401:
|
|
2591
|
+
raise InvalidCredentials(
|
|
2592
|
+
response.status_code,
|
|
2593
|
+
InvalidCredentials.Payload.model_validate(response.json()),
|
|
2594
|
+
)
|
|
2595
|
+
if response.status_code == 200:
|
|
2596
|
+
return LoginResponse.model_validate(response.json())
|
|
2597
|
+
response.raise_for_status()
|
|
2598
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2599
|
+
|
|
2600
|
+
|
|
2601
|
+
def logout(*, client: httpx.Client | None = None) -> LogoutResponse:
|
|
2602
|
+
"""
|
|
2603
|
+
Logs out the current user.
|
|
2604
|
+
"""
|
|
2605
|
+
client = client if client is not None else get_client()
|
|
2606
|
+
response = client.post("/api/auth/logout", headers=auth_headers(client))
|
|
2607
|
+
if response.status_code == 200:
|
|
2608
|
+
return LogoutResponse.model_validate(response.json())
|
|
2609
|
+
response.raise_for_status()
|
|
2610
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2611
|
+
|
|
2612
|
+
|
|
2613
|
+
def read_calendar_event(
|
|
2614
|
+
*,
|
|
2615
|
+
discipline: str,
|
|
2616
|
+
course: str,
|
|
2617
|
+
week: str,
|
|
2618
|
+
time_slot: str,
|
|
2619
|
+
client: httpx.Client | None = None,
|
|
2620
|
+
) -> CalendarEvent:
|
|
2621
|
+
"""
|
|
2622
|
+
Find a single Calendar Event.
|
|
2623
|
+
"""
|
|
2624
|
+
client = client if client is not None else get_client()
|
|
2625
|
+
response = client.get(
|
|
2626
|
+
"/api/course/{discipline}/{course}/calendar-event/{week}/{timeSlot}".format(
|
|
2627
|
+
discipline=discipline, course=course, week=week, timeSlot=time_slot
|
|
2628
|
+
),
|
|
2629
|
+
headers=auth_headers(client),
|
|
2630
|
+
)
|
|
2631
|
+
if response.status_code == 200:
|
|
2632
|
+
return CalendarEvent.model_validate(response.json())
|
|
2633
|
+
response.raise_for_status()
|
|
2634
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2635
|
+
|
|
2636
|
+
|
|
2637
|
+
def read_course(
|
|
2638
|
+
*, discipline: str, course: str, client: httpx.Client | None = None
|
|
2639
|
+
) -> Course:
|
|
2640
|
+
"""
|
|
2641
|
+
Find a single Course.
|
|
2642
|
+
"""
|
|
2643
|
+
client = client if client is not None else get_client()
|
|
2644
|
+
response = client.get(
|
|
2645
|
+
"/api/course/{discipline}/{course}".format(
|
|
2646
|
+
discipline=discipline, course=course
|
|
2647
|
+
),
|
|
2648
|
+
headers=auth_headers(client),
|
|
2649
|
+
)
|
|
2650
|
+
if response.status_code == 200:
|
|
2651
|
+
return Course.model_validate(response.json())
|
|
2652
|
+
response.raise_for_status()
|
|
2653
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2654
|
+
|
|
2655
|
+
|
|
2656
|
+
def read_discipline(*, slug: str, client: httpx.Client | None = None) -> Discipline:
|
|
2657
|
+
"""
|
|
2658
|
+
Find a single Discipline.
|
|
2659
|
+
"""
|
|
2660
|
+
client = client if client is not None else get_client()
|
|
2661
|
+
response = client.get(
|
|
2662
|
+
"/api/discipline/{slug}".format(slug=slug), headers=auth_headers(client)
|
|
2663
|
+
)
|
|
2664
|
+
if response.status_code == 200:
|
|
2665
|
+
return Discipline.model_validate(response.json())
|
|
2666
|
+
response.raise_for_status()
|
|
2667
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
def read_edition(*, slug: str, client: httpx.Client | None = None) -> Edition:
|
|
2671
|
+
"""
|
|
2672
|
+
Find a single Edition.
|
|
2673
|
+
"""
|
|
2674
|
+
client = client if client is not None else get_client()
|
|
2675
|
+
response = client.get(
|
|
2676
|
+
"/api/edition/{slug}".format(slug=slug), headers=auth_headers(client)
|
|
2677
|
+
)
|
|
2678
|
+
if response.status_code == 200:
|
|
2679
|
+
return Edition.model_validate(response.json())
|
|
2680
|
+
response.raise_for_status()
|
|
2681
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2682
|
+
|
|
2683
|
+
|
|
2684
|
+
def read_exam(
|
|
2685
|
+
*, discipline: str, course: str, slug: str, client: httpx.Client | None = None
|
|
2686
|
+
) -> Exam:
|
|
2687
|
+
"""
|
|
2688
|
+
Find a single Exam.
|
|
2689
|
+
"""
|
|
2690
|
+
client = client if client is not None else get_client()
|
|
2691
|
+
response = client.get(
|
|
2692
|
+
"/api/course/{discipline}/{course}/exam/{slug}".format(
|
|
2693
|
+
discipline=discipline, course=course, slug=slug
|
|
2694
|
+
),
|
|
2695
|
+
headers=auth_headers(client),
|
|
2696
|
+
)
|
|
2697
|
+
if response.status_code == 200:
|
|
2698
|
+
return Exam.model_validate(response.json())
|
|
2699
|
+
response.raise_for_status()
|
|
2700
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2701
|
+
|
|
2702
|
+
|
|
2703
|
+
def read_grade_column(
|
|
2704
|
+
*, discipline: str, course: str, slug: str, client: httpx.Client | None = None
|
|
2705
|
+
) -> GradeColumn:
|
|
2706
|
+
"""
|
|
2707
|
+
Find a single Grade Column.
|
|
2708
|
+
"""
|
|
2709
|
+
client = client if client is not None else get_client()
|
|
2710
|
+
response = client.get(
|
|
2711
|
+
"/api/course/{discipline}/{course}/grade-column/{slug}".format(
|
|
2712
|
+
discipline=discipline, course=course, slug=slug
|
|
2713
|
+
),
|
|
2714
|
+
headers=auth_headers(client),
|
|
2715
|
+
)
|
|
2716
|
+
if response.status_code == 200:
|
|
2717
|
+
return GradeColumn.model_validate(response.json())
|
|
2718
|
+
response.raise_for_status()
|
|
2719
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
def read_question(
|
|
2723
|
+
*,
|
|
2724
|
+
discipline: str,
|
|
2725
|
+
course: str,
|
|
2726
|
+
slug: str,
|
|
2727
|
+
public: bool | None = None,
|
|
2728
|
+
client: httpx.Client | None = None,
|
|
2729
|
+
) -> ListQuestionResponseItemsItem | ListQuestionResponseItemsItem2:
|
|
2730
|
+
"""
|
|
2731
|
+
Find a single Question.
|
|
2732
|
+
"""
|
|
2733
|
+
client = client if client is not None else get_client()
|
|
2734
|
+
response = client.get(
|
|
2735
|
+
"/api/course/{discipline}/{course}/question/{slug}".format(
|
|
2736
|
+
discipline=discipline, course=course, slug=slug
|
|
2737
|
+
),
|
|
2738
|
+
params=query_params({"public": public}),
|
|
2739
|
+
headers=auth_headers(client),
|
|
2740
|
+
)
|
|
2741
|
+
if response.status_code == 200:
|
|
2742
|
+
return TypeAdapter(
|
|
2743
|
+
ListQuestionResponseItemsItem | ListQuestionResponseItemsItem2
|
|
2744
|
+
).validate_python(response.json())
|
|
2745
|
+
response.raise_for_status()
|
|
2746
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2747
|
+
|
|
2748
|
+
|
|
2749
|
+
def read_resource(
|
|
2750
|
+
*, discipline: str, course: str, slug: str, client: httpx.Client | None = None
|
|
2751
|
+
) -> Resource:
|
|
2752
|
+
"""
|
|
2753
|
+
Find a single Resource.
|
|
2754
|
+
"""
|
|
2755
|
+
client = client if client is not None else get_client()
|
|
2756
|
+
response = client.get(
|
|
2757
|
+
"/api/course/{discipline}/{course}/resource/{slug}".format(
|
|
2758
|
+
discipline=discipline, course=course, slug=slug
|
|
2759
|
+
),
|
|
2760
|
+
headers=auth_headers(client),
|
|
2761
|
+
)
|
|
2762
|
+
if response.status_code == 200:
|
|
2763
|
+
return Resource.model_validate(response.json())
|
|
2764
|
+
response.raise_for_status()
|
|
2765
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2766
|
+
|
|
2767
|
+
|
|
2768
|
+
def read_roll_call(
|
|
2769
|
+
*,
|
|
2770
|
+
discipline: str,
|
|
2771
|
+
course: str,
|
|
2772
|
+
week: str,
|
|
2773
|
+
time_slot: str,
|
|
2774
|
+
client: httpx.Client | None = None,
|
|
2775
|
+
) -> ReadRollCallResponse:
|
|
2776
|
+
"""
|
|
2777
|
+
Find a single Roll Call.
|
|
2778
|
+
"""
|
|
2779
|
+
client = client if client is not None else get_client()
|
|
2780
|
+
response = client.get(
|
|
2781
|
+
"/api/course/{discipline}/{course}/roll-call/{week}/{timeSlot}".format(
|
|
2782
|
+
discipline=discipline, course=course, week=week, timeSlot=time_slot
|
|
2783
|
+
),
|
|
2784
|
+
headers=auth_headers(client),
|
|
2785
|
+
)
|
|
2786
|
+
if response.status_code == 200:
|
|
2787
|
+
return ReadRollCallResponse.model_validate(response.json())
|
|
2788
|
+
response.raise_for_status()
|
|
2789
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2790
|
+
|
|
2791
|
+
|
|
2792
|
+
def read_timeslot(
|
|
2793
|
+
*, discipline: str, course: str, slug: str, client: httpx.Client | None = None
|
|
2794
|
+
) -> TimeSlot:
|
|
2795
|
+
"""
|
|
2796
|
+
Find a single TimeSlot.
|
|
2797
|
+
"""
|
|
2798
|
+
client = client if client is not None else get_client()
|
|
2799
|
+
response = client.get(
|
|
2800
|
+
"/api/course/{discipline}/{course}/time-slot/{slug}".format(
|
|
2801
|
+
discipline=discipline, course=course, slug=slug
|
|
2802
|
+
),
|
|
2803
|
+
headers=auth_headers(client),
|
|
2804
|
+
)
|
|
2805
|
+
if response.status_code == 200:
|
|
2806
|
+
return TimeSlot.model_validate(response.json())
|
|
2807
|
+
response.raise_for_status()
|
|
2808
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
def read_user(*, username: str, client: httpx.Client | None = None) -> User:
|
|
2812
|
+
"""
|
|
2813
|
+
Find a single User.
|
|
2814
|
+
"""
|
|
2815
|
+
client = client if client is not None else get_client()
|
|
2816
|
+
response = client.get(
|
|
2817
|
+
"/api/user/{username}".format(username=username), headers=auth_headers(client)
|
|
2818
|
+
)
|
|
2819
|
+
if response.status_code == 200:
|
|
2820
|
+
return User.model_validate(response.json())
|
|
2821
|
+
response.raise_for_status()
|
|
2822
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2823
|
+
|
|
2824
|
+
|
|
2825
|
+
def renew_grading_job(
|
|
2826
|
+
*, submission: str, body: RenewGradingJobRequest, client: httpx.Client | None = None
|
|
2827
|
+
) -> RenewGradingJobResponse:
|
|
2828
|
+
"""
|
|
2829
|
+
Renew the lease of a grading job
|
|
2830
|
+
"""
|
|
2831
|
+
client = client if client is not None else get_client()
|
|
2832
|
+
response = client.post(
|
|
2833
|
+
"/api/grading-jobs/{submission}/renew".format(submission=submission),
|
|
2834
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
2835
|
+
headers=auth_headers(client),
|
|
2836
|
+
)
|
|
2837
|
+
if response.status_code == 200:
|
|
2838
|
+
return RenewGradingJobResponse.model_validate(response.json())
|
|
2839
|
+
response.raise_for_status()
|
|
2840
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2841
|
+
|
|
2842
|
+
|
|
2843
|
+
def report_grading_job(
|
|
2844
|
+
*, submission: str, body: dict[str, Any], client: httpx.Client | None = None
|
|
2845
|
+
) -> ReportGradingJobResponse:
|
|
2846
|
+
"""
|
|
2847
|
+
Report the result of a grading job
|
|
2848
|
+
"""
|
|
2849
|
+
client = client if client is not None else get_client()
|
|
2850
|
+
response = client.post(
|
|
2851
|
+
"/api/grading-jobs/{submission}/result".format(submission=submission),
|
|
2852
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
2853
|
+
headers=auth_headers(client),
|
|
2854
|
+
)
|
|
2855
|
+
if response.status_code == 200:
|
|
2856
|
+
return ReportGradingJobResponse.model_validate(response.json())
|
|
2857
|
+
response.raise_for_status()
|
|
2858
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2859
|
+
|
|
2860
|
+
|
|
2861
|
+
def repository_delete(
|
|
2862
|
+
*,
|
|
2863
|
+
discipline: str,
|
|
2864
|
+
course: str,
|
|
2865
|
+
slug: str,
|
|
2866
|
+
if_match: str | None = None,
|
|
2867
|
+
client: httpx.Client | None = None,
|
|
2868
|
+
) -> RepositoryDeleted:
|
|
2869
|
+
"""
|
|
2870
|
+
Delete a single Repository.
|
|
2871
|
+
"""
|
|
2872
|
+
client = client if client is not None else get_client()
|
|
2873
|
+
response = client.delete(
|
|
2874
|
+
"/api/course/{discipline}/{course}/repository/{slug}".format(
|
|
2875
|
+
discipline=discipline, course=course, slug=slug
|
|
2876
|
+
),
|
|
2877
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
2878
|
+
)
|
|
2879
|
+
if response.status_code == 412:
|
|
2880
|
+
raise PreconditionFailed(
|
|
2881
|
+
response.status_code,
|
|
2882
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
2883
|
+
)
|
|
2884
|
+
if response.status_code == 200:
|
|
2885
|
+
return RepositoryDeleted.model_validate(response.json())
|
|
2886
|
+
response.raise_for_status()
|
|
2887
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2888
|
+
|
|
2889
|
+
|
|
2890
|
+
def repository_list(
|
|
2891
|
+
*, discipline: str, course: str, client: httpx.Client | None = None
|
|
2892
|
+
) -> RepositoryListResponse:
|
|
2893
|
+
"""
|
|
2894
|
+
Find multiple Repositories.
|
|
2895
|
+
"""
|
|
2896
|
+
client = client if client is not None else get_client()
|
|
2897
|
+
response = client.get(
|
|
2898
|
+
"/api/course/{discipline}/{course}/repository".format(
|
|
2899
|
+
discipline=discipline, course=course
|
|
2900
|
+
),
|
|
2901
|
+
headers=auth_headers(client),
|
|
2902
|
+
)
|
|
2903
|
+
if response.status_code == 200:
|
|
2904
|
+
return RepositoryListResponse.model_validate(response.json())
|
|
2905
|
+
response.raise_for_status()
|
|
2906
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2907
|
+
|
|
2908
|
+
|
|
2909
|
+
def repository_upsert(
|
|
2910
|
+
*,
|
|
2911
|
+
discipline: str,
|
|
2912
|
+
course: str,
|
|
2913
|
+
if_match: str | None = None,
|
|
2914
|
+
if_none_match: Literal["*"] | None = None,
|
|
2915
|
+
body: RepositoryCreate,
|
|
2916
|
+
client: httpx.Client | None = None,
|
|
2917
|
+
) -> Repository:
|
|
2918
|
+
"""
|
|
2919
|
+
Upsert a single Repository.
|
|
2920
|
+
"""
|
|
2921
|
+
client = client if client is not None else get_client()
|
|
2922
|
+
response = client.put(
|
|
2923
|
+
"/api/course/{discipline}/{course}/repository".format(
|
|
2924
|
+
discipline=discipline, course=course
|
|
2925
|
+
),
|
|
2926
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
2927
|
+
headers={
|
|
2928
|
+
**auth_headers(client),
|
|
2929
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
2930
|
+
},
|
|
2931
|
+
)
|
|
2932
|
+
if response.status_code == 412:
|
|
2933
|
+
raise PreconditionFailed(
|
|
2934
|
+
response.status_code,
|
|
2935
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
2936
|
+
)
|
|
2937
|
+
if response.status_code == 200:
|
|
2938
|
+
return Repository.model_validate(response.json())
|
|
2939
|
+
response.raise_for_status()
|
|
2940
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2941
|
+
|
|
2942
|
+
|
|
2943
|
+
def rubric_item_create(
|
|
2944
|
+
*,
|
|
2945
|
+
discipline: str,
|
|
2946
|
+
course: str,
|
|
2947
|
+
slug: str,
|
|
2948
|
+
question: str,
|
|
2949
|
+
body: RubricItemCreate,
|
|
2950
|
+
client: httpx.Client | None = None,
|
|
2951
|
+
) -> RubricItem:
|
|
2952
|
+
"""
|
|
2953
|
+
Add an item to a rubric.
|
|
2954
|
+
"""
|
|
2955
|
+
client = client if client is not None else get_client()
|
|
2956
|
+
response = client.post(
|
|
2957
|
+
"/api/course/{discipline}/{course}/exam/{slug}/question/{question}/rubric/item".format(
|
|
2958
|
+
discipline=discipline, course=course, slug=slug, question=question
|
|
2959
|
+
),
|
|
2960
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
2961
|
+
headers=auth_headers(client),
|
|
2962
|
+
)
|
|
2963
|
+
if response.status_code == 200:
|
|
2964
|
+
return RubricItem.model_validate(response.json())
|
|
2965
|
+
response.raise_for_status()
|
|
2966
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
def rubric_item_delete(
|
|
2970
|
+
*,
|
|
2971
|
+
discipline: str,
|
|
2972
|
+
course: str,
|
|
2973
|
+
slug: str,
|
|
2974
|
+
question: str,
|
|
2975
|
+
key: str,
|
|
2976
|
+
if_match: str | None = None,
|
|
2977
|
+
client: httpx.Client | None = None,
|
|
2978
|
+
) -> RubricItemDeleted:
|
|
2979
|
+
"""
|
|
2980
|
+
Delete a rubric item.
|
|
2981
|
+
"""
|
|
2982
|
+
client = client if client is not None else get_client()
|
|
2983
|
+
response = client.delete(
|
|
2984
|
+
"/api/course/{discipline}/{course}/exam/{slug}/question/{question}/rubric/item/{key}".format(
|
|
2985
|
+
discipline=discipline, course=course, slug=slug, question=question, key=key
|
|
2986
|
+
),
|
|
2987
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
2988
|
+
)
|
|
2989
|
+
if response.status_code == 412:
|
|
2990
|
+
raise PreconditionFailed(
|
|
2991
|
+
response.status_code,
|
|
2992
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
2993
|
+
)
|
|
2994
|
+
if response.status_code == 200:
|
|
2995
|
+
return RubricItemDeleted.model_validate(response.json())
|
|
2996
|
+
response.raise_for_status()
|
|
2997
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
def rubric_item_put(
|
|
3001
|
+
*,
|
|
3002
|
+
discipline: str,
|
|
3003
|
+
course: str,
|
|
3004
|
+
slug: str,
|
|
3005
|
+
question: str,
|
|
3006
|
+
key: str,
|
|
3007
|
+
if_match: str | None = None,
|
|
3008
|
+
if_none_match: Literal["*"] | None = None,
|
|
3009
|
+
body: RubricItemPut,
|
|
3010
|
+
client: httpx.Client | None = None,
|
|
3011
|
+
) -> RubricItem:
|
|
3012
|
+
"""
|
|
3013
|
+
Create or replace a rubric item under the given key.
|
|
3014
|
+
"""
|
|
3015
|
+
client = client if client is not None else get_client()
|
|
3016
|
+
response = client.put(
|
|
3017
|
+
"/api/course/{discipline}/{course}/exam/{slug}/question/{question}/rubric/item/{key}".format(
|
|
3018
|
+
discipline=discipline, course=course, slug=slug, question=question, key=key
|
|
3019
|
+
),
|
|
3020
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3021
|
+
headers={
|
|
3022
|
+
**auth_headers(client),
|
|
3023
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
3024
|
+
},
|
|
3025
|
+
)
|
|
3026
|
+
if response.status_code == 412:
|
|
3027
|
+
raise PreconditionFailed(
|
|
3028
|
+
response.status_code,
|
|
3029
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3030
|
+
)
|
|
3031
|
+
if response.status_code == 200:
|
|
3032
|
+
return RubricItem.model_validate(response.json())
|
|
3033
|
+
response.raise_for_status()
|
|
3034
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3035
|
+
|
|
3036
|
+
|
|
3037
|
+
def rubric_item_split(
|
|
3038
|
+
*,
|
|
3039
|
+
discipline: str,
|
|
3040
|
+
course: str,
|
|
3041
|
+
slug: str,
|
|
3042
|
+
question: str,
|
|
3043
|
+
key: str,
|
|
3044
|
+
body: RubricSplit,
|
|
3045
|
+
client: httpx.Client | None = None,
|
|
3046
|
+
) -> list[RubricItem]:
|
|
3047
|
+
"""
|
|
3048
|
+
Split a rubric item into finer items.
|
|
3049
|
+
"""
|
|
3050
|
+
client = client if client is not None else get_client()
|
|
3051
|
+
response = client.post(
|
|
3052
|
+
"/api/course/{discipline}/{course}/exam/{slug}/question/{question}/rubric/item/{key}/split".format(
|
|
3053
|
+
discipline=discipline, course=course, slug=slug, question=question, key=key
|
|
3054
|
+
),
|
|
3055
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3056
|
+
headers=auth_headers(client),
|
|
3057
|
+
)
|
|
3058
|
+
if response.status_code == 200:
|
|
3059
|
+
return TypeAdapter(list[RubricItem]).validate_python(response.json())
|
|
3060
|
+
response.raise_for_status()
|
|
3061
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
def rubric_item_update(
|
|
3065
|
+
*,
|
|
3066
|
+
discipline: str,
|
|
3067
|
+
course: str,
|
|
3068
|
+
slug: str,
|
|
3069
|
+
question: str,
|
|
3070
|
+
key: str,
|
|
3071
|
+
if_match: str | None = None,
|
|
3072
|
+
body: RubricItemUpdate,
|
|
3073
|
+
client: httpx.Client | None = None,
|
|
3074
|
+
) -> RubricItem:
|
|
3075
|
+
"""
|
|
3076
|
+
Change some fields of a rubric item.
|
|
3077
|
+
"""
|
|
3078
|
+
client = client if client is not None else get_client()
|
|
3079
|
+
response = client.patch(
|
|
3080
|
+
"/api/course/{discipline}/{course}/exam/{slug}/question/{question}/rubric/item/{key}".format(
|
|
3081
|
+
discipline=discipline, course=course, slug=slug, question=question, key=key
|
|
3082
|
+
),
|
|
3083
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3084
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3085
|
+
)
|
|
3086
|
+
if response.status_code == 412:
|
|
3087
|
+
raise PreconditionFailed(
|
|
3088
|
+
response.status_code,
|
|
3089
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3090
|
+
)
|
|
3091
|
+
if response.status_code == 200:
|
|
3092
|
+
return RubricItem.model_validate(response.json())
|
|
3093
|
+
response.raise_for_status()
|
|
3094
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3095
|
+
|
|
3096
|
+
|
|
3097
|
+
def rubric_preview(
|
|
3098
|
+
*,
|
|
3099
|
+
discipline: str,
|
|
3100
|
+
course: str,
|
|
3101
|
+
slug: str,
|
|
3102
|
+
question: str,
|
|
3103
|
+
body: RubricPreviewRequestUpdate
|
|
3104
|
+
| RubricPreviewRequestUpdateItem
|
|
3105
|
+
| RubricPreviewRequestDeleteItem,
|
|
3106
|
+
client: httpx.Client | None = None,
|
|
3107
|
+
) -> RubricPreview:
|
|
3108
|
+
"""
|
|
3109
|
+
Count the passes a rubric change would move.
|
|
3110
|
+
"""
|
|
3111
|
+
client = client if client is not None else get_client()
|
|
3112
|
+
response = client.post(
|
|
3113
|
+
"/api/course/{discipline}/{course}/exam/{slug}/question/{question}/rubric/preview".format(
|
|
3114
|
+
discipline=discipline, course=course, slug=slug, question=question
|
|
3115
|
+
),
|
|
3116
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3117
|
+
headers=auth_headers(client),
|
|
3118
|
+
)
|
|
3119
|
+
if response.status_code == 200:
|
|
3120
|
+
return RubricPreview.model_validate(response.json())
|
|
3121
|
+
response.raise_for_status()
|
|
3122
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3123
|
+
|
|
3124
|
+
|
|
3125
|
+
def rubric_read(
|
|
3126
|
+
*,
|
|
3127
|
+
discipline: str,
|
|
3128
|
+
course: str,
|
|
3129
|
+
slug: str,
|
|
3130
|
+
question: str,
|
|
3131
|
+
client: httpx.Client | None = None,
|
|
3132
|
+
) -> Rubric:
|
|
3133
|
+
"""
|
|
3134
|
+
Read the grading rubric of a question in an exam.
|
|
3135
|
+
"""
|
|
3136
|
+
client = client if client is not None else get_client()
|
|
3137
|
+
response = client.get(
|
|
3138
|
+
"/api/course/{discipline}/{course}/exam/{slug}/question/{question}/rubric".format(
|
|
3139
|
+
discipline=discipline, course=course, slug=slug, question=question
|
|
3140
|
+
),
|
|
3141
|
+
headers=auth_headers(client),
|
|
3142
|
+
)
|
|
3143
|
+
if response.status_code == 200:
|
|
3144
|
+
return Rubric.model_validate(response.json())
|
|
3145
|
+
response.raise_for_status()
|
|
3146
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3147
|
+
|
|
3148
|
+
|
|
3149
|
+
def rubric_rename_group(
|
|
3150
|
+
*,
|
|
3151
|
+
discipline: str,
|
|
3152
|
+
course: str,
|
|
3153
|
+
slug: str,
|
|
3154
|
+
question: str,
|
|
3155
|
+
body: RubricRenameGroup,
|
|
3156
|
+
client: httpx.Client | None = None,
|
|
3157
|
+
) -> RubricRenameResult:
|
|
3158
|
+
"""
|
|
3159
|
+
Rename a group of rubric items.
|
|
3160
|
+
"""
|
|
3161
|
+
client = client if client is not None else get_client()
|
|
3162
|
+
response = client.post(
|
|
3163
|
+
"/api/course/{discipline}/{course}/exam/{slug}/question/{question}/rubric/rename-group".format(
|
|
3164
|
+
discipline=discipline, course=course, slug=slug, question=question
|
|
3165
|
+
),
|
|
3166
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3167
|
+
headers=auth_headers(client),
|
|
3168
|
+
)
|
|
3169
|
+
if response.status_code == 200:
|
|
3170
|
+
return RubricRenameResult.model_validate(response.json())
|
|
3171
|
+
response.raise_for_status()
|
|
3172
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3173
|
+
|
|
3174
|
+
|
|
3175
|
+
def rubric_update(
|
|
3176
|
+
*,
|
|
3177
|
+
discipline: str,
|
|
3178
|
+
course: str,
|
|
3179
|
+
slug: str,
|
|
3180
|
+
question: str,
|
|
3181
|
+
if_match: str | None = None,
|
|
3182
|
+
body: RubricUpdate,
|
|
3183
|
+
client: httpx.Client | None = None,
|
|
3184
|
+
) -> Rubric:
|
|
3185
|
+
"""
|
|
3186
|
+
Set the base score of a rubric.
|
|
3187
|
+
"""
|
|
3188
|
+
client = client if client is not None else get_client()
|
|
3189
|
+
response = client.patch(
|
|
3190
|
+
"/api/course/{discipline}/{course}/exam/{slug}/question/{question}/rubric".format(
|
|
3191
|
+
discipline=discipline, course=course, slug=slug, question=question
|
|
3192
|
+
),
|
|
3193
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3194
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3195
|
+
)
|
|
3196
|
+
if response.status_code == 412:
|
|
3197
|
+
raise PreconditionFailed(
|
|
3198
|
+
response.status_code,
|
|
3199
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3200
|
+
)
|
|
3201
|
+
if response.status_code == 200:
|
|
3202
|
+
return Rubric.model_validate(response.json())
|
|
3203
|
+
response.raise_for_status()
|
|
3204
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3205
|
+
|
|
3206
|
+
|
|
3207
|
+
def update_calendar_event(
|
|
3208
|
+
*,
|
|
3209
|
+
discipline: str,
|
|
3210
|
+
course: str,
|
|
3211
|
+
week: str,
|
|
3212
|
+
time_slot: str,
|
|
3213
|
+
if_match: str | None = None,
|
|
3214
|
+
body: UpdateCalendarEventRequest,
|
|
3215
|
+
client: httpx.Client | None = None,
|
|
3216
|
+
) -> CalendarEvent:
|
|
3217
|
+
"""
|
|
3218
|
+
Update a single Calendar Event.
|
|
3219
|
+
"""
|
|
3220
|
+
client = client if client is not None else get_client()
|
|
3221
|
+
response = client.patch(
|
|
3222
|
+
"/api/course/{discipline}/{course}/calendar-event/{week}/{timeSlot}".format(
|
|
3223
|
+
discipline=discipline, course=course, week=week, timeSlot=time_slot
|
|
3224
|
+
),
|
|
3225
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3226
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3227
|
+
)
|
|
3228
|
+
if response.status_code == 412:
|
|
3229
|
+
raise PreconditionFailed(
|
|
3230
|
+
response.status_code,
|
|
3231
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3232
|
+
)
|
|
3233
|
+
if response.status_code == 200:
|
|
3234
|
+
return CalendarEvent.model_validate(response.json())
|
|
3235
|
+
response.raise_for_status()
|
|
3236
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3237
|
+
|
|
3238
|
+
|
|
3239
|
+
def update_course(
|
|
3240
|
+
*,
|
|
3241
|
+
discipline: str,
|
|
3242
|
+
course: str,
|
|
3243
|
+
if_match: str | None = None,
|
|
3244
|
+
body: UpdateCourseRequest,
|
|
3245
|
+
client: httpx.Client | None = None,
|
|
3246
|
+
) -> Course:
|
|
3247
|
+
"""
|
|
3248
|
+
Update a single Course.
|
|
3249
|
+
"""
|
|
3250
|
+
client = client if client is not None else get_client()
|
|
3251
|
+
response = client.patch(
|
|
3252
|
+
"/api/course/{discipline}/{course}".format(
|
|
3253
|
+
discipline=discipline, course=course
|
|
3254
|
+
),
|
|
3255
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3256
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3257
|
+
)
|
|
3258
|
+
if response.status_code == 412:
|
|
3259
|
+
raise PreconditionFailed(
|
|
3260
|
+
response.status_code,
|
|
3261
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3262
|
+
)
|
|
3263
|
+
if response.status_code == 200:
|
|
3264
|
+
return Course.model_validate(response.json())
|
|
3265
|
+
response.raise_for_status()
|
|
3266
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3267
|
+
|
|
3268
|
+
|
|
3269
|
+
def update_discipline(
|
|
3270
|
+
*,
|
|
3271
|
+
slug: str,
|
|
3272
|
+
if_match: str | None = None,
|
|
3273
|
+
body: UpdateDisciplineRequest,
|
|
3274
|
+
client: httpx.Client | None = None,
|
|
3275
|
+
) -> Discipline:
|
|
3276
|
+
"""
|
|
3277
|
+
Update a single Discipline.
|
|
3278
|
+
"""
|
|
3279
|
+
client = client if client is not None else get_client()
|
|
3280
|
+
response = client.patch(
|
|
3281
|
+
"/api/discipline/{slug}".format(slug=slug),
|
|
3282
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3283
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3284
|
+
)
|
|
3285
|
+
if response.status_code == 412:
|
|
3286
|
+
raise PreconditionFailed(
|
|
3287
|
+
response.status_code,
|
|
3288
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3289
|
+
)
|
|
3290
|
+
if response.status_code == 200:
|
|
3291
|
+
return Discipline.model_validate(response.json())
|
|
3292
|
+
response.raise_for_status()
|
|
3293
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3294
|
+
|
|
3295
|
+
|
|
3296
|
+
def update_edition(
|
|
3297
|
+
*, slug: str, body: UpdateEditionRequest, client: httpx.Client | None = None
|
|
3298
|
+
) -> Edition:
|
|
3299
|
+
"""
|
|
3300
|
+
Update a single Edition.
|
|
3301
|
+
"""
|
|
3302
|
+
client = client if client is not None else get_client()
|
|
3303
|
+
response = client.patch(
|
|
3304
|
+
"/api/edition/{slug}".format(slug=slug),
|
|
3305
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3306
|
+
headers=auth_headers(client),
|
|
3307
|
+
)
|
|
3308
|
+
if response.status_code == 200:
|
|
3309
|
+
return Edition.model_validate(response.json())
|
|
3310
|
+
response.raise_for_status()
|
|
3311
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3312
|
+
|
|
3313
|
+
|
|
3314
|
+
def update_exam(
|
|
3315
|
+
*,
|
|
3316
|
+
discipline: str,
|
|
3317
|
+
course: str,
|
|
3318
|
+
slug: str,
|
|
3319
|
+
if_match: str | None = None,
|
|
3320
|
+
body: UpdateExamRequest,
|
|
3321
|
+
client: httpx.Client | None = None,
|
|
3322
|
+
) -> Exam:
|
|
3323
|
+
"""
|
|
3324
|
+
Update a single Exam.
|
|
3325
|
+
"""
|
|
3326
|
+
client = client if client is not None else get_client()
|
|
3327
|
+
response = client.patch(
|
|
3328
|
+
"/api/course/{discipline}/{course}/exam/{slug}".format(
|
|
3329
|
+
discipline=discipline, course=course, slug=slug
|
|
3330
|
+
),
|
|
3331
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3332
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3333
|
+
)
|
|
3334
|
+
if response.status_code == 412:
|
|
3335
|
+
raise PreconditionFailed(
|
|
3336
|
+
response.status_code,
|
|
3337
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3338
|
+
)
|
|
3339
|
+
if response.status_code == 200:
|
|
3340
|
+
return Exam.model_validate(response.json())
|
|
3341
|
+
response.raise_for_status()
|
|
3342
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3343
|
+
|
|
3344
|
+
|
|
3345
|
+
def update_grade_column(
|
|
3346
|
+
*,
|
|
3347
|
+
discipline: str,
|
|
3348
|
+
course: str,
|
|
3349
|
+
slug: str,
|
|
3350
|
+
if_match: str | None = None,
|
|
3351
|
+
body: UpdateGradeColumnRequest,
|
|
3352
|
+
client: httpx.Client | None = None,
|
|
3353
|
+
) -> GradeColumn:
|
|
3354
|
+
"""
|
|
3355
|
+
Update a single Grade Column.
|
|
3356
|
+
"""
|
|
3357
|
+
client = client if client is not None else get_client()
|
|
3358
|
+
response = client.patch(
|
|
3359
|
+
"/api/course/{discipline}/{course}/grade-column/{slug}".format(
|
|
3360
|
+
discipline=discipline, course=course, slug=slug
|
|
3361
|
+
),
|
|
3362
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3363
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3364
|
+
)
|
|
3365
|
+
if response.status_code == 412:
|
|
3366
|
+
raise PreconditionFailed(
|
|
3367
|
+
response.status_code,
|
|
3368
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3369
|
+
)
|
|
3370
|
+
if response.status_code == 200:
|
|
3371
|
+
return GradeColumn.model_validate(response.json())
|
|
3372
|
+
response.raise_for_status()
|
|
3373
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3374
|
+
|
|
3375
|
+
|
|
3376
|
+
def update_question(
|
|
3377
|
+
*,
|
|
3378
|
+
discipline: str,
|
|
3379
|
+
course: str,
|
|
3380
|
+
slug: str,
|
|
3381
|
+
if_match: str | None = None,
|
|
3382
|
+
body: UpdateQuestionRequest,
|
|
3383
|
+
client: httpx.Client | None = None,
|
|
3384
|
+
) -> ListQuestionResponseItemsItem | ListQuestionResponseItemsItem2:
|
|
3385
|
+
"""
|
|
3386
|
+
Update a single Question.
|
|
3387
|
+
"""
|
|
3388
|
+
client = client if client is not None else get_client()
|
|
3389
|
+
response = client.patch(
|
|
3390
|
+
"/api/course/{discipline}/{course}/question/{slug}".format(
|
|
3391
|
+
discipline=discipline, course=course, slug=slug
|
|
3392
|
+
),
|
|
3393
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3394
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3395
|
+
)
|
|
3396
|
+
if response.status_code == 412:
|
|
3397
|
+
raise PreconditionFailed(
|
|
3398
|
+
response.status_code,
|
|
3399
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3400
|
+
)
|
|
3401
|
+
if response.status_code == 200:
|
|
3402
|
+
return TypeAdapter(
|
|
3403
|
+
ListQuestionResponseItemsItem | ListQuestionResponseItemsItem2
|
|
3404
|
+
).validate_python(response.json())
|
|
3405
|
+
response.raise_for_status()
|
|
3406
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3407
|
+
|
|
3408
|
+
|
|
3409
|
+
def update_resource(
|
|
3410
|
+
*,
|
|
3411
|
+
discipline: str,
|
|
3412
|
+
course: str,
|
|
3413
|
+
slug: str,
|
|
3414
|
+
if_match: str | None = None,
|
|
3415
|
+
body: UpdateResourceRequest,
|
|
3416
|
+
client: httpx.Client | None = None,
|
|
3417
|
+
) -> Resource:
|
|
3418
|
+
"""
|
|
3419
|
+
Update a single Resource.
|
|
3420
|
+
"""
|
|
3421
|
+
client = client if client is not None else get_client()
|
|
3422
|
+
response = client.patch(
|
|
3423
|
+
"/api/course/{discipline}/{course}/resource/{slug}".format(
|
|
3424
|
+
discipline=discipline, course=course, slug=slug
|
|
3425
|
+
),
|
|
3426
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3427
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3428
|
+
)
|
|
3429
|
+
if response.status_code == 412:
|
|
3430
|
+
raise PreconditionFailed(
|
|
3431
|
+
response.status_code,
|
|
3432
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3433
|
+
)
|
|
3434
|
+
if response.status_code == 200:
|
|
3435
|
+
return Resource.model_validate(response.json())
|
|
3436
|
+
response.raise_for_status()
|
|
3437
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3438
|
+
|
|
3439
|
+
|
|
3440
|
+
def update_roll_call(
|
|
3441
|
+
*,
|
|
3442
|
+
discipline: str,
|
|
3443
|
+
course: str,
|
|
3444
|
+
week: str,
|
|
3445
|
+
time_slot: str,
|
|
3446
|
+
if_match: str | None = None,
|
|
3447
|
+
body: UpdateRollCallRequest,
|
|
3448
|
+
client: httpx.Client | None = None,
|
|
3449
|
+
) -> ReadRollCallResponse:
|
|
3450
|
+
"""
|
|
3451
|
+
Update a single Roll Call.
|
|
3452
|
+
"""
|
|
3453
|
+
client = client if client is not None else get_client()
|
|
3454
|
+
response = client.patch(
|
|
3455
|
+
"/api/course/{discipline}/{course}/roll-call/{week}/{timeSlot}".format(
|
|
3456
|
+
discipline=discipline, course=course, week=week, timeSlot=time_slot
|
|
3457
|
+
),
|
|
3458
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3459
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3460
|
+
)
|
|
3461
|
+
if response.status_code == 412:
|
|
3462
|
+
raise PreconditionFailed(
|
|
3463
|
+
response.status_code,
|
|
3464
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3465
|
+
)
|
|
3466
|
+
if response.status_code == 200:
|
|
3467
|
+
return ReadRollCallResponse.model_validate(response.json())
|
|
3468
|
+
response.raise_for_status()
|
|
3469
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3470
|
+
|
|
3471
|
+
|
|
3472
|
+
def update_timeslot(
|
|
3473
|
+
*,
|
|
3474
|
+
discipline: str,
|
|
3475
|
+
course: str,
|
|
3476
|
+
slug: str,
|
|
3477
|
+
if_match: str | None = None,
|
|
3478
|
+
body: UpdateTimeslotRequest,
|
|
3479
|
+
client: httpx.Client | None = None,
|
|
3480
|
+
) -> TimeSlot:
|
|
3481
|
+
"""
|
|
3482
|
+
Update a single TimeSlot.
|
|
3483
|
+
"""
|
|
3484
|
+
client = client if client is not None else get_client()
|
|
3485
|
+
response = client.patch(
|
|
3486
|
+
"/api/course/{discipline}/{course}/time-slot/{slug}".format(
|
|
3487
|
+
discipline=discipline, course=course, slug=slug
|
|
3488
|
+
),
|
|
3489
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3490
|
+
headers={**auth_headers(client), **header_params({"If-Match": if_match})},
|
|
3491
|
+
)
|
|
3492
|
+
if response.status_code == 412:
|
|
3493
|
+
raise PreconditionFailed(
|
|
3494
|
+
response.status_code,
|
|
3495
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3496
|
+
)
|
|
3497
|
+
if response.status_code == 200:
|
|
3498
|
+
return TimeSlot.model_validate(response.json())
|
|
3499
|
+
response.raise_for_status()
|
|
3500
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3501
|
+
|
|
3502
|
+
|
|
3503
|
+
def update_user(
|
|
3504
|
+
*, username: str, body: UpdateUserRequest, client: httpx.Client | None = None
|
|
3505
|
+
) -> User:
|
|
3506
|
+
"""
|
|
3507
|
+
Update a single User.
|
|
3508
|
+
"""
|
|
3509
|
+
client = client if client is not None else get_client()
|
|
3510
|
+
response = client.patch(
|
|
3511
|
+
"/api/user/{username}".format(username=username),
|
|
3512
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3513
|
+
headers=auth_headers(client),
|
|
3514
|
+
)
|
|
3515
|
+
if response.status_code == 200:
|
|
3516
|
+
return User.model_validate(response.json())
|
|
3517
|
+
response.raise_for_status()
|
|
3518
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3519
|
+
|
|
3520
|
+
|
|
3521
|
+
def upsert_calendar_event(
|
|
3522
|
+
*,
|
|
3523
|
+
discipline: str,
|
|
3524
|
+
course: str,
|
|
3525
|
+
if_match: str | None = None,
|
|
3526
|
+
if_none_match: Literal["*"] | None = None,
|
|
3527
|
+
body: CalendarEventCreate,
|
|
3528
|
+
client: httpx.Client | None = None,
|
|
3529
|
+
) -> CalendarEvent:
|
|
3530
|
+
"""
|
|
3531
|
+
Upsert a single Calendar Event. Creates if it does not exist, update otherwise.
|
|
3532
|
+
"""
|
|
3533
|
+
client = client if client is not None else get_client()
|
|
3534
|
+
response = client.put(
|
|
3535
|
+
"/api/course/{discipline}/{course}/calendar-event".format(
|
|
3536
|
+
discipline=discipline, course=course
|
|
3537
|
+
),
|
|
3538
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3539
|
+
headers={
|
|
3540
|
+
**auth_headers(client),
|
|
3541
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
3542
|
+
},
|
|
3543
|
+
)
|
|
3544
|
+
if response.status_code == 412:
|
|
3545
|
+
raise PreconditionFailed(
|
|
3546
|
+
response.status_code,
|
|
3547
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3548
|
+
)
|
|
3549
|
+
if response.status_code == 200:
|
|
3550
|
+
return CalendarEvent.model_validate(response.json())
|
|
3551
|
+
response.raise_for_status()
|
|
3552
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3553
|
+
|
|
3554
|
+
|
|
3555
|
+
def upsert_course(
|
|
3556
|
+
*,
|
|
3557
|
+
if_match: str | None = None,
|
|
3558
|
+
if_none_match: Literal["*"] | None = None,
|
|
3559
|
+
body: CourseCreate,
|
|
3560
|
+
client: httpx.Client | None = None,
|
|
3561
|
+
) -> Course:
|
|
3562
|
+
"""
|
|
3563
|
+
Upsert a single Course. Creates if it does not exist, update otherwise.
|
|
3564
|
+
"""
|
|
3565
|
+
client = client if client is not None else get_client()
|
|
3566
|
+
response = client.put(
|
|
3567
|
+
"/api/course",
|
|
3568
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3569
|
+
headers={
|
|
3570
|
+
**auth_headers(client),
|
|
3571
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
3572
|
+
},
|
|
3573
|
+
)
|
|
3574
|
+
if response.status_code == 412:
|
|
3575
|
+
raise PreconditionFailed(
|
|
3576
|
+
response.status_code,
|
|
3577
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3578
|
+
)
|
|
3579
|
+
if response.status_code == 200:
|
|
3580
|
+
return Course.model_validate(response.json())
|
|
3581
|
+
response.raise_for_status()
|
|
3582
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3583
|
+
|
|
3584
|
+
|
|
3585
|
+
def upsert_discipline(
|
|
3586
|
+
*,
|
|
3587
|
+
if_match: str | None = None,
|
|
3588
|
+
if_none_match: Literal["*"] | None = None,
|
|
3589
|
+
body: DisciplineCreate,
|
|
3590
|
+
client: httpx.Client | None = None,
|
|
3591
|
+
) -> Discipline:
|
|
3592
|
+
"""
|
|
3593
|
+
Upsert a single Discipline. Creates if it does not exist, update otherwise.
|
|
3594
|
+
"""
|
|
3595
|
+
client = client if client is not None else get_client()
|
|
3596
|
+
response = client.put(
|
|
3597
|
+
"/api/discipline",
|
|
3598
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3599
|
+
headers={
|
|
3600
|
+
**auth_headers(client),
|
|
3601
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
3602
|
+
},
|
|
3603
|
+
)
|
|
3604
|
+
if response.status_code == 412:
|
|
3605
|
+
raise PreconditionFailed(
|
|
3606
|
+
response.status_code,
|
|
3607
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3608
|
+
)
|
|
3609
|
+
if response.status_code == 200:
|
|
3610
|
+
return Discipline.model_validate(response.json())
|
|
3611
|
+
response.raise_for_status()
|
|
3612
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3613
|
+
|
|
3614
|
+
|
|
3615
|
+
def upsert_edition(
|
|
3616
|
+
*, body: EditionCreate, client: httpx.Client | None = None
|
|
3617
|
+
) -> Edition:
|
|
3618
|
+
"""
|
|
3619
|
+
Upsert a single Edition. Creates if it does not exist, update otherwise.
|
|
3620
|
+
"""
|
|
3621
|
+
client = client if client is not None else get_client()
|
|
3622
|
+
response = client.put(
|
|
3623
|
+
"/api/edition",
|
|
3624
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3625
|
+
headers=auth_headers(client),
|
|
3626
|
+
)
|
|
3627
|
+
if response.status_code == 200:
|
|
3628
|
+
return Edition.model_validate(response.json())
|
|
3629
|
+
response.raise_for_status()
|
|
3630
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3631
|
+
|
|
3632
|
+
|
|
3633
|
+
def upsert_exam(
|
|
3634
|
+
*,
|
|
3635
|
+
discipline: str,
|
|
3636
|
+
course: str,
|
|
3637
|
+
if_match: str | None = None,
|
|
3638
|
+
if_none_match: Literal["*"] | None = None,
|
|
3639
|
+
body: ExamCreate,
|
|
3640
|
+
client: httpx.Client | None = None,
|
|
3641
|
+
) -> Exam:
|
|
3642
|
+
"""
|
|
3643
|
+
Upsert a single Exam. Creates if it does not exist, update otherwise.
|
|
3644
|
+
"""
|
|
3645
|
+
client = client if client is not None else get_client()
|
|
3646
|
+
response = client.put(
|
|
3647
|
+
"/api/course/{discipline}/{course}/exam".format(
|
|
3648
|
+
discipline=discipline, course=course
|
|
3649
|
+
),
|
|
3650
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3651
|
+
headers={
|
|
3652
|
+
**auth_headers(client),
|
|
3653
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
3654
|
+
},
|
|
3655
|
+
)
|
|
3656
|
+
if response.status_code == 412:
|
|
3657
|
+
raise PreconditionFailed(
|
|
3658
|
+
response.status_code,
|
|
3659
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3660
|
+
)
|
|
3661
|
+
if response.status_code == 200:
|
|
3662
|
+
return Exam.model_validate(response.json())
|
|
3663
|
+
response.raise_for_status()
|
|
3664
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3665
|
+
|
|
3666
|
+
|
|
3667
|
+
def upsert_grade_column(
|
|
3668
|
+
*,
|
|
3669
|
+
discipline: str,
|
|
3670
|
+
course: str,
|
|
3671
|
+
if_match: str | None = None,
|
|
3672
|
+
if_none_match: Literal["*"] | None = None,
|
|
3673
|
+
body: GradeColumnCreate,
|
|
3674
|
+
client: httpx.Client | None = None,
|
|
3675
|
+
) -> GradeColumn:
|
|
3676
|
+
"""
|
|
3677
|
+
Upsert a single Grade Column. Creates if it does not exist, update otherwise.
|
|
3678
|
+
"""
|
|
3679
|
+
client = client if client is not None else get_client()
|
|
3680
|
+
response = client.put(
|
|
3681
|
+
"/api/course/{discipline}/{course}/grade-column".format(
|
|
3682
|
+
discipline=discipline, course=course
|
|
3683
|
+
),
|
|
3684
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3685
|
+
headers={
|
|
3686
|
+
**auth_headers(client),
|
|
3687
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
3688
|
+
},
|
|
3689
|
+
)
|
|
3690
|
+
if response.status_code == 412:
|
|
3691
|
+
raise PreconditionFailed(
|
|
3692
|
+
response.status_code,
|
|
3693
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3694
|
+
)
|
|
3695
|
+
if response.status_code == 200:
|
|
3696
|
+
return GradeColumn.model_validate(response.json())
|
|
3697
|
+
response.raise_for_status()
|
|
3698
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3699
|
+
|
|
3700
|
+
|
|
3701
|
+
def upsert_question(
|
|
3702
|
+
*,
|
|
3703
|
+
discipline: str,
|
|
3704
|
+
course: str,
|
|
3705
|
+
if_match: str | None = None,
|
|
3706
|
+
if_none_match: Literal["*"] | None = None,
|
|
3707
|
+
body: QuestionCreate,
|
|
3708
|
+
client: httpx.Client | None = None,
|
|
3709
|
+
) -> ListQuestionResponseItemsItem | ListQuestionResponseItemsItem2:
|
|
3710
|
+
"""
|
|
3711
|
+
Upsert a single Question. Creates if it does not exist, update otherwise.
|
|
3712
|
+
"""
|
|
3713
|
+
client = client if client is not None else get_client()
|
|
3714
|
+
response = client.put(
|
|
3715
|
+
"/api/course/{discipline}/{course}/question".format(
|
|
3716
|
+
discipline=discipline, course=course
|
|
3717
|
+
),
|
|
3718
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3719
|
+
headers={
|
|
3720
|
+
**auth_headers(client),
|
|
3721
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
3722
|
+
},
|
|
3723
|
+
)
|
|
3724
|
+
if response.status_code == 412:
|
|
3725
|
+
raise PreconditionFailed(
|
|
3726
|
+
response.status_code,
|
|
3727
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3728
|
+
)
|
|
3729
|
+
if response.status_code == 200:
|
|
3730
|
+
return TypeAdapter(
|
|
3731
|
+
ListQuestionResponseItemsItem | ListQuestionResponseItemsItem2
|
|
3732
|
+
).validate_python(response.json())
|
|
3733
|
+
response.raise_for_status()
|
|
3734
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3735
|
+
|
|
3736
|
+
|
|
3737
|
+
def upsert_resource(
|
|
3738
|
+
*,
|
|
3739
|
+
discipline: str,
|
|
3740
|
+
course: str,
|
|
3741
|
+
if_match: str | None = None,
|
|
3742
|
+
if_none_match: Literal["*"] | None = None,
|
|
3743
|
+
body: ResourceCreate,
|
|
3744
|
+
client: httpx.Client | None = None,
|
|
3745
|
+
) -> Resource:
|
|
3746
|
+
"""
|
|
3747
|
+
Upsert a single Resource. Creates if it does not exist, update otherwise.
|
|
3748
|
+
"""
|
|
3749
|
+
client = client if client is not None else get_client()
|
|
3750
|
+
response = client.put(
|
|
3751
|
+
"/api/course/{discipline}/{course}/resource".format(
|
|
3752
|
+
discipline=discipline, course=course
|
|
3753
|
+
),
|
|
3754
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3755
|
+
headers={
|
|
3756
|
+
**auth_headers(client),
|
|
3757
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
3758
|
+
},
|
|
3759
|
+
)
|
|
3760
|
+
if response.status_code == 412:
|
|
3761
|
+
raise PreconditionFailed(
|
|
3762
|
+
response.status_code,
|
|
3763
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3764
|
+
)
|
|
3765
|
+
if response.status_code == 200:
|
|
3766
|
+
return Resource.model_validate(response.json())
|
|
3767
|
+
response.raise_for_status()
|
|
3768
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3769
|
+
|
|
3770
|
+
|
|
3771
|
+
def upsert_timeslot(
|
|
3772
|
+
*,
|
|
3773
|
+
discipline: str,
|
|
3774
|
+
course: str,
|
|
3775
|
+
if_match: str | None = None,
|
|
3776
|
+
if_none_match: Literal["*"] | None = None,
|
|
3777
|
+
body: TimeSlotCreate,
|
|
3778
|
+
client: httpx.Client | None = None,
|
|
3779
|
+
) -> TimeSlot:
|
|
3780
|
+
"""
|
|
3781
|
+
Upsert a single TimeSlot. Creates if it does not exist, update otherwise.
|
|
3782
|
+
"""
|
|
3783
|
+
client = client if client is not None else get_client()
|
|
3784
|
+
response = client.put(
|
|
3785
|
+
"/api/course/{discipline}/{course}/time-slot".format(
|
|
3786
|
+
discipline=discipline, course=course
|
|
3787
|
+
),
|
|
3788
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3789
|
+
headers={
|
|
3790
|
+
**auth_headers(client),
|
|
3791
|
+
**header_params({"If-Match": if_match, "If-None-Match": if_none_match}),
|
|
3792
|
+
},
|
|
3793
|
+
)
|
|
3794
|
+
if response.status_code == 412:
|
|
3795
|
+
raise PreconditionFailed(
|
|
3796
|
+
response.status_code,
|
|
3797
|
+
PreconditionFailed.Payload.model_validate(response.json()),
|
|
3798
|
+
)
|
|
3799
|
+
if response.status_code == 200:
|
|
3800
|
+
return TimeSlot.model_validate(response.json())
|
|
3801
|
+
response.raise_for_status()
|
|
3802
|
+
raise CodehoodAPIError(response.status_code, Model())
|
|
3803
|
+
|
|
3804
|
+
|
|
3805
|
+
def upsert_user(*, body: UserCreate, client: httpx.Client | None = None) -> User:
|
|
3806
|
+
"""
|
|
3807
|
+
Upsert a single User. Creates if it does not exist, update otherwise.
|
|
3808
|
+
"""
|
|
3809
|
+
client = client if client is not None else get_client()
|
|
3810
|
+
response = client.put(
|
|
3811
|
+
"/api/user",
|
|
3812
|
+
json=body.model_dump(mode="json", by_alias=True),
|
|
3813
|
+
headers=auth_headers(client),
|
|
3814
|
+
)
|
|
3815
|
+
if response.status_code == 200:
|
|
3816
|
+
return User.model_validate(response.json())
|
|
3817
|
+
response.raise_for_status()
|
|
3818
|
+
raise CodehoodAPIError(response.status_code, Model())
|