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\AddOnAttachment;
|
---|
21 | use Google\Service\Classroom\ClassroomEmpty;
|
---|
22 | use Google\Service\Classroom\ListAddOnAttachmentsResponse;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "addOnAttachments" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $classroomService = new Google\Service\Classroom(...);
|
---|
29 | * $addOnAttachments = $classroomService->courses_announcements_addOnAttachments;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class CoursesAnnouncementsAddOnAttachments extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Creates an add-on attachment under a post. Requires the add-on to have
|
---|
36 | * permission to create new attachments on the post. This method returns the
|
---|
37 | * following error codes: * `PERMISSION_DENIED` for access errors. *
|
---|
38 | * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if one of the
|
---|
39 | * identified resources does not exist. (addOnAttachments.create)
|
---|
40 | *
|
---|
41 | * @param string $courseId Required. Identifier of the course.
|
---|
42 | * @param string $itemId Identifier of the `Announcement`, `CourseWork`, or
|
---|
43 | * `CourseWorkMaterial` under which to create the attachment. This field is
|
---|
44 | * required, but is not marked as such while we are migrating from post_id.
|
---|
45 | * @param AddOnAttachment $postBody
|
---|
46 | * @param array $optParams Optional parameters.
|
---|
47 | *
|
---|
48 | * @opt_param string addOnToken Optional. Token that authorizes the request. The
|
---|
49 | * token is passed as a query parameter when the user is redirected from
|
---|
50 | * Classroom to the add-on's URL. This authorization token is required for in-
|
---|
51 | * Classroom attachment creation but optional for partner-first attachment
|
---|
52 | * creation. Returns an error if not provided for partner-first attachment
|
---|
53 | * creation and the developer projects that created the attachment and its
|
---|
54 | * parent stream item do not match.
|
---|
55 | * @opt_param string postId Optional. Deprecated, use `item_id` instead.
|
---|
56 | * @return AddOnAttachment
|
---|
57 | * @throws \Google\Service\Exception
|
---|
58 | */
|
---|
59 | public function create($courseId, $itemId, AddOnAttachment $postBody, $optParams = [])
|
---|
60 | {
|
---|
61 | $params = ['courseId' => $courseId, 'itemId' => $itemId, 'postBody' => $postBody];
|
---|
62 | $params = array_merge($params, $optParams);
|
---|
63 | return $this->call('create', [$params], AddOnAttachment::class);
|
---|
64 | }
|
---|
65 | /**
|
---|
66 | * Deletes an add-on attachment. Requires the add-on to have been the original
|
---|
67 | * creator of the attachment. This method returns the following error codes: *
|
---|
68 | * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the request is
|
---|
69 | * malformed. * `NOT_FOUND` if one of the identified resources does not exist.
|
---|
70 | * (addOnAttachments.delete)
|
---|
71 | *
|
---|
72 | * @param string $courseId Required. Identifier of the course.
|
---|
73 | * @param string $itemId Identifier of the `Announcement`, `CourseWork`, or
|
---|
74 | * `CourseWorkMaterial` under which the attachment is attached. This field is
|
---|
75 | * required, but is not marked as such while we are migrating from post_id.
|
---|
76 | * @param string $attachmentId Required. Identifier of the attachment.
|
---|
77 | * @param array $optParams Optional parameters.
|
---|
78 | *
|
---|
79 | * @opt_param string postId Optional. Deprecated, use `item_id` instead.
|
---|
80 | * @return ClassroomEmpty
|
---|
81 | * @throws \Google\Service\Exception
|
---|
82 | */
|
---|
83 | public function delete($courseId, $itemId, $attachmentId, $optParams = [])
|
---|
84 | {
|
---|
85 | $params = ['courseId' => $courseId, 'itemId' => $itemId, 'attachmentId' => $attachmentId];
|
---|
86 | $params = array_merge($params, $optParams);
|
---|
87 | return $this->call('delete', [$params], ClassroomEmpty::class);
|
---|
88 | }
|
---|
89 | /**
|
---|
90 | * Returns an add-on attachment. Requires the add-on requesting the attachment
|
---|
91 | * to be the original creator of the attachment. This method returns the
|
---|
92 | * following error codes: * `PERMISSION_DENIED` for access errors. *
|
---|
93 | * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if one of the
|
---|
94 | * identified resources does not exist. (addOnAttachments.get)
|
---|
95 | *
|
---|
96 | * @param string $courseId Required. Identifier of the course.
|
---|
97 | * @param string $itemId Identifier of the `Announcement`, `CourseWork`, or
|
---|
98 | * `CourseWorkMaterial` under which the attachment is attached. This field is
|
---|
99 | * required, but is not marked as such while we are migrating from post_id.
|
---|
100 | * @param string $attachmentId Required. Identifier of the attachment.
|
---|
101 | * @param array $optParams Optional parameters.
|
---|
102 | *
|
---|
103 | * @opt_param string postId Optional. Deprecated, use `item_id` instead.
|
---|
104 | * @return AddOnAttachment
|
---|
105 | * @throws \Google\Service\Exception
|
---|
106 | */
|
---|
107 | public function get($courseId, $itemId, $attachmentId, $optParams = [])
|
---|
108 | {
|
---|
109 | $params = ['courseId' => $courseId, 'itemId' => $itemId, 'attachmentId' => $attachmentId];
|
---|
110 | $params = array_merge($params, $optParams);
|
---|
111 | return $this->call('get', [$params], AddOnAttachment::class);
|
---|
112 | }
|
---|
113 | /**
|
---|
114 | * Returns all attachments created by an add-on under the post. Requires the
|
---|
115 | * add-on to have active attachments on the post or have permission to create
|
---|
116 | * new attachments on the post. This method returns the following error codes: *
|
---|
117 | * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the request is
|
---|
118 | * malformed. * `NOT_FOUND` if one of the identified resources does not exist.
|
---|
119 | * (addOnAttachments.listCoursesAnnouncementsAddOnAttachments)
|
---|
120 | *
|
---|
121 | * @param string $courseId Required. Identifier of the course.
|
---|
122 | * @param string $itemId Identifier of the `Announcement`, `CourseWork`, or
|
---|
123 | * `CourseWorkMaterial` whose attachments should be enumerated. This field is
|
---|
124 | * required, but is not marked as such while we are migrating from post_id.
|
---|
125 | * @param array $optParams Optional parameters.
|
---|
126 | *
|
---|
127 | * @opt_param int pageSize The maximum number of attachments to return. The
|
---|
128 | * service may return fewer than this value. If unspecified, at most 20
|
---|
129 | * attachments will be returned. The maximum value is 20; values above 20 will
|
---|
130 | * be coerced to 20.
|
---|
131 | * @opt_param string pageToken A page token, received from a previous
|
---|
132 | * `ListAddOnAttachments` call. Provide this to retrieve the subsequent page.
|
---|
133 | * When paginating, all other parameters provided to `ListAddOnAttachments` must
|
---|
134 | * match the call that provided the page token.
|
---|
135 | * @opt_param string postId Optional. Identifier of the post under the course
|
---|
136 | * whose attachments to enumerate. Deprecated, use `item_id` instead.
|
---|
137 | * @return ListAddOnAttachmentsResponse
|
---|
138 | * @throws \Google\Service\Exception
|
---|
139 | */
|
---|
140 | public function listCoursesAnnouncementsAddOnAttachments($courseId, $itemId, $optParams = [])
|
---|
141 | {
|
---|
142 | $params = ['courseId' => $courseId, 'itemId' => $itemId];
|
---|
143 | $params = array_merge($params, $optParams);
|
---|
144 | return $this->call('list', [$params], ListAddOnAttachmentsResponse::class);
|
---|
145 | }
|
---|
146 | /**
|
---|
147 | * Updates an add-on attachment. Requires the add-on to have been the original
|
---|
148 | * creator of the attachment. This method returns the following error codes: *
|
---|
149 | * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the request is
|
---|
150 | * malformed. * `NOT_FOUND` if one of the identified resources does not exist.
|
---|
151 | * (addOnAttachments.patch)
|
---|
152 | *
|
---|
153 | * @param string $courseId Required. Identifier of the course.
|
---|
154 | * @param string $itemId Identifier of the post under which the attachment is
|
---|
155 | * attached.
|
---|
156 | * @param string $attachmentId Required. Identifier of the attachment.
|
---|
157 | * @param AddOnAttachment $postBody
|
---|
158 | * @param array $optParams Optional parameters.
|
---|
159 | *
|
---|
160 | * @opt_param string postId Required. Identifier of the post under which the
|
---|
161 | * attachment is attached.
|
---|
162 | * @opt_param string updateMask Required. Mask that identifies which fields on
|
---|
163 | * the attachment to update. The update fails if invalid fields are specified.
|
---|
164 | * If a field supports empty values, it can be cleared by specifying it in the
|
---|
165 | * update mask and not in the `AddOnAttachment` object. If a field that does not
|
---|
166 | * support empty values is included in the update mask and not set in the
|
---|
167 | * `AddOnAttachment` object, an `INVALID_ARGUMENT` error is returned. The
|
---|
168 | * following fields may be specified by teachers: * `title` * `teacher_view_uri`
|
---|
169 | * * `student_view_uri` * `student_work_review_uri` * `due_date` * `due_time` *
|
---|
170 | * `max_points`
|
---|
171 | * @return AddOnAttachment
|
---|
172 | * @throws \Google\Service\Exception
|
---|
173 | */
|
---|
174 | public function patch($courseId, $itemId, $attachmentId, AddOnAttachment $postBody, $optParams = [])
|
---|
175 | {
|
---|
176 | $params = ['courseId' => $courseId, 'itemId' => $itemId, 'attachmentId' => $attachmentId, 'postBody' => $postBody];
|
---|
177 | $params = array_merge($params, $optParams);
|
---|
178 | return $this->call('patch', [$params], AddOnAttachment::class);
|
---|
179 | }
|
---|
180 | }
|
---|
181 |
|
---|
182 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
183 | class_alias(CoursesAnnouncementsAddOnAttachments::class, 'Google_Service_Classroom_Resource_CoursesAnnouncementsAddOnAttachments');
|
---|