[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\ListTopicResponse;
|
---|
| 22 | use Google\Service\Classroom\Topic;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "topics" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $classroomService = new Google\Service\Classroom(...);
|
---|
| 29 | * $topics = $classroomService->courses_topics;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class CoursesTopics extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Creates a topic. This method returns the following error codes: *
|
---|
| 36 | * `PERMISSION_DENIED` if the requesting user is not permitted to access the
|
---|
| 37 | * requested course, create a topic in the requested course, or for access
|
---|
| 38 | * errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if
|
---|
| 39 | * the requested course does not exist. (topics.create)
|
---|
| 40 | *
|
---|
| 41 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
| 42 | * either the Classroom-assigned identifier or an alias.
|
---|
| 43 | * @param Topic $postBody
|
---|
| 44 | * @param array $optParams Optional parameters.
|
---|
| 45 | * @return Topic
|
---|
| 46 | * @throws \Google\Service\Exception
|
---|
| 47 | */
|
---|
| 48 | public function create($courseId, Topic $postBody, $optParams = [])
|
---|
| 49 | {
|
---|
| 50 | $params = ['courseId' => $courseId, 'postBody' => $postBody];
|
---|
| 51 | $params = array_merge($params, $optParams);
|
---|
| 52 | return $this->call('create', [$params], Topic::class);
|
---|
| 53 | }
|
---|
| 54 | /**
|
---|
| 55 | * Deletes a topic. This method returns the following error codes: *
|
---|
| 56 | * `PERMISSION_DENIED` if the requesting user is not allowed to delete the
|
---|
| 57 | * requested topic or for access errors. * `FAILED_PRECONDITION` if the
|
---|
| 58 | * requested topic has already been deleted. * `NOT_FOUND` if no course or topic
|
---|
| 59 | * exists with the requested ID. (topics.delete)
|
---|
| 60 | *
|
---|
| 61 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
| 62 | * either the Classroom-assigned identifier or an alias.
|
---|
| 63 | * @param string $id Identifier of the topic to delete.
|
---|
| 64 | * @param array $optParams Optional parameters.
|
---|
| 65 | * @return ClassroomEmpty
|
---|
| 66 | * @throws \Google\Service\Exception
|
---|
| 67 | */
|
---|
| 68 | public function delete($courseId, $id, $optParams = [])
|
---|
| 69 | {
|
---|
| 70 | $params = ['courseId' => $courseId, 'id' => $id];
|
---|
| 71 | $params = array_merge($params, $optParams);
|
---|
| 72 | return $this->call('delete', [$params], ClassroomEmpty::class);
|
---|
| 73 | }
|
---|
| 74 | /**
|
---|
| 75 | * Returns a topic. This method returns the following error codes: *
|
---|
| 76 | * `PERMISSION_DENIED` if the requesting user is not permitted to access the
|
---|
| 77 | * requested course or topic, or for access errors. * `INVALID_ARGUMENT` if the
|
---|
| 78 | * request is malformed. * `NOT_FOUND` if the requested course or topic does not
|
---|
| 79 | * exist. (topics.get)
|
---|
| 80 | *
|
---|
| 81 | * @param string $courseId Identifier of the course.
|
---|
| 82 | * @param string $id Identifier of the topic.
|
---|
| 83 | * @param array $optParams Optional parameters.
|
---|
| 84 | * @return Topic
|
---|
| 85 | * @throws \Google\Service\Exception
|
---|
| 86 | */
|
---|
| 87 | public function get($courseId, $id, $optParams = [])
|
---|
| 88 | {
|
---|
| 89 | $params = ['courseId' => $courseId, 'id' => $id];
|
---|
| 90 | $params = array_merge($params, $optParams);
|
---|
| 91 | return $this->call('get', [$params], Topic::class);
|
---|
| 92 | }
|
---|
| 93 | /**
|
---|
| 94 | * Returns the list of topics that the requester is permitted to view. This
|
---|
| 95 | * method returns the following error codes: * `PERMISSION_DENIED` if the
|
---|
| 96 | * requesting user is not permitted to access the requested course or for access
|
---|
| 97 | * errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if
|
---|
| 98 | * the requested course does not exist. (topics.listCoursesTopics)
|
---|
| 99 | *
|
---|
| 100 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
| 101 | * either the Classroom-assigned identifier or an alias.
|
---|
| 102 | * @param array $optParams Optional parameters.
|
---|
| 103 | *
|
---|
| 104 | * @opt_param int pageSize Maximum number of items to return. Zero or
|
---|
| 105 | * unspecified indicates that the server may assign a maximum. The server may
|
---|
| 106 | * return fewer than the specified number of results.
|
---|
| 107 | * @opt_param string pageToken nextPageToken value returned from a previous list
|
---|
| 108 | * call, indicating that the subsequent page of results should be returned. The
|
---|
| 109 | * list request must be otherwise identical to the one that resulted in this
|
---|
| 110 | * token.
|
---|
| 111 | * @return ListTopicResponse
|
---|
| 112 | * @throws \Google\Service\Exception
|
---|
| 113 | */
|
---|
| 114 | public function listCoursesTopics($courseId, $optParams = [])
|
---|
| 115 | {
|
---|
| 116 | $params = ['courseId' => $courseId];
|
---|
| 117 | $params = array_merge($params, $optParams);
|
---|
| 118 | return $this->call('list', [$params], ListTopicResponse::class);
|
---|
| 119 | }
|
---|
| 120 | /**
|
---|
| 121 | * Updates one or more fields of a topic. This method returns the following
|
---|
| 122 | * error codes: * `PERMISSION_DENIED` if the requesting developer project did
|
---|
| 123 | * not create the corresponding topic or for access errors. * `INVALID_ARGUMENT`
|
---|
| 124 | * if the request is malformed. * `NOT_FOUND` if the requested course or topic
|
---|
| 125 | * does not exist (topics.patch)
|
---|
| 126 | *
|
---|
| 127 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
| 128 | * either the Classroom-assigned identifier or an alias.
|
---|
| 129 | * @param string $id Identifier of the topic.
|
---|
| 130 | * @param Topic $postBody
|
---|
| 131 | * @param array $optParams Optional parameters.
|
---|
| 132 | *
|
---|
| 133 | * @opt_param string updateMask Mask that identifies which fields on the topic
|
---|
| 134 | * to update. This field is required to do an update. The update fails if
|
---|
| 135 | * invalid fields are specified. If a field supports empty values, it can be
|
---|
| 136 | * cleared by specifying it in the update mask and not in the Topic object. If a
|
---|
| 137 | * field that does not support empty values is included in the update mask and
|
---|
| 138 | * not set in the Topic object, an `INVALID_ARGUMENT` error is returned. The
|
---|
| 139 | * following fields may be specified: * `name`
|
---|
| 140 | * @return Topic
|
---|
| 141 | * @throws \Google\Service\Exception
|
---|
| 142 | */
|
---|
| 143 | public function patch($courseId, $id, Topic $postBody, $optParams = [])
|
---|
| 144 | {
|
---|
| 145 | $params = ['courseId' => $courseId, 'id' => $id, 'postBody' => $postBody];
|
---|
| 146 | $params = array_merge($params, $optParams);
|
---|
| 147 | return $this->call('patch', [$params], Topic::class);
|
---|
| 148 | }
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 152 | class_alias(CoursesTopics::class, 'Google_Service_Classroom_Resource_CoursesTopics');
|
---|