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