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\Blogger\Resource;
19
20use Google\Service\Blogger\Page;
21use Google\Service\Blogger\PageList;
22
23/**
24 * The "pages" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $bloggerService = new Google\Service\Blogger(...);
28 *   $pages = $bloggerService->pages;
29 *  </code>
30 */
31class Pages extends \Google\Service\Resource
32{
33  /**
34   * Deletes a page by blog id and page id. (pages.delete)
35   *
36   * @param string $blogId
37   * @param string $pageId
38   * @param array $optParams Optional parameters.
39   */
40  public function delete($blogId, $pageId, $optParams = [])
41  {
42    $params = ['blogId' => $blogId, 'pageId' => $pageId];
43    $params = array_merge($params, $optParams);
44    return $this->call('delete', [$params]);
45  }
46  /**
47   * Gets a page by blog id and page id. (pages.get)
48   *
49   * @param string $blogId
50   * @param string $pageId
51   * @param array $optParams Optional parameters.
52   *
53   * @opt_param string view
54   * @return Page
55   */
56  public function get($blogId, $pageId, $optParams = [])
57  {
58    $params = ['blogId' => $blogId, 'pageId' => $pageId];
59    $params = array_merge($params, $optParams);
60    return $this->call('get', [$params], Page::class);
61  }
62  /**
63   * Inserts a page. (pages.insert)
64   *
65   * @param string $blogId
66   * @param Page $postBody
67   * @param array $optParams Optional parameters.
68   *
69   * @opt_param bool isDraft
70   * @return Page
71   */
72  public function insert($blogId, Page $postBody, $optParams = [])
73  {
74    $params = ['blogId' => $blogId, 'postBody' => $postBody];
75    $params = array_merge($params, $optParams);
76    return $this->call('insert', [$params], Page::class);
77  }
78  /**
79   * Lists pages. (pages.listPages)
80   *
81   * @param string $blogId
82   * @param array $optParams Optional parameters.
83   *
84   * @opt_param bool fetchBodies
85   * @opt_param string maxResults
86   * @opt_param string pageToken
87   * @opt_param string status
88   * @opt_param string view
89   * @return PageList
90   */
91  public function listPages($blogId, $optParams = [])
92  {
93    $params = ['blogId' => $blogId];
94    $params = array_merge($params, $optParams);
95    return $this->call('list', [$params], PageList::class);
96  }
97  /**
98   * Patches a page. (pages.patch)
99   *
100   * @param string $blogId
101   * @param string $pageId
102   * @param Page $postBody
103   * @param array $optParams Optional parameters.
104   *
105   * @opt_param bool publish
106   * @opt_param bool revert
107   * @return Page
108   */
109  public function patch($blogId, $pageId, Page $postBody, $optParams = [])
110  {
111    $params = ['blogId' => $blogId, 'pageId' => $pageId, 'postBody' => $postBody];
112    $params = array_merge($params, $optParams);
113    return $this->call('patch', [$params], Page::class);
114  }
115  /**
116   * Publishes a page. (pages.publish)
117   *
118   * @param string $blogId
119   * @param string $pageId
120   * @param array $optParams Optional parameters.
121   * @return Page
122   */
123  public function publish($blogId, $pageId, $optParams = [])
124  {
125    $params = ['blogId' => $blogId, 'pageId' => $pageId];
126    $params = array_merge($params, $optParams);
127    return $this->call('publish', [$params], Page::class);
128  }
129  /**
130   * Reverts a published or scheduled page to draft state. (pages.revert)
131   *
132   * @param string $blogId
133   * @param string $pageId
134   * @param array $optParams Optional parameters.
135   * @return Page
136   */
137  public function revert($blogId, $pageId, $optParams = [])
138  {
139    $params = ['blogId' => $blogId, 'pageId' => $pageId];
140    $params = array_merge($params, $optParams);
141    return $this->call('revert', [$params], Page::class);
142  }
143  /**
144   * Updates a page by blog id and page id. (pages.update)
145   *
146   * @param string $blogId
147   * @param string $pageId
148   * @param Page $postBody
149   * @param array $optParams Optional parameters.
150   *
151   * @opt_param bool publish
152   * @opt_param bool revert
153   * @return Page
154   */
155  public function update($blogId, $pageId, Page $postBody, $optParams = [])
156  {
157    $params = ['blogId' => $blogId, 'pageId' => $pageId, 'postBody' => $postBody];
158    $params = array_merge($params, $optParams);
159    return $this->call('update', [$params], Page::class);
160  }
161}
162
163// Adding a class alias for backwards compatibility with the previous class name.
164class_alias(Pages::class, 'Google_Service_Blogger_Resource_Pages');
165