[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\Blogger\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Blogger\Post;
|
---|
| 21 | use Google\Service\Blogger\PostList;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The "posts" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $bloggerService = new Google\Service\Blogger(...);
|
---|
| 28 | * $posts = $bloggerService->posts;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class Posts extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Deletes a post by blog id and post id. (posts.delete)
|
---|
| 35 | *
|
---|
| 36 | * @param string $blogId
|
---|
| 37 | * @param string $postId
|
---|
| 38 | * @param array $optParams Optional parameters.
|
---|
| 39 | *
|
---|
| 40 | * @opt_param bool useTrash Move to Trash if possible
|
---|
| 41 | * @throws \Google\Service\Exception
|
---|
| 42 | */
|
---|
| 43 | public function delete($blogId, $postId, $optParams = [])
|
---|
| 44 | {
|
---|
| 45 | $params = ['blogId' => $blogId, 'postId' => $postId];
|
---|
| 46 | $params = array_merge($params, $optParams);
|
---|
| 47 | return $this->call('delete', [$params]);
|
---|
| 48 | }
|
---|
| 49 | /**
|
---|
| 50 | * Gets a post by blog id and post id (posts.get)
|
---|
| 51 | *
|
---|
| 52 | * @param string $blogId
|
---|
| 53 | * @param string $postId
|
---|
| 54 | * @param array $optParams Optional parameters.
|
---|
| 55 | *
|
---|
| 56 | * @opt_param bool fetchBody
|
---|
| 57 | * @opt_param bool fetchImages
|
---|
| 58 | * @opt_param string maxComments
|
---|
| 59 | * @opt_param string view
|
---|
| 60 | * @return Post
|
---|
| 61 | * @throws \Google\Service\Exception
|
---|
| 62 | */
|
---|
| 63 | public function get($blogId, $postId, $optParams = [])
|
---|
| 64 | {
|
---|
| 65 | $params = ['blogId' => $blogId, 'postId' => $postId];
|
---|
| 66 | $params = array_merge($params, $optParams);
|
---|
| 67 | return $this->call('get', [$params], Post::class);
|
---|
| 68 | }
|
---|
| 69 | /**
|
---|
| 70 | * Gets a post by path. (posts.getByPath)
|
---|
| 71 | *
|
---|
| 72 | * @param string $blogId
|
---|
| 73 | * @param string $path
|
---|
| 74 | * @param array $optParams Optional parameters.
|
---|
| 75 | *
|
---|
| 76 | * @opt_param string maxComments
|
---|
| 77 | * @opt_param string view
|
---|
| 78 | * @return Post
|
---|
| 79 | * @throws \Google\Service\Exception
|
---|
| 80 | */
|
---|
| 81 | public function getByPath($blogId, $path, $optParams = [])
|
---|
| 82 | {
|
---|
| 83 | $params = ['blogId' => $blogId, 'path' => $path];
|
---|
| 84 | $params = array_merge($params, $optParams);
|
---|
| 85 | return $this->call('getByPath', [$params], Post::class);
|
---|
| 86 | }
|
---|
| 87 | /**
|
---|
| 88 | * Inserts a post. (posts.insert)
|
---|
| 89 | *
|
---|
| 90 | * @param string $blogId
|
---|
| 91 | * @param Post $postBody
|
---|
| 92 | * @param array $optParams Optional parameters.
|
---|
| 93 | *
|
---|
| 94 | * @opt_param bool fetchBody
|
---|
| 95 | * @opt_param bool fetchImages
|
---|
| 96 | * @opt_param bool isDraft
|
---|
| 97 | * @return Post
|
---|
| 98 | * @throws \Google\Service\Exception
|
---|
| 99 | */
|
---|
| 100 | public function insert($blogId, Post $postBody, $optParams = [])
|
---|
| 101 | {
|
---|
| 102 | $params = ['blogId' => $blogId, 'postBody' => $postBody];
|
---|
| 103 | $params = array_merge($params, $optParams);
|
---|
| 104 | return $this->call('insert', [$params], Post::class);
|
---|
| 105 | }
|
---|
| 106 | /**
|
---|
| 107 | * Lists posts. (posts.listPosts)
|
---|
| 108 | *
|
---|
| 109 | * @param string $blogId
|
---|
| 110 | * @param array $optParams Optional parameters.
|
---|
| 111 | *
|
---|
| 112 | * @opt_param string endDate
|
---|
| 113 | * @opt_param bool fetchBodies
|
---|
| 114 | * @opt_param bool fetchImages
|
---|
| 115 | * @opt_param string labels
|
---|
| 116 | * @opt_param string maxResults
|
---|
| 117 | * @opt_param string orderBy
|
---|
| 118 | * @opt_param string pageToken
|
---|
| 119 | * @opt_param string sortOption Sort direction applied to post list.
|
---|
| 120 | * @opt_param string startDate
|
---|
| 121 | * @opt_param string status
|
---|
| 122 | * @opt_param string view
|
---|
| 123 | * @return PostList
|
---|
| 124 | * @throws \Google\Service\Exception
|
---|
| 125 | */
|
---|
| 126 | public function listPosts($blogId, $optParams = [])
|
---|
| 127 | {
|
---|
| 128 | $params = ['blogId' => $blogId];
|
---|
| 129 | $params = array_merge($params, $optParams);
|
---|
| 130 | return $this->call('list', [$params], PostList::class);
|
---|
| 131 | }
|
---|
| 132 | /**
|
---|
| 133 | * Patches a post. (posts.patch)
|
---|
| 134 | *
|
---|
| 135 | * @param string $blogId
|
---|
| 136 | * @param string $postId
|
---|
| 137 | * @param Post $postBody
|
---|
| 138 | * @param array $optParams Optional parameters.
|
---|
| 139 | *
|
---|
| 140 | * @opt_param bool fetchBody
|
---|
| 141 | * @opt_param bool fetchImages
|
---|
| 142 | * @opt_param string maxComments
|
---|
| 143 | * @opt_param bool publish
|
---|
| 144 | * @opt_param bool revert
|
---|
| 145 | * @return Post
|
---|
| 146 | * @throws \Google\Service\Exception
|
---|
| 147 | */
|
---|
| 148 | public function patch($blogId, $postId, Post $postBody, $optParams = [])
|
---|
| 149 | {
|
---|
| 150 | $params = ['blogId' => $blogId, 'postId' => $postId, 'postBody' => $postBody];
|
---|
| 151 | $params = array_merge($params, $optParams);
|
---|
| 152 | return $this->call('patch', [$params], Post::class);
|
---|
| 153 | }
|
---|
| 154 | /**
|
---|
| 155 | * Publishes a post. (posts.publish)
|
---|
| 156 | *
|
---|
| 157 | * @param string $blogId
|
---|
| 158 | * @param string $postId
|
---|
| 159 | * @param array $optParams Optional parameters.
|
---|
| 160 | *
|
---|
| 161 | * @opt_param string publishDate
|
---|
| 162 | * @return Post
|
---|
| 163 | * @throws \Google\Service\Exception
|
---|
| 164 | */
|
---|
| 165 | public function publish($blogId, $postId, $optParams = [])
|
---|
| 166 | {
|
---|
| 167 | $params = ['blogId' => $blogId, 'postId' => $postId];
|
---|
| 168 | $params = array_merge($params, $optParams);
|
---|
| 169 | return $this->call('publish', [$params], Post::class);
|
---|
| 170 | }
|
---|
| 171 | /**
|
---|
| 172 | * Reverts a published or scheduled post to draft state. (posts.revert)
|
---|
| 173 | *
|
---|
| 174 | * @param string $blogId
|
---|
| 175 | * @param string $postId
|
---|
| 176 | * @param array $optParams Optional parameters.
|
---|
| 177 | * @return Post
|
---|
| 178 | * @throws \Google\Service\Exception
|
---|
| 179 | */
|
---|
| 180 | public function revert($blogId, $postId, $optParams = [])
|
---|
| 181 | {
|
---|
| 182 | $params = ['blogId' => $blogId, 'postId' => $postId];
|
---|
| 183 | $params = array_merge($params, $optParams);
|
---|
| 184 | return $this->call('revert', [$params], Post::class);
|
---|
| 185 | }
|
---|
| 186 | /**
|
---|
| 187 | * Searches for posts matching given query terms in the specified blog.
|
---|
| 188 | * (posts.search)
|
---|
| 189 | *
|
---|
| 190 | * @param string $blogId
|
---|
| 191 | * @param string $q
|
---|
| 192 | * @param array $optParams Optional parameters.
|
---|
| 193 | *
|
---|
| 194 | * @opt_param bool fetchBodies
|
---|
| 195 | * @opt_param string orderBy
|
---|
| 196 | * @return PostList
|
---|
| 197 | * @throws \Google\Service\Exception
|
---|
| 198 | */
|
---|
| 199 | public function search($blogId, $q, $optParams = [])
|
---|
| 200 | {
|
---|
| 201 | $params = ['blogId' => $blogId, 'q' => $q];
|
---|
| 202 | $params = array_merge($params, $optParams);
|
---|
| 203 | return $this->call('search', [$params], PostList::class);
|
---|
| 204 | }
|
---|
| 205 | /**
|
---|
| 206 | * Updates a post by blog id and post id. (posts.update)
|
---|
| 207 | *
|
---|
| 208 | * @param string $blogId
|
---|
| 209 | * @param string $postId
|
---|
| 210 | * @param Post $postBody
|
---|
| 211 | * @param array $optParams Optional parameters.
|
---|
| 212 | *
|
---|
| 213 | * @opt_param bool fetchBody
|
---|
| 214 | * @opt_param bool fetchImages
|
---|
| 215 | * @opt_param string maxComments
|
---|
| 216 | * @opt_param bool publish
|
---|
| 217 | * @opt_param bool revert
|
---|
| 218 | * @return Post
|
---|
| 219 | * @throws \Google\Service\Exception
|
---|
| 220 | */
|
---|
| 221 | public function update($blogId, $postId, Post $postBody, $optParams = [])
|
---|
| 222 | {
|
---|
| 223 | $params = ['blogId' => $blogId, 'postId' => $postId, 'postBody' => $postBody];
|
---|
| 224 | $params = array_merge($params, $optParams);
|
---|
| 225 | return $this->call('update', [$params], Post::class);
|
---|
| 226 | }
|
---|
| 227 | }
|
---|
| 228 |
|
---|
| 229 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 230 | class_alias(Posts::class, 'Google_Service_Blogger_Resource_Posts');
|
---|