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\Channel; 21use Google\Service\Calendar\Event; 22use Google\Service\Calendar\Events as EventsModel; 23 24/** 25 * The "events" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $calendarService = new Google\Service\Calendar(...); 29 * $events = $calendarService->events; 30 * </code> 31 */ 32class Events extends \Google\Service\Resource 33{ 34 /** 35 * Deletes an event. (events.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 string $eventId Event identifier. 41 * @param array $optParams Optional parameters. 42 * 43 * @opt_param bool sendNotifications Deprecated. Please use sendUpdates instead. 44 * 45 * Whether to send notifications about the deletion of the event. Note that some 46 * emails might still be sent even if you set the value to false. The default is 47 * false. 48 * @opt_param string sendUpdates Guests who should receive notifications about 49 * the deletion of the event. 50 */ 51 public function delete($calendarId, $eventId, $optParams = []) 52 { 53 $params = ['calendarId' => $calendarId, 'eventId' => $eventId]; 54 $params = array_merge($params, $optParams); 55 return $this->call('delete', [$params]); 56 } 57 /** 58 * Returns an event. (events.get) 59 * 60 * @param string $calendarId Calendar identifier. To retrieve calendar IDs call 61 * the calendarList.list method. If you want to access the primary calendar of 62 * the currently logged in user, use the "primary" keyword. 63 * @param string $eventId Event identifier. 64 * @param array $optParams Optional parameters. 65 * 66 * @opt_param bool alwaysIncludeEmail Deprecated and ignored. A value will 67 * always be returned in the email field for the organizer, creator and 68 * attendees, even if no real email address is available (i.e. a generated, non- 69 * working value will be provided). 70 * @opt_param int maxAttendees The maximum number of attendees to include in the 71 * response. If there are more than the specified number of attendees, only the 72 * participant is returned. Optional. 73 * @opt_param string timeZone Time zone used in the response. Optional. The 74 * default is the time zone of the calendar. 75 * @return Event 76 */ 77 public function get($calendarId, $eventId, $optParams = []) 78 { 79 $params = ['calendarId' => $calendarId, 'eventId' => $eventId]; 80 $params = array_merge($params, $optParams); 81 return $this->call('get', [$params], Event::class); 82 } 83 /** 84 * Imports an event. This operation is used to add a private copy of an existing 85 * event to a calendar. (events.import) 86 * 87 * @param string $calendarId Calendar identifier. To retrieve calendar IDs call 88 * the calendarList.list method. If you want to access the primary calendar of 89 * the currently logged in user, use the "primary" keyword. 90 * @param Event $postBody 91 * @param array $optParams Optional parameters. 92 * 93 * @opt_param int conferenceDataVersion Version number of conference data 94 * supported by the API client. Version 0 assumes no conference data support and 95 * ignores conference data in the event's body. Version 1 enables support for 96 * copying of ConferenceData as well as for creating new conferences using the 97 * createRequest field of conferenceData. The default is 0. 98 * @opt_param bool supportsAttachments Whether API client performing operation 99 * supports event attachments. Optional. The default is False. 100 * @return Event 101 */ 102 public function import($calendarId, Event $postBody, $optParams = []) 103 { 104 $params = ['calendarId' => $calendarId, 'postBody' => $postBody]; 105 $params = array_merge($params, $optParams); 106 return $this->call('import', [$params], Event::class); 107 } 108 /** 109 * Creates an event. (events.insert) 110 * 111 * @param string $calendarId Calendar identifier. To retrieve calendar IDs call 112 * the calendarList.list method. If you want to access the primary calendar of 113 * the currently logged in user, use the "primary" keyword. 114 * @param Event $postBody 115 * @param array $optParams Optional parameters. 116 * 117 * @opt_param int conferenceDataVersion Version number of conference data 118 * supported by the API client. Version 0 assumes no conference data support and 119 * ignores conference data in the event's body. Version 1 enables support for 120 * copying of ConferenceData as well as for creating new conferences using the 121 * createRequest field of conferenceData. The default is 0. 122 * @opt_param int maxAttendees The maximum number of attendees to include in the 123 * response. If there are more than the specified number of attendees, only the 124 * participant is returned. Optional. 125 * @opt_param bool sendNotifications Deprecated. Please use sendUpdates instead. 126 * 127 * Whether to send notifications about the creation of the new event. Note that 128 * some emails might still be sent even if you set the value to false. The 129 * default is false. 130 * @opt_param string sendUpdates Whether to send notifications about the 131 * creation of the new event. Note that some emails might still be sent. The 132 * default is false. 133 * @opt_param bool supportsAttachments Whether API client performing operation 134 * supports event attachments. Optional. The default is False. 135 * @return Event 136 */ 137 public function insert($calendarId, Event $postBody, $optParams = []) 138 { 139 $params = ['calendarId' => $calendarId, 'postBody' => $postBody]; 140 $params = array_merge($params, $optParams); 141 return $this->call('insert', [$params], Event::class); 142 } 143 /** 144 * Returns instances of the specified recurring event. (events.instances) 145 * 146 * @param string $calendarId Calendar identifier. To retrieve calendar IDs call 147 * the calendarList.list method. If you want to access the primary calendar of 148 * the currently logged in user, use the "primary" keyword. 149 * @param string $eventId Recurring event identifier. 150 * @param array $optParams Optional parameters. 151 * 152 * @opt_param bool alwaysIncludeEmail Deprecated and ignored. A value will 153 * always be returned in the email field for the organizer, creator and 154 * attendees, even if no real email address is available (i.e. a generated, non- 155 * working value will be provided). 156 * @opt_param int maxAttendees The maximum number of attendees to include in the 157 * response. If there are more than the specified number of attendees, only the 158 * participant is returned. Optional. 159 * @opt_param int maxResults Maximum number of events returned on one result 160 * page. By default the value is 250 events. The page size can never be larger 161 * than 2500 events. Optional. 162 * @opt_param string originalStart The original start time of the instance in 163 * the result. Optional. 164 * @opt_param string pageToken Token specifying which result page to return. 165 * Optional. 166 * @opt_param bool showDeleted Whether to include deleted events (with status 167 * equals "cancelled") in the result. Cancelled instances of recurring events 168 * will still be included if singleEvents is False. Optional. The default is 169 * False. 170 * @opt_param string timeMax Upper bound (exclusive) for an event's start time 171 * to filter by. Optional. The default is not to filter by start time. Must be 172 * an RFC3339 timestamp with mandatory time zone offset. 173 * @opt_param string timeMin Lower bound (inclusive) for an event's end time to 174 * filter by. Optional. The default is not to filter by end time. Must be an 175 * RFC3339 timestamp with mandatory time zone offset. 176 * @opt_param string timeZone Time zone used in the response. Optional. The 177 * default is the time zone of the calendar. 178 * @return EventsModel 179 */ 180 public function instances($calendarId, $eventId, $optParams = []) 181 { 182 $params = ['calendarId' => $calendarId, 'eventId' => $eventId]; 183 $params = array_merge($params, $optParams); 184 return $this->call('instances', [$params], EventsModel::class); 185 } 186 /** 187 * Returns events on the specified calendar. (events.listEvents) 188 * 189 * @param string $calendarId Calendar identifier. To retrieve calendar IDs call 190 * the calendarList.list method. If you want to access the primary calendar of 191 * the currently logged in user, use the "primary" keyword. 192 * @param array $optParams Optional parameters. 193 * 194 * @opt_param bool alwaysIncludeEmail Deprecated and ignored. A value will 195 * always be returned in the email field for the organizer, creator and 196 * attendees, even if no real email address is available (i.e. a generated, non- 197 * working value will be provided). 198 * @opt_param string iCalUID Specifies event ID in the iCalendar format to be 199 * included in the response. Optional. 200 * @opt_param int maxAttendees The maximum number of attendees to include in the 201 * response. If there are more than the specified number of attendees, only the 202 * participant is returned. Optional. 203 * @opt_param int maxResults Maximum number of events returned on one result 204 * page. The number of events in the resulting page may be less than this value, 205 * or none at all, even if there are more events matching the query. Incomplete 206 * pages can be detected by a non-empty nextPageToken field in the response. By 207 * default the value is 250 events. The page size can never be larger than 2500 208 * events. Optional. 209 * @opt_param string orderBy The order of the events returned in the result. 210 * Optional. The default is an unspecified, stable order. 211 * @opt_param string pageToken Token specifying which result page to return. 212 * Optional. 213 * @opt_param string privateExtendedProperty Extended properties constraint 214 * specified as propertyName=value. Matches only private properties. This 215 * parameter might be repeated multiple times to return events that match all 216 * given constraints. 217 * @opt_param string q Free text search terms to find events that match these 218 * terms in any field, except for extended properties. Optional. 219 * @opt_param string sharedExtendedProperty Extended properties constraint 220 * specified as propertyName=value. Matches only shared properties. This 221 * parameter might be repeated multiple times to return events that match all 222 * given constraints. 223 * @opt_param bool showDeleted Whether to include deleted events (with status 224 * equals "cancelled") in the result. Cancelled instances of recurring events 225 * (but not the underlying recurring event) will still be included if 226 * showDeleted and singleEvents are both False. If showDeleted and singleEvents 227 * are both True, only single instances of deleted events (but not the 228 * underlying recurring events) are returned. Optional. The default is False. 229 * @opt_param bool showHiddenInvitations Whether to include hidden invitations 230 * in the result. Optional. The default is False. 231 * @opt_param bool singleEvents Whether to expand recurring events into 232 * instances and only return single one-off events and instances of recurring 233 * events, but not the underlying recurring events themselves. Optional. The 234 * default is False. 235 * @opt_param string syncToken Token obtained from the nextSyncToken field 236 * returned on the last page of results from the previous list request. It makes 237 * the result of this list request contain only entries that have changed since 238 * then. All events deleted since the previous list request will always be in 239 * the result set and it is not allowed to set showDeleted to False. There are 240 * several query parameters that cannot be specified together with nextSyncToken 241 * to ensure consistency of the client state. 242 * 243 * These are: - iCalUID - orderBy - privateExtendedProperty - q - 244 * sharedExtendedProperty - timeMin - timeMax - updatedMin If the syncToken 245 * expires, the server will respond with a 410 GONE response code and the client 246 * should clear its storage and perform a full synchronization without any 247 * syncToken. Learn more about incremental synchronization. Optional. The 248 * default is to return all entries. 249 * @opt_param string timeMax Upper bound (exclusive) for an event's start time 250 * to filter by. Optional. The default is not to filter by start time. Must be 251 * an RFC3339 timestamp with mandatory time zone offset, for example, 252 * 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided 253 * but are ignored. If timeMin is set, timeMax must be greater than timeMin. 254 * @opt_param string timeMin Lower bound (exclusive) for an event's end time to 255 * filter by. Optional. The default is not to filter by end time. Must be an 256 * RFC3339 timestamp with mandatory time zone offset, for example, 257 * 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided 258 * but are ignored. If timeMax is set, timeMin must be smaller than timeMax. 259 * @opt_param string timeZone Time zone used in the response. Optional. The 260 * default is the time zone of the calendar. 261 * @opt_param string updatedMin Lower bound for an event's last modification 262 * time (as a RFC3339 timestamp) to filter by. When specified, entries deleted 263 * since this time will always be included regardless of showDeleted. Optional. 264 * The default is not to filter by last modification time. 265 * @return EventsModel 266 */ 267 public function listEvents($calendarId, $optParams = []) 268 { 269 $params = ['calendarId' => $calendarId]; 270 $params = array_merge($params, $optParams); 271 return $this->call('list', [$params], EventsModel::class); 272 } 273 /** 274 * Moves an event to another calendar, i.e. changes an event's organizer. 275 * (events.move) 276 * 277 * @param string $calendarId Calendar identifier of the source calendar where 278 * the event currently is on. 279 * @param string $eventId Event identifier. 280 * @param string $destination Calendar identifier of the target calendar where 281 * the event is to be moved to. 282 * @param array $optParams Optional parameters. 283 * 284 * @opt_param bool sendNotifications Deprecated. Please use sendUpdates instead. 285 * 286 * Whether to send notifications about the change of the event's organizer. Note 287 * that some emails might still be sent even if you set the value to false. The 288 * default is false. 289 * @opt_param string sendUpdates Guests who should receive notifications about 290 * the change of the event's organizer. 291 * @return Event 292 */ 293 public function move($calendarId, $eventId, $destination, $optParams = []) 294 { 295 $params = ['calendarId' => $calendarId, 'eventId' => $eventId, 'destination' => $destination]; 296 $params = array_merge($params, $optParams); 297 return $this->call('move', [$params], Event::class); 298 } 299 /** 300 * Updates an event. This method supports patch semantics. (events.patch) 301 * 302 * @param string $calendarId Calendar identifier. To retrieve calendar IDs call 303 * the calendarList.list method. If you want to access the primary calendar of 304 * the currently logged in user, use the "primary" keyword. 305 * @param string $eventId Event identifier. 306 * @param Event $postBody 307 * @param array $optParams Optional parameters. 308 * 309 * @opt_param bool alwaysIncludeEmail Deprecated and ignored. A value will 310 * always be returned in the email field for the organizer, creator and 311 * attendees, even if no real email address is available (i.e. a generated, non- 312 * working value will be provided). 313 * @opt_param int conferenceDataVersion Version number of conference data 314 * supported by the API client. Version 0 assumes no conference data support and 315 * ignores conference data in the event's body. Version 1 enables support for 316 * copying of ConferenceData as well as for creating new conferences using the 317 * createRequest field of conferenceData. The default is 0. 318 * @opt_param int maxAttendees The maximum number of attendees to include in the 319 * response. If there are more than the specified number of attendees, only the 320 * participant is returned. Optional. 321 * @opt_param bool sendNotifications Deprecated. Please use sendUpdates instead. 322 * 323 * Whether to send notifications about the event update (for example, 324 * description changes, etc.). Note that some emails might still be sent even if 325 * you set the value to false. The default is false. 326 * @opt_param string sendUpdates Guests who should receive notifications about 327 * the event update (for example, title changes, etc.). 328 * @opt_param bool supportsAttachments Whether API client performing operation 329 * supports event attachments. Optional. The default is False. 330 * @return Event 331 */ 332 public function patch($calendarId, $eventId, Event $postBody, $optParams = []) 333 { 334 $params = ['calendarId' => $calendarId, 'eventId' => $eventId, 'postBody' => $postBody]; 335 $params = array_merge($params, $optParams); 336 return $this->call('patch', [$params], Event::class); 337 } 338 /** 339 * Creates an event based on a simple text string. (events.quickAdd) 340 * 341 * @param string $calendarId Calendar identifier. To retrieve calendar IDs call 342 * the calendarList.list method. If you want to access the primary calendar of 343 * the currently logged in user, use the "primary" keyword. 344 * @param string $text The text describing the event to be created. 345 * @param array $optParams Optional parameters. 346 * 347 * @opt_param bool sendNotifications Deprecated. Please use sendUpdates instead. 348 * 349 * Whether to send notifications about the creation of the event. Note that some 350 * emails might still be sent even if you set the value to false. The default is 351 * false. 352 * @opt_param string sendUpdates Guests who should receive notifications about 353 * the creation of the new event. 354 * @return Event 355 */ 356 public function quickAdd($calendarId, $text, $optParams = []) 357 { 358 $params = ['calendarId' => $calendarId, 'text' => $text]; 359 $params = array_merge($params, $optParams); 360 return $this->call('quickAdd', [$params], Event::class); 361 } 362 /** 363 * Updates an event. (events.update) 364 * 365 * @param string $calendarId Calendar identifier. To retrieve calendar IDs call 366 * the calendarList.list method. If you want to access the primary calendar of 367 * the currently logged in user, use the "primary" keyword. 368 * @param string $eventId Event identifier. 369 * @param Event $postBody 370 * @param array $optParams Optional parameters. 371 * 372 * @opt_param bool alwaysIncludeEmail Deprecated and ignored. A value will 373 * always be returned in the email field for the organizer, creator and 374 * attendees, even if no real email address is available (i.e. a generated, non- 375 * working value will be provided). 376 * @opt_param int conferenceDataVersion Version number of conference data 377 * supported by the API client. Version 0 assumes no conference data support and 378 * ignores conference data in the event's body. Version 1 enables support for 379 * copying of ConferenceData as well as for creating new conferences using the 380 * createRequest field of conferenceData. The default is 0. 381 * @opt_param int maxAttendees The maximum number of attendees to include in the 382 * response. If there are more than the specified number of attendees, only the 383 * participant is returned. Optional. 384 * @opt_param bool sendNotifications Deprecated. Please use sendUpdates instead. 385 * 386 * Whether to send notifications about the event update (for example, 387 * description changes, etc.). Note that some emails might still be sent even if 388 * you set the value to false. The default is false. 389 * @opt_param string sendUpdates Guests who should receive notifications about 390 * the event update (for example, title changes, etc.). 391 * @opt_param bool supportsAttachments Whether API client performing operation 392 * supports event attachments. Optional. The default is False. 393 * @return Event 394 */ 395 public function update($calendarId, $eventId, Event $postBody, $optParams = []) 396 { 397 $params = ['calendarId' => $calendarId, 'eventId' => $eventId, 'postBody' => $postBody]; 398 $params = array_merge($params, $optParams); 399 return $this->call('update', [$params], Event::class); 400 } 401 /** 402 * Watch for changes to Events resources. (events.watch) 403 * 404 * @param string $calendarId Calendar identifier. To retrieve calendar IDs call 405 * the calendarList.list method. If you want to access the primary calendar of 406 * the currently logged in user, use the "primary" keyword. 407 * @param Channel $postBody 408 * @param array $optParams Optional parameters. 409 * 410 * @opt_param bool alwaysIncludeEmail Deprecated and ignored. A value will 411 * always be returned in the email field for the organizer, creator and 412 * attendees, even if no real email address is available (i.e. a generated, non- 413 * working value will be provided). 414 * @opt_param string iCalUID Specifies event ID in the iCalendar format to be 415 * included in the response. Optional. 416 * @opt_param int maxAttendees The maximum number of attendees to include in the 417 * response. If there are more than the specified number of attendees, only the 418 * participant is returned. Optional. 419 * @opt_param int maxResults Maximum number of events returned on one result 420 * page. The number of events in the resulting page may be less than this value, 421 * or none at all, even if there are more events matching the query. Incomplete 422 * pages can be detected by a non-empty nextPageToken field in the response. By 423 * default the value is 250 events. The page size can never be larger than 2500 424 * events. Optional. 425 * @opt_param string orderBy The order of the events returned in the result. 426 * Optional. The default is an unspecified, stable order. 427 * @opt_param string pageToken Token specifying which result page to return. 428 * Optional. 429 * @opt_param string privateExtendedProperty Extended properties constraint 430 * specified as propertyName=value. Matches only private properties. This 431 * parameter might be repeated multiple times to return events that match all 432 * given constraints. 433 * @opt_param string q Free text search terms to find events that match these 434 * terms in any field, except for extended properties. Optional. 435 * @opt_param string sharedExtendedProperty Extended properties constraint 436 * specified as propertyName=value. Matches only shared properties. This 437 * parameter might be repeated multiple times to return events that match all 438 * given constraints. 439 * @opt_param bool showDeleted Whether to include deleted events (with status 440 * equals "cancelled") in the result. Cancelled instances of recurring events 441 * (but not the underlying recurring event) will still be included if 442 * showDeleted and singleEvents are both False. If showDeleted and singleEvents 443 * are both True, only single instances of deleted events (but not the 444 * underlying recurring events) are returned. Optional. The default is False. 445 * @opt_param bool showHiddenInvitations Whether to include hidden invitations 446 * in the result. Optional. The default is False. 447 * @opt_param bool singleEvents Whether to expand recurring events into 448 * instances and only return single one-off events and instances of recurring 449 * events, but not the underlying recurring events themselves. Optional. The 450 * default is False. 451 * @opt_param string syncToken Token obtained from the nextSyncToken field 452 * returned on the last page of results from the previous list request. It makes 453 * the result of this list request contain only entries that have changed since 454 * then. All events deleted since the previous list request will always be in 455 * the result set and it is not allowed to set showDeleted to False. There are 456 * several query parameters that cannot be specified together with nextSyncToken 457 * to ensure consistency of the client state. 458 * 459 * These are: - iCalUID - orderBy - privateExtendedProperty - q - 460 * sharedExtendedProperty - timeMin - timeMax - updatedMin If the syncToken 461 * expires, the server will respond with a 410 GONE response code and the client 462 * should clear its storage and perform a full synchronization without any 463 * syncToken. Learn more about incremental synchronization. Optional. The 464 * default is to return all entries. 465 * @opt_param string timeMax Upper bound (exclusive) for an event's start time 466 * to filter by. Optional. The default is not to filter by start time. Must be 467 * an RFC3339 timestamp with mandatory time zone offset, for example, 468 * 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided 469 * but are ignored. If timeMin is set, timeMax must be greater than timeMin. 470 * @opt_param string timeMin Lower bound (exclusive) for an event's end time to 471 * filter by. Optional. The default is not to filter by end time. Must be an 472 * RFC3339 timestamp with mandatory time zone offset, for example, 473 * 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided 474 * but are ignored. If timeMax is set, timeMin must be smaller than timeMax. 475 * @opt_param string timeZone Time zone used in the response. Optional. The 476 * default is the time zone of the calendar. 477 * @opt_param string updatedMin Lower bound for an event's last modification 478 * time (as a RFC3339 timestamp) to filter by. When specified, entries deleted 479 * since this time will always be included regardless of showDeleted. Optional. 480 * The default is not to filter by last modification time. 481 * @return Channel 482 */ 483 public function watch($calendarId, Channel $postBody, $optParams = []) 484 { 485 $params = ['calendarId' => $calendarId, 'postBody' => $postBody]; 486 $params = array_merge($params, $optParams); 487 return $this->call('watch', [$params], Channel::class); 488 } 489} 490 491// Adding a class alias for backwards compatibility with the previous class name. 492class_alias(Events::class, 'Google_Service_Calendar_Resource_Events'); 493