OLD | NEW |
(Empty) | |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
| 3 library googleapis.classroom.v1; |
| 4 |
| 5 import 'dart:core' as core; |
| 6 import 'dart:async' as async; |
| 7 import 'dart:convert' as convert; |
| 8 |
| 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 10 import 'package:http/http.dart' as http; |
| 11 |
| 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show |
| 13 ApiRequestError, DetailedApiRequestError; |
| 14 |
| 15 const core.String USER_AGENT = 'dart-api-client classroom/v1'; |
| 16 |
| 17 /** Google Classroom API */ |
| 18 class ClassroomApi { |
| 19 /** Manage your Google Classroom classes */ |
| 20 static const ClassroomCoursesScope = "https://www.googleapis.com/auth/classroo
m.courses"; |
| 21 |
| 22 /** View your Google Classroom classes */ |
| 23 static const ClassroomCoursesReadonlyScope = "https://www.googleapis.com/auth/
classroom.courses.readonly"; |
| 24 |
| 25 /** View the email addresses of people in your classes */ |
| 26 static const ClassroomProfileEmailsScope = "https://www.googleapis.com/auth/cl
assroom.profile.emails"; |
| 27 |
| 28 /** View the profile photos of people in your classes */ |
| 29 static const ClassroomProfilePhotosScope = "https://www.googleapis.com/auth/cl
assroom.profile.photos"; |
| 30 |
| 31 /** Manage your Google Classroom class rosters */ |
| 32 static const ClassroomRostersScope = "https://www.googleapis.com/auth/classroo
m.rosters"; |
| 33 |
| 34 /** View your Google Classroom class rosters */ |
| 35 static const ClassroomRostersReadonlyScope = "https://www.googleapis.com/auth/
classroom.rosters.readonly"; |
| 36 |
| 37 |
| 38 final commons.ApiRequester _requester; |
| 39 |
| 40 CoursesResourceApi get courses => new CoursesResourceApi(_requester); |
| 41 InvitationsResourceApi get invitations => new InvitationsResourceApi(_requeste
r); |
| 42 UserProfilesResourceApi get userProfiles => new UserProfilesResourceApi(_reque
ster); |
| 43 |
| 44 ClassroomApi(http.Client client, {core.String rootUrl: "https://classroom.goog
leapis.com/", core.String servicePath: ""}) : |
| 45 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
| 46 } |
| 47 |
| 48 |
| 49 class CoursesResourceApi { |
| 50 final commons.ApiRequester _requester; |
| 51 |
| 52 CoursesAliasesResourceApi get aliases => new CoursesAliasesResourceApi(_reques
ter); |
| 53 CoursesStudentsResourceApi get students => new CoursesStudentsResourceApi(_req
uester); |
| 54 CoursesTeachersResourceApi get teachers => new CoursesTeachersResourceApi(_req
uester); |
| 55 |
| 56 CoursesResourceApi(commons.ApiRequester client) : |
| 57 _requester = client; |
| 58 |
| 59 /** |
| 60 * Creates a course. The user specified as the primary teacher in |
| 61 * `primary_teacher_id` is the owner of the created course and added as a |
| 62 * teacher. This method returns the following error codes: * |
| 63 * `PERMISSION_DENIED` if the requesting user is not permitted to create |
| 64 * courses. * `NOT_FOUND` if the primary teacher is not a valid user. * |
| 65 * `ALREADY_EXISTS` if an alias was specified and already exists. |
| 66 * |
| 67 * [request] - The metadata request object. |
| 68 * |
| 69 * Request parameters: |
| 70 * |
| 71 * Completes with a [Course]. |
| 72 * |
| 73 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 74 * error. |
| 75 * |
| 76 * If the used [http.Client] completes with an error when making a REST call, |
| 77 * this method will complete with the same error. |
| 78 */ |
| 79 async.Future<Course> create(Course request) { |
| 80 var _url = null; |
| 81 var _queryParams = new core.Map(); |
| 82 var _uploadMedia = null; |
| 83 var _uploadOptions = null; |
| 84 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 85 var _body = null; |
| 86 |
| 87 if (request != null) { |
| 88 _body = convert.JSON.encode((request).toJson()); |
| 89 } |
| 90 |
| 91 _url = 'v1/courses'; |
| 92 |
| 93 var _response = _requester.request(_url, |
| 94 "POST", |
| 95 body: _body, |
| 96 queryParams: _queryParams, |
| 97 uploadOptions: _uploadOptions, |
| 98 uploadMedia: _uploadMedia, |
| 99 downloadOptions: _downloadOptions); |
| 100 return _response.then((data) => new Course.fromJson(data)); |
| 101 } |
| 102 |
| 103 /** |
| 104 * Deletes a course. This method returns the following error codes: * |
| 105 * `PERMISSION_DENIED` if the requesting user is not permitted to delete the |
| 106 * requested course. * `NOT_FOUND` if no course exists with the requested ID. |
| 107 * |
| 108 * Request parameters: |
| 109 * |
| 110 * [id] - Identifier of the course to delete. This may either be the |
| 111 * Classroom-assigned identifier or an |
| 112 * [alias][google.classroom.v1.CourseAlias]. |
| 113 * |
| 114 * Completes with a [Empty]. |
| 115 * |
| 116 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 117 * error. |
| 118 * |
| 119 * If the used [http.Client] completes with an error when making a REST call, |
| 120 * this method will complete with the same error. |
| 121 */ |
| 122 async.Future<Empty> delete(core.String id) { |
| 123 var _url = null; |
| 124 var _queryParams = new core.Map(); |
| 125 var _uploadMedia = null; |
| 126 var _uploadOptions = null; |
| 127 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 128 var _body = null; |
| 129 |
| 130 if (id == null) { |
| 131 throw new core.ArgumentError("Parameter id is required."); |
| 132 } |
| 133 |
| 134 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$id'); |
| 135 |
| 136 var _response = _requester.request(_url, |
| 137 "DELETE", |
| 138 body: _body, |
| 139 queryParams: _queryParams, |
| 140 uploadOptions: _uploadOptions, |
| 141 uploadMedia: _uploadMedia, |
| 142 downloadOptions: _downloadOptions); |
| 143 return _response.then((data) => new Empty.fromJson(data)); |
| 144 } |
| 145 |
| 146 /** |
| 147 * Returns a course. This method returns the following error codes: * |
| 148 * `PERMISSION_DENIED` if the requesting user is not permitted to access the |
| 149 * requested course. * `NOT_FOUND` if no course exists with the requested ID. |
| 150 * |
| 151 * Request parameters: |
| 152 * |
| 153 * [id] - Identifier of the course to return. This may either be the |
| 154 * Classroom-assigned identifier or an |
| 155 * [alias][google.classroom.v1.CourseAlias]. |
| 156 * |
| 157 * Completes with a [Course]. |
| 158 * |
| 159 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 160 * error. |
| 161 * |
| 162 * If the used [http.Client] completes with an error when making a REST call, |
| 163 * this method will complete with the same error. |
| 164 */ |
| 165 async.Future<Course> get(core.String id) { |
| 166 var _url = null; |
| 167 var _queryParams = new core.Map(); |
| 168 var _uploadMedia = null; |
| 169 var _uploadOptions = null; |
| 170 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 171 var _body = null; |
| 172 |
| 173 if (id == null) { |
| 174 throw new core.ArgumentError("Parameter id is required."); |
| 175 } |
| 176 |
| 177 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$id'); |
| 178 |
| 179 var _response = _requester.request(_url, |
| 180 "GET", |
| 181 body: _body, |
| 182 queryParams: _queryParams, |
| 183 uploadOptions: _uploadOptions, |
| 184 uploadMedia: _uploadMedia, |
| 185 downloadOptions: _downloadOptions); |
| 186 return _response.then((data) => new Course.fromJson(data)); |
| 187 } |
| 188 |
| 189 /** |
| 190 * Returns a list of courses that the requesting user is permitted to view, |
| 191 * restricted to those that match the request. This method returns the |
| 192 * following error codes: * `INVALID_ARGUMENT` if the query argument is |
| 193 * malformed. * `NOT_FOUND` if any users specified in the query arguments do |
| 194 * not exist. |
| 195 * |
| 196 * Request parameters: |
| 197 * |
| 198 * [studentId] - Restricts returned courses to those having a student with the |
| 199 * specified identifier, or an alias that identifies a student. The following |
| 200 * aliases are supported: * the e-mail address of the user * the string |
| 201 * literal `"me"`, indicating that the requesting user |
| 202 * |
| 203 * [teacherId] - Restricts returned courses to those having a teacher with the |
| 204 * specified identifier, or an alias that identifies a teacher. The following |
| 205 * aliases are supported: * the e-mail address of the user * the string |
| 206 * literal `"me"`, indicating that the requesting user |
| 207 * |
| 208 * [pageSize] - Maximum number of items to return. Zero or unspecified |
| 209 * indicates that the server may assign a maximum. The server may return fewer |
| 210 * than the specified number of results. |
| 211 * |
| 212 * [pageToken] - |
| 213 * [nextPageToken][google.classroom.v1.ListCoursesResponse.next_page_token] |
| 214 * value returned from a previous |
| 215 * [list][google.classroom.v1.Courses.ListCourses] call, indicating that the |
| 216 * subsequent page of results should be returned. The |
| 217 * [list][google.classroom.v1.Courses.ListCourses] request must be identical |
| 218 * to the one which resulted in this token. |
| 219 * |
| 220 * Completes with a [ListCoursesResponse]. |
| 221 * |
| 222 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 223 * error. |
| 224 * |
| 225 * If the used [http.Client] completes with an error when making a REST call, |
| 226 * this method will complete with the same error. |
| 227 */ |
| 228 async.Future<ListCoursesResponse> list({core.String studentId, core.String tea
cherId, core.int pageSize, core.String pageToken}) { |
| 229 var _url = null; |
| 230 var _queryParams = new core.Map(); |
| 231 var _uploadMedia = null; |
| 232 var _uploadOptions = null; |
| 233 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 234 var _body = null; |
| 235 |
| 236 if (studentId != null) { |
| 237 _queryParams["studentId"] = [studentId]; |
| 238 } |
| 239 if (teacherId != null) { |
| 240 _queryParams["teacherId"] = [teacherId]; |
| 241 } |
| 242 if (pageSize != null) { |
| 243 _queryParams["pageSize"] = ["${pageSize}"]; |
| 244 } |
| 245 if (pageToken != null) { |
| 246 _queryParams["pageToken"] = [pageToken]; |
| 247 } |
| 248 |
| 249 _url = 'v1/courses'; |
| 250 |
| 251 var _response = _requester.request(_url, |
| 252 "GET", |
| 253 body: _body, |
| 254 queryParams: _queryParams, |
| 255 uploadOptions: _uploadOptions, |
| 256 uploadMedia: _uploadMedia, |
| 257 downloadOptions: _downloadOptions); |
| 258 return _response.then((data) => new ListCoursesResponse.fromJson(data)); |
| 259 } |
| 260 |
| 261 /** |
| 262 * Updates one or more fields a course. This method returns the following |
| 263 * error codes: * `PERMISSION_DENIED` if the requesting user is not permitted |
| 264 * to modify the requested course. * `NOT_FOUND` if no course exists with the |
| 265 * requested ID. * `INVALID_ARGUMENT` if invalid fields are specified in the |
| 266 * update mask or if no update mask is supplied. |
| 267 * |
| 268 * [request] - The metadata request object. |
| 269 * |
| 270 * Request parameters: |
| 271 * |
| 272 * [id] - Identifier of the course to update. This may either be the |
| 273 * Classroom-assigned identifier or an |
| 274 * [alias][google.classroom.v1.CourseAlias]. |
| 275 * |
| 276 * [updateMask] - Mask which identifies which fields on the course to update. |
| 277 * This field is required to do an update. The update will fail if invalid |
| 278 * fields are specified. Valid fields are listed below: * `name` * `section` * |
| 279 * `descriptionHeading` * `description` * `room` * `courseState` When set in a |
| 280 * query parameter, this should be specified as `updateMask=,,...` |
| 281 * |
| 282 * Completes with a [Course]. |
| 283 * |
| 284 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 285 * error. |
| 286 * |
| 287 * If the used [http.Client] completes with an error when making a REST call, |
| 288 * this method will complete with the same error. |
| 289 */ |
| 290 async.Future<Course> patch(Course request, core.String id, {core.String update
Mask}) { |
| 291 var _url = null; |
| 292 var _queryParams = new core.Map(); |
| 293 var _uploadMedia = null; |
| 294 var _uploadOptions = null; |
| 295 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 296 var _body = null; |
| 297 |
| 298 if (request != null) { |
| 299 _body = convert.JSON.encode((request).toJson()); |
| 300 } |
| 301 if (id == null) { |
| 302 throw new core.ArgumentError("Parameter id is required."); |
| 303 } |
| 304 if (updateMask != null) { |
| 305 _queryParams["updateMask"] = [updateMask]; |
| 306 } |
| 307 |
| 308 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$id'); |
| 309 |
| 310 var _response = _requester.request(_url, |
| 311 "PATCH", |
| 312 body: _body, |
| 313 queryParams: _queryParams, |
| 314 uploadOptions: _uploadOptions, |
| 315 uploadMedia: _uploadMedia, |
| 316 downloadOptions: _downloadOptions); |
| 317 return _response.then((data) => new Course.fromJson(data)); |
| 318 } |
| 319 |
| 320 /** |
| 321 * Updates a course. This method returns the following error codes: * |
| 322 * `PERMISSION_DENIED` if the requesting user is not permitted to modify the |
| 323 * requested course. * `NOT_FOUND` if no course exists with the requested ID. |
| 324 * |
| 325 * [request] - The metadata request object. |
| 326 * |
| 327 * Request parameters: |
| 328 * |
| 329 * [id] - Identifier of the course to update. This may either be the |
| 330 * Classroom-assigned identifier or an |
| 331 * [alias][google.classroom.v1.CourseAlias]. |
| 332 * |
| 333 * Completes with a [Course]. |
| 334 * |
| 335 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 336 * error. |
| 337 * |
| 338 * If the used [http.Client] completes with an error when making a REST call, |
| 339 * this method will complete with the same error. |
| 340 */ |
| 341 async.Future<Course> update(Course request, core.String id) { |
| 342 var _url = null; |
| 343 var _queryParams = new core.Map(); |
| 344 var _uploadMedia = null; |
| 345 var _uploadOptions = null; |
| 346 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 347 var _body = null; |
| 348 |
| 349 if (request != null) { |
| 350 _body = convert.JSON.encode((request).toJson()); |
| 351 } |
| 352 if (id == null) { |
| 353 throw new core.ArgumentError("Parameter id is required."); |
| 354 } |
| 355 |
| 356 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$id'); |
| 357 |
| 358 var _response = _requester.request(_url, |
| 359 "PUT", |
| 360 body: _body, |
| 361 queryParams: _queryParams, |
| 362 uploadOptions: _uploadOptions, |
| 363 uploadMedia: _uploadMedia, |
| 364 downloadOptions: _downloadOptions); |
| 365 return _response.then((data) => new Course.fromJson(data)); |
| 366 } |
| 367 |
| 368 } |
| 369 |
| 370 |
| 371 class CoursesAliasesResourceApi { |
| 372 final commons.ApiRequester _requester; |
| 373 |
| 374 CoursesAliasesResourceApi(commons.ApiRequester client) : |
| 375 _requester = client; |
| 376 |
| 377 /** |
| 378 * Creates an alias to a course. This method returns the following error |
| 379 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to |
| 380 * create the alias. * `NOT_FOUND` if the course does not exist. * |
| 381 * `ALREADY_EXISTS` if the alias already exists. |
| 382 * |
| 383 * [request] - The metadata request object. |
| 384 * |
| 385 * Request parameters: |
| 386 * |
| 387 * [courseId] - The identifier of the course to alias. This may either be the |
| 388 * Classroom-assigned identifier or an |
| 389 * [alias][google.classroom.v1.CourseAlias]. |
| 390 * |
| 391 * Completes with a [CourseAlias]. |
| 392 * |
| 393 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 394 * error. |
| 395 * |
| 396 * If the used [http.Client] completes with an error when making a REST call, |
| 397 * this method will complete with the same error. |
| 398 */ |
| 399 async.Future<CourseAlias> create(CourseAlias request, core.String courseId) { |
| 400 var _url = null; |
| 401 var _queryParams = new core.Map(); |
| 402 var _uploadMedia = null; |
| 403 var _uploadOptions = null; |
| 404 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 405 var _body = null; |
| 406 |
| 407 if (request != null) { |
| 408 _body = convert.JSON.encode((request).toJson()); |
| 409 } |
| 410 if (courseId == null) { |
| 411 throw new core.ArgumentError("Parameter courseId is required."); |
| 412 } |
| 413 |
| 414 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/aliase
s'; |
| 415 |
| 416 var _response = _requester.request(_url, |
| 417 "POST", |
| 418 body: _body, |
| 419 queryParams: _queryParams, |
| 420 uploadOptions: _uploadOptions, |
| 421 uploadMedia: _uploadMedia, |
| 422 downloadOptions: _downloadOptions); |
| 423 return _response.then((data) => new CourseAlias.fromJson(data)); |
| 424 } |
| 425 |
| 426 /** |
| 427 * Deletes an alias of a course. This method returns the following error |
| 428 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to |
| 429 * remove the alias. * `NOT_FOUND` if the alias does not exist. |
| 430 * |
| 431 * Request parameters: |
| 432 * |
| 433 * [courseId] - The identifier of the course whose alias should be deleted. |
| 434 * This may either be the Classroom-assigned identifier or an |
| 435 * [alias][google.classroom.v1.CourseAlias]. |
| 436 * |
| 437 * [alias] - The alias to delete. This may not be the Classroom-assigned |
| 438 * identifier. |
| 439 * |
| 440 * Completes with a [Empty]. |
| 441 * |
| 442 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 443 * error. |
| 444 * |
| 445 * If the used [http.Client] completes with an error when making a REST call, |
| 446 * this method will complete with the same error. |
| 447 */ |
| 448 async.Future<Empty> delete(core.String courseId, core.String alias) { |
| 449 var _url = null; |
| 450 var _queryParams = new core.Map(); |
| 451 var _uploadMedia = null; |
| 452 var _uploadOptions = null; |
| 453 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 454 var _body = null; |
| 455 |
| 456 if (courseId == null) { |
| 457 throw new core.ArgumentError("Parameter courseId is required."); |
| 458 } |
| 459 if (alias == null) { |
| 460 throw new core.ArgumentError("Parameter alias is required."); |
| 461 } |
| 462 |
| 463 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/aliase
s/' + commons.Escaper.ecapeVariable('$alias'); |
| 464 |
| 465 var _response = _requester.request(_url, |
| 466 "DELETE", |
| 467 body: _body, |
| 468 queryParams: _queryParams, |
| 469 uploadOptions: _uploadOptions, |
| 470 uploadMedia: _uploadMedia, |
| 471 downloadOptions: _downloadOptions); |
| 472 return _response.then((data) => new Empty.fromJson(data)); |
| 473 } |
| 474 |
| 475 /** |
| 476 * Lists the aliases of a course. This method returns the following error |
| 477 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to |
| 478 * access the course. * `NOT_FOUND` if the course does not exist. |
| 479 * |
| 480 * Request parameters: |
| 481 * |
| 482 * [courseId] - The identifier of the course. This may either be the |
| 483 * Classroom-assigned identifier or an |
| 484 * [alias][google.classroom.v1.CourseAlias]. |
| 485 * |
| 486 * [pageSize] - Maximum number of items to return. Zero or unspecified |
| 487 * indicates that the server may assign a maximum. The server may return fewer |
| 488 * than the specified number of results. |
| 489 * |
| 490 * [pageToken] - |
| 491 * [nextPageToken][google.classroom.v1.ListCourseAliasesResponse.next_page_tok
en] |
| 492 * value returned from a previous |
| 493 * [list][google.classroom.v1.Courses.ListCourseAliases] call, indicating that |
| 494 * the subsequent page of results should be returned. The |
| 495 * [list][google.classroom.v1.Courses.ListCourseAliases] request must be |
| 496 * identical to the one which resulted in this token. |
| 497 * |
| 498 * Completes with a [ListCourseAliasesResponse]. |
| 499 * |
| 500 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 501 * error. |
| 502 * |
| 503 * If the used [http.Client] completes with an error when making a REST call, |
| 504 * this method will complete with the same error. |
| 505 */ |
| 506 async.Future<ListCourseAliasesResponse> list(core.String courseId, {core.int p
ageSize, core.String pageToken}) { |
| 507 var _url = null; |
| 508 var _queryParams = new core.Map(); |
| 509 var _uploadMedia = null; |
| 510 var _uploadOptions = null; |
| 511 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 512 var _body = null; |
| 513 |
| 514 if (courseId == null) { |
| 515 throw new core.ArgumentError("Parameter courseId is required."); |
| 516 } |
| 517 if (pageSize != null) { |
| 518 _queryParams["pageSize"] = ["${pageSize}"]; |
| 519 } |
| 520 if (pageToken != null) { |
| 521 _queryParams["pageToken"] = [pageToken]; |
| 522 } |
| 523 |
| 524 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/aliase
s'; |
| 525 |
| 526 var _response = _requester.request(_url, |
| 527 "GET", |
| 528 body: _body, |
| 529 queryParams: _queryParams, |
| 530 uploadOptions: _uploadOptions, |
| 531 uploadMedia: _uploadMedia, |
| 532 downloadOptions: _downloadOptions); |
| 533 return _response.then((data) => new ListCourseAliasesResponse.fromJson(data)
); |
| 534 } |
| 535 |
| 536 } |
| 537 |
| 538 |
| 539 class CoursesStudentsResourceApi { |
| 540 final commons.ApiRequester _requester; |
| 541 |
| 542 CoursesStudentsResourceApi(commons.ApiRequester client) : |
| 543 _requester = client; |
| 544 |
| 545 /** |
| 546 * Adds a user as a student of a course. This method returns the following |
| 547 * error codes: * `PERMISSION_DENIED` if the requesting user is not permitted |
| 548 * to create students in this course. * `NOT_FOUND` if the requested course ID |
| 549 * does not exist. * `ALREADY_EXISTS` if the user is already a student or |
| 550 * student in the course. |
| 551 * |
| 552 * [request] - The metadata request object. |
| 553 * |
| 554 * Request parameters: |
| 555 * |
| 556 * [courseId] - Identifier of the course to create the student in. This may |
| 557 * either be the Classroom-assigned identifier or an alias. |
| 558 * |
| 559 * [enrollmentCode] - Enrollment code of the course to create the student in. |
| 560 * This is required if [userId][google.classroom.v1.Student.user_id] |
| 561 * corresponds to the requesting user; this may be omitted if the requesting |
| 562 * user has administrative permissions to create students for any user. |
| 563 * |
| 564 * Completes with a [Student]. |
| 565 * |
| 566 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 567 * error. |
| 568 * |
| 569 * If the used [http.Client] completes with an error when making a REST call, |
| 570 * this method will complete with the same error. |
| 571 */ |
| 572 async.Future<Student> create(Student request, core.String courseId, {core.Stri
ng enrollmentCode}) { |
| 573 var _url = null; |
| 574 var _queryParams = new core.Map(); |
| 575 var _uploadMedia = null; |
| 576 var _uploadOptions = null; |
| 577 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 578 var _body = null; |
| 579 |
| 580 if (request != null) { |
| 581 _body = convert.JSON.encode((request).toJson()); |
| 582 } |
| 583 if (courseId == null) { |
| 584 throw new core.ArgumentError("Parameter courseId is required."); |
| 585 } |
| 586 if (enrollmentCode != null) { |
| 587 _queryParams["enrollmentCode"] = [enrollmentCode]; |
| 588 } |
| 589 |
| 590 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/studen
ts'; |
| 591 |
| 592 var _response = _requester.request(_url, |
| 593 "POST", |
| 594 body: _body, |
| 595 queryParams: _queryParams, |
| 596 uploadOptions: _uploadOptions, |
| 597 uploadMedia: _uploadMedia, |
| 598 downloadOptions: _downloadOptions); |
| 599 return _response.then((data) => new Student.fromJson(data)); |
| 600 } |
| 601 |
| 602 /** |
| 603 * Deletes a student of a course. This method returns the following error |
| 604 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to |
| 605 * delete students of this course. * `NOT_FOUND` if no student of this course |
| 606 * has the requested ID or if the course does not exist. |
| 607 * |
| 608 * Request parameters: |
| 609 * |
| 610 * [courseId] - Unique identifier of the course. This may either be the |
| 611 * Classroom-assigned identifier or an alias. |
| 612 * |
| 613 * [userId] - Identifier of the student to delete, or an alias the identifies |
| 614 * the user. The following aliases are supported: * the e-mail address of the |
| 615 * user * the string literal `"me"`, indicating that the requesting user |
| 616 * |
| 617 * Completes with a [Empty]. |
| 618 * |
| 619 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 620 * error. |
| 621 * |
| 622 * If the used [http.Client] completes with an error when making a REST call, |
| 623 * this method will complete with the same error. |
| 624 */ |
| 625 async.Future<Empty> delete(core.String courseId, core.String userId) { |
| 626 var _url = null; |
| 627 var _queryParams = new core.Map(); |
| 628 var _uploadMedia = null; |
| 629 var _uploadOptions = null; |
| 630 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 631 var _body = null; |
| 632 |
| 633 if (courseId == null) { |
| 634 throw new core.ArgumentError("Parameter courseId is required."); |
| 635 } |
| 636 if (userId == null) { |
| 637 throw new core.ArgumentError("Parameter userId is required."); |
| 638 } |
| 639 |
| 640 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/studen
ts/' + commons.Escaper.ecapeVariable('$userId'); |
| 641 |
| 642 var _response = _requester.request(_url, |
| 643 "DELETE", |
| 644 body: _body, |
| 645 queryParams: _queryParams, |
| 646 uploadOptions: _uploadOptions, |
| 647 uploadMedia: _uploadMedia, |
| 648 downloadOptions: _downloadOptions); |
| 649 return _response.then((data) => new Empty.fromJson(data)); |
| 650 } |
| 651 |
| 652 /** |
| 653 * Returns a student of a course. This method returns the following error |
| 654 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to |
| 655 * view students of this course. * `NOT_FOUND` if no student of this course |
| 656 * has the requested ID or if the course does not exist. |
| 657 * |
| 658 * Request parameters: |
| 659 * |
| 660 * [courseId] - Unique identifier of the course. This may either be the |
| 661 * Classroom-assigned identifier or an alias. |
| 662 * |
| 663 * [userId] - Identifier of the student to return, or an alias the identifies |
| 664 * the user. The following aliases are supported: * the e-mail address of the |
| 665 * user * the string literal `"me"`, indicating that the requesting user |
| 666 * |
| 667 * Completes with a [Student]. |
| 668 * |
| 669 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 670 * error. |
| 671 * |
| 672 * If the used [http.Client] completes with an error when making a REST call, |
| 673 * this method will complete with the same error. |
| 674 */ |
| 675 async.Future<Student> get(core.String courseId, core.String userId) { |
| 676 var _url = null; |
| 677 var _queryParams = new core.Map(); |
| 678 var _uploadMedia = null; |
| 679 var _uploadOptions = null; |
| 680 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 681 var _body = null; |
| 682 |
| 683 if (courseId == null) { |
| 684 throw new core.ArgumentError("Parameter courseId is required."); |
| 685 } |
| 686 if (userId == null) { |
| 687 throw new core.ArgumentError("Parameter userId is required."); |
| 688 } |
| 689 |
| 690 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/studen
ts/' + commons.Escaper.ecapeVariable('$userId'); |
| 691 |
| 692 var _response = _requester.request(_url, |
| 693 "GET", |
| 694 body: _body, |
| 695 queryParams: _queryParams, |
| 696 uploadOptions: _uploadOptions, |
| 697 uploadMedia: _uploadMedia, |
| 698 downloadOptions: _downloadOptions); |
| 699 return _response.then((data) => new Student.fromJson(data)); |
| 700 } |
| 701 |
| 702 /** |
| 703 * Returns a list of students of this course that the requester is permitted |
| 704 * to view. Fails with `NOT_FOUND` if the course does not exist. |
| 705 * |
| 706 * Request parameters: |
| 707 * |
| 708 * [courseId] - Unique identifier of the course. This may either be the |
| 709 * Classroom-assigned identifier or an alias. |
| 710 * |
| 711 * [pageSize] - Maximum number of items to return. Zero means no maximum. The |
| 712 * server may return fewer than the specified number of results. |
| 713 * |
| 714 * [pageToken] - |
| 715 * [nextPageToken][google.classroom.v1.ListStudentsResponse.next_page_token] |
| 716 * value returned from a previous |
| 717 * [list][google.classroom.v1.Users.ListStudents] call, indicating that the |
| 718 * subsequent page of results should be returned. The |
| 719 * [list][google.classroom.v1.Users.ListStudents] request must be identical to |
| 720 * the one which resulted in this token. |
| 721 * |
| 722 * Completes with a [ListStudentsResponse]. |
| 723 * |
| 724 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 725 * error. |
| 726 * |
| 727 * If the used [http.Client] completes with an error when making a REST call, |
| 728 * this method will complete with the same error. |
| 729 */ |
| 730 async.Future<ListStudentsResponse> list(core.String courseId, {core.int pageSi
ze, core.String pageToken}) { |
| 731 var _url = null; |
| 732 var _queryParams = new core.Map(); |
| 733 var _uploadMedia = null; |
| 734 var _uploadOptions = null; |
| 735 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 736 var _body = null; |
| 737 |
| 738 if (courseId == null) { |
| 739 throw new core.ArgumentError("Parameter courseId is required."); |
| 740 } |
| 741 if (pageSize != null) { |
| 742 _queryParams["pageSize"] = ["${pageSize}"]; |
| 743 } |
| 744 if (pageToken != null) { |
| 745 _queryParams["pageToken"] = [pageToken]; |
| 746 } |
| 747 |
| 748 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/studen
ts'; |
| 749 |
| 750 var _response = _requester.request(_url, |
| 751 "GET", |
| 752 body: _body, |
| 753 queryParams: _queryParams, |
| 754 uploadOptions: _uploadOptions, |
| 755 uploadMedia: _uploadMedia, |
| 756 downloadOptions: _downloadOptions); |
| 757 return _response.then((data) => new ListStudentsResponse.fromJson(data)); |
| 758 } |
| 759 |
| 760 } |
| 761 |
| 762 |
| 763 class CoursesTeachersResourceApi { |
| 764 final commons.ApiRequester _requester; |
| 765 |
| 766 CoursesTeachersResourceApi(commons.ApiRequester client) : |
| 767 _requester = client; |
| 768 |
| 769 /** |
| 770 * Creates a teacher of a course. This method returns the following error |
| 771 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to |
| 772 * create teachers in this course. * `NOT_FOUND` if the requested course ID |
| 773 * does not exist. * `ALREADY_EXISTS` if the user is already a teacher or |
| 774 * student in the course. |
| 775 * |
| 776 * [request] - The metadata request object. |
| 777 * |
| 778 * Request parameters: |
| 779 * |
| 780 * [courseId] - Unique identifier of the course. This may either be the |
| 781 * Classroom-assigned identifier or an alias. |
| 782 * |
| 783 * Completes with a [Teacher]. |
| 784 * |
| 785 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 786 * error. |
| 787 * |
| 788 * If the used [http.Client] completes with an error when making a REST call, |
| 789 * this method will complete with the same error. |
| 790 */ |
| 791 async.Future<Teacher> create(Teacher request, core.String courseId) { |
| 792 var _url = null; |
| 793 var _queryParams = new core.Map(); |
| 794 var _uploadMedia = null; |
| 795 var _uploadOptions = null; |
| 796 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 797 var _body = null; |
| 798 |
| 799 if (request != null) { |
| 800 _body = convert.JSON.encode((request).toJson()); |
| 801 } |
| 802 if (courseId == null) { |
| 803 throw new core.ArgumentError("Parameter courseId is required."); |
| 804 } |
| 805 |
| 806 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/teache
rs'; |
| 807 |
| 808 var _response = _requester.request(_url, |
| 809 "POST", |
| 810 body: _body, |
| 811 queryParams: _queryParams, |
| 812 uploadOptions: _uploadOptions, |
| 813 uploadMedia: _uploadMedia, |
| 814 downloadOptions: _downloadOptions); |
| 815 return _response.then((data) => new Teacher.fromJson(data)); |
| 816 } |
| 817 |
| 818 /** |
| 819 * Deletes a teacher of a course. This method returns the following error |
| 820 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to |
| 821 * delete teachers of this course. * `NOT_FOUND` if no teacher of this course |
| 822 * has the requested ID or if the course does not exist. * |
| 823 * `FAILED_PRECONDITION` if the requested ID belongs to the primary teacher of |
| 824 * this course. |
| 825 * |
| 826 * Request parameters: |
| 827 * |
| 828 * [courseId] - Unique identifier of the course. This may either be the |
| 829 * Classroom-assigned identifier or an alias. |
| 830 * |
| 831 * [userId] - Identifier of the teacher to delete, or an alias the identifies |
| 832 * the user. the following aliases are supported: * the e-mail address of the |
| 833 * user * the string literal `"me"`, indicating that the requesting user |
| 834 * |
| 835 * Completes with a [Empty]. |
| 836 * |
| 837 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 838 * error. |
| 839 * |
| 840 * If the used [http.Client] completes with an error when making a REST call, |
| 841 * this method will complete with the same error. |
| 842 */ |
| 843 async.Future<Empty> delete(core.String courseId, core.String userId) { |
| 844 var _url = null; |
| 845 var _queryParams = new core.Map(); |
| 846 var _uploadMedia = null; |
| 847 var _uploadOptions = null; |
| 848 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 849 var _body = null; |
| 850 |
| 851 if (courseId == null) { |
| 852 throw new core.ArgumentError("Parameter courseId is required."); |
| 853 } |
| 854 if (userId == null) { |
| 855 throw new core.ArgumentError("Parameter userId is required."); |
| 856 } |
| 857 |
| 858 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/teache
rs/' + commons.Escaper.ecapeVariable('$userId'); |
| 859 |
| 860 var _response = _requester.request(_url, |
| 861 "DELETE", |
| 862 body: _body, |
| 863 queryParams: _queryParams, |
| 864 uploadOptions: _uploadOptions, |
| 865 uploadMedia: _uploadMedia, |
| 866 downloadOptions: _downloadOptions); |
| 867 return _response.then((data) => new Empty.fromJson(data)); |
| 868 } |
| 869 |
| 870 /** |
| 871 * Returns a teacher of a course. This method returns the following error |
| 872 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to |
| 873 * view teachers of this course. * `NOT_FOUND` if no teacher of this course |
| 874 * has the requested ID or if the course does not exist. |
| 875 * |
| 876 * Request parameters: |
| 877 * |
| 878 * [courseId] - Unique identifier of the course. This may either be the |
| 879 * Classroom-assigned identifier or an alias. |
| 880 * |
| 881 * [userId] - Identifier of the teacher to return, or an alias the identifies |
| 882 * the user. the following aliases are supported: * the e-mail address of the |
| 883 * user * the string literal `"me"`, indicating that the requesting user |
| 884 * |
| 885 * Completes with a [Teacher]. |
| 886 * |
| 887 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 888 * error. |
| 889 * |
| 890 * If the used [http.Client] completes with an error when making a REST call, |
| 891 * this method will complete with the same error. |
| 892 */ |
| 893 async.Future<Teacher> get(core.String courseId, core.String userId) { |
| 894 var _url = null; |
| 895 var _queryParams = new core.Map(); |
| 896 var _uploadMedia = null; |
| 897 var _uploadOptions = null; |
| 898 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 899 var _body = null; |
| 900 |
| 901 if (courseId == null) { |
| 902 throw new core.ArgumentError("Parameter courseId is required."); |
| 903 } |
| 904 if (userId == null) { |
| 905 throw new core.ArgumentError("Parameter userId is required."); |
| 906 } |
| 907 |
| 908 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/teache
rs/' + commons.Escaper.ecapeVariable('$userId'); |
| 909 |
| 910 var _response = _requester.request(_url, |
| 911 "GET", |
| 912 body: _body, |
| 913 queryParams: _queryParams, |
| 914 uploadOptions: _uploadOptions, |
| 915 uploadMedia: _uploadMedia, |
| 916 downloadOptions: _downloadOptions); |
| 917 return _response.then((data) => new Teacher.fromJson(data)); |
| 918 } |
| 919 |
| 920 /** |
| 921 * Returns a list of teachers of this course that the requester is permitted |
| 922 * to view. Fails with `NOT_FOUND` if the course does not exist. |
| 923 * |
| 924 * Request parameters: |
| 925 * |
| 926 * [courseId] - Unique identifier of the course. This may either be the |
| 927 * Classroom-assigned identifier or an alias. |
| 928 * |
| 929 * [pageSize] - Maximum number of items to return. Zero means no maximum. The |
| 930 * server may return fewer than the specified number of results. |
| 931 * |
| 932 * [pageToken] - |
| 933 * [nextPageToken][google.classroom.v1.ListTeachersResponse.next_page_token] |
| 934 * value returned from a previous |
| 935 * [list][google.classroom.v1.Users.ListTeachers] call, indicating that the |
| 936 * subsequent page of results should be returned. The |
| 937 * [list][google.classroom.v1.Users.ListTeachers] request must be identical to |
| 938 * the one which resulted in this token. |
| 939 * |
| 940 * Completes with a [ListTeachersResponse]. |
| 941 * |
| 942 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 943 * error. |
| 944 * |
| 945 * If the used [http.Client] completes with an error when making a REST call, |
| 946 * this method will complete with the same error. |
| 947 */ |
| 948 async.Future<ListTeachersResponse> list(core.String courseId, {core.int pageSi
ze, core.String pageToken}) { |
| 949 var _url = null; |
| 950 var _queryParams = new core.Map(); |
| 951 var _uploadMedia = null; |
| 952 var _uploadOptions = null; |
| 953 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 954 var _body = null; |
| 955 |
| 956 if (courseId == null) { |
| 957 throw new core.ArgumentError("Parameter courseId is required."); |
| 958 } |
| 959 if (pageSize != null) { |
| 960 _queryParams["pageSize"] = ["${pageSize}"]; |
| 961 } |
| 962 if (pageToken != null) { |
| 963 _queryParams["pageToken"] = [pageToken]; |
| 964 } |
| 965 |
| 966 _url = 'v1/courses/' + commons.Escaper.ecapeVariable('$courseId') + '/teache
rs'; |
| 967 |
| 968 var _response = _requester.request(_url, |
| 969 "GET", |
| 970 body: _body, |
| 971 queryParams: _queryParams, |
| 972 uploadOptions: _uploadOptions, |
| 973 uploadMedia: _uploadMedia, |
| 974 downloadOptions: _downloadOptions); |
| 975 return _response.then((data) => new ListTeachersResponse.fromJson(data)); |
| 976 } |
| 977 |
| 978 } |
| 979 |
| 980 |
| 981 class InvitationsResourceApi { |
| 982 final commons.ApiRequester _requester; |
| 983 |
| 984 InvitationsResourceApi(commons.ApiRequester client) : |
| 985 _requester = client; |
| 986 |
| 987 /** |
| 988 * Accepts an invitation, removing it and adding the invited user to the |
| 989 * teachers or students (as appropriate) of the specified course. Only the |
| 990 * invited user may accept an invitation. This method returns the following |
| 991 * error codes: * `PERMISSION_DENIED` if the requesting user is not permitted |
| 992 * to accept the requested invitation. * `NOT_FOUND` if no invitation exists |
| 993 * with the requested ID. |
| 994 * |
| 995 * Request parameters: |
| 996 * |
| 997 * [id] - Identifier of the invitation to accept. |
| 998 * |
| 999 * Completes with a [Empty]. |
| 1000 * |
| 1001 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 1002 * error. |
| 1003 * |
| 1004 * If the used [http.Client] completes with an error when making a REST call, |
| 1005 * this method will complete with the same error. |
| 1006 */ |
| 1007 async.Future<Empty> accept(core.String id) { |
| 1008 var _url = null; |
| 1009 var _queryParams = new core.Map(); |
| 1010 var _uploadMedia = null; |
| 1011 var _uploadOptions = null; |
| 1012 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 1013 var _body = null; |
| 1014 |
| 1015 if (id == null) { |
| 1016 throw new core.ArgumentError("Parameter id is required."); |
| 1017 } |
| 1018 |
| 1019 _url = 'v1/invitations/' + commons.Escaper.ecapeVariable('$id') + ':accept'; |
| 1020 |
| 1021 var _response = _requester.request(_url, |
| 1022 "POST", |
| 1023 body: _body, |
| 1024 queryParams: _queryParams, |
| 1025 uploadOptions: _uploadOptions, |
| 1026 uploadMedia: _uploadMedia, |
| 1027 downloadOptions: _downloadOptions); |
| 1028 return _response.then((data) => new Empty.fromJson(data)); |
| 1029 } |
| 1030 |
| 1031 /** |
| 1032 * Creates a invitation. Only one invitation for a user and course may exist |
| 1033 * at a time. Delete and recreate an invitation to make changes. This method |
| 1034 * returns the following error codes: * `PERMISSION_DENIED` if the requesting |
| 1035 * user is not permitted to create invitations for this course. * `NOT_FOUND` |
| 1036 * if the course or the user does not exist. * `ALREADY_EXISTS` if an |
| 1037 * invitation for the specified user and course already exists. |
| 1038 * |
| 1039 * [request] - The metadata request object. |
| 1040 * |
| 1041 * Request parameters: |
| 1042 * |
| 1043 * Completes with a [Invitation]. |
| 1044 * |
| 1045 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 1046 * error. |
| 1047 * |
| 1048 * If the used [http.Client] completes with an error when making a REST call, |
| 1049 * this method will complete with the same error. |
| 1050 */ |
| 1051 async.Future<Invitation> create(Invitation request) { |
| 1052 var _url = null; |
| 1053 var _queryParams = new core.Map(); |
| 1054 var _uploadMedia = null; |
| 1055 var _uploadOptions = null; |
| 1056 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 1057 var _body = null; |
| 1058 |
| 1059 if (request != null) { |
| 1060 _body = convert.JSON.encode((request).toJson()); |
| 1061 } |
| 1062 |
| 1063 _url = 'v1/invitations'; |
| 1064 |
| 1065 var _response = _requester.request(_url, |
| 1066 "POST", |
| 1067 body: _body, |
| 1068 queryParams: _queryParams, |
| 1069 uploadOptions: _uploadOptions, |
| 1070 uploadMedia: _uploadMedia, |
| 1071 downloadOptions: _downloadOptions); |
| 1072 return _response.then((data) => new Invitation.fromJson(data)); |
| 1073 } |
| 1074 |
| 1075 /** |
| 1076 * Deletes a invitation. This method returns the following error codes: * |
| 1077 * `PERMISSION_DENIED` if the requesting user is not permitted to delete the |
| 1078 * requested invitation. * `NOT_FOUND` if no invitation exists with the |
| 1079 * requested ID. |
| 1080 * |
| 1081 * Request parameters: |
| 1082 * |
| 1083 * [id] - Identifier of the invitation to delete. |
| 1084 * |
| 1085 * Completes with a [Empty]. |
| 1086 * |
| 1087 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 1088 * error. |
| 1089 * |
| 1090 * If the used [http.Client] completes with an error when making a REST call, |
| 1091 * this method will complete with the same error. |
| 1092 */ |
| 1093 async.Future<Empty> delete(core.String id) { |
| 1094 var _url = null; |
| 1095 var _queryParams = new core.Map(); |
| 1096 var _uploadMedia = null; |
| 1097 var _uploadOptions = null; |
| 1098 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 1099 var _body = null; |
| 1100 |
| 1101 if (id == null) { |
| 1102 throw new core.ArgumentError("Parameter id is required."); |
| 1103 } |
| 1104 |
| 1105 _url = 'v1/invitations/' + commons.Escaper.ecapeVariable('$id'); |
| 1106 |
| 1107 var _response = _requester.request(_url, |
| 1108 "DELETE", |
| 1109 body: _body, |
| 1110 queryParams: _queryParams, |
| 1111 uploadOptions: _uploadOptions, |
| 1112 uploadMedia: _uploadMedia, |
| 1113 downloadOptions: _downloadOptions); |
| 1114 return _response.then((data) => new Empty.fromJson(data)); |
| 1115 } |
| 1116 |
| 1117 /** |
| 1118 * Returns a invitation. This method returns the following error codes: * |
| 1119 * `PERMISSION_DENIED` if the requesting user is not permitted to view the |
| 1120 * requested invitation. * `NOT_FOUND` if no invitation exists with the |
| 1121 * requested ID. |
| 1122 * |
| 1123 * Request parameters: |
| 1124 * |
| 1125 * [id] - Identifier of the invitation to return. |
| 1126 * |
| 1127 * Completes with a [Invitation]. |
| 1128 * |
| 1129 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 1130 * error. |
| 1131 * |
| 1132 * If the used [http.Client] completes with an error when making a REST call, |
| 1133 * this method will complete with the same error. |
| 1134 */ |
| 1135 async.Future<Invitation> get(core.String id) { |
| 1136 var _url = null; |
| 1137 var _queryParams = new core.Map(); |
| 1138 var _uploadMedia = null; |
| 1139 var _uploadOptions = null; |
| 1140 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 1141 var _body = null; |
| 1142 |
| 1143 if (id == null) { |
| 1144 throw new core.ArgumentError("Parameter id is required."); |
| 1145 } |
| 1146 |
| 1147 _url = 'v1/invitations/' + commons.Escaper.ecapeVariable('$id'); |
| 1148 |
| 1149 var _response = _requester.request(_url, |
| 1150 "GET", |
| 1151 body: _body, |
| 1152 queryParams: _queryParams, |
| 1153 uploadOptions: _uploadOptions, |
| 1154 uploadMedia: _uploadMedia, |
| 1155 downloadOptions: _downloadOptions); |
| 1156 return _response.then((data) => new Invitation.fromJson(data)); |
| 1157 } |
| 1158 |
| 1159 /** |
| 1160 * Returns a list of invitations that the requesting user is permitted to |
| 1161 * view, restricted to those that match the request. *Note:* At least one of |
| 1162 * `user_id` or `course_id` must be supplied. |
| 1163 * |
| 1164 * Request parameters: |
| 1165 * |
| 1166 * [userId] - Restricts returned invitations to those for a specific user. |
| 1167 * This may be the unique identifier for the user or an alias. The supported |
| 1168 * aliases are: * the e-mail address of the user * the string literal `"me"`, |
| 1169 * indicating the requesting user |
| 1170 * |
| 1171 * [courseId] - Restricts returned invitations to those for a course with the |
| 1172 * specified identifier. |
| 1173 * |
| 1174 * [pageSize] - The maximum number of items to return. Zero means no maximum. |
| 1175 * The server may return fewer than the specified number of results. |
| 1176 * |
| 1177 * [pageToken] - |
| 1178 * [nextPageToken][google.classroom.v1.ListInvitationsRespnse.next_page_token] |
| 1179 * value returned from a previous |
| 1180 * [list][google.classroom.v1.Users.ListInvitations] call, indicating that the |
| 1181 * subsequent page of results should be returned. The |
| 1182 * [list][google.classroom.v1.Users.ListInvitations] request must be identical |
| 1183 * to the one which resulted in this token. |
| 1184 * |
| 1185 * Completes with a [ListInvitationsResponse]. |
| 1186 * |
| 1187 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 1188 * error. |
| 1189 * |
| 1190 * If the used [http.Client] completes with an error when making a REST call, |
| 1191 * this method will complete with the same error. |
| 1192 */ |
| 1193 async.Future<ListInvitationsResponse> list({core.String userId, core.String co
urseId, core.int pageSize, core.String pageToken}) { |
| 1194 var _url = null; |
| 1195 var _queryParams = new core.Map(); |
| 1196 var _uploadMedia = null; |
| 1197 var _uploadOptions = null; |
| 1198 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 1199 var _body = null; |
| 1200 |
| 1201 if (userId != null) { |
| 1202 _queryParams["userId"] = [userId]; |
| 1203 } |
| 1204 if (courseId != null) { |
| 1205 _queryParams["courseId"] = [courseId]; |
| 1206 } |
| 1207 if (pageSize != null) { |
| 1208 _queryParams["pageSize"] = ["${pageSize}"]; |
| 1209 } |
| 1210 if (pageToken != null) { |
| 1211 _queryParams["pageToken"] = [pageToken]; |
| 1212 } |
| 1213 |
| 1214 _url = 'v1/invitations'; |
| 1215 |
| 1216 var _response = _requester.request(_url, |
| 1217 "GET", |
| 1218 body: _body, |
| 1219 queryParams: _queryParams, |
| 1220 uploadOptions: _uploadOptions, |
| 1221 uploadMedia: _uploadMedia, |
| 1222 downloadOptions: _downloadOptions); |
| 1223 return _response.then((data) => new ListInvitationsResponse.fromJson(data)); |
| 1224 } |
| 1225 |
| 1226 } |
| 1227 |
| 1228 |
| 1229 class UserProfilesResourceApi { |
| 1230 final commons.ApiRequester _requester; |
| 1231 |
| 1232 UserProfilesResourceApi(commons.ApiRequester client) : |
| 1233 _requester = client; |
| 1234 |
| 1235 /** |
| 1236 * Returns a user profile. This method returns the following error codes: * |
| 1237 * `PERMISSION_DENIED` if the requesting user is not permitted to access this |
| 1238 * user profile. * `NOT_FOUND` if the profile does not exist. |
| 1239 * |
| 1240 * Request parameters: |
| 1241 * |
| 1242 * [userId] - Identifier of the profile to return, or an alias the identifies |
| 1243 * the user. The following aliases are supported: * the e-mail address of the |
| 1244 * user * the string literal `"me"`, indicating the requesting user |
| 1245 * |
| 1246 * Completes with a [UserProfile]. |
| 1247 * |
| 1248 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 1249 * error. |
| 1250 * |
| 1251 * If the used [http.Client] completes with an error when making a REST call, |
| 1252 * this method will complete with the same error. |
| 1253 */ |
| 1254 async.Future<UserProfile> get(core.String userId) { |
| 1255 var _url = null; |
| 1256 var _queryParams = new core.Map(); |
| 1257 var _uploadMedia = null; |
| 1258 var _uploadOptions = null; |
| 1259 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 1260 var _body = null; |
| 1261 |
| 1262 if (userId == null) { |
| 1263 throw new core.ArgumentError("Parameter userId is required."); |
| 1264 } |
| 1265 |
| 1266 _url = 'v1/userProfiles/' + commons.Escaper.ecapeVariable('$userId'); |
| 1267 |
| 1268 var _response = _requester.request(_url, |
| 1269 "GET", |
| 1270 body: _body, |
| 1271 queryParams: _queryParams, |
| 1272 uploadOptions: _uploadOptions, |
| 1273 uploadMedia: _uploadMedia, |
| 1274 downloadOptions: _downloadOptions); |
| 1275 return _response.then((data) => new UserProfile.fromJson(data)); |
| 1276 } |
| 1277 |
| 1278 } |
| 1279 |
| 1280 |
| 1281 |
| 1282 /** A Course in Classroom. */ |
| 1283 class Course { |
| 1284 /** Absolute link to this course in the Classroom web UI. Read-only. */ |
| 1285 core.String alternateLink; |
| 1286 /** |
| 1287 * State of the course. If unspecified, the default state will be |
| 1288 * `PROVISIONED`. |
| 1289 * Possible string values are: |
| 1290 * - "COURSE_STATE_UNSPECIFIED" : A COURSE_STATE_UNSPECIFIED. |
| 1291 * - "ACTIVE" : A ACTIVE. |
| 1292 * - "ARCHIVED" : A ARCHIVED. |
| 1293 * - "PROVISIONED" : A PROVISIONED. |
| 1294 * - "DECLINED" : A DECLINED. |
| 1295 */ |
| 1296 core.String courseState; |
| 1297 /** |
| 1298 * Creation time of the course. Specifying this field in a course update mask |
| 1299 * will result in an error. Read-only. |
| 1300 */ |
| 1301 core.String creationTime; |
| 1302 /** |
| 1303 * Optional description. For example, "We'll be learning about about the |
| 1304 * structure of living creatures from a combination of textbooks, guest |
| 1305 * lectures, and lab work. Expect to be excited!" If set, this field must be a |
| 1306 * valid UTF-8 string and no longer than 30,000 characters. |
| 1307 */ |
| 1308 core.String description; |
| 1309 /** |
| 1310 * Optional heading for the description. For example, "Welcome to 10th Grade |
| 1311 * Biology" If set, this field must be a valid UTF-8 string and no longer than |
| 1312 * 3600 characters. |
| 1313 */ |
| 1314 core.String descriptionHeading; |
| 1315 /** |
| 1316 * Enrollment code to use when joining this course. Specifying this field in a |
| 1317 * course update mask will result in an error. Read-only. |
| 1318 */ |
| 1319 core.String enrollmentCode; |
| 1320 /** |
| 1321 * Unique identifier for this course assigned by Classroom. You may optionally |
| 1322 * set this to an [alias string][google.classroom.v1.CourseAlias] as part of |
| 1323 * [creating a course][google.classroom.v1.Courses.CreateCourse], creating a |
| 1324 * corresponding alias. The `ID` cannot be updated after a course is created. |
| 1325 * Specifying this field in a course update mask will result in an error. |
| 1326 */ |
| 1327 core.String id; |
| 1328 /** |
| 1329 * Name of the course. For example, "10th Grade Biology". This is required and |
| 1330 * must be between 1 and 750 characters and a valid UTF-8 string. |
| 1331 */ |
| 1332 core.String name; |
| 1333 /** |
| 1334 * The identifier of the owner (and primary teacher) of a course. When |
| 1335 * specified as a parameter of CreateCourseRequest, this field is required. It |
| 1336 * may be the numeric identifier for the user, or an alias that identifies the |
| 1337 * owner. The following aliases are supported: * the e-mail address of the |
| 1338 * user * the string literal `"me"`, indicating that the requesting user This |
| 1339 * must be set in a CreateRequest; specifying this field in a course update |
| 1340 * mask will result in an error. |
| 1341 */ |
| 1342 core.String ownerId; |
| 1343 /** |
| 1344 * Optional room location. For example, "301" If set, this field must be a |
| 1345 * valid UTF-8 string and no longer than 650 characters. |
| 1346 */ |
| 1347 core.String room; |
| 1348 /** |
| 1349 * Section of the course For example, "Period 2". If set, this field must be a |
| 1350 * valid UTF-8 string and no longer than 2800 characters. |
| 1351 */ |
| 1352 core.String section; |
| 1353 /** |
| 1354 * Time of the most recent update to this course. Specifying this field in a |
| 1355 * course update mask will result in an error. Read-only. |
| 1356 */ |
| 1357 core.String updateTime; |
| 1358 |
| 1359 Course(); |
| 1360 |
| 1361 Course.fromJson(core.Map _json) { |
| 1362 if (_json.containsKey("alternateLink")) { |
| 1363 alternateLink = _json["alternateLink"]; |
| 1364 } |
| 1365 if (_json.containsKey("courseState")) { |
| 1366 courseState = _json["courseState"]; |
| 1367 } |
| 1368 if (_json.containsKey("creationTime")) { |
| 1369 creationTime = _json["creationTime"]; |
| 1370 } |
| 1371 if (_json.containsKey("description")) { |
| 1372 description = _json["description"]; |
| 1373 } |
| 1374 if (_json.containsKey("descriptionHeading")) { |
| 1375 descriptionHeading = _json["descriptionHeading"]; |
| 1376 } |
| 1377 if (_json.containsKey("enrollmentCode")) { |
| 1378 enrollmentCode = _json["enrollmentCode"]; |
| 1379 } |
| 1380 if (_json.containsKey("id")) { |
| 1381 id = _json["id"]; |
| 1382 } |
| 1383 if (_json.containsKey("name")) { |
| 1384 name = _json["name"]; |
| 1385 } |
| 1386 if (_json.containsKey("ownerId")) { |
| 1387 ownerId = _json["ownerId"]; |
| 1388 } |
| 1389 if (_json.containsKey("room")) { |
| 1390 room = _json["room"]; |
| 1391 } |
| 1392 if (_json.containsKey("section")) { |
| 1393 section = _json["section"]; |
| 1394 } |
| 1395 if (_json.containsKey("updateTime")) { |
| 1396 updateTime = _json["updateTime"]; |
| 1397 } |
| 1398 } |
| 1399 |
| 1400 core.Map toJson() { |
| 1401 var _json = new core.Map(); |
| 1402 if (alternateLink != null) { |
| 1403 _json["alternateLink"] = alternateLink; |
| 1404 } |
| 1405 if (courseState != null) { |
| 1406 _json["courseState"] = courseState; |
| 1407 } |
| 1408 if (creationTime != null) { |
| 1409 _json["creationTime"] = creationTime; |
| 1410 } |
| 1411 if (description != null) { |
| 1412 _json["description"] = description; |
| 1413 } |
| 1414 if (descriptionHeading != null) { |
| 1415 _json["descriptionHeading"] = descriptionHeading; |
| 1416 } |
| 1417 if (enrollmentCode != null) { |
| 1418 _json["enrollmentCode"] = enrollmentCode; |
| 1419 } |
| 1420 if (id != null) { |
| 1421 _json["id"] = id; |
| 1422 } |
| 1423 if (name != null) { |
| 1424 _json["name"] = name; |
| 1425 } |
| 1426 if (ownerId != null) { |
| 1427 _json["ownerId"] = ownerId; |
| 1428 } |
| 1429 if (room != null) { |
| 1430 _json["room"] = room; |
| 1431 } |
| 1432 if (section != null) { |
| 1433 _json["section"] = section; |
| 1434 } |
| 1435 if (updateTime != null) { |
| 1436 _json["updateTime"] = updateTime; |
| 1437 } |
| 1438 return _json; |
| 1439 } |
| 1440 } |
| 1441 |
| 1442 /** |
| 1443 * Alternative identifier for a course. An alias uniquely identifies a course. |
| 1444 * It will be unique within one of the following scopes: * domain: A |
| 1445 * domain-scoped alias is visible to all users within the alias creator's domain |
| 1446 * and may only be created by a domain admin. A domain-scoped alias is often |
| 1447 * used when a course has an identifier external to Classroom. * project: A |
| 1448 * project-scoped alias is visible to any request from an application using the |
| 1449 * Developer Console Project ID that created the alias and may be created by any |
| 1450 * project. A project-scoped alias is often used when an application has |
| 1451 * alternative identifiers. A random value can also be used to avoid duplicate |
| 1452 * courses in the event of transmission failures, as retrying a request will |
| 1453 * return ALREADY_EXISTS if a previous one has succeeded. |
| 1454 */ |
| 1455 class CourseAlias { |
| 1456 /** |
| 1457 * Alias string. The format of the string indicated the desired alias scoping. |
| 1458 * * "d:" indicates a domain-scoped alias. Example: d:math_101 * "p:" |
| 1459 * indicates a project-scoped alias. Example: p:abc123 This field has a |
| 1460 * maximum length of 256 characters. |
| 1461 */ |
| 1462 core.String alias; |
| 1463 |
| 1464 CourseAlias(); |
| 1465 |
| 1466 CourseAlias.fromJson(core.Map _json) { |
| 1467 if (_json.containsKey("alias")) { |
| 1468 alias = _json["alias"]; |
| 1469 } |
| 1470 } |
| 1471 |
| 1472 core.Map toJson() { |
| 1473 var _json = new core.Map(); |
| 1474 if (alias != null) { |
| 1475 _json["alias"] = alias; |
| 1476 } |
| 1477 return _json; |
| 1478 } |
| 1479 } |
| 1480 |
| 1481 /** |
| 1482 * A generic empty message that you can re-use to avoid defining duplicated |
| 1483 * empty messages in your APIs. A typical example is to use it as the request or |
| 1484 * the response type of an API method. For instance: service Foo { rpc |
| 1485 * Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON |
| 1486 * representation for `Empty` is empty JSON object `{}`. |
| 1487 */ |
| 1488 class Empty { |
| 1489 |
| 1490 Empty(); |
| 1491 |
| 1492 Empty.fromJson(core.Map _json) { |
| 1493 } |
| 1494 |
| 1495 core.Map toJson() { |
| 1496 var _json = new core.Map(); |
| 1497 return _json; |
| 1498 } |
| 1499 } |
| 1500 |
| 1501 /** Global user permission description. */ |
| 1502 class GlobalPermission { |
| 1503 /** |
| 1504 * Permission value. |
| 1505 * Possible string values are: |
| 1506 * - "PERMISSION_UNSPECIFIED" : A PERMISSION_UNSPECIFIED. |
| 1507 * - "CREATE_COURSE" : A CREATE_COURSE. |
| 1508 */ |
| 1509 core.String permission; |
| 1510 |
| 1511 GlobalPermission(); |
| 1512 |
| 1513 GlobalPermission.fromJson(core.Map _json) { |
| 1514 if (_json.containsKey("permission")) { |
| 1515 permission = _json["permission"]; |
| 1516 } |
| 1517 } |
| 1518 |
| 1519 core.Map toJson() { |
| 1520 var _json = new core.Map(); |
| 1521 if (permission != null) { |
| 1522 _json["permission"] = permission; |
| 1523 } |
| 1524 return _json; |
| 1525 } |
| 1526 } |
| 1527 |
| 1528 /** An invitation to join a course. */ |
| 1529 class Invitation { |
| 1530 /** Identifier of the course to invite the user to. */ |
| 1531 core.String courseId; |
| 1532 /** Unique identifier assigned by Classroom. Read-only */ |
| 1533 core.String id; |
| 1534 /** |
| 1535 * Role to invite the user to have. Must not be `COURSE_ROLE_UNSPECIFIED`. |
| 1536 * Possible string values are: |
| 1537 * - "COURSE_ROLE_UNSPECIFIED" : A COURSE_ROLE_UNSPECIFIED. |
| 1538 * - "STUDENT" : A STUDENT. |
| 1539 * - "TEACHER" : A TEACHER. |
| 1540 */ |
| 1541 core.String role; |
| 1542 /** |
| 1543 * Identifier of the invited user. When specified as a parameter of a request, |
| 1544 * this may be set to an alias that identifies the user to invite. The |
| 1545 * supported aliases are: * the e-mail address of the user * the string |
| 1546 * literal `"me"`, indicating that the requesting user |
| 1547 */ |
| 1548 core.String userId; |
| 1549 |
| 1550 Invitation(); |
| 1551 |
| 1552 Invitation.fromJson(core.Map _json) { |
| 1553 if (_json.containsKey("courseId")) { |
| 1554 courseId = _json["courseId"]; |
| 1555 } |
| 1556 if (_json.containsKey("id")) { |
| 1557 id = _json["id"]; |
| 1558 } |
| 1559 if (_json.containsKey("role")) { |
| 1560 role = _json["role"]; |
| 1561 } |
| 1562 if (_json.containsKey("userId")) { |
| 1563 userId = _json["userId"]; |
| 1564 } |
| 1565 } |
| 1566 |
| 1567 core.Map toJson() { |
| 1568 var _json = new core.Map(); |
| 1569 if (courseId != null) { |
| 1570 _json["courseId"] = courseId; |
| 1571 } |
| 1572 if (id != null) { |
| 1573 _json["id"] = id; |
| 1574 } |
| 1575 if (role != null) { |
| 1576 _json["role"] = role; |
| 1577 } |
| 1578 if (userId != null) { |
| 1579 _json["userId"] = userId; |
| 1580 } |
| 1581 return _json; |
| 1582 } |
| 1583 } |
| 1584 |
| 1585 /** Response when listing course aliases. */ |
| 1586 class ListCourseAliasesResponse { |
| 1587 /** The course aliases. */ |
| 1588 core.List<CourseAlias> aliases; |
| 1589 /** |
| 1590 * Token identifying the next page of results to return. If empty, no further |
| 1591 * results are available. |
| 1592 */ |
| 1593 core.String nextPageToken; |
| 1594 |
| 1595 ListCourseAliasesResponse(); |
| 1596 |
| 1597 ListCourseAliasesResponse.fromJson(core.Map _json) { |
| 1598 if (_json.containsKey("aliases")) { |
| 1599 aliases = _json["aliases"].map((value) => new CourseAlias.fromJson(value))
.toList(); |
| 1600 } |
| 1601 if (_json.containsKey("nextPageToken")) { |
| 1602 nextPageToken = _json["nextPageToken"]; |
| 1603 } |
| 1604 } |
| 1605 |
| 1606 core.Map toJson() { |
| 1607 var _json = new core.Map(); |
| 1608 if (aliases != null) { |
| 1609 _json["aliases"] = aliases.map((value) => (value).toJson()).toList(); |
| 1610 } |
| 1611 if (nextPageToken != null) { |
| 1612 _json["nextPageToken"] = nextPageToken; |
| 1613 } |
| 1614 return _json; |
| 1615 } |
| 1616 } |
| 1617 |
| 1618 /** Response when listing courses. */ |
| 1619 class ListCoursesResponse { |
| 1620 /** Courses that match the request. */ |
| 1621 core.List<Course> courses; |
| 1622 /** |
| 1623 * Token identifying the next page of results to return. If empty, no further |
| 1624 * results are available. |
| 1625 */ |
| 1626 core.String nextPageToken; |
| 1627 |
| 1628 ListCoursesResponse(); |
| 1629 |
| 1630 ListCoursesResponse.fromJson(core.Map _json) { |
| 1631 if (_json.containsKey("courses")) { |
| 1632 courses = _json["courses"].map((value) => new Course.fromJson(value)).toLi
st(); |
| 1633 } |
| 1634 if (_json.containsKey("nextPageToken")) { |
| 1635 nextPageToken = _json["nextPageToken"]; |
| 1636 } |
| 1637 } |
| 1638 |
| 1639 core.Map toJson() { |
| 1640 var _json = new core.Map(); |
| 1641 if (courses != null) { |
| 1642 _json["courses"] = courses.map((value) => (value).toJson()).toList(); |
| 1643 } |
| 1644 if (nextPageToken != null) { |
| 1645 _json["nextPageToken"] = nextPageToken; |
| 1646 } |
| 1647 return _json; |
| 1648 } |
| 1649 } |
| 1650 |
| 1651 /** Response when listing invitations. */ |
| 1652 class ListInvitationsResponse { |
| 1653 /** Invitations that match the request. */ |
| 1654 core.List<Invitation> invitations; |
| 1655 /** |
| 1656 * Token identifying the next page of results to return. If empty, no further |
| 1657 * results are available. |
| 1658 */ |
| 1659 core.String nextPageToken; |
| 1660 |
| 1661 ListInvitationsResponse(); |
| 1662 |
| 1663 ListInvitationsResponse.fromJson(core.Map _json) { |
| 1664 if (_json.containsKey("invitations")) { |
| 1665 invitations = _json["invitations"].map((value) => new Invitation.fromJson(
value)).toList(); |
| 1666 } |
| 1667 if (_json.containsKey("nextPageToken")) { |
| 1668 nextPageToken = _json["nextPageToken"]; |
| 1669 } |
| 1670 } |
| 1671 |
| 1672 core.Map toJson() { |
| 1673 var _json = new core.Map(); |
| 1674 if (invitations != null) { |
| 1675 _json["invitations"] = invitations.map((value) => (value).toJson()).toList
(); |
| 1676 } |
| 1677 if (nextPageToken != null) { |
| 1678 _json["nextPageToken"] = nextPageToken; |
| 1679 } |
| 1680 return _json; |
| 1681 } |
| 1682 } |
| 1683 |
| 1684 /** Response when listing students. */ |
| 1685 class ListStudentsResponse { |
| 1686 /** |
| 1687 * Token identifying the next page of results to return. If empty, no further |
| 1688 * results are available. |
| 1689 */ |
| 1690 core.String nextPageToken; |
| 1691 /** The students who match the list request. */ |
| 1692 core.List<Student> students; |
| 1693 |
| 1694 ListStudentsResponse(); |
| 1695 |
| 1696 ListStudentsResponse.fromJson(core.Map _json) { |
| 1697 if (_json.containsKey("nextPageToken")) { |
| 1698 nextPageToken = _json["nextPageToken"]; |
| 1699 } |
| 1700 if (_json.containsKey("students")) { |
| 1701 students = _json["students"].map((value) => new Student.fromJson(value)).t
oList(); |
| 1702 } |
| 1703 } |
| 1704 |
| 1705 core.Map toJson() { |
| 1706 var _json = new core.Map(); |
| 1707 if (nextPageToken != null) { |
| 1708 _json["nextPageToken"] = nextPageToken; |
| 1709 } |
| 1710 if (students != null) { |
| 1711 _json["students"] = students.map((value) => (value).toJson()).toList(); |
| 1712 } |
| 1713 return _json; |
| 1714 } |
| 1715 } |
| 1716 |
| 1717 /** Response when listing teachers. */ |
| 1718 class ListTeachersResponse { |
| 1719 /** |
| 1720 * Token identifying the next page of results to return. If empty, no further |
| 1721 * results are available. |
| 1722 */ |
| 1723 core.String nextPageToken; |
| 1724 /** The teachers who match the list request. */ |
| 1725 core.List<Teacher> teachers; |
| 1726 |
| 1727 ListTeachersResponse(); |
| 1728 |
| 1729 ListTeachersResponse.fromJson(core.Map _json) { |
| 1730 if (_json.containsKey("nextPageToken")) { |
| 1731 nextPageToken = _json["nextPageToken"]; |
| 1732 } |
| 1733 if (_json.containsKey("teachers")) { |
| 1734 teachers = _json["teachers"].map((value) => new Teacher.fromJson(value)).t
oList(); |
| 1735 } |
| 1736 } |
| 1737 |
| 1738 core.Map toJson() { |
| 1739 var _json = new core.Map(); |
| 1740 if (nextPageToken != null) { |
| 1741 _json["nextPageToken"] = nextPageToken; |
| 1742 } |
| 1743 if (teachers != null) { |
| 1744 _json["teachers"] = teachers.map((value) => (value).toJson()).toList(); |
| 1745 } |
| 1746 return _json; |
| 1747 } |
| 1748 } |
| 1749 |
| 1750 /** Details of the user's name. */ |
| 1751 class Name { |
| 1752 /** The user's last name. Read-only */ |
| 1753 core.String familyName; |
| 1754 /** |
| 1755 * The user's full name formed by concatenating the first and last name |
| 1756 * values. Read-only |
| 1757 */ |
| 1758 core.String fullName; |
| 1759 /** The user's first name. Read-only */ |
| 1760 core.String givenName; |
| 1761 |
| 1762 Name(); |
| 1763 |
| 1764 Name.fromJson(core.Map _json) { |
| 1765 if (_json.containsKey("familyName")) { |
| 1766 familyName = _json["familyName"]; |
| 1767 } |
| 1768 if (_json.containsKey("fullName")) { |
| 1769 fullName = _json["fullName"]; |
| 1770 } |
| 1771 if (_json.containsKey("givenName")) { |
| 1772 givenName = _json["givenName"]; |
| 1773 } |
| 1774 } |
| 1775 |
| 1776 core.Map toJson() { |
| 1777 var _json = new core.Map(); |
| 1778 if (familyName != null) { |
| 1779 _json["familyName"] = familyName; |
| 1780 } |
| 1781 if (fullName != null) { |
| 1782 _json["fullName"] = fullName; |
| 1783 } |
| 1784 if (givenName != null) { |
| 1785 _json["givenName"] = givenName; |
| 1786 } |
| 1787 return _json; |
| 1788 } |
| 1789 } |
| 1790 |
| 1791 /** Student in a course. */ |
| 1792 class Student { |
| 1793 /** Unique identifier of the course. Read-only */ |
| 1794 core.String courseId; |
| 1795 /** Global user information for the student. Read-only */ |
| 1796 UserProfile profile; |
| 1797 /** |
| 1798 * The identifier of the user. When specified as a parameter of request, this |
| 1799 * field may be set to an alias that identifies the student. The following are |
| 1800 * supported: * the e-mail address of the user * the string literal `"me"`, |
| 1801 * indicating that the requesting user |
| 1802 */ |
| 1803 core.String userId; |
| 1804 |
| 1805 Student(); |
| 1806 |
| 1807 Student.fromJson(core.Map _json) { |
| 1808 if (_json.containsKey("courseId")) { |
| 1809 courseId = _json["courseId"]; |
| 1810 } |
| 1811 if (_json.containsKey("profile")) { |
| 1812 profile = new UserProfile.fromJson(_json["profile"]); |
| 1813 } |
| 1814 if (_json.containsKey("userId")) { |
| 1815 userId = _json["userId"]; |
| 1816 } |
| 1817 } |
| 1818 |
| 1819 core.Map toJson() { |
| 1820 var _json = new core.Map(); |
| 1821 if (courseId != null) { |
| 1822 _json["courseId"] = courseId; |
| 1823 } |
| 1824 if (profile != null) { |
| 1825 _json["profile"] = (profile).toJson(); |
| 1826 } |
| 1827 if (userId != null) { |
| 1828 _json["userId"] = userId; |
| 1829 } |
| 1830 return _json; |
| 1831 } |
| 1832 } |
| 1833 |
| 1834 /** Teacher of a course. */ |
| 1835 class Teacher { |
| 1836 /** Unique identifier of the course. Read-only */ |
| 1837 core.String courseId; |
| 1838 /** Global user information for the teacher. Read-only */ |
| 1839 UserProfile profile; |
| 1840 /** |
| 1841 * The identifier of the user. When specified as a parameter of request, this |
| 1842 * field may be set to an alias that identifies the teacher. The following are |
| 1843 * supported: * the e-mail address of the user * the string literal `"me"`, |
| 1844 * indicating the requesting user |
| 1845 */ |
| 1846 core.String userId; |
| 1847 |
| 1848 Teacher(); |
| 1849 |
| 1850 Teacher.fromJson(core.Map _json) { |
| 1851 if (_json.containsKey("courseId")) { |
| 1852 courseId = _json["courseId"]; |
| 1853 } |
| 1854 if (_json.containsKey("profile")) { |
| 1855 profile = new UserProfile.fromJson(_json["profile"]); |
| 1856 } |
| 1857 if (_json.containsKey("userId")) { |
| 1858 userId = _json["userId"]; |
| 1859 } |
| 1860 } |
| 1861 |
| 1862 core.Map toJson() { |
| 1863 var _json = new core.Map(); |
| 1864 if (courseId != null) { |
| 1865 _json["courseId"] = courseId; |
| 1866 } |
| 1867 if (profile != null) { |
| 1868 _json["profile"] = (profile).toJson(); |
| 1869 } |
| 1870 if (userId != null) { |
| 1871 _json["userId"] = userId; |
| 1872 } |
| 1873 return _json; |
| 1874 } |
| 1875 } |
| 1876 |
| 1877 /** Global information for a user. */ |
| 1878 class UserProfile { |
| 1879 /** E-mail address of the user. Read-only */ |
| 1880 core.String emailAddress; |
| 1881 /** Unique identifier of the user. Read-only */ |
| 1882 core.String id; |
| 1883 /** Name of the user. Read-only */ |
| 1884 Name name; |
| 1885 /** Global permissions of the user. Read-only */ |
| 1886 core.List<GlobalPermission> permissions; |
| 1887 /** Url of user's profile photo. Read-only */ |
| 1888 core.String photoUrl; |
| 1889 |
| 1890 UserProfile(); |
| 1891 |
| 1892 UserProfile.fromJson(core.Map _json) { |
| 1893 if (_json.containsKey("emailAddress")) { |
| 1894 emailAddress = _json["emailAddress"]; |
| 1895 } |
| 1896 if (_json.containsKey("id")) { |
| 1897 id = _json["id"]; |
| 1898 } |
| 1899 if (_json.containsKey("name")) { |
| 1900 name = new Name.fromJson(_json["name"]); |
| 1901 } |
| 1902 if (_json.containsKey("permissions")) { |
| 1903 permissions = _json["permissions"].map((value) => new GlobalPermission.fro
mJson(value)).toList(); |
| 1904 } |
| 1905 if (_json.containsKey("photoUrl")) { |
| 1906 photoUrl = _json["photoUrl"]; |
| 1907 } |
| 1908 } |
| 1909 |
| 1910 core.Map toJson() { |
| 1911 var _json = new core.Map(); |
| 1912 if (emailAddress != null) { |
| 1913 _json["emailAddress"] = emailAddress; |
| 1914 } |
| 1915 if (id != null) { |
| 1916 _json["id"] = id; |
| 1917 } |
| 1918 if (name != null) { |
| 1919 _json["name"] = (name).toJson(); |
| 1920 } |
| 1921 if (permissions != null) { |
| 1922 _json["permissions"] = permissions.map((value) => (value).toJson()).toList
(); |
| 1923 } |
| 1924 if (photoUrl != null) { |
| 1925 _json["photoUrl"] = photoUrl; |
| 1926 } |
| 1927 return _json; |
| 1928 } |
| 1929 } |
OLD | NEW |