@instructure/platform-mock-canvas-api 0.6.0 → 0.7.0
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/README.md +33 -0
- package/dist/handlers/cohorts.d.ts +44 -0
- package/dist/handlers/cohorts.d.ts.map +1 -0
- package/dist/handlers/index.d.ts +2 -1
- package/dist/handlers/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +724 -110
- package/dist/types/cohorts.d.ts +1082 -0
- package/dist/types/cohorts.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1082 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A global announcement for an account.
|
|
3
|
+
*/
|
|
4
|
+
export interface AccountNotification {
|
|
5
|
+
id?: Id;
|
|
6
|
+
/** The subject of the notification. */
|
|
7
|
+
subject?: string;
|
|
8
|
+
/** The message to be sent in the notification. */
|
|
9
|
+
message?: string;
|
|
10
|
+
/** When to send out the notification. */
|
|
11
|
+
start_at?: string;
|
|
12
|
+
/** When to expire the notification. */
|
|
13
|
+
end_at?: string;
|
|
14
|
+
/** The icon to display with the message. Defaults to warning. */
|
|
15
|
+
icon?: AccountNotificationIcon;
|
|
16
|
+
/**
|
|
17
|
+
* Role names the notification is sent to. Empty means all roles. Use
|
|
18
|
+
* `role_ids`.
|
|
19
|
+
* @deprecated
|
|
20
|
+
*/
|
|
21
|
+
roles?: string[];
|
|
22
|
+
/** Roles the notification is sent to. Empty means all roles. */
|
|
23
|
+
role_ids?: number[];
|
|
24
|
+
/**
|
|
25
|
+
* The author of the notification. Available only to admins using
|
|
26
|
+
* `include_all`.
|
|
27
|
+
* @nullable
|
|
28
|
+
*/
|
|
29
|
+
author?: AccountNotificationAuthor;
|
|
30
|
+
/**
|
|
31
|
+
* Cohorts the announcement is targeted at. Empty when the
|
|
32
|
+
* announcement is not cohort-targeted. Added by the cohorts feature.
|
|
33
|
+
*/
|
|
34
|
+
cohort_ids?: Id[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The author of the notification. Available only to admins using
|
|
38
|
+
* `include_all`.
|
|
39
|
+
* @nullable
|
|
40
|
+
*/
|
|
41
|
+
export type AccountNotificationAuthor = {
|
|
42
|
+
id?: Id;
|
|
43
|
+
name?: string;
|
|
44
|
+
} | null;
|
|
45
|
+
/**
|
|
46
|
+
* Form body of the create and update global notification operations. The
|
|
47
|
+
* nested `account_notification[...]` keys are sent flat, exactly as
|
|
48
|
+
* Canvas documents them.
|
|
49
|
+
*/
|
|
50
|
+
export interface AccountNotificationForm {
|
|
51
|
+
/** The subject of the notification. */
|
|
52
|
+
'account_notification[subject]'?: string;
|
|
53
|
+
/** The message body of the notification. */
|
|
54
|
+
'account_notification[message]'?: string;
|
|
55
|
+
/** When to start showing the notification. */
|
|
56
|
+
'account_notification[start_at]'?: string;
|
|
57
|
+
/** When to stop showing the notification. */
|
|
58
|
+
'account_notification[end_at]'?: string;
|
|
59
|
+
/** The icon to display with the notification. */
|
|
60
|
+
'account_notification[icon]'?: AccountNotificationFormAccountNotificationIcon;
|
|
61
|
+
/**
|
|
62
|
+
* Roles to send the notification to, by role id or role name.
|
|
63
|
+
* Omitting this sends to everyone.
|
|
64
|
+
*/
|
|
65
|
+
'account_notification_roles[]'?: string[];
|
|
66
|
+
/**
|
|
67
|
+
* Cohorts to send the notification to. Active members of these
|
|
68
|
+
* cohorts and of every cohort beneath them see it. Added by the
|
|
69
|
+
* cohorts feature; sending an empty array on update clears cohort
|
|
70
|
+
* targeting.
|
|
71
|
+
*/
|
|
72
|
+
'account_notification_cohort_ids[]'?: Id[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The icon to display with the notification.
|
|
76
|
+
*/
|
|
77
|
+
export type AccountNotificationFormAccountNotificationIcon = (typeof AccountNotificationFormAccountNotificationIcon)[keyof typeof AccountNotificationFormAccountNotificationIcon];
|
|
78
|
+
export declare const AccountNotificationFormAccountNotificationIcon: {
|
|
79
|
+
readonly warning: "warning";
|
|
80
|
+
readonly information: "information";
|
|
81
|
+
readonly question: "question";
|
|
82
|
+
readonly error: "error";
|
|
83
|
+
readonly calendar: "calendar";
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* The icon to display with the message. Defaults to warning.
|
|
87
|
+
*/
|
|
88
|
+
export type AccountNotificationIcon = (typeof AccountNotificationIcon)[keyof typeof AccountNotificationIcon];
|
|
89
|
+
export declare const AccountNotificationIcon: {
|
|
90
|
+
readonly warning: "warning";
|
|
91
|
+
readonly information: "information";
|
|
92
|
+
readonly question: "question";
|
|
93
|
+
readonly error: "error";
|
|
94
|
+
readonly calendar: "calendar";
|
|
95
|
+
};
|
|
96
|
+
export type AddCohortEnrollmentScopeBody = {
|
|
97
|
+
scopable_type: AddCohortEnrollmentScopeBodyScopableType;
|
|
98
|
+
/** Id of the course, account, collection, or program. */
|
|
99
|
+
scopable_id: string;
|
|
100
|
+
/**
|
|
101
|
+
* Optional. Omitting it stores `false`. Any non-boolean
|
|
102
|
+
* value, including `null` or the string `"true"`, is
|
|
103
|
+
* rejected with `400`.
|
|
104
|
+
*/
|
|
105
|
+
applies_to_descendants?: boolean;
|
|
106
|
+
};
|
|
107
|
+
export type AddCohortEnrollmentScopeBodyScopableType = (typeof AddCohortEnrollmentScopeBodyScopableType)[keyof typeof AddCohortEnrollmentScopeBodyScopableType];
|
|
108
|
+
export declare const AddCohortEnrollmentScopeBodyScopableType: {
|
|
109
|
+
readonly course: "course";
|
|
110
|
+
readonly account: "account";
|
|
111
|
+
readonly collection: "collection";
|
|
112
|
+
readonly program: "program";
|
|
113
|
+
};
|
|
114
|
+
export type AddCohortLeaderBody = {
|
|
115
|
+
/** Id of an existing user in this root account. */
|
|
116
|
+
user_id: Id;
|
|
117
|
+
/**
|
|
118
|
+
* A role whose base type is `CohortLeader`. Defaults to the
|
|
119
|
+
* built-in Cohort Leader role.
|
|
120
|
+
*/
|
|
121
|
+
role_id?: Id;
|
|
122
|
+
};
|
|
123
|
+
export type AddCohortMembersBody = {
|
|
124
|
+
/**
|
|
125
|
+
* Ids of existing users to add. At most 500 per request.
|
|
126
|
+
* @minItems 1
|
|
127
|
+
* @maxItems 500
|
|
128
|
+
*/
|
|
129
|
+
user_ids: Id[];
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Outcome of an add-members request. Ids that could not be added are
|
|
133
|
+
* reported rather than failing the whole request.
|
|
134
|
+
*/
|
|
135
|
+
export interface AddMembersResult {
|
|
136
|
+
added: CohortMembership[];
|
|
137
|
+
skipped: AddMembersResultSkippedItem[];
|
|
138
|
+
}
|
|
139
|
+
export type AddMembersResultSkippedItem = {
|
|
140
|
+
user_id: Id;
|
|
141
|
+
reason: AddMembersResultSkippedItemReason;
|
|
142
|
+
};
|
|
143
|
+
export type AddMembersResultSkippedItemReason = (typeof AddMembersResultSkippedItemReason)[keyof typeof AddMembersResultSkippedItemReason];
|
|
144
|
+
export declare const AddMembersResultSkippedItemReason: {
|
|
145
|
+
readonly already_member: "already_member";
|
|
146
|
+
readonly user_not_found: "user_not_found";
|
|
147
|
+
readonly user_not_in_root_account: "user_not_in_root_account";
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* The request was rejected.
|
|
151
|
+
*/
|
|
152
|
+
export type BadRequestResponse = Error | ValidationError;
|
|
153
|
+
/**
|
|
154
|
+
* Form body of the Canvas bulk enrolment operation, with the two
|
|
155
|
+
* cohort parameters added. Identical under either form encoding.
|
|
156
|
+
*/
|
|
157
|
+
export type BulkEnrollmentForm = unknown & {
|
|
158
|
+
/**
|
|
159
|
+
* Ids of the users to enrol. Required unless `cohort_ids[]`
|
|
160
|
+
* is given.
|
|
161
|
+
*/
|
|
162
|
+
'user_ids[]'?: Id[];
|
|
163
|
+
/**
|
|
164
|
+
* Ids of the courses to enrol each user in.
|
|
165
|
+
* @minItems 1
|
|
166
|
+
*/
|
|
167
|
+
'course_ids[]': Id[];
|
|
168
|
+
/**
|
|
169
|
+
* Enrol each user as a student, teacher, TA, observer, or
|
|
170
|
+
* designer. When `enrollment_role_id` is given, this must
|
|
171
|
+
* match that role's base type, and when omitted alongside
|
|
172
|
+
* `enrollment_role_id` Canvas derives it from that role's base
|
|
173
|
+
* type instead of applying the default.
|
|
174
|
+
*/
|
|
175
|
+
enrollment_type?: BulkEnrollmentFormEnrollmentType;
|
|
176
|
+
/** Custom course-level role to apply to the created enrolments. */
|
|
177
|
+
enrollment_role_id?: Id;
|
|
178
|
+
/**
|
|
179
|
+
* Pre-existing Canvas bulk_enrollment parameter. Canvas accepts it
|
|
180
|
+
* and ignores it; it has no effect on the enrolment created. Use
|
|
181
|
+
* `cohort_ids[]` to target cohorts.
|
|
182
|
+
* @deprecated
|
|
183
|
+
*/
|
|
184
|
+
cohort?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Existing Canvas bulk_enrollment parameter controlling
|
|
187
|
+
* whether each enrolled user is notified.
|
|
188
|
+
*/
|
|
189
|
+
notify?: boolean;
|
|
190
|
+
/** Start time applied to every created enrolment. */
|
|
191
|
+
start_at?: string;
|
|
192
|
+
/** End time applied to every created enrolment. */
|
|
193
|
+
end_at?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Cohorts whose active members should be enrolled. Added by
|
|
196
|
+
* the cohorts feature.
|
|
197
|
+
*/
|
|
198
|
+
'cohort_ids[]'?: Id[];
|
|
199
|
+
/**
|
|
200
|
+
* Also enrol the active members of every cohort beneath each
|
|
201
|
+
* listed cohort. Added by the cohorts feature.
|
|
202
|
+
*/
|
|
203
|
+
include_descendant_cohorts?: boolean;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Enrol each user as a student, teacher, TA, observer, or
|
|
207
|
+
* designer. When `enrollment_role_id` is given, this must
|
|
208
|
+
* match that role's base type, and when omitted alongside
|
|
209
|
+
* `enrollment_role_id` Canvas derives it from that role's base
|
|
210
|
+
* type instead of applying the default.
|
|
211
|
+
*/
|
|
212
|
+
export type BulkEnrollmentFormEnrollmentType = (typeof BulkEnrollmentFormEnrollmentType)[keyof typeof BulkEnrollmentFormEnrollmentType];
|
|
213
|
+
export declare const BulkEnrollmentFormEnrollmentType: {
|
|
214
|
+
readonly StudentEnrollment: "StudentEnrollment";
|
|
215
|
+
readonly TeacherEnrollment: "TeacherEnrollment";
|
|
216
|
+
readonly TaEnrollment: "TaEnrollment";
|
|
217
|
+
readonly ObserverEnrollment: "ObserverEnrollment";
|
|
218
|
+
readonly DesignerEnrollment: "DesignerEnrollment";
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* A group of people placed in a Canvas account.
|
|
222
|
+
*/
|
|
223
|
+
export interface Cohort {
|
|
224
|
+
id: Id;
|
|
225
|
+
/**
|
|
226
|
+
* Root account at the top of `account_id`'s account hierarchy.
|
|
227
|
+
* Equal to `account_id` when the cohort is placed in the root
|
|
228
|
+
* account itself. The same value for every cohort in one
|
|
229
|
+
* parent/child hierarchy.
|
|
230
|
+
*/
|
|
231
|
+
root_account_id: Id;
|
|
232
|
+
/**
|
|
233
|
+
* Root cohort at the top of this cohort's hierarchy tree: the
|
|
234
|
+
* ancestor whose own `parent_cohort_id` is null. Equal to `id`
|
|
235
|
+
* when this cohort is itself a root. A client walks up to the
|
|
236
|
+
* root structurally by fetching this id, with no dedicated route.
|
|
237
|
+
*/
|
|
238
|
+
root_cohort_id: Id;
|
|
239
|
+
/**
|
|
240
|
+
* The account the cohort is placed in, a root account or a
|
|
241
|
+
* sub-account.
|
|
242
|
+
*/
|
|
243
|
+
account_id: Id;
|
|
244
|
+
/**
|
|
245
|
+
* Cohort one level above this one. Null only for a root cohort,
|
|
246
|
+
* the anchor of a hierarchy tree. An account may anchor several
|
|
247
|
+
* independent root cohorts; see **Account scoping** in the API
|
|
248
|
+
* description.
|
|
249
|
+
*/
|
|
250
|
+
parent_cohort_id: Id | null;
|
|
251
|
+
/**
|
|
252
|
+
* @minLength 1
|
|
253
|
+
* @maxLength 255
|
|
254
|
+
*/
|
|
255
|
+
name: string;
|
|
256
|
+
/**
|
|
257
|
+
* Free-text description of the cohort.
|
|
258
|
+
* @nullable
|
|
259
|
+
*/
|
|
260
|
+
description?: string | null;
|
|
261
|
+
/**
|
|
262
|
+
* Level in the hierarchy. The root cohort is 1.
|
|
263
|
+
* @minimum 1
|
|
264
|
+
* @maximum 10
|
|
265
|
+
*/
|
|
266
|
+
depth: number;
|
|
267
|
+
workflow_state: WorkflowState;
|
|
268
|
+
/**
|
|
269
|
+
* Unique SIS identifier within the root account.
|
|
270
|
+
* @maxLength 255
|
|
271
|
+
* @nullable
|
|
272
|
+
*/
|
|
273
|
+
sis_source_id?: string | null;
|
|
274
|
+
/** SIS import that last touched this cohort, if any. */
|
|
275
|
+
sis_batch_id?: Id | null;
|
|
276
|
+
/**
|
|
277
|
+
* Fields last changed outside SIS. A subsequent SIS import leaves
|
|
278
|
+
* these alone unless it explicitly overrides stickiness.
|
|
279
|
+
*/
|
|
280
|
+
stuck_sis_fields?: string[];
|
|
281
|
+
created_at: string;
|
|
282
|
+
updated_at: string;
|
|
283
|
+
/**
|
|
284
|
+
* Active members of this cohort. Present with `include[]=member_count`.
|
|
285
|
+
* @minimum 0
|
|
286
|
+
*/
|
|
287
|
+
member_count?: number;
|
|
288
|
+
/**
|
|
289
|
+
* Active leaders of this cohort. Present with `include[]=leader_count`.
|
|
290
|
+
* @minimum 0
|
|
291
|
+
*/
|
|
292
|
+
leader_count?: number;
|
|
293
|
+
/**
|
|
294
|
+
* Active cohorts one level below this one. Present with
|
|
295
|
+
* `include[]=child_count`.
|
|
296
|
+
* @minimum 0
|
|
297
|
+
*/
|
|
298
|
+
child_count?: number;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* One course, account, collection, or program an admin has opted into
|
|
302
|
+
* a cohort's enrollment reach. Purely an allow-list entry: it grants no
|
|
303
|
+
* enrollment by itself and carries no `workflow_state`.
|
|
304
|
+
*/
|
|
305
|
+
export interface CohortEnrollmentScope {
|
|
306
|
+
id: Id;
|
|
307
|
+
cohort_id: Id;
|
|
308
|
+
/** Kind of resource this scope grants enrollment reach into. */
|
|
309
|
+
scopable_type: CohortEnrollmentScopeScopableType;
|
|
310
|
+
/**
|
|
311
|
+
* Stored per scope row, never per cohort. Always present in the
|
|
312
|
+
* response.
|
|
313
|
+
*
|
|
314
|
+
* Defaults to `false`. This is the opposite of Canvas
|
|
315
|
+
* `role_overrides.applies_to_descendants`, which defaults to
|
|
316
|
+
* `true`. A scope created without this field, or from a blank SIS
|
|
317
|
+
* CSV cell, does not cascade.
|
|
318
|
+
*
|
|
319
|
+
* Only meaningful on an `account` scope. On a `course`, `program`,
|
|
320
|
+
* or `collection` scope it is accepted, stored, and returned, but
|
|
321
|
+
* has no effect.
|
|
322
|
+
*
|
|
323
|
+
* What an `account` scope reaches when this is `true` is not yet
|
|
324
|
+
* settled: either the sub-accounts beneath that account, or the
|
|
325
|
+
* cohort's child cohorts. Until this contract names one, a server
|
|
326
|
+
* stores and returns the value but does not resolve any cascade
|
|
327
|
+
* from it.
|
|
328
|
+
*/
|
|
329
|
+
applies_to_descendants: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Id of the course, account, collection, or program. Course and
|
|
332
|
+
* account ids are Canvas ids; collection and program ids are
|
|
333
|
+
* Journey ids. Serialised as a string either way, since the two id
|
|
334
|
+
* spaces don't share a type.
|
|
335
|
+
*/
|
|
336
|
+
scopable_id: string;
|
|
337
|
+
created_at: string;
|
|
338
|
+
updated_at: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Kind of resource this scope grants enrollment reach into.
|
|
342
|
+
*/
|
|
343
|
+
export type CohortEnrollmentScopeScopableType = (typeof CohortEnrollmentScopeScopableType)[keyof typeof CohortEnrollmentScopeScopableType];
|
|
344
|
+
export declare const CohortEnrollmentScopeScopableType: {
|
|
345
|
+
readonly course: "course";
|
|
346
|
+
readonly account: "account";
|
|
347
|
+
readonly collection: "collection";
|
|
348
|
+
readonly program: "program";
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* A leader assignment. The rights it grants (managing membership of the
|
|
352
|
+
* cohort, and no content editing) always reach every cohort beneath the
|
|
353
|
+
* one the assignment lives on.
|
|
354
|
+
*/
|
|
355
|
+
export interface CohortLeader {
|
|
356
|
+
/** Id of the assignment itself, used to remove it. */
|
|
357
|
+
id: Id;
|
|
358
|
+
/** Cohort this assignment was returned for. */
|
|
359
|
+
cohort_id: Id;
|
|
360
|
+
user_id: Id;
|
|
361
|
+
root_account_id: Id;
|
|
362
|
+
role_id: Id;
|
|
363
|
+
role: CohortLeaderRole;
|
|
364
|
+
/**
|
|
365
|
+
* Always true. A leader's rights cannot be confined to a single
|
|
366
|
+
* level of the hierarchy.
|
|
367
|
+
*
|
|
368
|
+
* Which cohorts an assignment reaches is resolved live against the
|
|
369
|
+
* current `parent_cohort_id` chain at request time. An
|
|
370
|
+
* implementation may instead maintain a cache or closure table of
|
|
371
|
+
* descendants, but only if it is invalidated within the same
|
|
372
|
+
* transaction that commits a delete (`deleteCohort`), so no
|
|
373
|
+
* request can ever observe a stale ancestor chain.
|
|
374
|
+
*/
|
|
375
|
+
applies_to_descendants: true;
|
|
376
|
+
/**
|
|
377
|
+
* True when this assignment lives on an ancestor and was returned
|
|
378
|
+
* because of `include_inherited`. Remove it from `source_cohort_id`,
|
|
379
|
+
* not from `cohort_id`.
|
|
380
|
+
*/
|
|
381
|
+
inherited: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Cohort the assignment actually lives on. Equal to `cohort_id`
|
|
384
|
+
* unless `inherited` is true.
|
|
385
|
+
*/
|
|
386
|
+
source_cohort_id: Id;
|
|
387
|
+
workflow_state: WorkflowState;
|
|
388
|
+
created_at: string;
|
|
389
|
+
updated_at: string;
|
|
390
|
+
user?: UserDisplay;
|
|
391
|
+
}
|
|
392
|
+
export type CohortLeaderRole = {
|
|
393
|
+
id: Id;
|
|
394
|
+
label: string;
|
|
395
|
+
base_role_type: 'CohortLeader';
|
|
396
|
+
};
|
|
397
|
+
/**
|
|
398
|
+
* One person's place in one cohort.
|
|
399
|
+
*/
|
|
400
|
+
export interface CohortMembership {
|
|
401
|
+
id: Id;
|
|
402
|
+
cohort_id: Id;
|
|
403
|
+
user_id: Id;
|
|
404
|
+
root_account_id: Id;
|
|
405
|
+
workflow_state: WorkflowState;
|
|
406
|
+
sis_batch_id?: Id | null;
|
|
407
|
+
created_at: string;
|
|
408
|
+
updated_at: string;
|
|
409
|
+
/**
|
|
410
|
+
* When the member was last active in Canvas, as shown in the
|
|
411
|
+
* members list "Last active" column and sortable via
|
|
412
|
+
* `sort=last_activity_at`. Null when no activity has been
|
|
413
|
+
* recorded for the user.
|
|
414
|
+
* @nullable
|
|
415
|
+
*/
|
|
416
|
+
last_activity_at?: string | null;
|
|
417
|
+
/**
|
|
418
|
+
* True when this member also holds an active leader assignment
|
|
419
|
+
* on this cohort or on one of its ancestors, so the members list
|
|
420
|
+
* can badge them as a Leader without a second call. Reflects
|
|
421
|
+
* leadership that reaches this cohort, not membership.
|
|
422
|
+
*/
|
|
423
|
+
is_leader?: boolean;
|
|
424
|
+
/**
|
|
425
|
+
* The member's role label as shown in the members list "Role"
|
|
426
|
+
* column. Null when the member has no role to display. This is a
|
|
427
|
+
* display-only label; a `CohortMembership` carries no permissions
|
|
428
|
+
* of its own.
|
|
429
|
+
* @nullable
|
|
430
|
+
*/
|
|
431
|
+
role?: CohortMembershipRole;
|
|
432
|
+
/**
|
|
433
|
+
* Included by default so lists are renderable without a second
|
|
434
|
+
* call. Its identity fields are present by default; `sis_user_id`
|
|
435
|
+
* and `login_id` appear only under the permission rules on
|
|
436
|
+
* `UserDisplay`.
|
|
437
|
+
*/
|
|
438
|
+
user?: UserDisplay;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* The member's role label as shown in the members list "Role"
|
|
442
|
+
* column. Null when the member has no role to display. This is a
|
|
443
|
+
* display-only label; a `CohortMembership` carries no permissions
|
|
444
|
+
* of its own.
|
|
445
|
+
* @nullable
|
|
446
|
+
*/
|
|
447
|
+
export type CohortMembershipRole = {
|
|
448
|
+
id?: Id | null;
|
|
449
|
+
label: string;
|
|
450
|
+
} | null;
|
|
451
|
+
/**
|
|
452
|
+
* A cohort and the subtree beneath it.
|
|
453
|
+
*/
|
|
454
|
+
export interface CohortTreeNode {
|
|
455
|
+
cohort: Cohort;
|
|
456
|
+
/** Active direct children, newest first, capped at 100 per node. */
|
|
457
|
+
children: CohortTreeNode[];
|
|
458
|
+
/**
|
|
459
|
+
* True when this node has children that the requested `depth` cut
|
|
460
|
+
* off. Fetch the subtree again from this node to see them.
|
|
461
|
+
*/
|
|
462
|
+
truncated: boolean;
|
|
463
|
+
/**
|
|
464
|
+
* True when this node has more than 100 active direct children and
|
|
465
|
+
* `children` holds only the first 100. Call `listCohorts` with
|
|
466
|
+
* `parent_cohort_id` set to this node's cohort id for the complete
|
|
467
|
+
* set. Independent of `truncated`: either, both, or neither may be
|
|
468
|
+
* true.
|
|
469
|
+
*/
|
|
470
|
+
children_truncated: boolean;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* The account notification form with the fields Canvas requires on
|
|
474
|
+
* create marked required.
|
|
475
|
+
*/
|
|
476
|
+
export type CreateAccountNotificationForm = AccountNotificationForm & {
|
|
477
|
+
[key: string]: unknown;
|
|
478
|
+
} & Required<Pick<AccountNotificationForm & {
|
|
479
|
+
[key: string]: unknown;
|
|
480
|
+
}, 'account_notification[subject]' | 'account_notification[message]' | 'account_notification[start_at]' | 'account_notification[end_at]'>>;
|
|
481
|
+
export type CreateCohortBody = {
|
|
482
|
+
cohort: CreateCohortBodyCohort;
|
|
483
|
+
};
|
|
484
|
+
export type CreateCohortBodyCohort = {
|
|
485
|
+
/**
|
|
486
|
+
* Display name of the cohort.
|
|
487
|
+
* @minLength 1
|
|
488
|
+
* @maxLength 255
|
|
489
|
+
*/
|
|
490
|
+
name: string;
|
|
491
|
+
/** Free-text description of the cohort. */
|
|
492
|
+
description?: string;
|
|
493
|
+
/**
|
|
494
|
+
* Cohort to nest the new cohort under. Null creates a
|
|
495
|
+
* root cohort instead, with no parent.
|
|
496
|
+
*/
|
|
497
|
+
parent_cohort_id: Id | null;
|
|
498
|
+
/**
|
|
499
|
+
* Unique SIS identifier for the cohort within the root account.
|
|
500
|
+
* @maxLength 255
|
|
501
|
+
*/
|
|
502
|
+
sis_source_id?: string;
|
|
503
|
+
};
|
|
504
|
+
/**
|
|
505
|
+
* One course enrollment, as returned by the Canvas List Enrollments
|
|
506
|
+
* operation. This contract lists the subset of fields the cohort
|
|
507
|
+
* Enrollments tab renders; a live Canvas response carries more, and a
|
|
508
|
+
* client should tolerate additional properties. This is a plain Canvas
|
|
509
|
+
* enrollment and holds no cohort reference.
|
|
510
|
+
*/
|
|
511
|
+
export interface Enrollment {
|
|
512
|
+
id: Id;
|
|
513
|
+
user_id: Id;
|
|
514
|
+
course_id: Id;
|
|
515
|
+
course_section_id?: Id;
|
|
516
|
+
root_account_id: Id;
|
|
517
|
+
type: EnrollmentType;
|
|
518
|
+
/** Enrollment role name, a base type or a custom course-level role. */
|
|
519
|
+
role: string;
|
|
520
|
+
role_id: Id;
|
|
521
|
+
enrollment_state: EnrollmentEnrollmentState;
|
|
522
|
+
created_at: string;
|
|
523
|
+
updated_at: string;
|
|
524
|
+
/** @nullable */
|
|
525
|
+
last_activity_at?: string | null;
|
|
526
|
+
/**
|
|
527
|
+
* The enrolled user. Included by default so the tab renders without
|
|
528
|
+
* a second call, following the Canvas List Enrollments default.
|
|
529
|
+
*/
|
|
530
|
+
user?: UserDisplay;
|
|
531
|
+
}
|
|
532
|
+
export type EnrollmentEnrollmentState = (typeof EnrollmentEnrollmentState)[keyof typeof EnrollmentEnrollmentState];
|
|
533
|
+
export declare const EnrollmentEnrollmentState: {
|
|
534
|
+
readonly active: "active";
|
|
535
|
+
readonly invited: "invited";
|
|
536
|
+
readonly creation_pending: "creation_pending";
|
|
537
|
+
readonly deleted: "deleted";
|
|
538
|
+
readonly rejected: "rejected";
|
|
539
|
+
readonly completed: "completed";
|
|
540
|
+
readonly inactive: "inactive";
|
|
541
|
+
};
|
|
542
|
+
export type EnrollmentType = (typeof EnrollmentType)[keyof typeof EnrollmentType];
|
|
543
|
+
export declare const EnrollmentType: {
|
|
544
|
+
readonly StudentEnrollment: "StudentEnrollment";
|
|
545
|
+
readonly TeacherEnrollment: "TeacherEnrollment";
|
|
546
|
+
readonly TaEnrollment: "TaEnrollment";
|
|
547
|
+
readonly ObserverEnrollment: "ObserverEnrollment";
|
|
548
|
+
readonly DesignerEnrollment: "DesignerEnrollment";
|
|
549
|
+
};
|
|
550
|
+
/**
|
|
551
|
+
* The general Canvas error shape. `error_code` is present when the
|
|
552
|
+
* failure has a machine-readable cause; clients should branch on it
|
|
553
|
+
* rather than on `message`, which is localised.
|
|
554
|
+
*/
|
|
555
|
+
export interface CohortsApiError {
|
|
556
|
+
/** @minItems 1 */
|
|
557
|
+
errors: ErrorErrorsItem[];
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Machine-readable cause of a rejected cohort request.
|
|
561
|
+
*/
|
|
562
|
+
export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
563
|
+
export declare const ErrorCode: {
|
|
564
|
+
readonly feature_disabled: "feature_disabled";
|
|
565
|
+
readonly max_depth_exceeded: "max_depth_exceeded";
|
|
566
|
+
readonly max_cohorts_exceeded: "max_cohorts_exceeded";
|
|
567
|
+
readonly max_members_exceeded: "max_members_exceeded";
|
|
568
|
+
readonly cohort_has_children: "cohort_has_children";
|
|
569
|
+
readonly invalid_role: "invalid_role";
|
|
570
|
+
readonly too_many_enrollments: "too_many_enrollments";
|
|
571
|
+
readonly duplicate_scope: "duplicate_scope";
|
|
572
|
+
};
|
|
573
|
+
export type ErrorErrorsItem = {
|
|
574
|
+
message: string;
|
|
575
|
+
error_code?: ErrorCode;
|
|
576
|
+
};
|
|
577
|
+
/**
|
|
578
|
+
* Both grant sources were evaluated for this cohort and neither
|
|
579
|
+
* conveyed the required permission: no role the caller holds in an
|
|
580
|
+
* account this cohort is in or any account above it carries it, and no
|
|
581
|
+
* Leader assignment on this cohort or on one of its ancestors carries
|
|
582
|
+
* it either. See **Authorization** in the API description for how the
|
|
583
|
+
* two combine.
|
|
584
|
+
*/
|
|
585
|
+
export type ForbiddenResponse = UnauthorizedError;
|
|
586
|
+
export type GetCohort200 = Cohort & {
|
|
587
|
+
/**
|
|
588
|
+
* Present when requested via `include[]=ancestors`.
|
|
589
|
+
* Ordered root first, excluding the cohort itself.
|
|
590
|
+
*/
|
|
591
|
+
ancestors?: Cohort[];
|
|
592
|
+
};
|
|
593
|
+
export type GetCohortIncludeItem = (typeof GetCohortIncludeItem)[keyof typeof GetCohortIncludeItem];
|
|
594
|
+
export declare const GetCohortIncludeItem: {
|
|
595
|
+
readonly member_count: "member_count";
|
|
596
|
+
readonly leader_count: "leader_count";
|
|
597
|
+
readonly child_count: "child_count";
|
|
598
|
+
readonly ancestors: "ancestors";
|
|
599
|
+
};
|
|
600
|
+
export type GetCohortParams = {
|
|
601
|
+
/**
|
|
602
|
+
* Extra data to compute for the cohort. `ancestors` adds the chain of
|
|
603
|
+
* cohorts from the root down to the parent, root first. The
|
|
604
|
+
* permission is evaluated on the named cohort only; the ancestor
|
|
605
|
+
* chain is returned on the read reach set out under
|
|
606
|
+
* **Authorization**.
|
|
607
|
+
*/
|
|
608
|
+
'include[]'?: GetCohortIncludeItem[];
|
|
609
|
+
};
|
|
610
|
+
export type GetCohortTreeParams = {
|
|
611
|
+
/**
|
|
612
|
+
* How many levels of the tree to return, counting the requested
|
|
613
|
+
* cohort as level 1. `1` returns the cohort with no children.
|
|
614
|
+
* Defaults to `2`: the cohort and its direct children, so a client
|
|
615
|
+
* expands one level at a time unless it asks for more. `10` returns
|
|
616
|
+
* the full hierarchy.
|
|
617
|
+
* @minimum 1
|
|
618
|
+
* @maximum 10
|
|
619
|
+
*/
|
|
620
|
+
depth?: number;
|
|
621
|
+
};
|
|
622
|
+
/**
|
|
623
|
+
* A Canvas id. Serialised as a JSON string instead when the request
|
|
624
|
+
* carries `Accept: application/json+canvas-string-ids`, so clients should
|
|
625
|
+
* accept both an integer and a numeric string here.
|
|
626
|
+
*/
|
|
627
|
+
export type Id = number;
|
|
628
|
+
/**
|
|
629
|
+
* Extra data to compute for each cohort. Each value costs an extra
|
|
630
|
+
* aggregate, so ask only for what you display.
|
|
631
|
+
*/
|
|
632
|
+
export type IncludeParameter = IncludeParameterItem[];
|
|
633
|
+
export type IncludeParameterItem = (typeof IncludeParameterItem)[keyof typeof IncludeParameterItem];
|
|
634
|
+
export declare const IncludeParameterItem: {
|
|
635
|
+
readonly member_count: "member_count";
|
|
636
|
+
readonly leader_count: "leader_count";
|
|
637
|
+
readonly child_count: "child_count";
|
|
638
|
+
};
|
|
639
|
+
/**
|
|
640
|
+
* The error shape the existing Canvas bulk enrolment validation emits
|
|
641
|
+
* today: one human-readable string, no error code. Only validation
|
|
642
|
+
* that predates the cohorts feature uses it.
|
|
643
|
+
*/
|
|
644
|
+
export interface LegacyStringError {
|
|
645
|
+
errors: string;
|
|
646
|
+
}
|
|
647
|
+
export type ListCohortEnrollmentScopesParams = {
|
|
648
|
+
/**
|
|
649
|
+
* Restrict to scopes of these kinds. Omitting returns every kind.
|
|
650
|
+
*/
|
|
651
|
+
'scopable_type[]'?: ListCohortEnrollmentScopesScopableTypeItem[];
|
|
652
|
+
/**
|
|
653
|
+
* Field to sort enrollment scopes by. Defaults to `created_at`.
|
|
654
|
+
*/
|
|
655
|
+
sort?: SortCohortEnrollmentScopesParameter;
|
|
656
|
+
/**
|
|
657
|
+
* Direction to sort in, applied to whichever field `sort` names.
|
|
658
|
+
* Defaults to `desc`. Ties on a non-unique sort field break by id
|
|
659
|
+
* ascending, so pagination stays stable across pages even when sorting
|
|
660
|
+
* by a non-unique field like `name` or `workflow_state`.
|
|
661
|
+
*/
|
|
662
|
+
order?: OrderParameter;
|
|
663
|
+
/**
|
|
664
|
+
* Page of results to return. Prefer following the `Link` header.
|
|
665
|
+
* @minimum 1
|
|
666
|
+
*/
|
|
667
|
+
page?: PageParameter;
|
|
668
|
+
/**
|
|
669
|
+
* Results per page.
|
|
670
|
+
* @minimum 1
|
|
671
|
+
* @maximum 100
|
|
672
|
+
*/
|
|
673
|
+
per_page?: PerPageParameter;
|
|
674
|
+
};
|
|
675
|
+
export type ListCohortEnrollmentScopesScopableTypeItem = (typeof ListCohortEnrollmentScopesScopableTypeItem)[keyof typeof ListCohortEnrollmentScopesScopableTypeItem];
|
|
676
|
+
export declare const ListCohortEnrollmentScopesScopableTypeItem: {
|
|
677
|
+
readonly course: "course";
|
|
678
|
+
readonly account: "account";
|
|
679
|
+
readonly collection: "collection";
|
|
680
|
+
readonly program: "program";
|
|
681
|
+
};
|
|
682
|
+
export type ListCohortEnrollmentsParams = {
|
|
683
|
+
/**
|
|
684
|
+
* Partial, case-insensitive match against the name of the resource.
|
|
685
|
+
* Shorter than two characters is rejected.
|
|
686
|
+
* @minLength 2
|
|
687
|
+
*/
|
|
688
|
+
search_term?: SearchTermParameter;
|
|
689
|
+
/**
|
|
690
|
+
* Also list the enrollments of members of cohorts beneath this
|
|
691
|
+
* one, de-duplicated by user.
|
|
692
|
+
*/
|
|
693
|
+
include_descendants?: boolean;
|
|
694
|
+
/**
|
|
695
|
+
* Enrollment types to return. Omitting returns every type. Matches
|
|
696
|
+
* the Canvas List Enrollments `type[]` filter.
|
|
697
|
+
*/
|
|
698
|
+
'type[]'?: ListCohortEnrollmentsTypeItem[];
|
|
699
|
+
/**
|
|
700
|
+
* Enrollment states to return. Defaults to `active` and `invited`,
|
|
701
|
+
* matching the Canvas List Enrollments `state[]` filter.
|
|
702
|
+
*/
|
|
703
|
+
'state[]'?: ListCohortEnrollmentsStateItem[];
|
|
704
|
+
/**
|
|
705
|
+
* Field to sort enrollments by. Defaults to `created_at`. The
|
|
706
|
+
* `user_name` and `user_sortable_name` values sort on the enrolled
|
|
707
|
+
* user's `UserDisplay` field, same as members.
|
|
708
|
+
*/
|
|
709
|
+
sort?: SortCohortEnrollmentsParameter;
|
|
710
|
+
/**
|
|
711
|
+
* Direction to sort in, applied to whichever field `sort` names.
|
|
712
|
+
* Defaults to `desc`. Ties on a non-unique sort field break by id
|
|
713
|
+
* ascending, so pagination stays stable across pages even when sorting
|
|
714
|
+
* by a non-unique field like `name` or `workflow_state`.
|
|
715
|
+
*/
|
|
716
|
+
order?: OrderParameter;
|
|
717
|
+
/**
|
|
718
|
+
* Page of results to return. Prefer following the `Link` header.
|
|
719
|
+
* @minimum 1
|
|
720
|
+
*/
|
|
721
|
+
page?: PageParameter;
|
|
722
|
+
/**
|
|
723
|
+
* Results per page.
|
|
724
|
+
* @minimum 1
|
|
725
|
+
* @maximum 100
|
|
726
|
+
*/
|
|
727
|
+
per_page?: PerPageParameter;
|
|
728
|
+
};
|
|
729
|
+
export type ListCohortEnrollmentsStateItem = (typeof ListCohortEnrollmentsStateItem)[keyof typeof ListCohortEnrollmentsStateItem];
|
|
730
|
+
export declare const ListCohortEnrollmentsStateItem: {
|
|
731
|
+
readonly active: "active";
|
|
732
|
+
readonly invited: "invited";
|
|
733
|
+
readonly creation_pending: "creation_pending";
|
|
734
|
+
readonly deleted: "deleted";
|
|
735
|
+
readonly rejected: "rejected";
|
|
736
|
+
readonly completed: "completed";
|
|
737
|
+
readonly inactive: "inactive";
|
|
738
|
+
};
|
|
739
|
+
export type ListCohortEnrollmentsTypeItem = (typeof ListCohortEnrollmentsTypeItem)[keyof typeof ListCohortEnrollmentsTypeItem];
|
|
740
|
+
export declare const ListCohortEnrollmentsTypeItem: {
|
|
741
|
+
readonly StudentEnrollment: "StudentEnrollment";
|
|
742
|
+
readonly TeacherEnrollment: "TeacherEnrollment";
|
|
743
|
+
readonly TaEnrollment: "TaEnrollment";
|
|
744
|
+
readonly ObserverEnrollment: "ObserverEnrollment";
|
|
745
|
+
readonly DesignerEnrollment: "DesignerEnrollment";
|
|
746
|
+
};
|
|
747
|
+
export type ListCohortLeadersParams = {
|
|
748
|
+
/**
|
|
749
|
+
* Also return Leaders assigned to ancestor cohorts. The permission
|
|
750
|
+
* is evaluated on the named cohort only; the ancestor read reach is
|
|
751
|
+
* set out under **Authorization**.
|
|
752
|
+
*/
|
|
753
|
+
include_inherited?: boolean;
|
|
754
|
+
/**
|
|
755
|
+
* Field to sort leader assignments by. Defaults to `created_at`. The
|
|
756
|
+
* `user_name` and `user_sortable_name` values sort on the nested user
|
|
757
|
+
* record's corresponding `UserDisplay` field, same as members.
|
|
758
|
+
*/
|
|
759
|
+
sort?: SortCohortLeadersParameter;
|
|
760
|
+
/**
|
|
761
|
+
* Direction to sort in, applied to whichever field `sort` names.
|
|
762
|
+
* Defaults to `desc`. Ties on a non-unique sort field break by id
|
|
763
|
+
* ascending, so pagination stays stable across pages even when sorting
|
|
764
|
+
* by a non-unique field like `name` or `workflow_state`.
|
|
765
|
+
*/
|
|
766
|
+
order?: OrderParameter;
|
|
767
|
+
/**
|
|
768
|
+
* Page of results to return. Prefer following the `Link` header.
|
|
769
|
+
* @minimum 1
|
|
770
|
+
*/
|
|
771
|
+
page?: PageParameter;
|
|
772
|
+
/**
|
|
773
|
+
* Results per page.
|
|
774
|
+
* @minimum 1
|
|
775
|
+
* @maximum 100
|
|
776
|
+
*/
|
|
777
|
+
per_page?: PerPageParameter;
|
|
778
|
+
};
|
|
779
|
+
export type ListCohortMembersParams = {
|
|
780
|
+
/**
|
|
781
|
+
* Partial, case-insensitive match against the name of the resource.
|
|
782
|
+
* Shorter than two characters is rejected.
|
|
783
|
+
* @minLength 2
|
|
784
|
+
*/
|
|
785
|
+
search_term?: SearchTermParameter;
|
|
786
|
+
/**
|
|
787
|
+
* Also return members of cohorts beneath this one. The permission
|
|
788
|
+
* is evaluated on the named cohort only; the descendant reach is
|
|
789
|
+
* set out under **Authorization**.
|
|
790
|
+
*/
|
|
791
|
+
include_descendants?: boolean;
|
|
792
|
+
/**
|
|
793
|
+
* Which lifecycle states to return. Repeatable, matching the Canvas
|
|
794
|
+
* `workflow_state[]` list filter: `active`, `deleted`, or `all` for
|
|
795
|
+
* both. Defaults to `active` only.
|
|
796
|
+
*/
|
|
797
|
+
'workflow_state[]'?: WorkflowStateFilterParameter;
|
|
798
|
+
/**
|
|
799
|
+
* Field to sort memberships by. Defaults to `created_at`. The
|
|
800
|
+
* `user_name` and `user_sortable_name` values sort on the nested
|
|
801
|
+
* user record's corresponding `UserDisplay` field (`name`,
|
|
802
|
+
* `sortable_name`). `last_activity_at` sorts on the member's most
|
|
803
|
+
* recent activity; rows with no recorded activity sort last
|
|
804
|
+
* regardless of `order`.
|
|
805
|
+
*/
|
|
806
|
+
sort?: SortCohortMembersParameter;
|
|
807
|
+
/**
|
|
808
|
+
* Direction to sort in, applied to whichever field `sort` names.
|
|
809
|
+
* Defaults to `desc`. Ties on a non-unique sort field break by id
|
|
810
|
+
* ascending, so pagination stays stable across pages even when sorting
|
|
811
|
+
* by a non-unique field like `name` or `workflow_state`.
|
|
812
|
+
*/
|
|
813
|
+
order?: OrderParameter;
|
|
814
|
+
/**
|
|
815
|
+
* Page of results to return. Prefer following the `Link` header.
|
|
816
|
+
* @minimum 1
|
|
817
|
+
*/
|
|
818
|
+
page?: PageParameter;
|
|
819
|
+
/**
|
|
820
|
+
* Results per page.
|
|
821
|
+
* @minimum 1
|
|
822
|
+
* @maximum 100
|
|
823
|
+
*/
|
|
824
|
+
per_page?: PerPageParameter;
|
|
825
|
+
};
|
|
826
|
+
export type ListCohortsParams = {
|
|
827
|
+
/**
|
|
828
|
+
* Partial, case-insensitive match against the name of the resource.
|
|
829
|
+
* Shorter than two characters is rejected.
|
|
830
|
+
* @minLength 2
|
|
831
|
+
*/
|
|
832
|
+
search_term?: SearchTermParameter;
|
|
833
|
+
/**
|
|
834
|
+
* Return only the direct children of this cohort.
|
|
835
|
+
*/
|
|
836
|
+
parent_cohort_id?: Id;
|
|
837
|
+
/**
|
|
838
|
+
* Return only the parentless cohorts placed in this account.
|
|
839
|
+
* Mutually exclusive with `parent_cohort_id`.
|
|
840
|
+
*/
|
|
841
|
+
roots?: boolean;
|
|
842
|
+
/**
|
|
843
|
+
* Which lifecycle states to return. Repeatable, matching the Canvas
|
|
844
|
+
* `workflow_state[]` list filter: `active`, `deleted`, or `all` for
|
|
845
|
+
* both. Defaults to `active` only.
|
|
846
|
+
*/
|
|
847
|
+
'workflow_state[]'?: WorkflowStateFilterParameter;
|
|
848
|
+
/**
|
|
849
|
+
* Extra data to compute for each cohort. Each value costs an extra
|
|
850
|
+
* aggregate, so ask only for what you display.
|
|
851
|
+
*/
|
|
852
|
+
'include[]'?: IncludeParameter;
|
|
853
|
+
/**
|
|
854
|
+
* Field to sort cohorts by. Defaults to `created_at`. The computed
|
|
855
|
+
* counts gated behind `include[]` (`member_count`, `leader_count`,
|
|
856
|
+
* `child_count`) are not sortable, since they're only populated when
|
|
857
|
+
* explicitly requested.
|
|
858
|
+
*/
|
|
859
|
+
sort?: SortCohortsParameter;
|
|
860
|
+
/**
|
|
861
|
+
* Direction to sort in, applied to whichever field `sort` names.
|
|
862
|
+
* Defaults to `desc`. Ties on a non-unique sort field break by id
|
|
863
|
+
* ascending, so pagination stays stable across pages even when sorting
|
|
864
|
+
* by a non-unique field like `name` or `workflow_state`.
|
|
865
|
+
*/
|
|
866
|
+
order?: OrderParameter;
|
|
867
|
+
/**
|
|
868
|
+
* Page of results to return. Prefer following the `Link` header.
|
|
869
|
+
* @minimum 1
|
|
870
|
+
*/
|
|
871
|
+
page?: PageParameter;
|
|
872
|
+
/**
|
|
873
|
+
* Results per page.
|
|
874
|
+
* @minimum 1
|
|
875
|
+
* @maximum 100
|
|
876
|
+
*/
|
|
877
|
+
per_page?: PerPageParameter;
|
|
878
|
+
};
|
|
879
|
+
/**
|
|
880
|
+
* Nothing here for this caller. One response covers several causes on
|
|
881
|
+
* purpose, so that the API never reveals whether a cohort exists: the
|
|
882
|
+
* resource does not exist, the caller may not view it at all, the
|
|
883
|
+
* `institutional_cohorts` flag is off for this root account, or the
|
|
884
|
+
* account or cohort belongs to a different root account than the
|
|
885
|
+
* caller. A soft-deleted cohort still exists and remains addressable
|
|
886
|
+
* by id; it is not a `404`.
|
|
887
|
+
*/
|
|
888
|
+
export type NotFoundResponse = Error;
|
|
889
|
+
export type OrderParameter = (typeof OrderParameter)[keyof typeof OrderParameter];
|
|
890
|
+
export declare const OrderParameter: {
|
|
891
|
+
readonly asc: "asc";
|
|
892
|
+
readonly desc: "desc";
|
|
893
|
+
};
|
|
894
|
+
/**
|
|
895
|
+
* Page of results to return. Prefer following the `Link` header.
|
|
896
|
+
*/
|
|
897
|
+
export type PageParameter = number;
|
|
898
|
+
/**
|
|
899
|
+
* Results per page.
|
|
900
|
+
*/
|
|
901
|
+
export type PerPageParameter = number;
|
|
902
|
+
/**
|
|
903
|
+
* Progress of an asynchronous Canvas job. Poll `url` until
|
|
904
|
+
* `workflow_state` is `completed` or `failed`.
|
|
905
|
+
*/
|
|
906
|
+
export interface Progress {
|
|
907
|
+
/** The id of the Progress object. */
|
|
908
|
+
id?: number;
|
|
909
|
+
/** The context owning the job. */
|
|
910
|
+
context_id?: number;
|
|
911
|
+
context_type?: string;
|
|
912
|
+
/** The id of the user who started the job. */
|
|
913
|
+
user_id?: number;
|
|
914
|
+
/** The type of operation. */
|
|
915
|
+
tag?: string;
|
|
916
|
+
/** Percent completed. */
|
|
917
|
+
completion?: number;
|
|
918
|
+
workflow_state?: ProgressWorkflowState;
|
|
919
|
+
created_at?: string;
|
|
920
|
+
updated_at?: string;
|
|
921
|
+
/**
|
|
922
|
+
* Optional details about the job.
|
|
923
|
+
* @nullable
|
|
924
|
+
*/
|
|
925
|
+
message?: string | null;
|
|
926
|
+
/**
|
|
927
|
+
* Optional results of the job. Omitted while the job is still pending.
|
|
928
|
+
* @nullable
|
|
929
|
+
*/
|
|
930
|
+
results?: ProgressResults;
|
|
931
|
+
/** Url where a progress update can be retrieved. */
|
|
932
|
+
url?: string;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Optional results of the job. Omitted while the job is still pending.
|
|
936
|
+
* @nullable
|
|
937
|
+
*/
|
|
938
|
+
export type ProgressResults = {
|
|
939
|
+
[key: string]: unknown;
|
|
940
|
+
} | null;
|
|
941
|
+
export type ProgressWorkflowState = (typeof ProgressWorkflowState)[keyof typeof ProgressWorkflowState];
|
|
942
|
+
export declare const ProgressWorkflowState: {
|
|
943
|
+
readonly queued: "queued";
|
|
944
|
+
readonly running: "running";
|
|
945
|
+
readonly completed: "completed";
|
|
946
|
+
readonly failed: "failed";
|
|
947
|
+
};
|
|
948
|
+
/**
|
|
949
|
+
* Partial, case-insensitive match against the name of the resource.
|
|
950
|
+
* Shorter than two characters is rejected.
|
|
951
|
+
*/
|
|
952
|
+
export type SearchTermParameter = string;
|
|
953
|
+
export type SortCohortEnrollmentScopesParameter = (typeof SortCohortEnrollmentScopesParameter)[keyof typeof SortCohortEnrollmentScopesParameter];
|
|
954
|
+
export declare const SortCohortEnrollmentScopesParameter: {
|
|
955
|
+
readonly created_at: "created_at";
|
|
956
|
+
readonly scopable_type: "scopable_type";
|
|
957
|
+
};
|
|
958
|
+
export type SortCohortEnrollmentsParameter = (typeof SortCohortEnrollmentsParameter)[keyof typeof SortCohortEnrollmentsParameter];
|
|
959
|
+
export declare const SortCohortEnrollmentsParameter: {
|
|
960
|
+
readonly created_at: "created_at";
|
|
961
|
+
readonly user_name: "user_name";
|
|
962
|
+
readonly user_sortable_name: "user_sortable_name";
|
|
963
|
+
};
|
|
964
|
+
export type SortCohortLeadersParameter = (typeof SortCohortLeadersParameter)[keyof typeof SortCohortLeadersParameter];
|
|
965
|
+
export declare const SortCohortLeadersParameter: {
|
|
966
|
+
readonly created_at: "created_at";
|
|
967
|
+
readonly role_id: "role_id";
|
|
968
|
+
readonly user_name: "user_name";
|
|
969
|
+
readonly user_sortable_name: "user_sortable_name";
|
|
970
|
+
};
|
|
971
|
+
export type SortCohortMembersParameter = (typeof SortCohortMembersParameter)[keyof typeof SortCohortMembersParameter];
|
|
972
|
+
export declare const SortCohortMembersParameter: {
|
|
973
|
+
readonly created_at: "created_at";
|
|
974
|
+
readonly user_name: "user_name";
|
|
975
|
+
readonly user_sortable_name: "user_sortable_name";
|
|
976
|
+
readonly last_activity_at: "last_activity_at";
|
|
977
|
+
};
|
|
978
|
+
export type SortCohortsParameter = (typeof SortCohortsParameter)[keyof typeof SortCohortsParameter];
|
|
979
|
+
export declare const SortCohortsParameter: {
|
|
980
|
+
readonly created_at: "created_at";
|
|
981
|
+
readonly name: "name";
|
|
982
|
+
readonly workflow_state: "workflow_state";
|
|
983
|
+
readonly depth: "depth";
|
|
984
|
+
};
|
|
985
|
+
/**
|
|
986
|
+
* The shape Canvas returns when a caller lacks a required permission.
|
|
987
|
+
*/
|
|
988
|
+
export interface UnauthorizedError {
|
|
989
|
+
status: 'unauthorized';
|
|
990
|
+
errors: UnauthorizedErrorErrorsItem[];
|
|
991
|
+
}
|
|
992
|
+
export type UnauthorizedErrorErrorsItem = {
|
|
993
|
+
message: string;
|
|
994
|
+
};
|
|
995
|
+
export type UpdateCohortBody = {
|
|
996
|
+
cohort: UpdateCohortBodyCohort;
|
|
997
|
+
/** Allow this request to change fields marked sticky by SIS. */
|
|
998
|
+
override_sis_stickiness?: boolean;
|
|
999
|
+
};
|
|
1000
|
+
export type UpdateCohortBodyCohort = {
|
|
1001
|
+
/**
|
|
1002
|
+
* @minLength 1
|
|
1003
|
+
* @maxLength 255
|
|
1004
|
+
*/
|
|
1005
|
+
name?: string;
|
|
1006
|
+
/** Free-text description of the cohort. */
|
|
1007
|
+
description?: string;
|
|
1008
|
+
/** @maxLength 255 */
|
|
1009
|
+
sis_source_id?: string;
|
|
1010
|
+
};
|
|
1011
|
+
export type UpdateCohortLeaderBody = {
|
|
1012
|
+
/**
|
|
1013
|
+
* A role whose base type is `CohortLeader`. Required: an
|
|
1014
|
+
* update names the role to move to explicitly.
|
|
1015
|
+
*/
|
|
1016
|
+
role_id: Id;
|
|
1017
|
+
};
|
|
1018
|
+
/**
|
|
1019
|
+
* The subset of a Canvas user shown alongside cohort records.
|
|
1020
|
+
*/
|
|
1021
|
+
export interface UserDisplay {
|
|
1022
|
+
id: Id;
|
|
1023
|
+
name: string;
|
|
1024
|
+
sortable_name?: string;
|
|
1025
|
+
short_name?: string;
|
|
1026
|
+
avatar_url?: string;
|
|
1027
|
+
/**
|
|
1028
|
+
* Present only when the caller holds `read_sis` on the cohort's
|
|
1029
|
+
* account chain, or `manage_sis` on the root account. Omitted
|
|
1030
|
+
* entirely when the caller may not read SIS ids; `null` when the
|
|
1031
|
+
* caller may read them but the user has no SIS id. A Leader grant
|
|
1032
|
+
* never conveys this; it takes an account permission.
|
|
1033
|
+
* @nullable
|
|
1034
|
+
*/
|
|
1035
|
+
sis_user_id?: string | null;
|
|
1036
|
+
/**
|
|
1037
|
+
* Present only when the caller holds `view_user_logins` on the
|
|
1038
|
+
* cohort's account chain. Omitted entirely when the caller may not
|
|
1039
|
+
* read login ids; `null` when the caller may read them but the user
|
|
1040
|
+
* has no login. A Leader grant never conveys this; it takes an
|
|
1041
|
+
* account permission.
|
|
1042
|
+
* @nullable
|
|
1043
|
+
*/
|
|
1044
|
+
login_id?: string | null;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Per-attribute validation failures, in the shape Canvas produces from
|
|
1048
|
+
* model errors. Keys are attribute names.
|
|
1049
|
+
*/
|
|
1050
|
+
export interface ValidationError {
|
|
1051
|
+
errors: ValidationErrorErrors;
|
|
1052
|
+
}
|
|
1053
|
+
export type ValidationErrorErrors = {
|
|
1054
|
+
[key: string]: ValidationErrorErrorsItem[];
|
|
1055
|
+
};
|
|
1056
|
+
export type ValidationErrorErrorsItem = {
|
|
1057
|
+
attribute: string;
|
|
1058
|
+
type: string;
|
|
1059
|
+
message: string;
|
|
1060
|
+
};
|
|
1061
|
+
/**
|
|
1062
|
+
* Lifecycle state. Cohort records are never hard-deleted; they move to
|
|
1063
|
+
* `deleted` and stop appearing in default listings.
|
|
1064
|
+
*/
|
|
1065
|
+
export type WorkflowState = (typeof WorkflowState)[keyof typeof WorkflowState];
|
|
1066
|
+
export declare const WorkflowState: {
|
|
1067
|
+
readonly active: "active";
|
|
1068
|
+
readonly deleted: "deleted";
|
|
1069
|
+
};
|
|
1070
|
+
/**
|
|
1071
|
+
* Which lifecycle states to return. Repeatable, matching the Canvas
|
|
1072
|
+
* `workflow_state[]` list filter: `active`, `deleted`, or `all` for
|
|
1073
|
+
* both. Defaults to `active` only.
|
|
1074
|
+
*/
|
|
1075
|
+
export type WorkflowStateFilterParameter = WorkflowStateFilterParameterItem[];
|
|
1076
|
+
export type WorkflowStateFilterParameterItem = (typeof WorkflowStateFilterParameterItem)[keyof typeof WorkflowStateFilterParameterItem];
|
|
1077
|
+
export declare const WorkflowStateFilterParameterItem: {
|
|
1078
|
+
readonly active: "active";
|
|
1079
|
+
readonly deleted: "deleted";
|
|
1080
|
+
readonly all: "all";
|
|
1081
|
+
};
|
|
1082
|
+
//# sourceMappingURL=cohorts.d.ts.map
|