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\ListStudentSubmissionsResponse;
|
---|
22 | use Google\Service\Classroom\ModifyAttachmentsRequest;
|
---|
23 | use Google\Service\Classroom\ReclaimStudentSubmissionRequest;
|
---|
24 | use Google\Service\Classroom\ReturnStudentSubmissionRequest;
|
---|
25 | use Google\Service\Classroom\StudentSubmission;
|
---|
26 | use Google\Service\Classroom\TurnInStudentSubmissionRequest;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "studentSubmissions" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $classroomService = new Google\Service\Classroom(...);
|
---|
33 | * $studentSubmissions = $classroomService->courses_courseWork_studentSubmissions;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class CoursesCourseWorkStudentSubmissions extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Returns a student submission. * `PERMISSION_DENIED` if the requesting user is
|
---|
40 | * not permitted to access the requested course, course work, or student
|
---|
41 | * submission or for access errors. * `INVALID_ARGUMENT` if the request is
|
---|
42 | * malformed. * `NOT_FOUND` if the requested course, course work, or student
|
---|
43 | * submission does not exist. (studentSubmissions.get)
|
---|
44 | *
|
---|
45 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
46 | * either the Classroom-assigned identifier or an alias.
|
---|
47 | * @param string $courseWorkId Identifier of the course work.
|
---|
48 | * @param string $id Identifier of the student submission.
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return StudentSubmission
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function get($courseId, $courseWorkId, $id, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'id' => $id];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('get', [$params], StudentSubmission::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Returns a list of student submissions that the requester is permitted to
|
---|
61 | * view, factoring in the OAuth scopes of the request. `-` may be specified as
|
---|
62 | * the `course_work_id` to include student submissions for multiple course work
|
---|
63 | * items. Course students may only view their own work. Course teachers and
|
---|
64 | * domain administrators may view all student submissions. This method returns
|
---|
65 | * the following error codes: * `PERMISSION_DENIED` if the requesting user is
|
---|
66 | * not permitted to access the requested course or course work, or for access
|
---|
67 | * errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if
|
---|
68 | * the requested course does not exist.
|
---|
69 | * (studentSubmissions.listCoursesCourseWorkStudentSubmissions)
|
---|
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 $courseWorkId Identifier of the student work to request. This
|
---|
74 | * may be set to the string literal `"-"` to request student work for all course
|
---|
75 | * work in the specified course.
|
---|
76 | * @param array $optParams Optional parameters.
|
---|
77 | *
|
---|
78 | * @opt_param string late Requested lateness value. If specified, returned
|
---|
79 | * student submissions are restricted by the requested value. If unspecified,
|
---|
80 | * submissions are returned regardless of `late` value.
|
---|
81 | * @opt_param int pageSize Maximum number of items to return. Zero or
|
---|
82 | * unspecified indicates that the server may assign a maximum. The server may
|
---|
83 | * return fewer than the specified number of results.
|
---|
84 | * @opt_param string pageToken nextPageToken value returned from a previous list
|
---|
85 | * call, indicating that the subsequent page of results should be returned. The
|
---|
86 | * list request must be otherwise identical to the one that resulted in this
|
---|
87 | * token.
|
---|
88 | * @opt_param string states Requested submission states. If specified, returned
|
---|
89 | * student submissions match one of the specified submission states.
|
---|
90 | * @opt_param string userId Optional argument to restrict returned student work
|
---|
91 | * to those owned by the student with the specified identifier. The identifier
|
---|
92 | * can be one of the following: * the numeric identifier for the user * the
|
---|
93 | * email address of the user * the string literal `"me"`, indicating the
|
---|
94 | * requesting user
|
---|
95 | * @return ListStudentSubmissionsResponse
|
---|
96 | * @throws \Google\Service\Exception
|
---|
97 | */
|
---|
98 | public function listCoursesCourseWorkStudentSubmissions($courseId, $courseWorkId, $optParams = [])
|
---|
99 | {
|
---|
100 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId];
|
---|
101 | $params = array_merge($params, $optParams);
|
---|
102 | return $this->call('list', [$params], ListStudentSubmissionsResponse::class);
|
---|
103 | }
|
---|
104 | /**
|
---|
105 | * Modifies attachments of student submission. Attachments may only be added to
|
---|
106 | * student submissions belonging to course work objects with a `workType` of
|
---|
107 | * `ASSIGNMENT`. This request must be made by the Developer Console project of
|
---|
108 | * the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used
|
---|
109 | * to create the corresponding course work item. This method returns the
|
---|
110 | * following error codes: * `PERMISSION_DENIED` if the requesting user is not
|
---|
111 | * permitted to access the requested course or course work, if the user is not
|
---|
112 | * permitted to modify attachments on the requested student submission, or for
|
---|
113 | * access errors. * `INVALID_ARGUMENT` if the request is malformed. *
|
---|
114 | * `NOT_FOUND` if the requested course, course work, or student submission does
|
---|
115 | * not exist. (studentSubmissions.modifyAttachments)
|
---|
116 | *
|
---|
117 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
118 | * either the Classroom-assigned identifier or an alias.
|
---|
119 | * @param string $courseWorkId Identifier of the course work.
|
---|
120 | * @param string $id Identifier of the student submission.
|
---|
121 | * @param ModifyAttachmentsRequest $postBody
|
---|
122 | * @param array $optParams Optional parameters.
|
---|
123 | * @return StudentSubmission
|
---|
124 | * @throws \Google\Service\Exception
|
---|
125 | */
|
---|
126 | public function modifyAttachments($courseId, $courseWorkId, $id, ModifyAttachmentsRequest $postBody, $optParams = [])
|
---|
127 | {
|
---|
128 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'id' => $id, 'postBody' => $postBody];
|
---|
129 | $params = array_merge($params, $optParams);
|
---|
130 | return $this->call('modifyAttachments', [$params], StudentSubmission::class);
|
---|
131 | }
|
---|
132 | /**
|
---|
133 | * Updates one or more fields of a student submission. See
|
---|
134 | * google.classroom.v1.StudentSubmission for details of which fields may be
|
---|
135 | * updated and who may change them. This request must be made by the Developer
|
---|
136 | * Console project of the [OAuth client
|
---|
137 | * ID](https://support.google.com/cloud/answer/6158849) used to create the
|
---|
138 | * corresponding course work item. This method returns the following error
|
---|
139 | * codes: * `PERMISSION_DENIED` if the requesting developer project did not
|
---|
140 | * create the corresponding course work, if the user is not permitted to make
|
---|
141 | * the requested modification to the student submission, or for access errors. *
|
---|
142 | * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the
|
---|
143 | * requested course, course work, or student submission does not exist.
|
---|
144 | * (studentSubmissions.patch)
|
---|
145 | *
|
---|
146 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
147 | * either the Classroom-assigned identifier or an alias.
|
---|
148 | * @param string $courseWorkId Identifier of the course work.
|
---|
149 | * @param string $id Identifier of the student submission.
|
---|
150 | * @param StudentSubmission $postBody
|
---|
151 | * @param array $optParams Optional parameters.
|
---|
152 | *
|
---|
153 | * @opt_param string updateMask Mask that identifies which fields on the student
|
---|
154 | * submission to update. This field is required to do an update. The update
|
---|
155 | * fails if invalid fields are specified. The following fields may be specified
|
---|
156 | * by teachers: * `draft_grade` * `assigned_grade`
|
---|
157 | * @return StudentSubmission
|
---|
158 | * @throws \Google\Service\Exception
|
---|
159 | */
|
---|
160 | public function patch($courseId, $courseWorkId, $id, StudentSubmission $postBody, $optParams = [])
|
---|
161 | {
|
---|
162 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'id' => $id, 'postBody' => $postBody];
|
---|
163 | $params = array_merge($params, $optParams);
|
---|
164 | return $this->call('patch', [$params], StudentSubmission::class);
|
---|
165 | }
|
---|
166 | /**
|
---|
167 | * Reclaims a student submission on behalf of the student that owns it.
|
---|
168 | * Reclaiming a student submission transfers ownership of attached Drive files
|
---|
169 | * to the student and updates the submission state. Only the student that owns
|
---|
170 | * the requested student submission may call this method, and only for a student
|
---|
171 | * submission that has been turned in. This request must be made by the
|
---|
172 | * Developer Console project of the [OAuth client
|
---|
173 | * ID](https://support.google.com/cloud/answer/6158849) used to create the
|
---|
174 | * corresponding course work item. This method returns the following error
|
---|
175 | * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
|
---|
176 | * access the requested course or course work, unsubmit the requested student
|
---|
177 | * submission, or for access errors. * `FAILED_PRECONDITION` if the student
|
---|
178 | * submission has not been turned in. * `INVALID_ARGUMENT` if the request is
|
---|
179 | * malformed. * `NOT_FOUND` if the requested course, course work, or student
|
---|
180 | * submission does not exist. (studentSubmissions.reclaim)
|
---|
181 | *
|
---|
182 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
183 | * either the Classroom-assigned identifier or an alias.
|
---|
184 | * @param string $courseWorkId Identifier of the course work.
|
---|
185 | * @param string $id Identifier of the student submission.
|
---|
186 | * @param ReclaimStudentSubmissionRequest $postBody
|
---|
187 | * @param array $optParams Optional parameters.
|
---|
188 | * @return ClassroomEmpty
|
---|
189 | * @throws \Google\Service\Exception
|
---|
190 | */
|
---|
191 | public function reclaim($courseId, $courseWorkId, $id, ReclaimStudentSubmissionRequest $postBody, $optParams = [])
|
---|
192 | {
|
---|
193 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'id' => $id, 'postBody' => $postBody];
|
---|
194 | $params = array_merge($params, $optParams);
|
---|
195 | return $this->call('reclaim', [$params], ClassroomEmpty::class);
|
---|
196 | }
|
---|
197 | /**
|
---|
198 | * Returns a student submission. Returning a student submission transfers
|
---|
199 | * ownership of attached Drive files to the student and may also update the
|
---|
200 | * submission state. Unlike the Classroom application, returning a student
|
---|
201 | * submission does not set assignedGrade to the draftGrade value. Only a teacher
|
---|
202 | * of the course that contains the requested student submission may call this
|
---|
203 | * method. This request must be made by the Developer Console project of the
|
---|
204 | * [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to
|
---|
205 | * create the corresponding course work item. This method returns the following
|
---|
206 | * error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
|
---|
207 | * access the requested course or course work, return the requested student
|
---|
208 | * submission, or for access errors. * `INVALID_ARGUMENT` if the request is
|
---|
209 | * malformed. * `NOT_FOUND` if the requested course, course work, or student
|
---|
210 | * submission does not exist.
|
---|
211 | * (studentSubmissions.returnCoursesCourseWorkStudentSubmissions)
|
---|
212 | *
|
---|
213 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
214 | * either the Classroom-assigned identifier or an alias.
|
---|
215 | * @param string $courseWorkId Identifier of the course work.
|
---|
216 | * @param string $id Identifier of the student submission.
|
---|
217 | * @param ReturnStudentSubmissionRequest $postBody
|
---|
218 | * @param array $optParams Optional parameters.
|
---|
219 | * @return ClassroomEmpty
|
---|
220 | * @throws \Google\Service\Exception
|
---|
221 | */
|
---|
222 | public function returnCoursesCourseWorkStudentSubmissions($courseId, $courseWorkId, $id, ReturnStudentSubmissionRequest $postBody, $optParams = [])
|
---|
223 | {
|
---|
224 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'id' => $id, 'postBody' => $postBody];
|
---|
225 | $params = array_merge($params, $optParams);
|
---|
226 | return $this->call('return', [$params], ClassroomEmpty::class);
|
---|
227 | }
|
---|
228 | /**
|
---|
229 | * Turns in a student submission. Turning in a student submission transfers
|
---|
230 | * ownership of attached Drive files to the teacher and may also update the
|
---|
231 | * submission state. This may only be called by the student that owns the
|
---|
232 | * specified student submission. This request must be made by the Developer
|
---|
233 | * Console project of the [OAuth client
|
---|
234 | * ID](https://support.google.com/cloud/answer/6158849) used to create the
|
---|
235 | * corresponding course work item. This method returns the following error
|
---|
236 | * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
|
---|
237 | * access the requested course or course work, turn in the requested student
|
---|
238 | * submission, or for access errors. * `INVALID_ARGUMENT` if the request is
|
---|
239 | * malformed. * `NOT_FOUND` if the requested course, course work, or student
|
---|
240 | * submission does not exist. (studentSubmissions.turnIn)
|
---|
241 | *
|
---|
242 | * @param string $courseId Identifier of the course. This identifier can be
|
---|
243 | * either the Classroom-assigned identifier or an alias.
|
---|
244 | * @param string $courseWorkId Identifier of the course work.
|
---|
245 | * @param string $id Identifier of the student submission.
|
---|
246 | * @param TurnInStudentSubmissionRequest $postBody
|
---|
247 | * @param array $optParams Optional parameters.
|
---|
248 | * @return ClassroomEmpty
|
---|
249 | * @throws \Google\Service\Exception
|
---|
250 | */
|
---|
251 | public function turnIn($courseId, $courseWorkId, $id, TurnInStudentSubmissionRequest $postBody, $optParams = [])
|
---|
252 | {
|
---|
253 | $params = ['courseId' => $courseId, 'courseWorkId' => $courseWorkId, 'id' => $id, 'postBody' => $postBody];
|
---|
254 | $params = array_merge($params, $optParams);
|
---|
255 | return $this->call('turnIn', [$params], ClassroomEmpty::class);
|
---|
256 | }
|
---|
257 | }
|
---|
258 |
|
---|
259 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
260 | class_alias(CoursesCourseWorkStudentSubmissions::class, 'Google_Service_Classroom_Resource_CoursesCourseWorkStudentSubmissions');
|
---|