source: vendor/google/apiclient-services/src/Classroom/Resource/CoursesCourseWorkMaterials.php@ f9c482b

Last change on this file since f9c482b was f9c482b, checked in by Vlado 222039 <vlado.popovski@…>, 10 days ago

Upload new project files

  • Property mode set to 100644
File size: 11.1 KB
Line 
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\AddOnContext;
21use Google\Service\Classroom\ClassroomEmpty;
22use Google\Service\Classroom\CourseWorkMaterial;
23use Google\Service\Classroom\ListCourseWorkMaterialResponse;
24
25/**
26 * The "courseWorkMaterials" collection of methods.
27 * Typical usage is:
28 * <code>
29 * $classroomService = new Google\Service\Classroom(...);
30 * $courseWorkMaterials = $classroomService->courses_courseWorkMaterials;
31 * </code>
32 */
33class CoursesCourseWorkMaterials extends \Google\Service\Resource
34{
35 /**
36 * Creates a course work material. This method returns the following error
37 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
38 * access the requested course, create course work material in the requested
39 * course, share a Drive attachment, or for access errors. * `INVALID_ARGUMENT`
40 * if the request is malformed or if more than 20 * materials are provided. *
41 * `NOT_FOUND` if the requested course does not exist. * `FAILED_PRECONDITION`
42 * for the following request error: * AttachmentNotVisible
43 * (courseWorkMaterials.create)
44 *
45 * @param string $courseId Identifier of the course. This identifier can be
46 * either the Classroom-assigned identifier or an alias.
47 * @param CourseWorkMaterial $postBody
48 * @param array $optParams Optional parameters.
49 * @return CourseWorkMaterial
50 * @throws \Google\Service\Exception
51 */
52 public function create($courseId, CourseWorkMaterial $postBody, $optParams = [])
53 {
54 $params = ['courseId' => $courseId, 'postBody' => $postBody];
55 $params = array_merge($params, $optParams);
56 return $this->call('create', [$params], CourseWorkMaterial::class);
57 }
58 /**
59 * Deletes a course work material. This request must be made by the Developer
60 * Console project of the [OAuth client
61 * ID](https://support.google.com/cloud/answer/6158849) used to create the
62 * corresponding course work material item. This method returns the following
63 * error codes: * `PERMISSION_DENIED` if the requesting developer project did
64 * not create the corresponding course work material, if the requesting user is
65 * not permitted to delete the requested course or for access errors. *
66 * `FAILED_PRECONDITION` if the requested course work material has already been
67 * deleted. * `NOT_FOUND` if no course exists with the requested ID.
68 * (courseWorkMaterials.delete)
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 $id Identifier of the course work material to delete. This
73 * identifier is a Classroom-assigned identifier.
74 * @param array $optParams Optional parameters.
75 * @return ClassroomEmpty
76 * @throws \Google\Service\Exception
77 */
78 public function delete($courseId, $id, $optParams = [])
79 {
80 $params = ['courseId' => $courseId, 'id' => $id];
81 $params = array_merge($params, $optParams);
82 return $this->call('delete', [$params], ClassroomEmpty::class);
83 }
84 /**
85 * Returns a course work material. This method returns the following error
86 * codes: * `PERMISSION_DENIED` if the requesting user is not permitted to
87 * access the requested course or course work material, or for access errors. *
88 * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if the
89 * requested course or course work material does not exist.
90 * (courseWorkMaterials.get)
91 *
92 * @param string $courseId Identifier of the course. This identifier can be
93 * either the Classroom-assigned identifier or an alias.
94 * @param string $id Identifier of the course work material.
95 * @param array $optParams Optional parameters.
96 * @return CourseWorkMaterial
97 * @throws \Google\Service\Exception
98 */
99 public function get($courseId, $id, $optParams = [])
100 {
101 $params = ['courseId' => $courseId, 'id' => $id];
102 $params = array_merge($params, $optParams);
103 return $this->call('get', [$params], CourseWorkMaterial::class);
104 }
105 /**
106 * Gets metadata for Classroom add-ons in the context of a specific post. To
107 * maintain the integrity of its own data and permissions model, an add-on
108 * should call this to validate query parameters and the requesting user's role
109 * whenever the add-on is opened in an
110 * [iframe](https://developers.google.com/classroom/add-ons/get-
111 * started/iframes/iframes-overview). This method returns the following error
112 * codes: * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the
113 * request is malformed. * `NOT_FOUND` if one of the identified resources does
114 * not exist. (courseWorkMaterials.getAddOnContext)
115 *
116 * @param string $courseId Required. Identifier of the course.
117 * @param string $itemId Identifier of the `Announcement`, `CourseWork`, or
118 * `CourseWorkMaterial` under which the attachment is attached. This field is
119 * required, but is not marked as such while we are migrating from post_id.
120 * @param array $optParams Optional parameters.
121 *
122 * @opt_param string addOnToken Optional. Token that authorizes the request. The
123 * token is passed as a query parameter when the user is redirected from
124 * Classroom to the add-on's URL. The authorization token is required when
125 * neither of the following is true: * The add-on has attachments on the post. *
126 * The developer project issuing the request is the same project that created
127 * the post.
128 * @opt_param string attachmentId Optional. The identifier of the attachment.
129 * This field is required for all requests except when the user is in the
130 * [Attachment Discovery iframe](https://developers.google.com/classroom/add-
131 * ons/get-started/iframes/attachment-discovery-iframe).
132 * @opt_param string postId Optional. Deprecated, use `item_id` instead.
133 * @return AddOnContext
134 * @throws \Google\Service\Exception
135 */
136 public function getAddOnContext($courseId, $itemId, $optParams = [])
137 {
138 $params = ['courseId' => $courseId, 'itemId' => $itemId];
139 $params = array_merge($params, $optParams);
140 return $this->call('getAddOnContext', [$params], AddOnContext::class);
141 }
142 /**
143 * Returns a list of course work material that the requester is permitted to
144 * view. Course students may only view `PUBLISHED` course work material. Course
145 * teachers and domain administrators may view all course work material. This
146 * method returns the following error codes: * `PERMISSION_DENIED` if the
147 * requesting user is not permitted to access the requested course or for access
148 * errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if
149 * the requested course does not exist.
150 * (courseWorkMaterials.listCoursesCourseWorkMaterials)
151 *
152 * @param string $courseId Identifier of the course. This identifier can be
153 * either the Classroom-assigned identifier or an alias.
154 * @param array $optParams Optional parameters.
155 *
156 * @opt_param string courseWorkMaterialStates Restriction on the work status to
157 * return. Only course work material that matches is returned. If unspecified,
158 * items with a work status of `PUBLISHED` is returned.
159 * @opt_param string materialDriveId Optional filtering for course work material
160 * with at least one Drive material whose ID matches the provided string. If
161 * `material_link` is also specified, course work material must have materials
162 * matching both filters.
163 * @opt_param string materialLink Optional filtering for course work material
164 * with at least one link material whose URL partially matches the provided
165 * string.
166 * @opt_param string orderBy Optional sort ordering for results. A comma-
167 * separated list of fields with an optional sort direction keyword. Supported
168 * field is `updateTime`. Supported direction keywords are `asc` and `desc`. If
169 * not specified, `updateTime desc` is the default behavior. Examples:
170 * `updateTime asc`, `updateTime`
171 * @opt_param int pageSize Maximum number of items to return. Zero or
172 * unspecified indicates that the server may assign a maximum. The server may
173 * return fewer than the specified number of results.
174 * @opt_param string pageToken nextPageToken value returned from a previous list
175 * call, indicating that the subsequent page of results should be returned. The
176 * list request must be otherwise identical to the one that resulted in this
177 * token.
178 * @return ListCourseWorkMaterialResponse
179 * @throws \Google\Service\Exception
180 */
181 public function listCoursesCourseWorkMaterials($courseId, $optParams = [])
182 {
183 $params = ['courseId' => $courseId];
184 $params = array_merge($params, $optParams);
185 return $this->call('list', [$params], ListCourseWorkMaterialResponse::class);
186 }
187 /**
188 * Updates one or more fields of a course work material. This method returns the
189 * following error codes: * `PERMISSION_DENIED` if the requesting developer
190 * project for access errors. * `INVALID_ARGUMENT` if the request is malformed.
191 * * `FAILED_PRECONDITION` if the requested course work material has already
192 * been deleted. * `NOT_FOUND` if the requested course or course work material
193 * does not exist (courseWorkMaterials.patch)
194 *
195 * @param string $courseId Identifier of the course. This identifier can be
196 * either the Classroom-assigned identifier or an alias.
197 * @param string $id Identifier of the course work material.
198 * @param CourseWorkMaterial $postBody
199 * @param array $optParams Optional parameters.
200 *
201 * @opt_param string updateMask Mask that identifies which fields on the course
202 * work material to update. This field is required to do an update. The update
203 * fails if invalid fields are specified. If a field supports empty values, it
204 * can be cleared by specifying it in the update mask and not in the course work
205 * material object. If a field that does not support empty values is included in
206 * the update mask and not set in the course work material object, an
207 * `INVALID_ARGUMENT` error is returned. The following fields may be specified
208 * by teachers: * `title` * `description` * `state` * `scheduled_time` *
209 * `topic_id`
210 * @return CourseWorkMaterial
211 * @throws \Google\Service\Exception
212 */
213 public function patch($courseId, $id, CourseWorkMaterial $postBody, $optParams = [])
214 {
215 $params = ['courseId' => $courseId, 'id' => $id, 'postBody' => $postBody];
216 $params = array_merge($params, $optParams);
217 return $this->call('patch', [$params], CourseWorkMaterial::class);
218 }
219}
220
221// Adding a class alias for backwards compatibility with the previous class name.
222class_alias(CoursesCourseWorkMaterials::class, 'Google_Service_Classroom_Resource_CoursesCourseWorkMaterials');
Note: See TracBrowser for help on using the repository browser.