[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\AddOnContext;
|
---|
| 21 |
|
---|
| 22 | /**
|
---|
| 23 | * The "posts" collection of methods.
|
---|
| 24 | * Typical usage is:
|
---|
| 25 | * <code>
|
---|
| 26 | * $classroomService = new Google\Service\Classroom(...);
|
---|
| 27 | * $posts = $classroomService->courses_posts;
|
---|
| 28 | * </code>
|
---|
| 29 | */
|
---|
| 30 | class CoursesPosts extends \Google\Service\Resource
|
---|
| 31 | {
|
---|
| 32 | /**
|
---|
| 33 | * Gets metadata for Classroom add-ons in the context of a specific post. To
|
---|
| 34 | * maintain the integrity of its own data and permissions model, an add-on
|
---|
| 35 | * should call this to validate query parameters and the requesting user's role
|
---|
| 36 | * whenever the add-on is opened in an
|
---|
| 37 | * [iframe](https://developers.google.com/classroom/add-ons/get-
|
---|
| 38 | * started/iframes/iframes-overview). This method returns the following error
|
---|
| 39 | * codes: * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the
|
---|
| 40 | * request is malformed. * `NOT_FOUND` if one of the identified resources does
|
---|
| 41 | * not exist. (posts.getAddOnContext)
|
---|
| 42 | *
|
---|
| 43 | * @param string $courseId Required. Identifier of the course.
|
---|
| 44 | * @param string $postId Optional. Deprecated, use `item_id` instead.
|
---|
| 45 | * @param array $optParams Optional parameters.
|
---|
| 46 | *
|
---|
| 47 | * @opt_param string addOnToken Optional. Token that authorizes the request. The
|
---|
| 48 | * token is passed as a query parameter when the user is redirected from
|
---|
| 49 | * Classroom to the add-on's URL. The authorization token is required when
|
---|
| 50 | * neither of the following is true: * The add-on has attachments on the post. *
|
---|
| 51 | * The developer project issuing the request is the same project that created
|
---|
| 52 | * the post.
|
---|
| 53 | * @opt_param string attachmentId Optional. The identifier of the attachment.
|
---|
| 54 | * This field is required for all requests except when the user is in the
|
---|
| 55 | * [Attachment Discovery iframe](https://developers.google.com/classroom/add-
|
---|
| 56 | * ons/get-started/iframes/attachment-discovery-iframe).
|
---|
| 57 | * @opt_param string itemId Identifier of the `Announcement`, `CourseWork`, or
|
---|
| 58 | * `CourseWorkMaterial` under which the attachment is attached. This field is
|
---|
| 59 | * required, but is not marked as such while we are migrating from post_id.
|
---|
| 60 | * @return AddOnContext
|
---|
| 61 | * @throws \Google\Service\Exception
|
---|
| 62 | */
|
---|
| 63 | public function getAddOnContext($courseId, $postId, $optParams = [])
|
---|
| 64 | {
|
---|
| 65 | $params = ['courseId' => $courseId, 'postId' => $postId];
|
---|
| 66 | $params = array_merge($params, $optParams);
|
---|
| 67 | return $this->call('getAddOnContext', [$params], AddOnContext::class);
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 72 | class_alias(CoursesPosts::class, 'Google_Service_Classroom_Resource_CoursesPosts');
|
---|