[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\Invitation;
|
---|
| 22 | use Google\Service\Classroom\ListInvitationsResponse;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "invitations" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $classroomService = new Google\Service\Classroom(...);
|
---|
| 29 | * $invitations = $classroomService->invitations;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class Invitations extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Accepts an invitation, removing it and adding the invited user to the
|
---|
| 36 | * teachers or students (as appropriate) of the specified course. Only the
|
---|
| 37 | * invited user may accept an invitation. This method returns the following
|
---|
| 38 | * error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
|
---|
| 39 | * accept the requested invitation or for access errors. * `FAILED_PRECONDITION`
|
---|
| 40 | * for the following request errors: * CourseMemberLimitReached *
|
---|
| 41 | * CourseNotModifiable * CourseTeacherLimitReached *
|
---|
| 42 | * UserGroupsMembershipLimitReached * `NOT_FOUND` if no invitation exists with
|
---|
| 43 | * the requested ID. (invitations.accept)
|
---|
| 44 | *
|
---|
| 45 | * @param string $id Identifier of the invitation to accept.
|
---|
| 46 | * @param array $optParams Optional parameters.
|
---|
| 47 | * @return ClassroomEmpty
|
---|
| 48 | * @throws \Google\Service\Exception
|
---|
| 49 | */
|
---|
| 50 | public function accept($id, $optParams = [])
|
---|
| 51 | {
|
---|
| 52 | $params = ['id' => $id];
|
---|
| 53 | $params = array_merge($params, $optParams);
|
---|
| 54 | return $this->call('accept', [$params], ClassroomEmpty::class);
|
---|
| 55 | }
|
---|
| 56 | /**
|
---|
| 57 | * Creates an invitation. Only one invitation for a user and course may exist at
|
---|
| 58 | * a time. Delete and re-create an invitation to make changes. This method
|
---|
| 59 | * returns the following error codes: * `PERMISSION_DENIED` if the requesting
|
---|
| 60 | * user is not permitted to create invitations for this course or for access
|
---|
| 61 | * errors. * `NOT_FOUND` if the course or the user does not exist. *
|
---|
| 62 | * `FAILED_PRECONDITION`: * if the requested user's account is disabled. * if
|
---|
| 63 | * the user already has this role or a role with greater permissions. * for the
|
---|
| 64 | * following request errors: * IneligibleOwner * `ALREADY_EXISTS` if an
|
---|
| 65 | * invitation for the specified user and course already exists.
|
---|
| 66 | * (invitations.create)
|
---|
| 67 | *
|
---|
| 68 | * @param Invitation $postBody
|
---|
| 69 | * @param array $optParams Optional parameters.
|
---|
| 70 | * @return Invitation
|
---|
| 71 | * @throws \Google\Service\Exception
|
---|
| 72 | */
|
---|
| 73 | public function create(Invitation $postBody, $optParams = [])
|
---|
| 74 | {
|
---|
| 75 | $params = ['postBody' => $postBody];
|
---|
| 76 | $params = array_merge($params, $optParams);
|
---|
| 77 | return $this->call('create', [$params], Invitation::class);
|
---|
| 78 | }
|
---|
| 79 | /**
|
---|
| 80 | * Deletes an invitation. This method returns the following error codes: *
|
---|
| 81 | * `PERMISSION_DENIED` if the requesting user is not permitted to delete the
|
---|
| 82 | * requested invitation or for access errors. * `NOT_FOUND` if no invitation
|
---|
| 83 | * exists with the requested ID. (invitations.delete)
|
---|
| 84 | *
|
---|
| 85 | * @param string $id Identifier of the invitation to delete.
|
---|
| 86 | * @param array $optParams Optional parameters.
|
---|
| 87 | * @return ClassroomEmpty
|
---|
| 88 | * @throws \Google\Service\Exception
|
---|
| 89 | */
|
---|
| 90 | public function delete($id, $optParams = [])
|
---|
| 91 | {
|
---|
| 92 | $params = ['id' => $id];
|
---|
| 93 | $params = array_merge($params, $optParams);
|
---|
| 94 | return $this->call('delete', [$params], ClassroomEmpty::class);
|
---|
| 95 | }
|
---|
| 96 | /**
|
---|
| 97 | * Returns an invitation. This method returns the following error codes: *
|
---|
| 98 | * `PERMISSION_DENIED` if the requesting user is not permitted to view the
|
---|
| 99 | * requested invitation or for access errors. * `NOT_FOUND` if no invitation
|
---|
| 100 | * exists with the requested ID. (invitations.get)
|
---|
| 101 | *
|
---|
| 102 | * @param string $id Identifier of the invitation to return.
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | * @return Invitation
|
---|
| 105 | * @throws \Google\Service\Exception
|
---|
| 106 | */
|
---|
| 107 | public function get($id, $optParams = [])
|
---|
| 108 | {
|
---|
| 109 | $params = ['id' => $id];
|
---|
| 110 | $params = array_merge($params, $optParams);
|
---|
| 111 | return $this->call('get', [$params], Invitation::class);
|
---|
| 112 | }
|
---|
| 113 | /**
|
---|
| 114 | * Returns a list of invitations that the requesting user is permitted to view,
|
---|
| 115 | * restricted to those that match the list request. *Note:* At least one of
|
---|
| 116 | * `user_id` or `course_id` must be supplied. Both fields can be supplied. This
|
---|
| 117 | * method returns the following error codes: * `PERMISSION_DENIED` for access
|
---|
| 118 | * errors. (invitations.listInvitations)
|
---|
| 119 | *
|
---|
| 120 | * @param array $optParams Optional parameters.
|
---|
| 121 | *
|
---|
| 122 | * @opt_param string courseId Restricts returned invitations to those for a
|
---|
| 123 | * course with the specified identifier.
|
---|
| 124 | * @opt_param int pageSize Maximum number of items to return. The default is 500
|
---|
| 125 | * if unspecified or `0`. The server may return fewer than the specified number
|
---|
| 126 | * of results.
|
---|
| 127 | * @opt_param string pageToken nextPageToken value returned from a previous list
|
---|
| 128 | * call, indicating that the subsequent page of results should be returned. The
|
---|
| 129 | * list request must be otherwise identical to the one that resulted in this
|
---|
| 130 | * token.
|
---|
| 131 | * @opt_param string userId Restricts returned invitations to those for a
|
---|
| 132 | * specific user. The identifier can be one of the following: * the numeric
|
---|
| 133 | * identifier for the user * the email address of the user * the string literal
|
---|
| 134 | * `"me"`, indicating the requesting user
|
---|
| 135 | * @return ListInvitationsResponse
|
---|
| 136 | * @throws \Google\Service\Exception
|
---|
| 137 | */
|
---|
| 138 | public function listInvitations($optParams = [])
|
---|
| 139 | {
|
---|
| 140 | $params = [];
|
---|
| 141 | $params = array_merge($params, $optParams);
|
---|
| 142 | return $this->call('list', [$params], ListInvitationsResponse::class);
|
---|
| 143 | }
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 147 | class_alias(Invitations::class, 'Google_Service_Classroom_Resource_Invitations');
|
---|