@falkenslab/moodle-driver 0.5.0 → 0.5.1
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.
- package/dist/areas/quizzes/structure.d.ts +2 -2
- package/dist/areas/quizzes/structure.js.map +1 -1
- package/dist/client.d.ts +6 -179
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/moodle-methods.generated.d.ts +1127 -0
- package/dist/moodle-methods.generated.js +4 -0
- package/dist/moodle-methods.generated.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The methods a `Moodle` has from the driver's functions: each is the function of the same name
|
|
3
|
+
* without its first two parameters (the browser context and the site), and its doc comment.
|
|
4
|
+
*/
|
|
5
|
+
export interface MoodleMethods {
|
|
6
|
+
/**
|
|
7
|
+
* Moodle 5's activities overview of a course for one type ("resource" for every resource type):
|
|
8
|
+
* per activity, the columns its overview page shows the person (due dates, submissions, what needs
|
|
9
|
+
* grading, their own grade…). Without a type, every type in the course's state: "resource" first,
|
|
10
|
+
* which brings pages, books, files, folders and links at once, then each type still missing.
|
|
11
|
+
*/
|
|
12
|
+
activitiesOverview(courseId: number, type?: string): Promise<{
|
|
13
|
+
fields: import("./areas/courses/overview.js").OverviewField[];
|
|
14
|
+
available?: boolean | undefined;
|
|
15
|
+
visible: boolean;
|
|
16
|
+
url?: string | undefined;
|
|
17
|
+
id: number;
|
|
18
|
+
name: string;
|
|
19
|
+
type: string;
|
|
20
|
+
}[]>;
|
|
21
|
+
/**
|
|
22
|
+
* A course's activity report: per activity, how many times it was viewed, by how many people, and
|
|
23
|
+
* when last, from the logs (between `from` and `until` when given). Activities nobody viewed come with
|
|
24
|
+
* zero views.
|
|
25
|
+
*/
|
|
26
|
+
activityReport(courseId: number, options?: {
|
|
27
|
+
from?: Date | undefined;
|
|
28
|
+
until?: Date | undefined;
|
|
29
|
+
}): Promise<import("./areas/reports/reports.js").ActivityViews[]>;
|
|
30
|
+
/**
|
|
31
|
+
* An activity's settings as its form holds them, without submitting it: its module, name and
|
|
32
|
+
* description, every field by the name `updateActivity` takes in `settings`, the files of a
|
|
33
|
+
* resource, folder or SCORM, and its restrictions and completion in plain terms. Teachers only.
|
|
34
|
+
*/
|
|
35
|
+
activitySettings(activityId: number): Promise<{
|
|
36
|
+
id: number;
|
|
37
|
+
module: string;
|
|
38
|
+
courseId: number;
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
fields: import("./areas/activities/build.js").FormField[];
|
|
42
|
+
files: import("./core/forms.js").DraftFile[] | undefined;
|
|
43
|
+
restrictions: import("./areas/activities/conditions.js").Restrictions | undefined;
|
|
44
|
+
completion: import("./areas/activities/conditions.js").Completion | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
/** Adds a grade category (at the course's top level, or inside `parentId`); returns it as the setup shows it. */
|
|
47
|
+
addGradeCategory(courseId: number, options: {
|
|
48
|
+
name: string;
|
|
49
|
+
aggregation?: "mean" | "median" | "lowest" | "highest" | "mode" | "weighted-mean" | "simple-weighted-mean" | "mean-with-extra-credits" | "natural" | undefined;
|
|
50
|
+
parentId?: number | undefined;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
changed: string;
|
|
53
|
+
category?: import("./areas/grades/gradebook.js").GradebookCategory | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Adds a manual grade item (one graded in the gradebook, not by an activity): out of `maxGrade`
|
|
57
|
+
* (Moodle's default, 100, when left out) or on a scale (`scaleId`), at the course's top level or in
|
|
58
|
+
* `categoryId`, hidden from students when asked. Returns it as the setup shows it.
|
|
59
|
+
*/
|
|
60
|
+
addGradeItem(courseId: number, options: {
|
|
61
|
+
name: string;
|
|
62
|
+
maxGrade?: number | undefined;
|
|
63
|
+
scaleId?: number | undefined;
|
|
64
|
+
categoryId?: number | undefined;
|
|
65
|
+
hidden?: boolean | undefined;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
changed: string;
|
|
68
|
+
item?: import("./areas/grades/gradebook.js").GradebookItem | undefined;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Adds bank questions to a quiz by id, and random questions from a bank category, at the end or on a
|
|
72
|
+
* page, as the edit page's bank actions post them. Returns the quiz's structure afterwards. A quiz
|
|
73
|
+
* already attempted can't change its questions: Moodle refuses, and so does this.
|
|
74
|
+
*/
|
|
75
|
+
addQuestionsToQuiz(activityId: number, options: {
|
|
76
|
+
questionIds?: number[] | undefined;
|
|
77
|
+
random?: {
|
|
78
|
+
categoryId: number;
|
|
79
|
+
count: number;
|
|
80
|
+
includeSubcategories?: boolean | undefined;
|
|
81
|
+
} | undefined;
|
|
82
|
+
page?: number | undefined;
|
|
83
|
+
}): Promise<import("./areas/quizzes/structure.js").QuizChange>;
|
|
84
|
+
/**
|
|
85
|
+
* Adds a section to a quiz starting at a slot, with its heading and whether its questions are
|
|
86
|
+
* shuffled, as the edit page's "Add a new section heading" and its heading and shuffle controls do.
|
|
87
|
+
* A section starts at a page: the slot must be the first of its page (see `setQuizPages`).
|
|
88
|
+
*/
|
|
89
|
+
addQuizSection(activityId: number, options: {
|
|
90
|
+
firstSlot: number;
|
|
91
|
+
heading: string;
|
|
92
|
+
shuffle?: boolean | undefined;
|
|
93
|
+
}): Promise<import("./areas/quizzes/structure.js").QuizChange & {
|
|
94
|
+
sectionId: number;
|
|
95
|
+
}>;
|
|
96
|
+
/** Adds a section after another one (at the end without it), named when a name is given, with a description (HTML) when `summary` is. */
|
|
97
|
+
addSection(courseId: number, options?: {
|
|
98
|
+
name?: string | undefined;
|
|
99
|
+
afterSectionId?: number | undefined;
|
|
100
|
+
summary?: string | undefined;
|
|
101
|
+
}): Promise<import("./areas/activities/build.js").CourseChange>;
|
|
102
|
+
/**
|
|
103
|
+
* Allocates a marker (the user id of someone who can grade; several where the assignment uses
|
|
104
|
+
* several markers per submission) to participants' submissions, as the grading table's "Allocate
|
|
105
|
+
* marker" does. Moodle leaves alone submissions past marking (marking completed, in review, ready
|
|
106
|
+
* for release, released).
|
|
107
|
+
*/
|
|
108
|
+
allocateMarker(activityId: number, userIds: number[], markerId: number | number[]): Promise<{
|
|
109
|
+
changed: string;
|
|
110
|
+
}>;
|
|
111
|
+
/** Answers a choice with one option (several where it allows them) by id, as "Save my choice" does; returns the choice afterwards. */
|
|
112
|
+
answerChoice(activityId: number, optionIds: number[]): Promise<{
|
|
113
|
+
changed: string;
|
|
114
|
+
choice: import("./areas/surveys/choice.js").Choice;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Assesses a submission as the person, through the workshop's assessment form (its grading
|
|
118
|
+
* strategy's: accumulative, comments, number of errors or rubric), as "Assess" on the submission's
|
|
119
|
+
* page and the form do: a teacher who hasn't assessed it yet gets an assessment of their own, and one
|
|
120
|
+
* already made is changed. `criteria` go in the form's order; `feedback` is the overall feedback for
|
|
121
|
+
* the author (HTML), where the workshop has it on; `fields` sets any other field of the form by name
|
|
122
|
+
* (`weight`…). Returns a sentence of what changed, the assessment's id, and the grade it gives the
|
|
123
|
+
* submission out of the workshop's grade. Throws `WorkshopError` outside the assessment phase, when a
|
|
124
|
+
* criterion's grade isn't one it takes, or when the workshop has no overall feedback; `FormError` when
|
|
125
|
+
* Moodle refuses the form (a criterion left without a grade).
|
|
126
|
+
*/
|
|
127
|
+
assessWorkshopSubmission(activityId: number, submissionId: number, options: {
|
|
128
|
+
criteria?: import("./areas/workshops/workshops.js").WorkshopCriterion[] | undefined;
|
|
129
|
+
feedback?: string | undefined;
|
|
130
|
+
fields?: Record<string, import("./core/forms.js").FieldValue> | undefined;
|
|
131
|
+
}): Promise<{
|
|
132
|
+
changed: string;
|
|
133
|
+
assessmentId: number;
|
|
134
|
+
grade?: number | undefined;
|
|
135
|
+
maxGrade?: number | undefined;
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* Every participant's submission to an assignment, with the group they submit for (group
|
|
139
|
+
* submissions), and, unless `includeContent` is false, its content, the feedback files they have,
|
|
140
|
+
* its marking workflow state and markers (all from each participant's grading panel).
|
|
141
|
+
*/
|
|
142
|
+
assignmentSubmissions(activityId: number, options?: {
|
|
143
|
+
includeContent?: boolean | undefined;
|
|
144
|
+
}): Promise<import("./areas/assignments/grading.js").Submission[]>;
|
|
145
|
+
/**
|
|
146
|
+
* Backs a course up to a `.mbz` file, through Moodle's backup wizard (initial settings, schema,
|
|
147
|
+
* confirmation), and downloads it into `destDir`. Without users' data unless `withUsers`, which
|
|
148
|
+
* needs `moodle/backup:userinfo` (`anonymize` makes their names anonymous). An asynchronous backup
|
|
149
|
+
* is waited for up to `timeoutMs` (ten minutes). Moodle keeps the file in the course's or the
|
|
150
|
+
* person's backup area too.
|
|
151
|
+
*/
|
|
152
|
+
backupCourse(courseId: number, destDir: string, options?: {
|
|
153
|
+
withUsers?: boolean | undefined;
|
|
154
|
+
anonymize?: boolean | undefined;
|
|
155
|
+
timeoutMs?: number | undefined;
|
|
156
|
+
}): Promise<{
|
|
157
|
+
changed: string;
|
|
158
|
+
file: import("./core/files.js").DownloadedFile;
|
|
159
|
+
}>;
|
|
160
|
+
/** One calendar event by its id, as `upcomingEvents` gives them. */
|
|
161
|
+
calendarEvent(eventId: number): Promise<import("./areas/calendar/calendar.js").CalendarEvent>;
|
|
162
|
+
/**
|
|
163
|
+
* A course's progress report: every participant's completion of every activity that tracks it, page
|
|
164
|
+
* by page, in one group when given. People come as user id and full name only.
|
|
165
|
+
*/
|
|
166
|
+
completionReport(courseId: number, options?: {
|
|
167
|
+
group?: number | undefined;
|
|
168
|
+
}): Promise<import("./areas/completion/completion.js").CompletionReport>;
|
|
169
|
+
/**
|
|
170
|
+
* A conversation's messages, oldest first, as text, and its members as `conversations()` gives them:
|
|
171
|
+
* everyone but the person, whether they wrote in it or not (the person alone in their own conversation).
|
|
172
|
+
*/
|
|
173
|
+
conversation(conversationId: number): Promise<{
|
|
174
|
+
id: number;
|
|
175
|
+
members: {
|
|
176
|
+
userId: number;
|
|
177
|
+
fullName: string;
|
|
178
|
+
}[];
|
|
179
|
+
messages: {
|
|
180
|
+
id: number;
|
|
181
|
+
fromUserId: number;
|
|
182
|
+
text: string;
|
|
183
|
+
time: string | undefined;
|
|
184
|
+
}[];
|
|
185
|
+
}>;
|
|
186
|
+
/** The person's conversations, latest first, with their last message as text. */
|
|
187
|
+
conversations(): Promise<import("./areas/messages/messages.js").ConversationSummary[]>;
|
|
188
|
+
/**
|
|
189
|
+
* Copies a course into a new one, as Moodle's "Copy course" does: its content (and its people's
|
|
190
|
+
* data and enrolments, `withUsers`), under a new full and short name, in a category (the course's
|
|
191
|
+
* unless given), with new dates. Goes through Moodle's copy service, then waits for the copy, which
|
|
192
|
+
* Moodle makes in its scheduled tasks, up to `timeoutMs` (ten minutes). Needs the rights to back
|
|
193
|
+
* up, restore and create courses (`moodle/backup:backupcourse`, `moodle/restore:restorecourse`,
|
|
194
|
+
* `moodle/course:create`); without them, `BackupError` says so.
|
|
195
|
+
*/
|
|
196
|
+
copyCourse(courseId: number, options: {
|
|
197
|
+
fullName: string;
|
|
198
|
+
shortName: string;
|
|
199
|
+
categoryId?: number | undefined;
|
|
200
|
+
start?: Date | undefined;
|
|
201
|
+
end?: Date | undefined;
|
|
202
|
+
withUsers?: boolean | undefined;
|
|
203
|
+
visible?: boolean | undefined;
|
|
204
|
+
timeoutMs?: number | undefined;
|
|
205
|
+
}): Promise<{
|
|
206
|
+
changed: string;
|
|
207
|
+
course: import("./areas/backup/backup.js").CourseRef;
|
|
208
|
+
}>;
|
|
209
|
+
/**
|
|
210
|
+
* What the person can do in a course, asked of read-only services that need the capability: the
|
|
211
|
+
* activity types they can add (none without `moodle/course:manageactivities`) and the grader
|
|
212
|
+
* report's users (`nopermissions` without `gradereport/grader:view`). Nothing is changed.
|
|
213
|
+
*/
|
|
214
|
+
courseAbilities(courseId: number, sectionId: number): Promise<{
|
|
215
|
+
canEdit: boolean;
|
|
216
|
+
canGrade: boolean;
|
|
217
|
+
}>;
|
|
218
|
+
/** The activity and resource types the person can add to a course: none when they can't edit it. */
|
|
219
|
+
courseActivityTypes(courseId: number): Promise<{
|
|
220
|
+
purpose?: string | undefined;
|
|
221
|
+
type: string;
|
|
222
|
+
title: string;
|
|
223
|
+
}[]>;
|
|
224
|
+
/**
|
|
225
|
+
* A course's logs, newest first, as its logs report lists them: by a user, an activity, a kind of
|
|
226
|
+
* action, and a time span, up to `limit` entries (100 unless given). Moodle filters by user, activity
|
|
227
|
+
* and action; the span is read page by page, stopping at the first entry older than `from`. Every
|
|
228
|
+
* entry's time comes as an ISO date, read back with the site language's own format.
|
|
229
|
+
*/
|
|
230
|
+
courseLogs(courseId: number, options?: {
|
|
231
|
+
userId?: number | undefined;
|
|
232
|
+
activityId?: number | undefined;
|
|
233
|
+
from?: Date | undefined;
|
|
234
|
+
until?: Date | undefined;
|
|
235
|
+
action?: "create" | "view" | "update" | "delete" | "change" | undefined;
|
|
236
|
+
limit?: number | undefined;
|
|
237
|
+
}): Promise<import("./areas/reports/reports.js").LogEntry[]>;
|
|
238
|
+
/** A user's roles in a course, from their profile there: role links carry the role id in any language. */
|
|
239
|
+
courseRoles(userId: number, courseId: number): Promise<{
|
|
240
|
+
id: number;
|
|
241
|
+
name: string;
|
|
242
|
+
}[]>;
|
|
243
|
+
/**
|
|
244
|
+
* A course's sections and activities; with `details`, each activity's dates and restriction and each
|
|
245
|
+
* section's description, from the course page (slower).
|
|
246
|
+
*/
|
|
247
|
+
courseStructure(courseId: number, options?: {
|
|
248
|
+
details?: boolean | undefined;
|
|
249
|
+
}): Promise<import("./areas/courses/structure.js").CourseSection[]>;
|
|
250
|
+
/** What changed in a course's activities since a date, with their names from the course's state. */
|
|
251
|
+
courseUpdates(courseId: number, since: Date): Promise<{
|
|
252
|
+
changes: {
|
|
253
|
+
items?: number | undefined;
|
|
254
|
+
time?: string | undefined;
|
|
255
|
+
what: string;
|
|
256
|
+
}[];
|
|
257
|
+
name?: string | undefined;
|
|
258
|
+
type?: string | undefined;
|
|
259
|
+
id: number;
|
|
260
|
+
}[]>;
|
|
261
|
+
/**
|
|
262
|
+
* Creates an activity or resource of any type at the end of a section, through Moodle's own form,
|
|
263
|
+
* hidden from students unless `visibility` says otherwise. `files` are local paths uploaded to a file
|
|
264
|
+
* resource or folder (a `DraftUpload` puts one in a folder's subfolder); a SCORM (`type: "scorm"`) or
|
|
265
|
+
* an H5P activity (`type: "h5pactivity"`) takes the first as its package.
|
|
266
|
+
*/
|
|
267
|
+
createActivity(input: import("./areas/activities/build.js").ActivityFields & {
|
|
268
|
+
courseId: number;
|
|
269
|
+
sectionId: number;
|
|
270
|
+
type: string;
|
|
271
|
+
files?: (string | import("./core/forms.js").DraftUpload)[] | undefined;
|
|
272
|
+
}): Promise<import("./areas/activities/build.js").CourseChange>;
|
|
273
|
+
/**
|
|
274
|
+
* Creates a course event, through the calendar's own form: its start, and its duration and
|
|
275
|
+
* description when given. Returns it as the calendar has it.
|
|
276
|
+
*/
|
|
277
|
+
createEvent(options: {
|
|
278
|
+
courseId: number;
|
|
279
|
+
name: string;
|
|
280
|
+
start: Date;
|
|
281
|
+
durationMinutes?: number | undefined;
|
|
282
|
+
description?: string | undefined;
|
|
283
|
+
}): Promise<{
|
|
284
|
+
changed: string;
|
|
285
|
+
event: import("./areas/calendar/calendar.js").CalendarEvent;
|
|
286
|
+
}>;
|
|
287
|
+
/**
|
|
288
|
+
* Creates a group in a course with its group form (`group/group.php`). Throws `FormError` with
|
|
289
|
+
* Moodle's reason when it refuses (a name already used, an enrolment key another group has).
|
|
290
|
+
*/
|
|
291
|
+
createGroup(courseId: number, settings: import("./areas/participants/groups.js").GroupSettings & {
|
|
292
|
+
name: string;
|
|
293
|
+
}): Promise<{
|
|
294
|
+
changed: string;
|
|
295
|
+
groupId: number;
|
|
296
|
+
}>;
|
|
297
|
+
/** Creates a grouping in a course with its form (`group/grouping.php`); add its groups with `setGroupingGroups`. */
|
|
298
|
+
createGrouping(courseId: number, settings: import("./areas/participants/groups.js").GroupingSettings & {
|
|
299
|
+
name: string;
|
|
300
|
+
}): Promise<{
|
|
301
|
+
changed: string;
|
|
302
|
+
groupingId: number;
|
|
303
|
+
}>;
|
|
304
|
+
/**
|
|
305
|
+
* Creates one question in a bank through its type's edit form; returns its id. Imports are the way
|
|
306
|
+
* for several; this is for one-offs.
|
|
307
|
+
*/
|
|
308
|
+
createQuestion(activityId: number, input: import("./areas/questions/banks.js").QuestionInput): Promise<{
|
|
309
|
+
changed: string;
|
|
310
|
+
questionId?: number | undefined;
|
|
311
|
+
}>;
|
|
312
|
+
/**
|
|
313
|
+
* What the person has to do by a date (calendar action events: submit, attempt, grade…), from the
|
|
314
|
+
* last `pastDays` to `days` ahead, in one course or all. Teachers' grading counts come from the
|
|
315
|
+
* activities overview instead: Moodle gives them few action events.
|
|
316
|
+
*/
|
|
317
|
+
deadlines(options?: {
|
|
318
|
+
courseId?: number | undefined;
|
|
319
|
+
days?: number | undefined;
|
|
320
|
+
pastDays?: number | undefined;
|
|
321
|
+
}): Promise<{
|
|
322
|
+
action?: {
|
|
323
|
+
url?: string | undefined;
|
|
324
|
+
count?: number | undefined;
|
|
325
|
+
name: string;
|
|
326
|
+
actionable: boolean;
|
|
327
|
+
} | undefined;
|
|
328
|
+
course?: {
|
|
329
|
+
shortname?: string | undefined;
|
|
330
|
+
id: number;
|
|
331
|
+
} | undefined;
|
|
332
|
+
event: string;
|
|
333
|
+
kind: string;
|
|
334
|
+
date: string;
|
|
335
|
+
overdue: boolean;
|
|
336
|
+
type?: string | undefined;
|
|
337
|
+
activity: string;
|
|
338
|
+
activityId?: number | undefined;
|
|
339
|
+
}[]>;
|
|
340
|
+
/** Deletes an activity, with its participants' data (submissions, posts, attempts); gives the course afterwards. */
|
|
341
|
+
deleteActivity(courseId: number, activityId: number): Promise<import("./areas/activities/build.js").CourseChange>;
|
|
342
|
+
/** Deletes a calendar event the person can manage. */
|
|
343
|
+
deleteEvent(eventId: number): Promise<{
|
|
344
|
+
changed: string;
|
|
345
|
+
}>;
|
|
346
|
+
/**
|
|
347
|
+
* Deletes a grade category. Moodle moves what it held (items and categories) into its parent and
|
|
348
|
+
* deletes the grades of its total; the course's own category can't be deleted.
|
|
349
|
+
*/
|
|
350
|
+
deleteGradeCategory(courseId: number, categoryId: number): Promise<{
|
|
351
|
+
changed: string;
|
|
352
|
+
}>;
|
|
353
|
+
/**
|
|
354
|
+
* Deletes a manual grade item and its grades. An activity's item goes with its activity (Moodle
|
|
355
|
+
* would make it again), so it's refused.
|
|
356
|
+
*/
|
|
357
|
+
deleteGradeItem(courseId: number, itemId: number): Promise<{
|
|
358
|
+
changed: string;
|
|
359
|
+
}>;
|
|
360
|
+
/** Deletes a group, as the groups page's "Delete selected group" does once confirmed; its members stay in the course. */
|
|
361
|
+
deleteGroup(groupId: number): Promise<{
|
|
362
|
+
changed: string;
|
|
363
|
+
}>;
|
|
364
|
+
/** Deletes a grouping, as its delete icon does once confirmed; its groups stay. */
|
|
365
|
+
deleteGrouping(groupingId: number): Promise<{
|
|
366
|
+
changed: string;
|
|
367
|
+
}>;
|
|
368
|
+
/**
|
|
369
|
+
* Deletes a post and its replies through Moodle's own confirmation (`post.php?delete=`); a
|
|
370
|
+
* discussion's first post takes the whole discussion. Only a moderator deletes a post with replies,
|
|
371
|
+
* or someone else's. `replies` says how many replies went with it. Throws `ForumError` with
|
|
372
|
+
* Moodle's reason when it refuses.
|
|
373
|
+
*/
|
|
374
|
+
deletePost(postId: number): Promise<{
|
|
375
|
+
changed: string;
|
|
376
|
+
discussionId?: number | undefined;
|
|
377
|
+
replies: number;
|
|
378
|
+
discussionDeleted: boolean;
|
|
379
|
+
}>;
|
|
380
|
+
/**
|
|
381
|
+
* Deletes questions from a bank, every version of each, as the bank's delete action does: asked,
|
|
382
|
+
* then confirmed. Moodle doesn't delete a question a quiz uses: it hides it, and `hidden` lists those.
|
|
383
|
+
*/
|
|
384
|
+
deleteQuestions(activityId: number, questionIds: number[]): Promise<{
|
|
385
|
+
changed: string;
|
|
386
|
+
deleted: number[];
|
|
387
|
+
hidden: number[];
|
|
388
|
+
}>;
|
|
389
|
+
/** Deletes a section and every activity in it, with their participants' data. */
|
|
390
|
+
deleteSection(courseId: number, sectionId: number): Promise<import("./areas/activities/build.js").CourseChange>;
|
|
391
|
+
/** A discussion's posts, oldest first, with their messages as text. */
|
|
392
|
+
discussion(discussionId: number): Promise<{
|
|
393
|
+
discussion: {
|
|
394
|
+
id: number;
|
|
395
|
+
forumInstanceId: number;
|
|
396
|
+
courseId: number;
|
|
397
|
+
};
|
|
398
|
+
posts: import("./areas/forums/posts.js").ForumPost[];
|
|
399
|
+
}>;
|
|
400
|
+
/** Duplicates an activity as the course page's "Duplicate" does (right after it, named with "(copy)"); gives the copy's id and the course afterwards. */
|
|
401
|
+
duplicateActivity(courseId: number, activityId: number): Promise<import("./areas/activities/build.js").CourseChange>;
|
|
402
|
+
/** Renames, shows or hides, or moves an activity (to a section's end, or before another one). */
|
|
403
|
+
editActivity(courseId: number, activityId: number, options: {
|
|
404
|
+
name?: string | undefined;
|
|
405
|
+
visibility?: "shown" | "hidden" | "stealth" | undefined;
|
|
406
|
+
sectionId?: number | undefined;
|
|
407
|
+
beforeActivityId?: number | undefined;
|
|
408
|
+
}): Promise<import("./areas/activities/build.js").CourseChange>;
|
|
409
|
+
/**
|
|
410
|
+
* Changes a post through Moodle's own post form (`post.php?edit=`), as its author (within the site's
|
|
411
|
+
* editing time) or a moderator: only what's given changes. Returns the post afterwards. Throws
|
|
412
|
+
* `ForumError` with Moodle's reason when it refuses.
|
|
413
|
+
*/
|
|
414
|
+
editPost(postId: number, changes: import("./areas/forums/posts.js").PostChanges): Promise<{
|
|
415
|
+
changed: string;
|
|
416
|
+
post?: import("./areas/forums/posts.js").ForumPost | undefined;
|
|
417
|
+
}>;
|
|
418
|
+
/**
|
|
419
|
+
* Changes one slot of a quiz (by its place, from 1): its maximum mark, through the slots' service,
|
|
420
|
+
* and where it is, as dragging it on the edit page does: after another slot (`moveAfter`, 0 for
|
|
421
|
+
* first) and on a page. Moodle lets the mark change after attempts (it regrades them), not the rest.
|
|
422
|
+
*/
|
|
423
|
+
editQuizSlot(activityId: number, slot: number, options: {
|
|
424
|
+
maxMark?: number | undefined;
|
|
425
|
+
moveAfter?: number | undefined;
|
|
426
|
+
page?: number | undefined;
|
|
427
|
+
}): Promise<import("./areas/quizzes/structure.js").QuizChange>;
|
|
428
|
+
/**
|
|
429
|
+
* Renames, shows or hides, describes (`summary`, HTML), restricts (`restrictions`; `{ conditions: [] }`
|
|
430
|
+
* removes them) or moves a section after another one.
|
|
431
|
+
*/
|
|
432
|
+
editSection(courseId: number, sectionId: number, options: {
|
|
433
|
+
name?: string | undefined;
|
|
434
|
+
visible?: boolean | undefined;
|
|
435
|
+
summary?: string | undefined;
|
|
436
|
+
restrictions?: import("./areas/activities/conditions.js").Restrictions | undefined;
|
|
437
|
+
afterSectionId?: number | undefined;
|
|
438
|
+
}): Promise<import("./areas/activities/build.js").CourseChange>;
|
|
439
|
+
/**
|
|
440
|
+
* Enrols users in a course by manual enrolment, as the participants page's "Enrol users" dialog does:
|
|
441
|
+
* with `roleId` or the enrolment's default role, from `start` (now, unless given) until `end` (the
|
|
442
|
+
* enrolment's default duration, unless given). Users already enrolled keep their enrolment, with the
|
|
443
|
+
* new dates. Throws `EnrolmentError` with Moodle's reason when it refuses (a role the person can't
|
|
444
|
+
* assign, no manual enrolment).
|
|
445
|
+
*/
|
|
446
|
+
enrolUsers(courseId: number, userIds: number[], options?: {
|
|
447
|
+
roleId?: number | undefined;
|
|
448
|
+
start?: Date | undefined;
|
|
449
|
+
end?: Date | undefined;
|
|
450
|
+
}): Promise<{
|
|
451
|
+
changed: string;
|
|
452
|
+
count: number;
|
|
453
|
+
roleId?: number | undefined;
|
|
454
|
+
}>;
|
|
455
|
+
/**
|
|
456
|
+
* A course's enrolment methods, in the order Moodle tries them: each one's type, name, whether it's
|
|
457
|
+
* enabled and how many users it enrolled, and from its form the role it gives and, for self enrolment
|
|
458
|
+
* and guest access, whether it asks for a key (never the key), self enrolment's dates and limit.
|
|
459
|
+
* Throws `EnrolmentError` when the person can't manage the course's enrolment methods.
|
|
460
|
+
*/
|
|
461
|
+
enrolmentMethods(courseId: number): Promise<import("./areas/participants/methods.js").EnrolmentMethod[]>;
|
|
462
|
+
/** Submits an attempt for grading, and gives its review when the quiz shows it. */
|
|
463
|
+
finishQuizAttempt(attemptId: number): Promise<{
|
|
464
|
+
changed: string;
|
|
465
|
+
attemptId: number;
|
|
466
|
+
finished: true;
|
|
467
|
+
review: {
|
|
468
|
+
summary: import("./areas/quizzes/attempts.js").Detail[];
|
|
469
|
+
questions: import("./areas/quizzes/attempts.js").Question[];
|
|
470
|
+
} | undefined;
|
|
471
|
+
}>;
|
|
472
|
+
/** A forum's discussions, as its page lists them: who started each, replies, last post. */
|
|
473
|
+
forumDiscussions(activityId: number): Promise<import("./areas/forums/posts.js").ForumDiscussion[]>;
|
|
474
|
+
/**
|
|
475
|
+
* Everyone's whole-forum grade in a forum graded as a whole, as its grader shows them: one per
|
|
476
|
+
* person it can grade (only the active ones when the forum says so), with how it's graded. One
|
|
477
|
+
* service call per person. Throws `NotAForumError` for another activity, and `GradingError` when
|
|
478
|
+
* the forum isn't graded as a whole or uses an advanced grading method.
|
|
479
|
+
*/
|
|
480
|
+
forumGrades(activityId: number, options?: {
|
|
481
|
+
groupId?: number | undefined;
|
|
482
|
+
}): Promise<import("./areas/forums/grading.js").ForumGrades>;
|
|
483
|
+
/** A choice: its options, whether it can be answered or changed, and the person's answer. */
|
|
484
|
+
getChoice(activityId: number): Promise<import("./areas/surveys/choice.js").Choice>;
|
|
485
|
+
/** A survey (questionnaire or feedback): whether it can be answered, its intro and messages, and its questions page by page. Its module is found when not given. */
|
|
486
|
+
getSurvey(activityId: number, type?: import("./areas/surveys/surveys.js").SurveyType): Promise<{
|
|
487
|
+
questions: import("./areas/surveys/surveys.js").SurveyQuestion[];
|
|
488
|
+
canAnswer: boolean;
|
|
489
|
+
intro: string;
|
|
490
|
+
messages: string[];
|
|
491
|
+
}>;
|
|
492
|
+
/**
|
|
493
|
+
* Gives a person their whole-forum grade, as the forum's grader does: points (out of the forum's
|
|
494
|
+
* maximum), or a scale item by name or value; `null` takes the grade away. Moodle's forum grader
|
|
495
|
+
* has no feedback text. `notify` sends the person Moodle's notification, as the grader's checkbox
|
|
496
|
+
* does. Returns a sentence of what changed and the grade afterwards. Throws `GradingError` when the
|
|
497
|
+
* forum isn't graded as a whole, the grade is out of range or not on the scale, or Moodle refuses it.
|
|
498
|
+
*/
|
|
499
|
+
gradeForumUser(activityId: number, userId: number, options: {
|
|
500
|
+
grade: string | number | null;
|
|
501
|
+
notify?: boolean | undefined;
|
|
502
|
+
}): Promise<{
|
|
503
|
+
changed: string;
|
|
504
|
+
grade: Omit<import("./areas/forums/grading.js").ForumGrade, "fullName">;
|
|
505
|
+
}>;
|
|
506
|
+
/**
|
|
507
|
+
* Grades one question of a finished attempt by hand, with a comment, through Moodle's comment form
|
|
508
|
+
* (the review's "Make comment or override mark"): an essay waiting for grading, or any question whose
|
|
509
|
+
* mark the teacher overrides. The mark is in the question's points (0 to its maximum in the quiz).
|
|
510
|
+
* Returns the attempt's grade afterwards when the results report shows it.
|
|
511
|
+
*/
|
|
512
|
+
gradeQuizQuestion(attemptId: number, slot: number, options: {
|
|
513
|
+
mark: number;
|
|
514
|
+
comment?: string | undefined;
|
|
515
|
+
}): Promise<{
|
|
516
|
+
changed: string;
|
|
517
|
+
attemptId: number;
|
|
518
|
+
slot: number;
|
|
519
|
+
mark: number;
|
|
520
|
+
maxMark?: number | undefined;
|
|
521
|
+
grade?: string | undefined;
|
|
522
|
+
}>;
|
|
523
|
+
/**
|
|
524
|
+
* Grades a participant as the grader does: a grade (simple grading), a rubric's level per criterion
|
|
525
|
+
* or a marking guide's score per criterion (by their ids, from `rubric()`), remarks per criterion,
|
|
526
|
+
* feedback comments (HTML), feedback files (local paths that replace the ones the participant has;
|
|
527
|
+
* `[]` removes them), whether to notify, and any other grading field by name. Returns the grade
|
|
528
|
+
* saved and the gradebook's grade, the total Moodle computes for a rubric or a guide, and the
|
|
529
|
+
* feedback files after saving when they were given. Throws `GradingError` when Moodle refuses the
|
|
530
|
+
* grade, or when files are given to an assignment without feedback files.
|
|
531
|
+
*/
|
|
532
|
+
gradeSubmission(activityId: number, userId: number, options: {
|
|
533
|
+
grade?: string | number | undefined;
|
|
534
|
+
rubric?: Record<number, number> | undefined;
|
|
535
|
+
guide?: Record<number, number> | undefined;
|
|
536
|
+
remarks?: Record<number, string> | undefined;
|
|
537
|
+
feedback?: string | undefined;
|
|
538
|
+
feedbackFiles?: string[] | undefined;
|
|
539
|
+
workflowState?: "notmarked" | "inmarking" | "readyforreview" | "inreview" | "readyforrelease" | "released" | undefined;
|
|
540
|
+
applyToGroup?: boolean | undefined;
|
|
541
|
+
notify?: boolean | undefined;
|
|
542
|
+
fields?: Record<string, import("./core/forms.js").FieldValue> | undefined;
|
|
543
|
+
}): Promise<{
|
|
544
|
+
workflowState?: "notmarked" | "inmarking" | "readyforreview" | "inreview" | "readyforrelease" | "released" | undefined;
|
|
545
|
+
feedbackFiles?: {
|
|
546
|
+
name: string;
|
|
547
|
+
url: string;
|
|
548
|
+
}[] | undefined;
|
|
549
|
+
grade?: string | undefined;
|
|
550
|
+
gradebookGrade?: string | undefined;
|
|
551
|
+
feedback?: string | undefined;
|
|
552
|
+
changed: string;
|
|
553
|
+
}>;
|
|
554
|
+
/** A course's gradebook setup: its categories (aggregation, weights) and grade items (category, maximum, weight). */
|
|
555
|
+
gradebookSetup(courseId: number): Promise<{
|
|
556
|
+
categories: import("./areas/grades/gradebook.js").GradebookCategory[];
|
|
557
|
+
items: import("./areas/grades/gradebook.js").GradebookItem[];
|
|
558
|
+
}>;
|
|
559
|
+
/**
|
|
560
|
+
* Everyone's grades in a course as the grader report shows them, page by page, in one group when
|
|
561
|
+
* given. People come as user id and full name only.
|
|
562
|
+
*/
|
|
563
|
+
graderReport(courseId: number, options?: {
|
|
564
|
+
group?: number | undefined;
|
|
565
|
+
}): Promise<import("./areas/grades/gradebook.js").GraderReport>;
|
|
566
|
+
/**
|
|
567
|
+
* Grants participants an extension until a date, through the assignment's extension form (several at
|
|
568
|
+
* once as its bulk action does). Moodle refuses a date before the assignment's due date, and a person
|
|
569
|
+
* without its "grant extension" capability only on saving (the form opens for anyone, confirmed
|
|
570
|
+
* empirically on the sandbox, 5.2): both throw.
|
|
571
|
+
*/
|
|
572
|
+
grantExtension(activityId: number, userIds: number[], until: Date): Promise<{
|
|
573
|
+
changed: string;
|
|
574
|
+
}>;
|
|
575
|
+
/** A course's groupings with their groups' ids, from its groupings page and each grouping's groups page. Throws `MoodleError` with Moodle's refusal for a person who can't manage groups. */
|
|
576
|
+
groupings(courseId: number): Promise<import("./areas/participants/groups.js").Grouping[]>;
|
|
577
|
+
/** A course's groups the person can see, with their members' user ids. */
|
|
578
|
+
groups(courseId: number): Promise<import("./areas/participants/participants.js").CourseGroup[]>;
|
|
579
|
+
/** An H5P activity: its content type, whether attempts are tracked, and the person's attempts with their scores. */
|
|
580
|
+
h5pActivity(activityId: number): Promise<import("./areas/h5p/h5p.js").H5PActivity>;
|
|
581
|
+
/**
|
|
582
|
+
* Imports activities from another course into a course, as Moodle's "Import" does: every activity
|
|
583
|
+
* of `fromCourseId`, or only `activityIds`, added to `toCourseId`'s content (with their sections),
|
|
584
|
+
* without users' data. Needs `moodle/restore:restoretargetimport` in the course imported into and
|
|
585
|
+
* `moodle/backup:backuptargetimport` in the other. Returns the activities the course has afterwards
|
|
586
|
+
* that it didn't have before, by id.
|
|
587
|
+
*/
|
|
588
|
+
importActivities(fromCourseId: number, toCourseId: number, options?: {
|
|
589
|
+
activityIds?: number[] | undefined;
|
|
590
|
+
}): Promise<{
|
|
591
|
+
changed: string;
|
|
592
|
+
activityIds: number[];
|
|
593
|
+
}>;
|
|
594
|
+
/**
|
|
595
|
+
* Imports questions into a bank from a GIFT or Moodle XML file (a local path) or text, through the
|
|
596
|
+
* bank's import form; returns the questions created. A file Moodle can't parse comes back as a
|
|
597
|
+
* `QuestionBankError` with its messages, and nothing is imported.
|
|
598
|
+
*/
|
|
599
|
+
importQuestions(activityId: number, options: {
|
|
600
|
+
format: "xml" | "gift";
|
|
601
|
+
file?: string | undefined;
|
|
602
|
+
text?: string | undefined;
|
|
603
|
+
categoryId?: number | undefined;
|
|
604
|
+
}): Promise<{
|
|
605
|
+
changed: string;
|
|
606
|
+
questions: import("./areas/questions/banks.js").BankQuestion[];
|
|
607
|
+
}>;
|
|
608
|
+
/** The lesson page the person is on (starting the lesson the first time). */
|
|
609
|
+
lessonPage(activityId: number): Promise<import("./areas/lessons/lessons.js").LessonPage>;
|
|
610
|
+
/** The course's assignments, in the course's order, with the section each is in. */
|
|
611
|
+
listAssignments(courseId: number): Promise<import("./areas/courses/structure.js").CourseAssignment[]>;
|
|
612
|
+
/** The courses the person is enrolled in, as teacher or student. */
|
|
613
|
+
listCourses(classification?: "all" | "inprogress" | "future" | "past"): Promise<import("./areas/courses/list.js").Course[]>;
|
|
614
|
+
/**
|
|
615
|
+
* Logs the person out of Moodle through the user menu's logout link (it carries the sesskey; without
|
|
616
|
+
* one Moodle asks to confirm, and the confirmation is accepted). Returns false when nobody was logged
|
|
617
|
+
* in. Only Moodle's session ends: a single sign-on provider may keep its own.
|
|
618
|
+
*/
|
|
619
|
+
logOut(): Promise<boolean>;
|
|
620
|
+
/** Marks all the person's notifications read, as the popover's "Mark all as read" does; doing it twice changes nothing. */
|
|
621
|
+
markNotificationsRead(): Promise<{
|
|
622
|
+
changed: string;
|
|
623
|
+
}>;
|
|
624
|
+
/**
|
|
625
|
+
* Sends one message to several participants of a course, as the participants page's "Send a message"
|
|
626
|
+
* does for the users selected: one private message each, in one call. They are `userIds`, or the
|
|
627
|
+
* participants `participants()` chooses with `role`, `group` and `inactiveSince` (all of them when
|
|
628
|
+
* none is given), the person left out. `sentTo` lists exactly who got it, `refused` who Moodle
|
|
629
|
+
* didn't write to and why (they blocked the person, their privacy settings); someone who may message
|
|
630
|
+
* any user (a teacher, `moodle/site:messageanyuser`) gets through a block, as in Moodle's own page
|
|
631
|
+
* (confirmed empirically, Moodle 5.2). Throws `MessageError`
|
|
632
|
+
* for an empty message or nobody to write to, `NoParticipantsError` when the person can't see the
|
|
633
|
+
* course's participants.
|
|
634
|
+
*/
|
|
635
|
+
messageParticipants(courseId: number, text: string, selection?: import("./areas/messages/messages.js").ParticipantSelection): Promise<{
|
|
636
|
+
changed: string;
|
|
637
|
+
sentTo: number[];
|
|
638
|
+
refused: {
|
|
639
|
+
userId: number;
|
|
640
|
+
reason: string;
|
|
641
|
+
}[];
|
|
642
|
+
}>;
|
|
643
|
+
/** The person's own grade report for a course. */
|
|
644
|
+
myGrades(courseId: number): Promise<import("./areas/grades/user-report.js").GradeRow[]>;
|
|
645
|
+
/** The person's notifications, newest first, only the unread ones when asked. */
|
|
646
|
+
notifications(options?: {
|
|
647
|
+
unreadOnly?: boolean | undefined;
|
|
648
|
+
}): Promise<import("./areas/messages/messages.js").Notification[]>;
|
|
649
|
+
/** Opens a Moodle form page and waits for its editors to be ready. */
|
|
650
|
+
openForm(pathAndQuery: string): Promise<import("playwright-core").Page>;
|
|
651
|
+
/**
|
|
652
|
+
* Opens a page of the site (`path` relative to it) in a new tab and checks the session; throws
|
|
653
|
+
* `NotLoggedInError`, closing the tab, when Moodle answers with its login page.
|
|
654
|
+
*/
|
|
655
|
+
openSitePage(path: string, options?: {
|
|
656
|
+
follow?: boolean | undefined;
|
|
657
|
+
}): Promise<import("playwright-core").Page>;
|
|
658
|
+
/** Sets someone's completion of an activity as a teacher does from the progress report; returns the state saved. */
|
|
659
|
+
overrideCompletion(activityId: number, userId: number, state: "incomplete" | "complete" | "complete-pass" | "complete-fail"): Promise<{
|
|
660
|
+
changed: string;
|
|
661
|
+
state: "incomplete" | "complete" | "complete-pass" | "complete-fail";
|
|
662
|
+
overridden: boolean;
|
|
663
|
+
}>;
|
|
664
|
+
/**
|
|
665
|
+
* The roles and groups the participants page filters by in a course (its filters' options), as the
|
|
666
|
+
* person may use them: every group, or only their own in a course with separate groups. "No roles"
|
|
667
|
+
* and "no group" left out.
|
|
668
|
+
*/
|
|
669
|
+
participantFilters(courseId: number): Promise<{
|
|
670
|
+
roles: {
|
|
671
|
+
id: number;
|
|
672
|
+
name: string;
|
|
673
|
+
}[];
|
|
674
|
+
groups: {
|
|
675
|
+
id: number;
|
|
676
|
+
name: string;
|
|
677
|
+
}[];
|
|
678
|
+
}>;
|
|
679
|
+
/**
|
|
680
|
+
* A course's participants with their roles and groups, as the participants page lists them: only
|
|
681
|
+
* those with a role (its id), in a group, or (`inactiveSince`) who haven't accessed the course since
|
|
682
|
+
* that date, when asked. Each role and group is a filter of its own, so ids come in any language.
|
|
683
|
+
*/
|
|
684
|
+
participants(courseId: number, options?: {
|
|
685
|
+
role?: number | undefined;
|
|
686
|
+
group?: number | undefined;
|
|
687
|
+
inactiveSince?: Date | undefined;
|
|
688
|
+
}): Promise<import("./areas/participants/participants.js").Participant[]>;
|
|
689
|
+
/**
|
|
690
|
+
* Who took part in an activity of a course, as its participation report counts it: everyone with
|
|
691
|
+
* the role (every role the report offers, unless `roleId`), with how many actions they made there
|
|
692
|
+
* (views or posts only, when `action`; since `since`, when given); those who did nothing come with 0.
|
|
693
|
+
*/
|
|
694
|
+
participationReport(courseId: number, activityId: number, options?: {
|
|
695
|
+
roleId?: number | undefined;
|
|
696
|
+
since?: Date | undefined;
|
|
697
|
+
action?: "view" | "post" | undefined;
|
|
698
|
+
}): Promise<import("./areas/reports/reports.js").ActivityParticipant[]>;
|
|
699
|
+
/**
|
|
700
|
+
* What the person still has to do in a course: activities whose completion is tracked and not
|
|
701
|
+
* complete or, where completion isn't tracked, graded activities without a grade yet.
|
|
702
|
+
*/
|
|
703
|
+
pendingActivities(courseId: number): Promise<{
|
|
704
|
+
completionTracked: boolean;
|
|
705
|
+
pending: import("./areas/courses/structure.js").PendingActivity[];
|
|
706
|
+
}>;
|
|
707
|
+
/**
|
|
708
|
+
* Users the person may enrol in a course by manual enrolment, matching `search` anywhere in their
|
|
709
|
+
* name or the identity fields the site shows (all of them, a page of up to 100, when empty), as the
|
|
710
|
+
* "Enrol users" dialog finds them. Throws `EnrolmentError` when the course has no manual enrolment
|
|
711
|
+
* the person can use.
|
|
712
|
+
*/
|
|
713
|
+
potentialUsers(courseId: number, search?: string): Promise<import("./areas/participants/enrolments.js").PotentialUser[]>;
|
|
714
|
+
/** A course's question banks: its shared ones and the activities' own, as the banks page lists them. */
|
|
715
|
+
questionBanks(courseId: number): Promise<import("./areas/questions/banks.js").QuestionBank[]>;
|
|
716
|
+
/** A bank's categories and every question in them, category by category. */
|
|
717
|
+
questions(activityId: number): Promise<{
|
|
718
|
+
categories: import("./areas/questions/banks.js").BankCategory[];
|
|
719
|
+
questions: import("./areas/questions/banks.js").BankQuestion[];
|
|
720
|
+
}>;
|
|
721
|
+
/**
|
|
722
|
+
* The questions of a quiz that wait for grading by hand (essays…), as its manual grading report lists
|
|
723
|
+
* them, each with the finished attempts whose answer requires grading (from the results report).
|
|
724
|
+
* People as user id and full name.
|
|
725
|
+
*/
|
|
726
|
+
questionsToGrade(activityId: number): Promise<{
|
|
727
|
+
quiz: {
|
|
728
|
+
id: number;
|
|
729
|
+
};
|
|
730
|
+
questions: import("./areas/quizzes/grading.js").QuestionToGrade[];
|
|
731
|
+
}>;
|
|
732
|
+
/** A quiz's page as the person sees it: its description and dates, the person's attempts with their summary, and whether they can start one. */
|
|
733
|
+
quizInfo(activityId: number): Promise<import("./areas/quizzes/attempts.js").QuizInfo>;
|
|
734
|
+
/**
|
|
735
|
+
* A quiz's attempts as its grades report shows them: per attempt the user, state, dates, grade and
|
|
736
|
+
* the mark per question; with `responses`, also the answer per question from the responses report.
|
|
737
|
+
* Every page of the report.
|
|
738
|
+
*/
|
|
739
|
+
quizResults(activityId: number, options?: {
|
|
740
|
+
responses?: boolean | undefined;
|
|
741
|
+
}): Promise<{
|
|
742
|
+
quiz: {
|
|
743
|
+
id: number;
|
|
744
|
+
};
|
|
745
|
+
attempts: import("./areas/quizzes/results.js").QuizAttemptResult[];
|
|
746
|
+
}>;
|
|
747
|
+
/** A quiz's questions as its edit page lists them: slots with their page, question, type, name and mark, and its sections. */
|
|
748
|
+
quizStructure(activityId: number): Promise<{
|
|
749
|
+
quiz: {
|
|
750
|
+
id: number;
|
|
751
|
+
};
|
|
752
|
+
slots: import("./areas/quizzes/structure.js").QuizSlot[];
|
|
753
|
+
sections: import("./areas/quizzes/structure.js").QuizSection[];
|
|
754
|
+
}>;
|
|
755
|
+
/**
|
|
756
|
+
* Rates a forum post, a glossary entry or a database record as the person, as the rating menu under
|
|
757
|
+
* it does: by a scale item's name, or its number (the points of a point scale). `null` takes the
|
|
758
|
+
* person's rating away. Returns a sentence of what changed and the item's aggregate afterwards (as
|
|
759
|
+
* Moodle shows it, by the activity's aggregation) with the number of ratings. Throws `GradingError`
|
|
760
|
+
* when the item has no rating menu for the person (ratings off, their own item, outside the
|
|
761
|
+
* rating period, or no permission) or the rating isn't on its scale.
|
|
762
|
+
*/
|
|
763
|
+
rate(item: import("./areas/ratings/ratings.js").RateableItem, rating: string | number | null): Promise<{
|
|
764
|
+
changed: string;
|
|
765
|
+
aggregate?: string | undefined;
|
|
766
|
+
count?: number | undefined;
|
|
767
|
+
}>;
|
|
768
|
+
/** Every question of an attempt, page by page, with the page each is on. */
|
|
769
|
+
readAttempt(attemptId: number): Promise<import("./areas/quizzes/attempts.js").Question[]>;
|
|
770
|
+
/** A finished attempt's review, as far as the quiz's review options let the person see it. */
|
|
771
|
+
readReview(attemptId: number): Promise<{
|
|
772
|
+
summary: import("./areas/quizzes/attempts.js").Detail[];
|
|
773
|
+
questions: import("./areas/quizzes/attempts.js").Question[];
|
|
774
|
+
}>;
|
|
775
|
+
/** Removes a slot (by its place, from 1) from a quiz, as the edit page's delete icon does; the question stays in its bank. */
|
|
776
|
+
removeQuizSlot(activityId: number, slot: number): Promise<import("./areas/quizzes/structure.js").QuizChange>;
|
|
777
|
+
/** Replies to a post; returns the new post's id and its discussion's. */
|
|
778
|
+
replyToPost(postId: number, input: import("./areas/forums/posts.js").PostInput & {
|
|
779
|
+
subject?: string | undefined;
|
|
780
|
+
}): Promise<{
|
|
781
|
+
changed: string;
|
|
782
|
+
postId: number | undefined;
|
|
783
|
+
discussionId: number | undefined;
|
|
784
|
+
}>;
|
|
785
|
+
/**
|
|
786
|
+
* Resets a course for a new year, as Moodle's reset form does: deletes only what's named in `delete`
|
|
787
|
+
* (in every module of the course that has it), unenrols the people with `unenrolRoles` (role ids),
|
|
788
|
+
* moves the course's start date to `start` (and its activities' dates with it), and sets any other of
|
|
789
|
+
* the form's fields by name (`fields`). Nothing is deleted unless asked: the form's own defaults are
|
|
790
|
+
* unticked first. It can't be undone. Returns Moodle's report: per component, what it did and its
|
|
791
|
+
* errors. Needs `moodle/course:reset`.
|
|
792
|
+
*/
|
|
793
|
+
resetCourse(courseId: number, options: {
|
|
794
|
+
delete?: import("./areas/courses/reset.js").ResetDeletions | undefined;
|
|
795
|
+
unenrolRoles?: number[] | undefined;
|
|
796
|
+
start?: Date | undefined;
|
|
797
|
+
fields?: Record<string, import("./core/forms.js").FieldValue> | undefined;
|
|
798
|
+
}): Promise<{
|
|
799
|
+
changed: string;
|
|
800
|
+
report: import("./areas/courses/reset.js").ResetStatus[];
|
|
801
|
+
}>;
|
|
802
|
+
/**
|
|
803
|
+
* Restores a backup file (`.mbz`) through Moodle's restore wizard: into a new course in a category
|
|
804
|
+
* (`into: "new"`, with `categoryId`, which needs `moodle/course:create` there), or into an existing
|
|
805
|
+
* course (`into: <course id>`), its content added to the course's (`mode: "merge"`, the default) or
|
|
806
|
+
* replacing it (`"replace"`: the course's content is deleted first). A new course takes the backup's
|
|
807
|
+
* names unless `fullName` and `shortName` are given. Users' data is restored when `withUsers` and the
|
|
808
|
+
* backup has it. An asynchronous restore is waited for up to `timeoutMs` (ten minutes). Needs
|
|
809
|
+
* `moodle/restore:restorecourse` where it restores.
|
|
810
|
+
*/
|
|
811
|
+
restoreCourse(file: string, options: {
|
|
812
|
+
into: number | "new";
|
|
813
|
+
categoryId?: number | undefined;
|
|
814
|
+
mode?: "merge" | "replace" | undefined;
|
|
815
|
+
fullName?: string | undefined;
|
|
816
|
+
shortName?: string | undefined;
|
|
817
|
+
withUsers?: boolean | undefined;
|
|
818
|
+
timeoutMs?: number | undefined;
|
|
819
|
+
}): Promise<{
|
|
820
|
+
changed: string;
|
|
821
|
+
course: import("./areas/backup/backup.js").CourseRef;
|
|
822
|
+
}>;
|
|
823
|
+
/**
|
|
824
|
+
* An assignment's grading method and, for a rubric or a marking guide, its criteria with the ids
|
|
825
|
+
* `gradeSubmission` takes: read from the grader's panel for its first participant.
|
|
826
|
+
*/
|
|
827
|
+
rubric(activityId: number): Promise<{
|
|
828
|
+
assignment: {
|
|
829
|
+
id: number;
|
|
830
|
+
};
|
|
831
|
+
} & import("./areas/assignments/grading.js").GradingDefinition>;
|
|
832
|
+
/** Saves the submission's online text and adds files, as "Save changes" on the edit page does; gives the assignment afterwards. */
|
|
833
|
+
saveSubmission(activityId: number, input: {
|
|
834
|
+
onlineText?: string | undefined;
|
|
835
|
+
files?: string[] | undefined;
|
|
836
|
+
}): Promise<{
|
|
837
|
+
changed: string;
|
|
838
|
+
assignment: import("./areas/assignments/student.js").StudentAssignment;
|
|
839
|
+
}>;
|
|
840
|
+
/**
|
|
841
|
+
* A SCORM activity as the person sees it: its attempts (allowed and made), the grading method, the
|
|
842
|
+
* grade reported and each attempt's, and its SCOs with the person's status and score in the last
|
|
843
|
+
* attempt. Moodle doesn't show a SCORM's version on its page: `openScorm` tells it.
|
|
844
|
+
*/
|
|
845
|
+
scorm(activityId: number): Promise<import("./areas/scorm/scorm.js").ScormActivity>;
|
|
846
|
+
/** Sends a private message to a user, as the messaging drawer does; returns the message and its conversation. */
|
|
847
|
+
sendMessage(userId: number, text: string): Promise<{
|
|
848
|
+
changed: string;
|
|
849
|
+
messageId: number;
|
|
850
|
+
conversationId?: number | undefined;
|
|
851
|
+
}>;
|
|
852
|
+
/**
|
|
853
|
+
* Marks the person's own completion of an activity with manual completion, done or not, as its
|
|
854
|
+
* "Mark as done" button does; doing it twice changes nothing. An activity that completes on its own
|
|
855
|
+
* gives a `CompletionError`.
|
|
856
|
+
*/
|
|
857
|
+
setCompletion(activityId: number, done: boolean): Promise<{
|
|
858
|
+
changed: string;
|
|
859
|
+
}>;
|
|
860
|
+
/**
|
|
861
|
+
* Pins or unpins, locks or unlocks a discussion, as the discussion list's menu does; what's already
|
|
862
|
+
* so is left alone. Returns the discussion as the forum lists it afterwards.
|
|
863
|
+
*/
|
|
864
|
+
setDiscussionState(activityId: number, discussionId: number, options: {
|
|
865
|
+
pinned?: boolean | undefined;
|
|
866
|
+
locked?: boolean | undefined;
|
|
867
|
+
}): Promise<{
|
|
868
|
+
changed: string;
|
|
869
|
+
discussion?: import("./areas/forums/posts.js").ForumDiscussion | undefined;
|
|
870
|
+
}>;
|
|
871
|
+
/**
|
|
872
|
+
* Sets an enrolment method with its form: by id, or the course's first method of a type
|
|
873
|
+
* (`{ type: "self" }`), added when the course has none and the "Add method" menu offers it. Only
|
|
874
|
+
* what's given changes. Returns the method afterwards. Throws `EnrolmentError` for a method the
|
|
875
|
+
* course doesn't have or can't add, `FormError` with Moodle's reason when it refuses the form (a key
|
|
876
|
+
* required by the site, an end before the start).
|
|
877
|
+
*/
|
|
878
|
+
setEnrolmentMethod(courseId: number, method: number | {
|
|
879
|
+
type: string;
|
|
880
|
+
}, settings: import("./areas/participants/methods.js").EnrolmentMethodSettings): Promise<{
|
|
881
|
+
changed: string;
|
|
882
|
+
method: import("./areas/participants/methods.js").EnrolmentMethod;
|
|
883
|
+
}>;
|
|
884
|
+
/**
|
|
885
|
+
* Sets a person's grade in a grade item through the gradebook's single view report, as a teacher
|
|
886
|
+
* does there: a manual item takes the grade; an activity's or a category's is overridden (Moodle
|
|
887
|
+
* keeps the override until it's taken off with `override: false`). Feedback and excluding from
|
|
888
|
+
* the totals go the same way. Returns a sentence of what changed and the grade afterwards.
|
|
889
|
+
* Throws `GradebookError` when the item or the person isn't in the course's gradebook, the grade
|
|
890
|
+
* is locked, or Moodle refuses the value (out of range, a scale item it doesn't have).
|
|
891
|
+
*/
|
|
892
|
+
setGrade(courseId: number, itemId: number, userId: number, options: import("./areas/grades/singleview.js").SetGradeOptions): Promise<{
|
|
893
|
+
changed: string;
|
|
894
|
+
grade: import("./areas/grades/singleview.js").GradebookGrade;
|
|
895
|
+
}>;
|
|
896
|
+
/**
|
|
897
|
+
* Adds and removes a group's members (user ids), as its members page does. Only the course's
|
|
898
|
+
* participants can be added: ids the page doesn't offer (not enrolled, or already members) and
|
|
899
|
+
* members not in it are left as they were and named in `changed`. Returns the members afterwards.
|
|
900
|
+
*/
|
|
901
|
+
setGroupMembers(groupId: number, options: {
|
|
902
|
+
add?: number[] | undefined;
|
|
903
|
+
remove?: number[] | undefined;
|
|
904
|
+
}): Promise<{
|
|
905
|
+
changed: string;
|
|
906
|
+
members: number[];
|
|
907
|
+
}>;
|
|
908
|
+
/**
|
|
909
|
+
* Makes a grouping's groups exactly `groupIds`, as its groups page adds and removes them. Groups of
|
|
910
|
+
* other courses aren't offered there and are left out, named in `changed`. Returns the groups afterwards.
|
|
911
|
+
*/
|
|
912
|
+
setGroupingGroups(groupingId: number, groupIds: number[]): Promise<{
|
|
913
|
+
changed: string;
|
|
914
|
+
groupIds: number[];
|
|
915
|
+
}>;
|
|
916
|
+
/** Sets a question ready (quizzes can use it) or draft, as the bank's status menu does, through its service. */
|
|
917
|
+
setQuestionStatus(questionId: number, status: "ready" | "draft"): Promise<{
|
|
918
|
+
changed: string;
|
|
919
|
+
questionId: number;
|
|
920
|
+
status: "ready" | "draft";
|
|
921
|
+
}>;
|
|
922
|
+
/**
|
|
923
|
+
* Sets a user override on a quiz, through its override form: other opening and closing dates, a time
|
|
924
|
+
* limit in minutes, or a number of attempts (0 unlimited); what isn't given stays the quiz's.
|
|
925
|
+
*/
|
|
926
|
+
setQuizOverride(activityId: number, userId: number, options: {
|
|
927
|
+
open?: Date | undefined;
|
|
928
|
+
close?: Date | undefined;
|
|
929
|
+
timeLimitMinutes?: number | undefined;
|
|
930
|
+
attempts?: number | undefined;
|
|
931
|
+
}): Promise<{
|
|
932
|
+
changed: string;
|
|
933
|
+
}>;
|
|
934
|
+
/**
|
|
935
|
+
* Sets a quiz's pages: `perPage` questions a page (0 for all on one), as the edit page's
|
|
936
|
+
* "Repaginate" does, or page breaks exactly after the given slots (and nowhere else), as its page
|
|
937
|
+
* break icons do one by one.
|
|
938
|
+
*/
|
|
939
|
+
setQuizPages(activityId: number, pages: {
|
|
940
|
+
perPage: number;
|
|
941
|
+
} | {
|
|
942
|
+
breaksAfter: number[];
|
|
943
|
+
}): Promise<import("./areas/quizzes/structure.js").QuizChange>;
|
|
944
|
+
/**
|
|
945
|
+
* Sets a user's roles in a course, as the participants page's roles column does: gives the roles in
|
|
946
|
+
* `roleIds` the person may assign, and takes away the others the person may assign. Roles the person
|
|
947
|
+
* can't assign that the user already holds, and those from elsewhere (a category, an enrolment that
|
|
948
|
+
* protects them), stay. Returns the user's roles afterwards, as that column shows them. Throws
|
|
949
|
+
* `EnrolmentError` with Moodle's reason for a role the person can't assign or a user not enrolled.
|
|
950
|
+
*/
|
|
951
|
+
setUserRoles(courseId: number, userId: number, roleIds: number[]): Promise<{
|
|
952
|
+
changed: string;
|
|
953
|
+
roleIds: number[];
|
|
954
|
+
}>;
|
|
955
|
+
/**
|
|
956
|
+
* Sets the marking workflow state of participants' submissions, as the grading table's "Set marking
|
|
957
|
+
* workflow state" does; "released" shows them their grades, notifying them when `notify` is true
|
|
958
|
+
* (the form's default is not to). With several markers, it sets the submission's overall state.
|
|
959
|
+
*/
|
|
960
|
+
setWorkflowState(activityId: number, userIds: number[], state: "inmarking" | "readyforreview" | "inreview" | "readyforrelease" | "released", options?: {
|
|
961
|
+
notify?: boolean | undefined;
|
|
962
|
+
}): Promise<{
|
|
963
|
+
changed: string;
|
|
964
|
+
}>;
|
|
965
|
+
/**
|
|
966
|
+
* Switches a workshop to a phase, as its page's phase links do, confirming Moodle's question (any
|
|
967
|
+
* phase, forwards or back; Moodle allocates nothing and calculates no grades on its own when it
|
|
968
|
+
* switches). Returns a sentence of what changed and the phase afterwards. Throws `WorkshopError` when
|
|
969
|
+
* the person can't switch the workshop's phases (Moodle's `mod/workshop:switchphase`, a teacher's) or
|
|
970
|
+
* the id isn't a workshop's.
|
|
971
|
+
*/
|
|
972
|
+
setWorkshopPhase(activityId: number, phase: import("./areas/workshops/workshops.js").WorkshopPhase): Promise<{
|
|
973
|
+
changed: string;
|
|
974
|
+
phase: import("./areas/workshops/workshops.js").WorkshopPhase;
|
|
975
|
+
}>;
|
|
976
|
+
/** The site's name, from its public settings; `undefined` where the mobile app support is off. */
|
|
977
|
+
siteName(): Promise<string | undefined>;
|
|
978
|
+
/** Starts a discussion in a forum; returns its id. */
|
|
979
|
+
startDiscussion(activityId: number, input: import("./areas/forums/posts.js").PostInput & {
|
|
980
|
+
subject: string;
|
|
981
|
+
}): Promise<{
|
|
982
|
+
changed: string;
|
|
983
|
+
discussionId: number | undefined;
|
|
984
|
+
}>;
|
|
985
|
+
/** Starts an attempt, or continues the one in progress, and gives its questions. */
|
|
986
|
+
startQuizAttempt(activityId: number): Promise<{
|
|
987
|
+
changed: string;
|
|
988
|
+
attemptId: number;
|
|
989
|
+
questions: import("./areas/quizzes/attempts.js").Question[];
|
|
990
|
+
}>;
|
|
991
|
+
/** An assignment as the student sees it: its description and files, dates, the submission's status and files, the feedback, and whether it can be edited or submitted now. */
|
|
992
|
+
studentAssignment(activityId: number): Promise<import("./areas/assignments/student.js").StudentAssignment>;
|
|
993
|
+
/**
|
|
994
|
+
* Submits the saved submission for grading, accepting the site's statement when it asks for one
|
|
995
|
+
* (`acceptStatement`, once the person agrees; a bare boolean as before 0.2 too); gives the
|
|
996
|
+
* assignment afterwards.
|
|
997
|
+
*/
|
|
998
|
+
submitForGrading(activityId: number, options?: boolean | {
|
|
999
|
+
acceptStatement?: boolean | undefined;
|
|
1000
|
+
}): Promise<{
|
|
1001
|
+
changed: string;
|
|
1002
|
+
assignment: import("./areas/assignments/student.js").StudentAssignment;
|
|
1003
|
+
}>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Fills the survey page by page with `responses` (field name → value) and submits it on the last
|
|
1006
|
+
* page. Every name is checked against the form first, so nothing is sent with a wrong one.
|
|
1007
|
+
*/
|
|
1008
|
+
submitSurvey(activityId: number, type: import("./areas/surveys/surveys.js").SurveyType, responses: Record<string, string>): Promise<{
|
|
1009
|
+
changed: string;
|
|
1010
|
+
messages: string[];
|
|
1011
|
+
}>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Fills the survey page by page with `responses` (field name → value) and submits it on the last
|
|
1014
|
+
* page. Every name is checked against the form first, so nothing is sent with a wrong one.
|
|
1015
|
+
*/
|
|
1016
|
+
submitSurvey(activityId: number, responses: Record<string, string>, options?: {
|
|
1017
|
+
type?: import("./areas/surveys/surveys.js").SurveyType | undefined;
|
|
1018
|
+
}): Promise<{
|
|
1019
|
+
changed: string;
|
|
1020
|
+
messages: string[];
|
|
1021
|
+
}>;
|
|
1022
|
+
/**
|
|
1023
|
+
* Unenrols a user from a course: removes every enrolment of theirs the person may remove (its
|
|
1024
|
+
* unenrol link on the participants page), with their roles and group memberships in the course, as
|
|
1025
|
+
* that link does. `changed` and `removed` say which ones (by enrolment method's name), `kept` those
|
|
1026
|
+
* the person may not remove (a cohort sync, another teacher's method). Throws `EnrolmentError` when
|
|
1027
|
+
* the user isn't enrolled.
|
|
1028
|
+
*/
|
|
1029
|
+
unenrolUser(courseId: number, userId: number): Promise<{
|
|
1030
|
+
changed: string;
|
|
1031
|
+
removed: string[];
|
|
1032
|
+
kept: string[];
|
|
1033
|
+
}>;
|
|
1034
|
+
/** The person's upcoming events, as the calendar's "Upcoming events" view lists them, in one course or all. */
|
|
1035
|
+
upcomingEvents(options?: {
|
|
1036
|
+
courseId?: number | undefined;
|
|
1037
|
+
}): Promise<import("./areas/calendar/calendar.js").CalendarEvent[]>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Changes an existing activity through its form: only what's given changes. A file resource's or
|
|
1040
|
+
* folder's files stay as they are unless `files` says what to add, remove or replace.
|
|
1041
|
+
*/
|
|
1042
|
+
updateActivity(activityId: number, input: import("./areas/activities/build.js").ActivityFields & {
|
|
1043
|
+
files?: import("./areas/activities/build.js").FileChanges | undefined;
|
|
1044
|
+
}): Promise<import("./areas/activities/build.js").CourseChange>;
|
|
1045
|
+
/**
|
|
1046
|
+
* Changes a course's full name, short name, summary (HTML) or any other setting by its form field
|
|
1047
|
+
* name, through the course's settings form; returns the course as `listCourses` gives it. Moodle's
|
|
1048
|
+
* refusals (a short name already taken) come back as `FormError` by field.
|
|
1049
|
+
*/
|
|
1050
|
+
updateCourse(courseId: number, options: {
|
|
1051
|
+
fullName?: string | undefined;
|
|
1052
|
+
shortName?: string | undefined;
|
|
1053
|
+
summary?: string | undefined;
|
|
1054
|
+
settings?: Record<string, import("./core/forms.js").FieldValue> | undefined;
|
|
1055
|
+
}): Promise<{
|
|
1056
|
+
changed: string;
|
|
1057
|
+
course?: import("./areas/courses/list.js").Course | undefined;
|
|
1058
|
+
}>;
|
|
1059
|
+
/**
|
|
1060
|
+
* Changes a calendar event through the calendar's own form, opened on it: only what's given
|
|
1061
|
+
* changes. A new start keeps the event's length unless a new one is given. Returns the event as the
|
|
1062
|
+
* calendar has it afterwards.
|
|
1063
|
+
*/
|
|
1064
|
+
updateEvent(eventId: number, changes: import("./areas/calendar/calendar.js").EventChanges): Promise<{
|
|
1065
|
+
changed: string;
|
|
1066
|
+
event: import("./areas/calendar/calendar.js").CalendarEvent;
|
|
1067
|
+
}>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Changes a grade category: its name, its aggregation, its weight in its parent (percent, overriding
|
|
1070
|
+
* Natural's automatic one), or moves it into another category. Returns the category afterwards.
|
|
1071
|
+
*/
|
|
1072
|
+
updateGradeCategory(courseId: number, categoryId: number, options: {
|
|
1073
|
+
name?: string | undefined;
|
|
1074
|
+
aggregation?: "mean" | "median" | "lowest" | "highest" | "mode" | "weighted-mean" | "simple-weighted-mean" | "mean-with-extra-credits" | "natural" | undefined;
|
|
1075
|
+
weight?: number | undefined;
|
|
1076
|
+
parentId?: number | undefined;
|
|
1077
|
+
}): Promise<{
|
|
1078
|
+
changed: string;
|
|
1079
|
+
category?: import("./areas/grades/gradebook.js").GradebookCategory | undefined;
|
|
1080
|
+
}>;
|
|
1081
|
+
/**
|
|
1082
|
+
* Changes a grade item: moves it into a category, sets its weight (percent, overriding Natural's
|
|
1083
|
+
* automatic one), or its maximum grade (a manual item's; an activity's is set in the activity).
|
|
1084
|
+
* Returns the item afterwards.
|
|
1085
|
+
*/
|
|
1086
|
+
updateGradeItem(courseId: number, itemId: number, options: {
|
|
1087
|
+
category?: number | undefined;
|
|
1088
|
+
weight?: number | undefined;
|
|
1089
|
+
maxGrade?: number | undefined;
|
|
1090
|
+
}): Promise<{
|
|
1091
|
+
changed: string;
|
|
1092
|
+
item?: import("./areas/grades/gradebook.js").GradebookItem | undefined;
|
|
1093
|
+
}>;
|
|
1094
|
+
/** Changes a group's name, description, ID number or enrolment key with its form; what isn't given stays. */
|
|
1095
|
+
updateGroup(groupId: number, settings: import("./areas/participants/groups.js").GroupSettings): Promise<{
|
|
1096
|
+
changed: string;
|
|
1097
|
+
}>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Changes a question of a bank through its type's edit form, with the same inputs as
|
|
1100
|
+
* `createQuestion` and only what's given (`answers` replaces them all). Saving makes a new version
|
|
1101
|
+
* of the question, with an id of its own: the one returned, which quizzes using the latest version
|
|
1102
|
+
* get from then on.
|
|
1103
|
+
*/
|
|
1104
|
+
updateQuestion(activityId: number, questionId: number, input: Partial<Omit<import("./areas/questions/banks.js").QuestionInput, "type">>): Promise<{
|
|
1105
|
+
changed: string;
|
|
1106
|
+
questionId?: number | undefined;
|
|
1107
|
+
}>;
|
|
1108
|
+
/**
|
|
1109
|
+
* A user by id, or `undefined` when there's nobody: no such user, one the person may not see, or a
|
|
1110
|
+
* deleted account. Moodle keeps a deleted account's record and its user service still gives it to an
|
|
1111
|
+
* administrator, renamed, with the email replaced by an MD5 hash of the old username (`delete_user`,
|
|
1112
|
+
* confirmed empirically on the sandbox, 5.2); the driver treats it as gone.
|
|
1113
|
+
*/
|
|
1114
|
+
userById(userId: number): Promise<import("./areas/site/users.js").User | undefined>;
|
|
1115
|
+
/** Who the logged-in person is; with `courseId`, also their roles and abilities in that course. */
|
|
1116
|
+
whoAmI(courseId?: number): Promise<import("./areas/site/users.js").Me>;
|
|
1117
|
+
/**
|
|
1118
|
+
* A workshop's phase, and its report as the workshop's page shows it to a teacher: every submission
|
|
1119
|
+
* (its author, title, and grade once calculated) and every assessment (reviewer, the submission's
|
|
1120
|
+
* author, the grade it gives, its weight, the grade for assessing once calculated), all of its pages.
|
|
1121
|
+
* The report is Moodle's own: it shows from the submission phase on to those who can see every
|
|
1122
|
+
* submission, in the course's current group; for anyone else the lists are empty. Grades are out of
|
|
1123
|
+
* the workshop's grade for submission, as Moodle shows them. Throws `WorkshopError` for an activity
|
|
1124
|
+
* that isn't a workshop the person can view.
|
|
1125
|
+
*/
|
|
1126
|
+
workshopInfo(activityId: number): Promise<import("./areas/workshops/workshops.js").WorkshopInfo>;
|
|
1127
|
+
}
|