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\Forms\Resource; 19 20use Google\Service\Forms\CreateWatchRequest; 21use Google\Service\Forms\FormsEmpty; 22use Google\Service\Forms\ListWatchesResponse; 23use Google\Service\Forms\RenewWatchRequest; 24use Google\Service\Forms\Watch; 25 26/** 27 * The "watches" collection of methods. 28 * Typical usage is: 29 * <code> 30 * $formsService = new Google\Service\Forms(...); 31 * $watches = $formsService->watches; 32 * </code> 33 */ 34class FormsWatches extends \Google\Service\Resource 35{ 36 /** 37 * Create a new watch. If a watch ID is provided, it must be unused. For each 38 * invoking project, the per form limit is one watch per Watch.EventType. A 39 * watch expires seven days after it is created (see Watch.expire_time). 40 * (watches.create) 41 * 42 * @param string $formId Required. ID of the Form to watch. 43 * @param CreateWatchRequest $postBody 44 * @param array $optParams Optional parameters. 45 * @return Watch 46 */ 47 public function create($formId, CreateWatchRequest $postBody, $optParams = []) 48 { 49 $params = ['formId' => $formId, 'postBody' => $postBody]; 50 $params = array_merge($params, $optParams); 51 return $this->call('create', [$params], Watch::class); 52 } 53 /** 54 * Delete a watch. (watches.delete) 55 * 56 * @param string $formId Required. The ID of the Form. 57 * @param string $watchId Required. The ID of the Watch to delete. 58 * @param array $optParams Optional parameters. 59 * @return FormsEmpty 60 */ 61 public function delete($formId, $watchId, $optParams = []) 62 { 63 $params = ['formId' => $formId, 'watchId' => $watchId]; 64 $params = array_merge($params, $optParams); 65 return $this->call('delete', [$params], FormsEmpty::class); 66 } 67 /** 68 * Return a list of the watches owned by the invoking project. The maximum 69 * number of watches is two: For each invoker, the limit is one for each event 70 * type per form. (watches.listFormsWatches) 71 * 72 * @param string $formId Required. ID of the Form whose watches to list. 73 * @param array $optParams Optional parameters. 74 * @return ListWatchesResponse 75 */ 76 public function listFormsWatches($formId, $optParams = []) 77 { 78 $params = ['formId' => $formId]; 79 $params = array_merge($params, $optParams); 80 return $this->call('list', [$params], ListWatchesResponse::class); 81 } 82 /** 83 * Renew an existing watch for seven days. The state of the watch after renewal 84 * is `ACTIVE`, and the `expire_time` is seven days from the renewal. Renewing a 85 * watch in an error state (e.g. `SUSPENDED`) succeeds if the error is no longer 86 * present, but fail otherwise. After a watch has expired, RenewWatch returns 87 * `NOT_FOUND`. (watches.renew) 88 * 89 * @param string $formId Required. The ID of the Form. 90 * @param string $watchId Required. The ID of the Watch to renew. 91 * @param RenewWatchRequest $postBody 92 * @param array $optParams Optional parameters. 93 * @return Watch 94 */ 95 public function renew($formId, $watchId, RenewWatchRequest $postBody, $optParams = []) 96 { 97 $params = ['formId' => $formId, 'watchId' => $watchId, 'postBody' => $postBody]; 98 $params = array_merge($params, $optParams); 99 return $this->call('renew', [$params], Watch::class); 100 } 101} 102 103// Adding a class alias for backwards compatibility with the previous class name. 104class_alias(FormsWatches::class, 'Google_Service_Forms_Resource_FormsWatches'); 105