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\HangoutsChat\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\HangoutsChat\ChatEmpty;
|
---|
21 | use Google\Service\HangoutsChat\CompleteImportSpaceRequest;
|
---|
22 | use Google\Service\HangoutsChat\CompleteImportSpaceResponse;
|
---|
23 | use Google\Service\HangoutsChat\ListSpacesResponse;
|
---|
24 | use Google\Service\HangoutsChat\SearchSpacesResponse;
|
---|
25 | use Google\Service\HangoutsChat\SetUpSpaceRequest;
|
---|
26 | use Google\Service\HangoutsChat\Space;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "spaces" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $chatService = new Google\Service\HangoutsChat(...);
|
---|
33 | * $spaces = $chatService->spaces;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class Spaces extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Completes the [import
|
---|
40 | * process](https://developers.google.com/workspace/chat/import-data) for the
|
---|
41 | * specified space and makes it visible to users. Requires [app
|
---|
42 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
43 | * authorize-chat-app) and domain-wide delegation. For more information, see
|
---|
44 | * [Authorize Google Chat apps to import
|
---|
45 | * data](https://developers.google.com/workspace/chat/authorize-import).
|
---|
46 | * (spaces.completeImport)
|
---|
47 | *
|
---|
48 | * @param string $name Required. Resource name of the import mode space. Format:
|
---|
49 | * `spaces/{space}`
|
---|
50 | * @param CompleteImportSpaceRequest $postBody
|
---|
51 | * @param array $optParams Optional parameters.
|
---|
52 | * @return CompleteImportSpaceResponse
|
---|
53 | * @throws \Google\Service\Exception
|
---|
54 | */
|
---|
55 | public function completeImport($name, CompleteImportSpaceRequest $postBody, $optParams = [])
|
---|
56 | {
|
---|
57 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
58 | $params = array_merge($params, $optParams);
|
---|
59 | return $this->call('completeImport', [$params], CompleteImportSpaceResponse::class);
|
---|
60 | }
|
---|
61 | /**
|
---|
62 | * Creates a space with no members. Can be used to create a named space, or a
|
---|
63 | * group chat in `Import mode`. Spaces grouped by topics aren't supported. For
|
---|
64 | * an example, see [Create a
|
---|
65 | * space](https://developers.google.com/workspace/chat/create-spaces). If you
|
---|
66 | * receive the error message `ALREADY_EXISTS` when creating a space, try a
|
---|
67 | * different `displayName`. An existing space within the Google Workspace
|
---|
68 | * organization might already use this display name. Supports the following
|
---|
69 | * types of
|
---|
70 | * [authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
71 | * authorize): - [App
|
---|
72 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
73 | * authorize-chat-app) with [administrator
|
---|
74 | * approval](https://support.google.com/a?p=chat-app-auth) in [Developer
|
---|
75 | * Preview](https://developers.google.com/workspace/preview) - [User
|
---|
76 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
77 | * authorize-chat-user) When authenticating as an app, the `space.customer`
|
---|
78 | * field must be set in the request. (spaces.create)
|
---|
79 | *
|
---|
80 | * @param Space $postBody
|
---|
81 | * @param array $optParams Optional parameters.
|
---|
82 | *
|
---|
83 | * @opt_param string requestId Optional. A unique identifier for this request. A
|
---|
84 | * random UUID is recommended. Specifying an existing request ID returns the
|
---|
85 | * space created with that ID instead of creating a new space. Specifying an
|
---|
86 | * existing request ID from the same Chat app with a different authenticated
|
---|
87 | * user returns an error.
|
---|
88 | * @return Space
|
---|
89 | * @throws \Google\Service\Exception
|
---|
90 | */
|
---|
91 | public function create(Space $postBody, $optParams = [])
|
---|
92 | {
|
---|
93 | $params = ['postBody' => $postBody];
|
---|
94 | $params = array_merge($params, $optParams);
|
---|
95 | return $this->call('create', [$params], Space::class);
|
---|
96 | }
|
---|
97 | /**
|
---|
98 | * Deletes a named space. Always performs a cascading delete, which means that
|
---|
99 | * the space's child resources—like messages posted in the space and memberships
|
---|
100 | * in the space—are also deleted. For an example, see [Delete a
|
---|
101 | * space](https://developers.google.com/workspace/chat/delete-spaces). Supports
|
---|
102 | * the following types of
|
---|
103 | * [authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
104 | * authorize): - [App
|
---|
105 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
106 | * authorize-chat-app) with [administrator
|
---|
107 | * approval](https://support.google.com/a?p=chat-app-auth) in [Developer
|
---|
108 | * Preview](https://developers.google.com/workspace/preview) - [User
|
---|
109 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
110 | * authorize-chat-user) You can authenticate and authorize this method with
|
---|
111 | * administrator privileges by setting the `use_admin_access` field in the
|
---|
112 | * request. (spaces.delete)
|
---|
113 | *
|
---|
114 | * @param string $name Required. Resource name of the space to delete. Format:
|
---|
115 | * `spaces/{space}`
|
---|
116 | * @param array $optParams Optional parameters.
|
---|
117 | *
|
---|
118 | * @opt_param bool useAdminAccess Optional. When `true`, the method runs using
|
---|
119 | * the user's Google Workspace administrator privileges. The calling user must
|
---|
120 | * be a Google Workspace administrator with the [manage chat and spaces
|
---|
121 | * conversations privilege](https://support.google.com/a/answer/13369245).
|
---|
122 | * Requires the `chat.admin.delete` [OAuth 2.0
|
---|
123 | * scope](https://developers.google.com/workspace/chat/authenticate-
|
---|
124 | * authorize#chat-api-scopes).
|
---|
125 | * @return ChatEmpty
|
---|
126 | * @throws \Google\Service\Exception
|
---|
127 | */
|
---|
128 | public function delete($name, $optParams = [])
|
---|
129 | {
|
---|
130 | $params = ['name' => $name];
|
---|
131 | $params = array_merge($params, $optParams);
|
---|
132 | return $this->call('delete', [$params], ChatEmpty::class);
|
---|
133 | }
|
---|
134 | /**
|
---|
135 | * Returns the existing direct message with the specified user. If no direct
|
---|
136 | * message space is found, returns a `404 NOT_FOUND` error. For an example, see
|
---|
137 | * [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message). With
|
---|
138 | * [app
|
---|
139 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
140 | * authorize-chat-app), returns the direct message space between the specified
|
---|
141 | * user and the calling Chat app. With [user
|
---|
142 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
143 | * authorize-chat-user), returns the direct message space between the specified
|
---|
144 | * user and the authenticated user. // Supports the following types of
|
---|
145 | * [authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
146 | * authorize): - [App
|
---|
147 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
148 | * authorize-chat-app) - [User
|
---|
149 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
150 | * authorize-chat-user) (spaces.findDirectMessage)
|
---|
151 | *
|
---|
152 | * @param array $optParams Optional parameters.
|
---|
153 | *
|
---|
154 | * @opt_param string name Required. Resource name of the user to find direct
|
---|
155 | * message with. Format: `users/{user}`, where `{user}` is either the `id` for
|
---|
156 | * the [person](https://developers.google.com/people/api/rest/v1/people) from
|
---|
157 | * the People API, or the `id` for the
|
---|
158 | * [user](https://developers.google.com/admin-
|
---|
159 | * sdk/directory/reference/rest/v1/users) in the Directory API. For example, if
|
---|
160 | * the People API profile ID is `123456789`, you can find a direct message with
|
---|
161 | * that person by using `users/123456789` as the `name`. When [authenticated as
|
---|
162 | * a user](https://developers.google.com/workspace/chat/authenticate-authorize-
|
---|
163 | * chat-user), you can use the email as an alias for `{user}`. For example,
|
---|
164 | * `users/example@gmail.com` where `example@gmail.com` is the email of the
|
---|
165 | * Google Chat user.
|
---|
166 | * @return Space
|
---|
167 | * @throws \Google\Service\Exception
|
---|
168 | */
|
---|
169 | public function findDirectMessage($optParams = [])
|
---|
170 | {
|
---|
171 | $params = [];
|
---|
172 | $params = array_merge($params, $optParams);
|
---|
173 | return $this->call('findDirectMessage', [$params], Space::class);
|
---|
174 | }
|
---|
175 | /**
|
---|
176 | * Returns details about a space. For an example, see [Get details about a
|
---|
177 | * space](https://developers.google.com/workspace/chat/get-spaces). Supports the
|
---|
178 | * following types of
|
---|
179 | * [authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
180 | * authorize): - [App
|
---|
181 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
182 | * authorize-chat-app) - [User
|
---|
183 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
184 | * authorize-chat-user) You can authenticate and authorize this method with
|
---|
185 | * administrator privileges by setting the `use_admin_access` field in the
|
---|
186 | * request. (spaces.get)
|
---|
187 | *
|
---|
188 | * @param string $name Required. Resource name of the space, in the form
|
---|
189 | * `spaces/{space}`. Format: `spaces/{space}`
|
---|
190 | * @param array $optParams Optional parameters.
|
---|
191 | *
|
---|
192 | * @opt_param bool useAdminAccess Optional. When `true`, the method runs using
|
---|
193 | * the user's Google Workspace administrator privileges. The calling user must
|
---|
194 | * be a Google Workspace administrator with the [manage chat and spaces
|
---|
195 | * conversations privilege](https://support.google.com/a/answer/13369245).
|
---|
196 | * Requires the `chat.admin.spaces` or `chat.admin.spaces.readonly` [OAuth 2.0
|
---|
197 | * scopes](https://developers.google.com/workspace/chat/authenticate-
|
---|
198 | * authorize#chat-api-scopes).
|
---|
199 | * @return Space
|
---|
200 | * @throws \Google\Service\Exception
|
---|
201 | */
|
---|
202 | public function get($name, $optParams = [])
|
---|
203 | {
|
---|
204 | $params = ['name' => $name];
|
---|
205 | $params = array_merge($params, $optParams);
|
---|
206 | return $this->call('get', [$params], Space::class);
|
---|
207 | }
|
---|
208 | /**
|
---|
209 | * Lists spaces the caller is a member of. Group chats and DMs aren't listed
|
---|
210 | * until the first message is sent. For an example, see [List
|
---|
211 | * spaces](https://developers.google.com/workspace/chat/list-spaces). Supports
|
---|
212 | * the following types of
|
---|
213 | * [authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
214 | * authorize): - [App
|
---|
215 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
216 | * authorize-chat-app) - [User
|
---|
217 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
218 | * authorize-chat-user) To list all named spaces by Google Workspace
|
---|
219 | * organization, use the [`spaces.search()`](https://developers.google.com/works
|
---|
220 | * pace/chat/api/reference/rest/v1/spaces/search) method using Workspace
|
---|
221 | * administrator privileges instead. (spaces.listSpaces)
|
---|
222 | *
|
---|
223 | * @param array $optParams Optional parameters.
|
---|
224 | *
|
---|
225 | * @opt_param string filter Optional. A query filter. You can filter spaces by
|
---|
226 | * the space type ([`space_type`](https://developers.google.com/workspace/chat/a
|
---|
227 | * pi/reference/rest/v1/spaces#spacetype)). To filter by space type, you must
|
---|
228 | * specify valid enum value, such as `SPACE` or `GROUP_CHAT` (the `space_type`
|
---|
229 | * can't be `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use
|
---|
230 | * the `OR` operator. For example, the following queries are valid: ```
|
---|
231 | * space_type = "SPACE" spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE"
|
---|
232 | * ``` Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
|
---|
233 | * error.
|
---|
234 | * @opt_param int pageSize Optional. The maximum number of spaces to return. The
|
---|
235 | * service might return fewer than this value. If unspecified, at most 100
|
---|
236 | * spaces are returned. The maximum value is 1000. If you use a value more than
|
---|
237 | * 1000, it's automatically changed to 1000. Negative values return an
|
---|
238 | * `INVALID_ARGUMENT` error.
|
---|
239 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
240 | * list spaces call. Provide this parameter to retrieve the subsequent page.
|
---|
241 | * When paginating, the filter value should match the call that provided the
|
---|
242 | * page token. Passing a different value may lead to unexpected results.
|
---|
243 | * @return ListSpacesResponse
|
---|
244 | * @throws \Google\Service\Exception
|
---|
245 | */
|
---|
246 | public function listSpaces($optParams = [])
|
---|
247 | {
|
---|
248 | $params = [];
|
---|
249 | $params = array_merge($params, $optParams);
|
---|
250 | return $this->call('list', [$params], ListSpacesResponse::class);
|
---|
251 | }
|
---|
252 | /**
|
---|
253 | * Updates a space. For an example, see [Update a
|
---|
254 | * space](https://developers.google.com/workspace/chat/update-spaces). If you're
|
---|
255 | * updating the `displayName` field and receive the error message
|
---|
256 | * `ALREADY_EXISTS`, try a different display name.. An existing space within the
|
---|
257 | * Google Workspace organization might already use this display name. Supports
|
---|
258 | * the following types of
|
---|
259 | * [authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
260 | * authorize): - [App
|
---|
261 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
262 | * authorize-chat-app) with [administrator
|
---|
263 | * approval](https://support.google.com/a?p=chat-app-auth) in [Developer
|
---|
264 | * Preview](https://developers.google.com/workspace/preview) - [User
|
---|
265 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
266 | * authorize-chat-user) You can authenticate and authorize this method with
|
---|
267 | * administrator privileges by setting the `use_admin_access` field in the
|
---|
268 | * request. (spaces.patch)
|
---|
269 | *
|
---|
270 | * @param string $name Identifier. Resource name of the space. Format:
|
---|
271 | * `spaces/{space}` Where `{space}` represents the system-assigned ID for the
|
---|
272 | * space. You can obtain the space ID by calling the [`spaces.list()`](https://d
|
---|
273 | * evelopers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method
|
---|
274 | * or from the space URL. For example, if the space URL is
|
---|
275 | * `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is
|
---|
276 | * `AAAAAAAAA`.
|
---|
277 | * @param Space $postBody
|
---|
278 | * @param array $optParams Optional parameters.
|
---|
279 | *
|
---|
280 | * @opt_param string updateMask Required. The updated field paths, comma
|
---|
281 | * separated if there are multiple. You can update the following fields for a
|
---|
282 | * space: `space_details`: Updates the space's description. Supports up to 150
|
---|
283 | * characters. `display_name`: Only supports updating the display name for
|
---|
284 | * spaces where `spaceType` field is `SPACE`. If you receive the error message
|
---|
285 | * `ALREADY_EXISTS`, try a different value. An existing space within the Google
|
---|
286 | * Workspace organization might already use this display name. `space_type`:
|
---|
287 | * Only supports changing a `GROUP_CHAT` space type to `SPACE`. Include
|
---|
288 | * `display_name` together with `space_type` in the update mask and ensure that
|
---|
289 | * the specified space has a non-empty display name and the `SPACE` space type.
|
---|
290 | * Including the `space_type` mask and the `SPACE` type in the specified space
|
---|
291 | * when updating the display name is optional if the existing space already has
|
---|
292 | * the `SPACE` type. Trying to update the space type in other ways results in an
|
---|
293 | * invalid argument error. `space_type` is not supported with `useAdminAccess`.
|
---|
294 | * `space_history_state`: Updates [space history
|
---|
295 | * settings](https://support.google.com/chat/answer/7664687) by turning history
|
---|
296 | * on or off for the space. Only supported if history settings are enabled for
|
---|
297 | * the Google Workspace organization. To update the space history state, you
|
---|
298 | * must omit all other field masks in your request. `space_history_state` is not
|
---|
299 | * supported with `useAdminAccess`. `access_settings.audience`: Updates the
|
---|
300 | * [access setting](https://support.google.com/chat/answer/11971020) of who can
|
---|
301 | * discover the space, join the space, and preview the messages in named space
|
---|
302 | * where `spaceType` field is `SPACE`. If the existing space has a target
|
---|
303 | * audience, you can remove the audience and restrict space access by omitting a
|
---|
304 | * value for this field mask. To update access settings for a space, the
|
---|
305 | * authenticating user must be a space manager and omit all other field masks in
|
---|
306 | * your request. You can't update this field if the space is in [import
|
---|
307 | * mode](https://developers.google.com/workspace/chat/import-data-overview). To
|
---|
308 | * learn more, see [Make a space discoverable to specific
|
---|
309 | * users](https://developers.google.com/workspace/chat/space-target-audience).
|
---|
310 | * `access_settings.audience` is not supported with `useAdminAccess`.
|
---|
311 | * `permission_settings`: Supports changing the [permission
|
---|
312 | * settings](https://support.google.com/chat/answer/13340792) of a space. When
|
---|
313 | * updating permission settings, you can only specify `permissionSettings` field
|
---|
314 | * masks; you cannot update other field masks at the same time.
|
---|
315 | * `permissionSettings` is not supported with `useAdminAccess`. The supported
|
---|
316 | * field masks include: - `permission_settings.manageMembersAndGroups` -
|
---|
317 | * `permission_settings.modifySpaceDetails` -
|
---|
318 | * `permission_settings.toggleHistory` - `permission_settings.useAtMentionAll` -
|
---|
319 | * `permission_settings.manageApps` - `permission_settings.manageWebhooks` -
|
---|
320 | * `permission_settings.replyMessages`
|
---|
321 | * @opt_param bool useAdminAccess Optional. When `true`, the method runs using
|
---|
322 | * the user's Google Workspace administrator privileges. The calling user must
|
---|
323 | * be a Google Workspace administrator with the [manage chat and spaces
|
---|
324 | * conversations privilege](https://support.google.com/a/answer/13369245).
|
---|
325 | * Requires the `chat.admin.spaces` [OAuth 2.0
|
---|
326 | * scope](https://developers.google.com/workspace/chat/authenticate-
|
---|
327 | * authorize#chat-api-scopes). Some `FieldMask` values are not supported using
|
---|
328 | * admin access. For details, see the description of `update_mask`.
|
---|
329 | * @return Space
|
---|
330 | * @throws \Google\Service\Exception
|
---|
331 | */
|
---|
332 | public function patch($name, Space $postBody, $optParams = [])
|
---|
333 | {
|
---|
334 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
335 | $params = array_merge($params, $optParams);
|
---|
336 | return $this->call('patch', [$params], Space::class);
|
---|
337 | }
|
---|
338 | /**
|
---|
339 | * Returns a list of spaces in a Google Workspace organization based on an
|
---|
340 | * administrator's search. Requires [user authentication with administrator
|
---|
341 | * privileges](https://developers.google.com/workspace/chat/authenticate-
|
---|
342 | * authorize-chat-user#admin-privileges). In the request, set `use_admin_access`
|
---|
343 | * to `true`. (spaces.search)
|
---|
344 | *
|
---|
345 | * @param array $optParams Optional parameters.
|
---|
346 | *
|
---|
347 | * @opt_param string orderBy Optional. How the list of spaces is ordered.
|
---|
348 | * Supported attributes to order by are: -
|
---|
349 | * `membership_count.joined_direct_human_user_count` — Denotes the count of
|
---|
350 | * human users that have directly joined a space. - `last_active_time` — Denotes
|
---|
351 | * the time when last eligible item is added to any topic of this space. -
|
---|
352 | * `create_time` — Denotes the time of the space creation. Valid ordering
|
---|
353 | * operation values are: - `ASC` for ascending. Default value. - `DESC` for
|
---|
354 | * descending. The supported syntax are: -
|
---|
355 | * `membership_count.joined_direct_human_user_count DESC` -
|
---|
356 | * `membership_count.joined_direct_human_user_count ASC` - `last_active_time
|
---|
357 | * DESC` - `last_active_time ASC` - `create_time DESC` - `create_time ASC`
|
---|
358 | * @opt_param int pageSize The maximum number of spaces to return. The service
|
---|
359 | * may return fewer than this value. If unspecified, at most 100 spaces are
|
---|
360 | * returned. The maximum value is 1000. If you use a value more than 1000, it's
|
---|
361 | * automatically changed to 1000.
|
---|
362 | * @opt_param string pageToken A token, received from the previous search spaces
|
---|
363 | * call. Provide this parameter to retrieve the subsequent page. When
|
---|
364 | * paginating, all other parameters provided should match the call that provided
|
---|
365 | * the page token. Passing different values to the other parameters might lead
|
---|
366 | * to unexpected results.
|
---|
367 | * @opt_param string query Required. A search query. You can search by using the
|
---|
368 | * following parameters: - `create_time` - `customer` - `display_name` -
|
---|
369 | * `external_user_allowed` - `last_active_time` - `space_history_state` -
|
---|
370 | * `space_type` `create_time` and `last_active_time` accept a timestamp in
|
---|
371 | * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the supported
|
---|
372 | * comparison operators are: `=`, `<`, `>`, `<=`, `>=`. `customer` is required
|
---|
373 | * and is used to indicate which customer to fetch spaces from.
|
---|
374 | * `customers/my_customer` is the only supported value. `display_name` only
|
---|
375 | * accepts the `HAS` (`:`) operator. The text to match is first tokenized into
|
---|
376 | * tokens and each token is prefix-matched case-insensitively and independently
|
---|
377 | * as a substring anywhere in the space's `display_name`. For example, `Fun Eve`
|
---|
378 | * matches `Fun event` or `The evening was fun`, but not `notFun event` or
|
---|
379 | * `even`. `external_user_allowed` accepts either `true` or `false`.
|
---|
380 | * `space_history_state` only accepts values from the [`historyState`] (https://
|
---|
381 | * developers.google.com/workspace/chat/api/reference/rest/v1/spaces#Space.Histo
|
---|
382 | * ryState) field of a `space` resource. `space_type` is required and the only
|
---|
383 | * valid value is `SPACE`. Across different fields, only `AND` operators are
|
---|
384 | * supported. A valid example is `space_type = "SPACE" AND display_name:"Hello"`
|
---|
385 | * and an invalid example is `space_type = "SPACE" OR display_name:"Hello"`.
|
---|
386 | * Among the same field, `space_type` doesn't support `AND` or `OR` operators.
|
---|
387 | * `display_name`, 'space_history_state', and 'external_user_allowed' only
|
---|
388 | * support `OR` operators. `last_active_time` and `create_time` support both
|
---|
389 | * `AND` and `OR` operators. `AND` can only be used to represent an interval,
|
---|
390 | * such as `last_active_time < "2022-01-01T00:00:00+00:00" AND last_active_time
|
---|
391 | * > "2023-01-01T00:00:00+00:00"`. The following example queries are valid: ```
|
---|
392 | * customer = "customers/my_customer" AND space_type = "SPACE" customer =
|
---|
393 | * "customers/my_customer" AND space_type = "SPACE" AND display_name:"Hello
|
---|
394 | * World" customer = "customers/my_customer" AND space_type = "SPACE" AND
|
---|
395 | * (last_active_time < "2020-01-01T00:00:00+00:00" OR last_active_time >
|
---|
396 | * "2022-01-01T00:00:00+00:00") customer = "customers/my_customer" AND
|
---|
397 | * space_type = "SPACE" AND (display_name:"Hello World" OR display_name:"Fun
|
---|
398 | * event") AND (last_active_time > "2020-01-01T00:00:00+00:00" AND
|
---|
399 | * last_active_time < "2022-01-01T00:00:00+00:00") customer =
|
---|
400 | * "customers/my_customer" AND space_type = "SPACE" AND (create_time >
|
---|
401 | * "2019-01-01T00:00:00+00:00" AND create_time < "2020-01-01T00:00:00+00:00")
|
---|
402 | * AND (external_user_allowed = "true") AND (space_history_state = "HISTORY_ON"
|
---|
403 | * OR space_history_state = "HISTORY_OFF") ```
|
---|
404 | * @opt_param bool useAdminAccess When `true`, the method runs using the user's
|
---|
405 | * Google Workspace administrator privileges. The calling user must be a Google
|
---|
406 | * Workspace administrator with the [manage chat and spaces conversations
|
---|
407 | * privilege](https://support.google.com/a/answer/13369245). Requires either the
|
---|
408 | * `chat.admin.spaces.readonly` or `chat.admin.spaces` [OAuth 2.0
|
---|
409 | * scope](https://developers.google.com/workspace/chat/authenticate-
|
---|
410 | * authorize#chat-api-scopes). This method currently only supports admin access,
|
---|
411 | * thus only `true` is accepted for this field.
|
---|
412 | * @return SearchSpacesResponse
|
---|
413 | * @throws \Google\Service\Exception
|
---|
414 | */
|
---|
415 | public function search($optParams = [])
|
---|
416 | {
|
---|
417 | $params = [];
|
---|
418 | $params = array_merge($params, $optParams);
|
---|
419 | return $this->call('search', [$params], SearchSpacesResponse::class);
|
---|
420 | }
|
---|
421 | /**
|
---|
422 | * Creates a space and adds specified users to it. The calling user is
|
---|
423 | * automatically added to the space, and shouldn't be specified as a membership
|
---|
424 | * in the request. For an example, see [Set up a space with initial
|
---|
425 | * members](https://developers.google.com/workspace/chat/set-up-spaces). To
|
---|
426 | * specify the human members to add, add memberships with the appropriate
|
---|
427 | * `membership.member.name`. To add a human user, use `users/{user}`, where
|
---|
428 | * `{user}` can be the email address for the user. For users in the same
|
---|
429 | * Workspace organization `{user}` can also be the `id` for the person from the
|
---|
430 | * People API, or the `id` for the user in the Directory API. For example, if
|
---|
431 | * the People API Person profile ID for `user@example.com` is `123456789`, you
|
---|
432 | * can add the user to the space by setting the `membership.member.name` to
|
---|
433 | * `users/user@example.com` or `users/123456789`. To specify the Google groups
|
---|
434 | * to add, add memberships with the appropriate `membership.group_member.name`.
|
---|
435 | * To add or invite a Google group, use `groups/{group}`, where `{group}` is the
|
---|
436 | * `id` for the group from the Cloud Identity Groups API. For example, you can
|
---|
437 | * use [Cloud Identity Groups lookup
|
---|
438 | * API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup)
|
---|
439 | * to retrieve the ID `123456789` for group email `group@example.com`, then you
|
---|
440 | * can add the group to the space by setting the `membership.group_member.name`
|
---|
441 | * to `groups/123456789`. Group email is not supported, and Google groups can
|
---|
442 | * only be added as members in named spaces. For a named space or group chat, if
|
---|
443 | * the caller blocks, or is blocked by some members, or doesn't have permission
|
---|
444 | * to add some members, then those members aren't added to the created space. To
|
---|
445 | * create a direct message (DM) between the calling user and another human user,
|
---|
446 | * specify exactly one membership to represent the human user. If one user
|
---|
447 | * blocks the other, the request fails and the DM isn't created. To create a DM
|
---|
448 | * between the calling user and the calling app, set `Space.singleUserBotDm` to
|
---|
449 | * `true` and don't specify any memberships. You can only use this method to set
|
---|
450 | * up a DM with the calling app. To add the calling app as a member of a space
|
---|
451 | * or an existing DM between two human users, see [Invite or add a user or app
|
---|
452 | * to a space](https://developers.google.com/workspace/chat/create-members). If
|
---|
453 | * a DM already exists between two users, even when one user blocks the other at
|
---|
454 | * the time a request is made, then the existing DM is returned. Spaces with
|
---|
455 | * threaded replies aren't supported. If you receive the error message
|
---|
456 | * `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An
|
---|
457 | * existing space within the Google Workspace organization might already use
|
---|
458 | * this display name. Requires [user
|
---|
459 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
460 | * authorize-chat-user). (spaces.setup)
|
---|
461 | *
|
---|
462 | * @param SetUpSpaceRequest $postBody
|
---|
463 | * @param array $optParams Optional parameters.
|
---|
464 | * @return Space
|
---|
465 | * @throws \Google\Service\Exception
|
---|
466 | */
|
---|
467 | public function setup(SetUpSpaceRequest $postBody, $optParams = [])
|
---|
468 | {
|
---|
469 | $params = ['postBody' => $postBody];
|
---|
470 | $params = array_merge($params, $optParams);
|
---|
471 | return $this->call('setup', [$params], Space::class);
|
---|
472 | }
|
---|
473 | }
|
---|
474 |
|
---|
475 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
476 | class_alias(Spaces::class, 'Google_Service_HangoutsChat_Resource_Spaces');
|
---|