[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\YouTube\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\YouTube\Comment;
|
---|
| 21 | use Google\Service\YouTube\CommentListResponse;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The "comments" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $youtubeService = new Google\Service\YouTube(...);
|
---|
| 28 | * $comments = $youtubeService->comments;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class Comments extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Deletes a resource. (comments.delete)
|
---|
| 35 | *
|
---|
| 36 | * @param string $id
|
---|
| 37 | * @param array $optParams Optional parameters.
|
---|
| 38 | * @throws \Google\Service\Exception
|
---|
| 39 | */
|
---|
| 40 | public function delete($id, $optParams = [])
|
---|
| 41 | {
|
---|
| 42 | $params = ['id' => $id];
|
---|
| 43 | $params = array_merge($params, $optParams);
|
---|
| 44 | return $this->call('delete', [$params]);
|
---|
| 45 | }
|
---|
| 46 | /**
|
---|
| 47 | * Inserts a new resource into this collection. (comments.insert)
|
---|
| 48 | *
|
---|
| 49 | * @param string|array $part The *part* parameter identifies the properties that
|
---|
| 50 | * the API response will include. Set the parameter value to snippet. The
|
---|
| 51 | * snippet part has a quota cost of 2 units.
|
---|
| 52 | * @param Comment $postBody
|
---|
| 53 | * @param array $optParams Optional parameters.
|
---|
| 54 | * @return Comment
|
---|
| 55 | * @throws \Google\Service\Exception
|
---|
| 56 | */
|
---|
| 57 | public function insert($part, Comment $postBody, $optParams = [])
|
---|
| 58 | {
|
---|
| 59 | $params = ['part' => $part, 'postBody' => $postBody];
|
---|
| 60 | $params = array_merge($params, $optParams);
|
---|
| 61 | return $this->call('insert', [$params], Comment::class);
|
---|
| 62 | }
|
---|
| 63 | /**
|
---|
| 64 | * Retrieves a list of resources, possibly filtered. (comments.listComments)
|
---|
| 65 | *
|
---|
| 66 | * @param string|array $part The *part* parameter specifies a comma-separated
|
---|
| 67 | * list of one or more comment resource properties that the API response will
|
---|
| 68 | * include.
|
---|
| 69 | * @param array $optParams Optional parameters.
|
---|
| 70 | *
|
---|
| 71 | * @opt_param string id Returns the comments with the given IDs for One
|
---|
| 72 | * Platform.
|
---|
| 73 | * @opt_param string maxResults The *maxResults* parameter specifies the maximum
|
---|
| 74 | * number of items that should be returned in the result set.
|
---|
| 75 | * @opt_param string pageToken The *pageToken* parameter identifies a specific
|
---|
| 76 | * page in the result set that should be returned. In an API response, the
|
---|
| 77 | * nextPageToken and prevPageToken properties identify other pages that could be
|
---|
| 78 | * retrieved.
|
---|
| 79 | * @opt_param string parentId Returns replies to the specified comment. Note,
|
---|
| 80 | * currently YouTube features only one level of replies (ie replies to top level
|
---|
| 81 | * comments). However replies to replies may be supported in the future.
|
---|
| 82 | * @opt_param string textFormat The requested text format for the returned
|
---|
| 83 | * comments.
|
---|
| 84 | * @return CommentListResponse
|
---|
| 85 | * @throws \Google\Service\Exception
|
---|
| 86 | */
|
---|
| 87 | public function listComments($part, $optParams = [])
|
---|
| 88 | {
|
---|
| 89 | $params = ['part' => $part];
|
---|
| 90 | $params = array_merge($params, $optParams);
|
---|
| 91 | return $this->call('list', [$params], CommentListResponse::class);
|
---|
| 92 | }
|
---|
| 93 | /**
|
---|
| 94 | * Expresses the caller's opinion that one or more comments should be flagged as
|
---|
| 95 | * spam. (comments.markAsSpam)
|
---|
| 96 | *
|
---|
| 97 | * @param string|array $id Flags the comments with the given IDs as spam in the
|
---|
| 98 | * caller's opinion.
|
---|
| 99 | * @param array $optParams Optional parameters.
|
---|
| 100 | * @throws \Google\Service\Exception
|
---|
| 101 | */
|
---|
| 102 | public function markAsSpam($id, $optParams = [])
|
---|
| 103 | {
|
---|
| 104 | $params = ['id' => $id];
|
---|
| 105 | $params = array_merge($params, $optParams);
|
---|
| 106 | return $this->call('markAsSpam', [$params]);
|
---|
| 107 | }
|
---|
| 108 | /**
|
---|
| 109 | * Sets the moderation status of one or more comments.
|
---|
| 110 | * (comments.setModerationStatus)
|
---|
| 111 | *
|
---|
| 112 | * @param string|array $id Modifies the moderation status of the comments with
|
---|
| 113 | * the given IDs
|
---|
| 114 | * @param string $moderationStatus Specifies the requested moderation status.
|
---|
| 115 | * Note, comments can be in statuses, which are not available through this call.
|
---|
| 116 | * For example, this call does not allow to mark a comment as 'likely spam'.
|
---|
| 117 | * Valid values: 'heldForReview', 'published' or 'rejected'.
|
---|
| 118 | * @param array $optParams Optional parameters.
|
---|
| 119 | *
|
---|
| 120 | * @opt_param bool banAuthor If set to true the author of the comment gets added
|
---|
| 121 | * to the ban list. This means all future comments of the author will
|
---|
| 122 | * autmomatically be rejected. Only valid in combination with STATUS_REJECTED.
|
---|
| 123 | * @throws \Google\Service\Exception
|
---|
| 124 | */
|
---|
| 125 | public function setModerationStatus($id, $moderationStatus, $optParams = [])
|
---|
| 126 | {
|
---|
| 127 | $params = ['id' => $id, 'moderationStatus' => $moderationStatus];
|
---|
| 128 | $params = array_merge($params, $optParams);
|
---|
| 129 | return $this->call('setModerationStatus', [$params]);
|
---|
| 130 | }
|
---|
| 131 | /**
|
---|
| 132 | * Updates an existing resource. (comments.update)
|
---|
| 133 | *
|
---|
| 134 | * @param string|array $part The *part* parameter identifies the properties that
|
---|
| 135 | * the API response will include. You must at least include the snippet part in
|
---|
| 136 | * the parameter value since that part contains all of the properties that the
|
---|
| 137 | * API request can update.
|
---|
| 138 | * @param Comment $postBody
|
---|
| 139 | * @param array $optParams Optional parameters.
|
---|
| 140 | * @return Comment
|
---|
| 141 | * @throws \Google\Service\Exception
|
---|
| 142 | */
|
---|
| 143 | public function update($part, Comment $postBody, $optParams = [])
|
---|
| 144 | {
|
---|
| 145 | $params = ['part' => $part, 'postBody' => $postBody];
|
---|
| 146 | $params = array_merge($params, $optParams);
|
---|
| 147 | return $this->call('update', [$params], Comment::class);
|
---|
| 148 | }
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 152 | class_alias(Comments::class, 'Google_Service_YouTube_Resource_Comments');
|
---|