[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\ListRubricsResponse;
|
---|
| 22 | use Google\Service\Classroom\Rubric;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "rubrics" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $classroomService = new Google\Service\Classroom(...);
|
---|
| 29 | * $rubrics = $classroomService->courses_courseWork_rubrics;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class CoursesCourseWorkRubrics extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Creates a rubric. This request must be made by the Google Cloud console of
|
---|
| 36 | * the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used
|
---|
| 37 | * to create the parent course work item. For further details, see [Rubrics
|
---|
| 38 | * structure and known limitations](/classroom/rubrics/limitations). This method
|
---|
| 39 | * returns the following error codes: * `PERMISSION_DENIED` if the requesting
|
---|
| 40 | * user isn't permitted to create rubrics for course work in the requested
|
---|
| 41 | * course. * `INTERNAL` if the request has insufficient OAuth scopes. *
|
---|
| 42 | * `INVALID_ARGUMENT` if the request is malformed and for the following request
|
---|
| 43 | * error: * `RubricCriteriaInvalidFormat` * `NOT_FOUND` if the requested course
|
---|
| 44 | * or course work don't exist or the user doesn't have access to the course or
|
---|
| 45 | * course work. * `FAILED_PRECONDITION` for the following request error: *
|
---|
| 46 | * `AttachmentNotVisible` (rubrics.create)
|
---|
| 47 | *
|
---|
| 48 | * @param string $courseId Required. Identifier of the course.
|
---|
| 49 | * @param string $courseWorkId Required. Identifier of the course work.
|
---|
| 50 | * @param Rubric $postBody
|
---|
| 51 | * @param array $optParams Optional parameters.
|
---|
| 52 | * @return Rubric
|
---|
| 53 | * @throws \Google\Service\Exception
|
---|
| 54 | */
|
---|
| 55 | public function create($courseId, $courseWorkId, Rubric $postBody, $optParams = [])
|
---|
| 56 | {
|
---|
| 57 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'postBody' => $postBody];
|
---|
| 58 | $params = array_merge($params, $optParams);
|
---|
| 59 | return $this->call('create', [$params], Rubric::class);
|
---|
| 60 | }
|
---|
| 61 | /**
|
---|
| 62 | * Deletes a rubric. This request must be made by the Google Cloud console of
|
---|
| 63 | * the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used
|
---|
| 64 | * to create the corresponding rubric. This method returns the following error
|
---|
| 65 | * codes: * `PERMISSION_DENIED` if the requesting developer project didn't
|
---|
| 66 | * create the corresponding rubric, or if the requesting user isn't permitted to
|
---|
| 67 | * delete the requested rubric. * `NOT_FOUND` if no rubric exists with the
|
---|
| 68 | * requested ID or the user does not have access to the course, course work, or
|
---|
| 69 | * rubric. * `INVALID_ARGUMENT` if grading has already started on the rubric.
|
---|
| 70 | * (rubrics.delete)
|
---|
| 71 | *
|
---|
| 72 | * @param string $courseId Required. Identifier of the course.
|
---|
| 73 | * @param string $courseWorkId Required. Identifier of the course work.
|
---|
| 74 | * @param string $id Required. Identifier of the rubric.
|
---|
| 75 | * @param array $optParams Optional parameters.
|
---|
| 76 | * @return ClassroomEmpty
|
---|
| 77 | * @throws \Google\Service\Exception
|
---|
| 78 | */
|
---|
| 79 | public function delete($courseId, $courseWorkId, $id, $optParams = [])
|
---|
| 80 | {
|
---|
| 81 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'id' => $id];
|
---|
| 82 | $params = array_merge($params, $optParams);
|
---|
| 83 | return $this->call('delete', [$params], ClassroomEmpty::class);
|
---|
| 84 | }
|
---|
| 85 | /**
|
---|
| 86 | * Returns a rubric. This method returns the following error codes: *
|
---|
| 87 | * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the request is
|
---|
| 88 | * malformed. * `NOT_FOUND` if the requested course, course work, or rubric
|
---|
| 89 | * doesn't exist or if the user doesn't have access to the corresponding course
|
---|
| 90 | * work. (rubrics.get)
|
---|
| 91 | *
|
---|
| 92 | * @param string $courseId Required. Identifier of the course.
|
---|
| 93 | * @param string $courseWorkId Required. Identifier of the course work.
|
---|
| 94 | * @param string $id Required. Identifier of the rubric.
|
---|
| 95 | * @param array $optParams Optional parameters.
|
---|
| 96 | * @return Rubric
|
---|
| 97 | * @throws \Google\Service\Exception
|
---|
| 98 | */
|
---|
| 99 | public function get($courseId, $courseWorkId, $id, $optParams = [])
|
---|
| 100 | {
|
---|
| 101 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'id' => $id];
|
---|
| 102 | $params = array_merge($params, $optParams);
|
---|
| 103 | return $this->call('get', [$params], Rubric::class);
|
---|
| 104 | }
|
---|
| 105 | /**
|
---|
| 106 | * Returns a list of rubrics that the requester is permitted to view. This
|
---|
| 107 | * method returns the following error codes: * `PERMISSION_DENIED` for access
|
---|
| 108 | * errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if
|
---|
| 109 | * the requested course or course work doesn't exist or if the user doesn't have
|
---|
| 110 | * access to the corresponding course work.
|
---|
| 111 | * (rubrics.listCoursesCourseWorkRubrics)
|
---|
| 112 | *
|
---|
| 113 | * @param string $courseId Required. Identifier of the course.
|
---|
| 114 | * @param string $courseWorkId Required. Identifier of the course work.
|
---|
| 115 | * @param array $optParams Optional parameters.
|
---|
| 116 | *
|
---|
| 117 | * @opt_param int pageSize The maximum number of rubrics to return. If
|
---|
| 118 | * unspecified, at most 1 rubric is returned. The maximum value is 1; values
|
---|
| 119 | * above 1 are coerced to 1.
|
---|
| 120 | * @opt_param string pageToken nextPageToken value returned from a previous list
|
---|
| 121 | * call, indicating that the subsequent page of results should be returned. The
|
---|
| 122 | * list request must be otherwise identical to the one that resulted in this
|
---|
| 123 | * token.
|
---|
| 124 | * @return ListRubricsResponse
|
---|
| 125 | * @throws \Google\Service\Exception
|
---|
| 126 | */
|
---|
| 127 | public function listCoursesCourseWorkRubrics($courseId, $courseWorkId, $optParams = [])
|
---|
| 128 | {
|
---|
| 129 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId];
|
---|
| 130 | $params = array_merge($params, $optParams);
|
---|
| 131 | return $this->call('list', [$params], ListRubricsResponse::class);
|
---|
| 132 | }
|
---|
| 133 | /**
|
---|
| 134 | * Updates a rubric. See google.classroom.v1.Rubric for details of which fields
|
---|
| 135 | * can be updated. Rubric update capabilities are
|
---|
| 136 | * [limited](/classroom/rubrics/limitations) once grading has started. This
|
---|
| 137 | * request must be made by the Google Cloud console of the [OAuth client
|
---|
| 138 | * ID](https://support.google.com/cloud/answer/6158849) used to create the
|
---|
| 139 | * parent course work item. This method returns the following error codes: *
|
---|
| 140 | * `PERMISSION_DENIED` if the requesting developer project didn't create the
|
---|
| 141 | * corresponding course work, if the user isn't permitted to make the requested
|
---|
| 142 | * modification to the rubric, or for access errors. This error code is also
|
---|
| 143 | * returned if grading has already started on the rubric. * `INVALID_ARGUMENT`
|
---|
| 144 | * if the request is malformed and for the following request error: *
|
---|
| 145 | * `RubricCriteriaInvalidFormat` * `NOT_FOUND` if the requested course, course
|
---|
| 146 | * work, or rubric doesn't exist or if the user doesn't have access to the
|
---|
| 147 | * corresponding course work. * `INTERNAL` if grading has already started on the
|
---|
| 148 | * rubric. (rubrics.patch)
|
---|
| 149 | *
|
---|
| 150 | * @param string $courseId Required. Identifier of the course.
|
---|
| 151 | * @param string $courseWorkId Required. Identifier of the course work.
|
---|
| 152 | * @param string $id Optional. Identifier of the rubric.
|
---|
| 153 | * @param Rubric $postBody
|
---|
| 154 | * @param array $optParams Optional parameters.
|
---|
| 155 | *
|
---|
| 156 | * @opt_param string updateMask Optional. Mask that identifies which fields on
|
---|
| 157 | * the rubric to update. This field is required to do an update. The update
|
---|
| 158 | * fails if invalid fields are specified. There are multiple options to define
|
---|
| 159 | * the criteria of a rubric: the `source_spreadsheet_id` and the `criteria`
|
---|
| 160 | * list. Only one of these can be used at a time to define a rubric. The rubric
|
---|
| 161 | * `criteria` list is fully replaced by the rubric criteria specified in the
|
---|
| 162 | * update request. For example, if a criterion or level is missing from the
|
---|
| 163 | * request, it is deleted. New criteria and levels are added and an ID is
|
---|
| 164 | * assigned. Existing criteria and levels retain the previously assigned ID if
|
---|
| 165 | * the ID is specified in the request. The following fields can be specified by
|
---|
| 166 | * teachers: * `criteria` * `source_spreadsheet_id`
|
---|
| 167 | * @return Rubric
|
---|
| 168 | * @throws \Google\Service\Exception
|
---|
| 169 | */
|
---|
| 170 | public function patch($courseId, $courseWorkId, $id, Rubric $postBody, $optParams = [])
|
---|
| 171 | {
|
---|
| 172 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'id' => $id, 'postBody' => $postBody];
|
---|
| 173 | $params = array_merge($params, $optParams);
|
---|
| 174 | return $this->call('patch', [$params], Rubric::class);
|
---|
| 175 | }
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 179 | class_alias(CoursesCourseWorkRubrics::class, 'Google_Service_Classroom_Resource_CoursesCourseWorkRubrics');
|
---|