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\WorkspaceEvents\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\WorkspaceEvents\ListSubscriptionsResponse;
|
---|
21 | use Google\Service\WorkspaceEvents\Operation;
|
---|
22 | use Google\Service\WorkspaceEvents\ReactivateSubscriptionRequest;
|
---|
23 | use Google\Service\WorkspaceEvents\Subscription;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "subscriptions" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $workspaceeventsService = new Google\Service\WorkspaceEvents(...);
|
---|
30 | * $subscriptions = $workspaceeventsService->subscriptions;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class Subscriptions extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * [Developer Preview](https://developers.google.com/workspace/preview): Creates
|
---|
37 | * a Google Workspace subscription. To learn how to use this method, see [Create
|
---|
38 | * a Google Workspace
|
---|
39 | * subscription](https://developers.google.com/workspace/events/guides/create-
|
---|
40 | * subscription). (subscriptions.create)
|
---|
41 | *
|
---|
42 | * @param Subscription $postBody
|
---|
43 | * @param array $optParams Optional parameters.
|
---|
44 | *
|
---|
45 | * @opt_param bool validateOnly Optional. If set to `true`, validates and
|
---|
46 | * previews the request, but doesn't create the subscription.
|
---|
47 | * @return Operation
|
---|
48 | * @throws \Google\Service\Exception
|
---|
49 | */
|
---|
50 | public function create(Subscription $postBody, $optParams = [])
|
---|
51 | {
|
---|
52 | $params = ['postBody' => $postBody];
|
---|
53 | $params = array_merge($params, $optParams);
|
---|
54 | return $this->call('create', [$params], Operation::class);
|
---|
55 | }
|
---|
56 | /**
|
---|
57 | * [Developer Preview](https://developers.google.com/workspace/preview): Deletes
|
---|
58 | * a Google Workspace subscription. To learn how to use this method, see [Delete
|
---|
59 | * a Google Workspace
|
---|
60 | * subscription](https://developers.google.com/workspace/events/guides/delete-
|
---|
61 | * subscription). (subscriptions.delete)
|
---|
62 | *
|
---|
63 | * @param string $name Required. Resource name of the subscription to delete.
|
---|
64 | * Format: `subscriptions/{subscription}`
|
---|
65 | * @param array $optParams Optional parameters.
|
---|
66 | *
|
---|
67 | * @opt_param bool allowMissing Optional. If set to `true` and the subscription
|
---|
68 | * isn't found, the request succeeds but doesn't delete the subscription.
|
---|
69 | * @opt_param string etag Optional. Etag of the subscription. If present, it
|
---|
70 | * must match with the server's etag. Otherwise, request fails with the status
|
---|
71 | * `ABORTED`.
|
---|
72 | * @opt_param bool validateOnly Optional. If set to `true`, validates and
|
---|
73 | * previews the request, but doesn't delete the subscription.
|
---|
74 | * @return Operation
|
---|
75 | * @throws \Google\Service\Exception
|
---|
76 | */
|
---|
77 | public function delete($name, $optParams = [])
|
---|
78 | {
|
---|
79 | $params = ['name' => $name];
|
---|
80 | $params = array_merge($params, $optParams);
|
---|
81 | return $this->call('delete', [$params], Operation::class);
|
---|
82 | }
|
---|
83 | /**
|
---|
84 | * [Developer Preview](https://developers.google.com/workspace/preview): Gets
|
---|
85 | * details about a Google Workspace subscription. To learn how to use this
|
---|
86 | * method, see [Get details about a Google Workspace
|
---|
87 | * subscription](https://developers.google.com/workspace/events/guides/get-
|
---|
88 | * subscription). (subscriptions.get)
|
---|
89 | *
|
---|
90 | * @param string $name Required. Resource name of the subscription. Format:
|
---|
91 | * `subscriptions/{subscription}`
|
---|
92 | * @param array $optParams Optional parameters.
|
---|
93 | * @return Subscription
|
---|
94 | * @throws \Google\Service\Exception
|
---|
95 | */
|
---|
96 | public function get($name, $optParams = [])
|
---|
97 | {
|
---|
98 | $params = ['name' => $name];
|
---|
99 | $params = array_merge($params, $optParams);
|
---|
100 | return $this->call('get', [$params], Subscription::class);
|
---|
101 | }
|
---|
102 | /**
|
---|
103 | * [Developer Preview](https://developers.google.com/workspace/preview): Lists
|
---|
104 | * Google Workspace subscriptions. To learn how to use this method, see [List
|
---|
105 | * Google Workspace
|
---|
106 | * subscriptions](https://developers.google.com/workspace/events/guides/list-
|
---|
107 | * subscriptions). (subscriptions.listSubscriptions)
|
---|
108 | *
|
---|
109 | * @param array $optParams Optional parameters.
|
---|
110 | *
|
---|
111 | * @opt_param string filter Required. A query filter. You can filter
|
---|
112 | * subscriptions by event type (`event_types`) and target resource
|
---|
113 | * (`target_resource`). You must specify at least one event type in your query.
|
---|
114 | * To filter for multiple event types, use the `OR` operator. To filter by both
|
---|
115 | * event type and target resource, use the `AND` operator and specify the full
|
---|
116 | * resource name, such as `//chat.googleapis.com/spaces/{space}`. For example,
|
---|
117 | * the following queries are valid: ```
|
---|
118 | * event_types:"google.workspace.chat.membership.v1.updated" OR
|
---|
119 | * event_types:"google.workspace.chat.message.v1.created"
|
---|
120 | * event_types:"google.workspace.chat.message.v1.created" AND
|
---|
121 | * target_resource="//chat.googleapis.com/spaces/{space}" (
|
---|
122 | * event_types:"google.workspace.chat.membership.v1.updated" OR
|
---|
123 | * event_types:"google.workspace.chat.message.v1.created" ) AND
|
---|
124 | * target_resource="//chat.googleapis.com/spaces/{space}" ``` The server rejects
|
---|
125 | * invalid queries with an `INVALID_ARGUMENT` error.
|
---|
126 | * @opt_param int pageSize Optional. The maximum number of subscriptions to
|
---|
127 | * return. The service might return fewer than this value. If unspecified or set
|
---|
128 | * to `0`, up to 50 subscriptions are returned. The maximum value is 100. If you
|
---|
129 | * specify a value more than 100, the system only returns 100 subscriptions.
|
---|
130 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
131 | * list subscriptions call. Provide this parameter to retrieve the subsequent
|
---|
132 | * page. When paginating, the filter value should match the call that provided
|
---|
133 | * the page token. Passing a different value might lead to unexpected results.
|
---|
134 | * @return ListSubscriptionsResponse
|
---|
135 | * @throws \Google\Service\Exception
|
---|
136 | */
|
---|
137 | public function listSubscriptions($optParams = [])
|
---|
138 | {
|
---|
139 | $params = [];
|
---|
140 | $params = array_merge($params, $optParams);
|
---|
141 | return $this->call('list', [$params], ListSubscriptionsResponse::class);
|
---|
142 | }
|
---|
143 | /**
|
---|
144 | * [Developer Preview](https://developers.google.com/workspace/preview): Updates
|
---|
145 | * or renews a Google Workspace subscription. To learn how to use this method,
|
---|
146 | * see [Update or renew a Google Workspace
|
---|
147 | * subscription](https://developers.google.com/workspace/events/guides/update-
|
---|
148 | * subscription). (subscriptions.patch)
|
---|
149 | *
|
---|
150 | * @param string $name Identifier. Resource name of the subscription. Format:
|
---|
151 | * `subscriptions/{subscription}`
|
---|
152 | * @param Subscription $postBody
|
---|
153 | * @param array $optParams Optional parameters.
|
---|
154 | *
|
---|
155 | * @opt_param string updateMask Optional. The field to update. If omitted,
|
---|
156 | * updates any fields included in the request. You can update one of the
|
---|
157 | * following fields in a subscription: * `expire_time`: The timestamp when the
|
---|
158 | * subscription expires. * `ttl`: The time-to-live (TTL) or duration of the
|
---|
159 | * subscription. * `event_types`: The list of event types to receive about the
|
---|
160 | * target resource. To fully replace the subscription (the equivalent of `PUT`),
|
---|
161 | * use `*`. Any omitted fields are updated with empty values.
|
---|
162 | * @opt_param bool validateOnly Optional. If set to `true`, validates and
|
---|
163 | * previews the request, but doesn't update the subscription.
|
---|
164 | * @return Operation
|
---|
165 | * @throws \Google\Service\Exception
|
---|
166 | */
|
---|
167 | public function patch($name, Subscription $postBody, $optParams = [])
|
---|
168 | {
|
---|
169 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
170 | $params = array_merge($params, $optParams);
|
---|
171 | return $this->call('patch', [$params], Operation::class);
|
---|
172 | }
|
---|
173 | /**
|
---|
174 | * [Developer Preview](https://developers.google.com/workspace/preview):
|
---|
175 | * Reactivates a suspended Google Workspace subscription. This method resets
|
---|
176 | * your subscription's `State` field to `ACTIVE`. Before you use this method,
|
---|
177 | * you must fix the error that suspended the subscription. This method will
|
---|
178 | * ignore or reject any subscription that isn't currently in a suspended state.
|
---|
179 | * To learn how to use this method, see [Reactivate a Google Workspace subscript
|
---|
180 | * ion](https://developers.google.com/workspace/events/guides/reactivate-
|
---|
181 | * subscription). (subscriptions.reactivate)
|
---|
182 | *
|
---|
183 | * @param string $name Required. Resource name of the subscription. Format:
|
---|
184 | * `subscriptions/{subscription}`
|
---|
185 | * @param ReactivateSubscriptionRequest $postBody
|
---|
186 | * @param array $optParams Optional parameters.
|
---|
187 | * @return Operation
|
---|
188 | * @throws \Google\Service\Exception
|
---|
189 | */
|
---|
190 | public function reactivate($name, ReactivateSubscriptionRequest $postBody, $optParams = [])
|
---|
191 | {
|
---|
192 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
193 | $params = array_merge($params, $optParams);
|
---|
194 | return $this->call('reactivate', [$params], Operation::class);
|
---|
195 | }
|
---|
196 | }
|
---|
197 |
|
---|
198 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
199 | class_alias(Subscriptions::class, 'Google_Service_WorkspaceEvents_Resource_Subscriptions');
|
---|