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