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\Calendar\Resource;
19
20use Google\Service\Calendar\CalendarList as CalendarListModel;
21use Google\Service\Calendar\CalendarListEntry;
22use Google\Service\Calendar\Channel;
23
24/**
25 * The "calendarList" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $calendarService = new Google\Service\Calendar(...);
29 *   $calendarList = $calendarService->calendarList;
30 *  </code>
31 */
32class CalendarList extends \Google\Service\Resource
33{
34  /**
35   * Removes a calendar from the user's calendar list. (calendarList.delete)
36   *
37   * @param string $calendarId Calendar identifier. To retrieve calendar IDs call
38   * the calendarList.list method. If you want to access the primary calendar of
39   * the currently logged in user, use the "primary" keyword.
40   * @param array $optParams Optional parameters.
41   */
42  public function delete($calendarId, $optParams = [])
43  {
44    $params = ['calendarId' => $calendarId];
45    $params = array_merge($params, $optParams);
46    return $this->call('delete', [$params]);
47  }
48  /**
49   * Returns a calendar from the user's calendar list. (calendarList.get)
50   *
51   * @param string $calendarId Calendar identifier. To retrieve calendar IDs call
52   * the calendarList.list method. If you want to access the primary calendar of
53   * the currently logged in user, use the "primary" keyword.
54   * @param array $optParams Optional parameters.
55   * @return CalendarListEntry
56   */
57  public function get($calendarId, $optParams = [])
58  {
59    $params = ['calendarId' => $calendarId];
60    $params = array_merge($params, $optParams);
61    return $this->call('get', [$params], CalendarListEntry::class);
62  }
63  /**
64   * Inserts an existing calendar into the user's calendar list.
65   * (calendarList.insert)
66   *
67   * @param CalendarListEntry $postBody
68   * @param array $optParams Optional parameters.
69   *
70   * @opt_param bool colorRgbFormat Whether to use the foregroundColor and
71   * backgroundColor fields to write the calendar colors (RGB). If this feature is
72   * used, the index-based colorId field will be set to the best matching option
73   * automatically. Optional. The default is False.
74   * @return CalendarListEntry
75   */
76  public function insert(CalendarListEntry $postBody, $optParams = [])
77  {
78    $params = ['postBody' => $postBody];
79    $params = array_merge($params, $optParams);
80    return $this->call('insert', [$params], CalendarListEntry::class);
81  }
82  /**
83   * Returns the calendars on the user's calendar list.
84   * (calendarList.listCalendarList)
85   *
86   * @param array $optParams Optional parameters.
87   *
88   * @opt_param int maxResults Maximum number of entries returned on one result
89   * page. By default the value is 100 entries. The page size can never be larger
90   * than 250 entries. Optional.
91   * @opt_param string minAccessRole The minimum access role for the user in the
92   * returned entries. Optional. The default is no restriction.
93   * @opt_param string pageToken Token specifying which result page to return.
94   * Optional.
95   * @opt_param bool showDeleted Whether to include deleted calendar list entries
96   * in the result. Optional. The default is False.
97   * @opt_param bool showHidden Whether to show hidden entries. Optional. The
98   * default is False.
99   * @opt_param string syncToken Token obtained from the nextSyncToken field
100   * returned on the last page of results from the previous list request. It makes
101   * the result of this list request contain only entries that have changed since
102   * then. If only read-only fields such as calendar properties or ACLs have
103   * changed, the entry won't be returned. All entries deleted and hidden since
104   * the previous list request will always be in the result set and it is not
105   * allowed to set showDeleted neither showHidden to False. To ensure client
106   * state consistency minAccessRole query parameter cannot be specified together
107   * with nextSyncToken. If the syncToken expires, the server will respond with a
108   * 410 GONE response code and the client should clear its storage and perform a
109   * full synchronization without any syncToken. Learn more about incremental
110   * synchronization. Optional. The default is to return all entries.
111   * @return CalendarListModel
112   */
113  public function listCalendarList($optParams = [])
114  {
115    $params = [];
116    $params = array_merge($params, $optParams);
117    return $this->call('list', [$params], CalendarListModel::class);
118  }
119  /**
120   * Updates an existing calendar on the user's calendar list. This method
121   * supports patch semantics. (calendarList.patch)
122   *
123   * @param string $calendarId Calendar identifier. To retrieve calendar IDs call
124   * the calendarList.list method. If you want to access the primary calendar of
125   * the currently logged in user, use the "primary" keyword.
126   * @param CalendarListEntry $postBody
127   * @param array $optParams Optional parameters.
128   *
129   * @opt_param bool colorRgbFormat Whether to use the foregroundColor and
130   * backgroundColor fields to write the calendar colors (RGB). If this feature is
131   * used, the index-based colorId field will be set to the best matching option
132   * automatically. Optional. The default is False.
133   * @return CalendarListEntry
134   */
135  public function patch($calendarId, CalendarListEntry $postBody, $optParams = [])
136  {
137    $params = ['calendarId' => $calendarId, 'postBody' => $postBody];
138    $params = array_merge($params, $optParams);
139    return $this->call('patch', [$params], CalendarListEntry::class);
140  }
141  /**
142   * Updates an existing calendar on the user's calendar list.
143   * (calendarList.update)
144   *
145   * @param string $calendarId Calendar identifier. To retrieve calendar IDs call
146   * the calendarList.list method. If you want to access the primary calendar of
147   * the currently logged in user, use the "primary" keyword.
148   * @param CalendarListEntry $postBody
149   * @param array $optParams Optional parameters.
150   *
151   * @opt_param bool colorRgbFormat Whether to use the foregroundColor and
152   * backgroundColor fields to write the calendar colors (RGB). If this feature is
153   * used, the index-based colorId field will be set to the best matching option
154   * automatically. Optional. The default is False.
155   * @return CalendarListEntry
156   */
157  public function update($calendarId, CalendarListEntry $postBody, $optParams = [])
158  {
159    $params = ['calendarId' => $calendarId, 'postBody' => $postBody];
160    $params = array_merge($params, $optParams);
161    return $this->call('update', [$params], CalendarListEntry::class);
162  }
163  /**
164   * Watch for changes to CalendarList resources. (calendarList.watch)
165   *
166   * @param Channel $postBody
167   * @param array $optParams Optional parameters.
168   *
169   * @opt_param int maxResults Maximum number of entries returned on one result
170   * page. By default the value is 100 entries. The page size can never be larger
171   * than 250 entries. Optional.
172   * @opt_param string minAccessRole The minimum access role for the user in the
173   * returned entries. Optional. The default is no restriction.
174   * @opt_param string pageToken Token specifying which result page to return.
175   * Optional.
176   * @opt_param bool showDeleted Whether to include deleted calendar list entries
177   * in the result. Optional. The default is False.
178   * @opt_param bool showHidden Whether to show hidden entries. Optional. The
179   * default is False.
180   * @opt_param string syncToken Token obtained from the nextSyncToken field
181   * returned on the last page of results from the previous list request. It makes
182   * the result of this list request contain only entries that have changed since
183   * then. If only read-only fields such as calendar properties or ACLs have
184   * changed, the entry won't be returned. All entries deleted and hidden since
185   * the previous list request will always be in the result set and it is not
186   * allowed to set showDeleted neither showHidden to False. To ensure client
187   * state consistency minAccessRole query parameter cannot be specified together
188   * with nextSyncToken. If the syncToken expires, the server will respond with a
189   * 410 GONE response code and the client should clear its storage and perform a
190   * full synchronization without any syncToken. Learn more about incremental
191   * synchronization. Optional. The default is to return all entries.
192   * @return Channel
193   */
194  public function watch(Channel $postBody, $optParams = [])
195  {
196    $params = ['postBody' => $postBody];
197    $params = array_merge($params, $optParams);
198    return $this->call('watch', [$params], Channel::class);
199  }
200}
201
202// Adding a class alias for backwards compatibility with the previous class name.
203class_alias(CalendarList::class, 'Google_Service_Calendar_Resource_CalendarList');
204