[e3d4e0a] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | * Copyright 2014 Google Inc.
|
---|
| 4 | *
|
---|
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
| 6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
| 7 | * the License at
|
---|
| 8 | *
|
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | *
|
---|
| 11 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
| 14 | * License for the specific language governing permissions and limitations under
|
---|
| 15 | * the License.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | namespace Google\Service\Classroom\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Classroom\ClassroomEmpty;
|
---|
| 21 | use Google\Service\Classroom\ListTeachersResponse;
|
---|
| 22 | use Google\Service\Classroom\Teacher;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "teachers" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $classroomService = new Google\Service\Classroom(...);
|
---|
| 29 | * $teachers = $classroomService->courses_teachers;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class CoursesTeachers extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Creates a teacher of a course. Domain administrators are permitted to
|
---|
| 36 | * [directly add](https://developers.google.com/classroom/guides/manage-users)
|
---|
| 37 | * users within their domain as teachers to courses within their domain. Non-
|
---|
| 38 | * admin users should send an Invitation instead. This method returns the
|
---|
| 39 | * following error codes: * `PERMISSION_DENIED` if the requesting user is not
|
---|
| 40 | * permitted to create teachers in this course or for access errors. *
|
---|
| 41 | * `NOT_FOUND` if the requested course ID does not exist. *
|
---|
| 42 | * `FAILED_PRECONDITION` if the requested user's account is disabled, for the
|
---|
| 43 | * following request errors: * CourseMemberLimitReached * CourseNotModifiable *
|
---|
| 44 | * CourseTeacherLimitReached * UserGroupsMembershipLimitReached *
|
---|
| 45 | * InactiveCourseOwner * `ALREADY_EXISTS` if the user is already a teacher or
|
---|
| 46 | * student in the course. (teachers.create)
|
---|
| 47 | *
|
---|
| 48 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
| 49 | * either the Classroom-assigned identifier or an alias.
|
---|
| 50 | * @param Teacher $postBody
|
---|
| 51 | * @param array $optParams Optional parameters.
|
---|
| 52 | * @return Teacher
|
---|
| 53 | * @throws \Google\Service\Exception
|
---|
| 54 | */
|
---|
| 55 | public function create($courseId, Teacher $postBody, $optParams = [])
|
---|
| 56 | {
|
---|
| 57 | $params = ['courseId' => $courseId, 'postBody' => $postBody];
|
---|
| 58 | $params = array_merge($params, $optParams);
|
---|
| 59 | return $this->call('create', [$params], Teacher::class);
|
---|
| 60 | }
|
---|
| 61 | /**
|
---|
| 62 | * Removes the specified teacher from the specified course. This method returns
|
---|
| 63 | * the following error codes: * `PERMISSION_DENIED` if the requesting user is
|
---|
| 64 | * not permitted to delete teachers of this course or for access errors. *
|
---|
| 65 | * `NOT_FOUND` if no teacher of this course has the requested ID or if the
|
---|
| 66 | * course does not exist. * `FAILED_PRECONDITION` if the requested ID belongs to
|
---|
| 67 | * the primary teacher of this course. * `FAILED_PRECONDITION` if the requested
|
---|
| 68 | * ID belongs to the owner of the course Drive folder. * `FAILED_PRECONDITION`
|
---|
| 69 | * if the course no longer has an active owner. (teachers.delete)
|
---|
| 70 | *
|
---|
| 71 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
| 72 | * either the Classroom-assigned identifier or an alias.
|
---|
| 73 | * @param string $userId Identifier of the teacher to delete. The identifier can
|
---|
| 74 | * be one of the following: * the numeric identifier for the user * the email
|
---|
| 75 | * address of the user * the string literal `"me"`, indicating the requesting
|
---|
| 76 | * user
|
---|
| 77 | * @param array $optParams Optional parameters.
|
---|
| 78 | * @return ClassroomEmpty
|
---|
| 79 | * @throws \Google\Service\Exception
|
---|
| 80 | */
|
---|
| 81 | public function delete($courseId, $userId, $optParams = [])
|
---|
| 82 | {
|
---|
| 83 | $params = ['courseId' => $courseId, 'userId' => $userId];
|
---|
| 84 | $params = array_merge($params, $optParams);
|
---|
| 85 | return $this->call('delete', [$params], ClassroomEmpty::class);
|
---|
| 86 | }
|
---|
| 87 | /**
|
---|
| 88 | * Returns a teacher of a course. This method returns the following error codes:
|
---|
| 89 | * * `PERMISSION_DENIED` if the requesting user is not permitted to view
|
---|
| 90 | * teachers of this course or for access errors. * `NOT_FOUND` if no teacher of
|
---|
| 91 | * this course has the requested ID or if the course does not exist.
|
---|
| 92 | * (teachers.get)
|
---|
| 93 | *
|
---|
| 94 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
| 95 | * either the Classroom-assigned identifier or an alias.
|
---|
| 96 | * @param string $userId Identifier of the teacher to return. The identifier can
|
---|
| 97 | * be one of the following: * the numeric identifier for the user * the email
|
---|
| 98 | * address of the user * the string literal `"me"`, indicating the requesting
|
---|
| 99 | * user
|
---|
| 100 | * @param array $optParams Optional parameters.
|
---|
| 101 | * @return Teacher
|
---|
| 102 | * @throws \Google\Service\Exception
|
---|
| 103 | */
|
---|
| 104 | public function get($courseId, $userId, $optParams = [])
|
---|
| 105 | {
|
---|
| 106 | $params = ['courseId' => $courseId, 'userId' => $userId];
|
---|
| 107 | $params = array_merge($params, $optParams);
|
---|
| 108 | return $this->call('get', [$params], Teacher::class);
|
---|
| 109 | }
|
---|
| 110 | /**
|
---|
| 111 | * Returns a list of teachers of this course that the requester is permitted to
|
---|
| 112 | * view. This method returns the following error codes: * `NOT_FOUND` if the
|
---|
| 113 | * course does not exist. * `PERMISSION_DENIED` for access errors.
|
---|
| 114 | * (teachers.listCoursesTeachers)
|
---|
| 115 | *
|
---|
| 116 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
| 117 | * either the Classroom-assigned identifier or an alias.
|
---|
| 118 | * @param array $optParams Optional parameters.
|
---|
| 119 | *
|
---|
| 120 | * @opt_param int pageSize Maximum number of items to return. The default is 30
|
---|
| 121 | * if unspecified or `0`. The server may return fewer than the specified number
|
---|
| 122 | * of results.
|
---|
| 123 | * @opt_param string pageToken nextPageToken value returned from a previous list
|
---|
| 124 | * call, indicating that the subsequent page of results should be returned. The
|
---|
| 125 | * list request must be otherwise identical to the one that resulted in this
|
---|
| 126 | * token.
|
---|
| 127 | * @return ListTeachersResponse
|
---|
| 128 | * @throws \Google\Service\Exception
|
---|
| 129 | */
|
---|
| 130 | public function listCoursesTeachers($courseId, $optParams = [])
|
---|
| 131 | {
|
---|
| 132 | $params = ['courseId' => $courseId];
|
---|
| 133 | $params = array_merge($params, $optParams);
|
---|
| 134 | return $this->call('list', [$params], ListTeachersResponse::class);
|
---|
| 135 | }
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 139 | class_alias(CoursesTeachers::class, 'Google_Service_Classroom_Resource_CoursesTeachers');
|
---|