[e3d4e0a] | 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\ListSpaceEventsResponse;
|
---|
| 21 | use Google\Service\HangoutsChat\SpaceEvent;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The "spaceEvents" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $chatService = new Google\Service\HangoutsChat(...);
|
---|
| 28 | * $spaceEvents = $chatService->spaces_spaceEvents;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class SpacesSpaceEvents extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Returns an event from a Google Chat space. The [event payload](https://develo
|
---|
| 35 | * pers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#Space
|
---|
| 36 | * Event.FIELDS.oneof_payload) contains the most recent version of the resource
|
---|
| 37 | * that changed. For example, if you request an event about a new message but
|
---|
| 38 | * the message was later updated, the server returns the updated `Message`
|
---|
| 39 | * resource in the event payload. Note: The `permissionSettings` field is not
|
---|
| 40 | * returned in the Space object of the Space event data for this request.
|
---|
| 41 | * Requires [user
|
---|
| 42 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
| 43 | * authorize-chat-user). To get an event, the authenticated user must be a
|
---|
| 44 | * member of the space. For an example, see [Get details about an event from a
|
---|
| 45 | * Google Chat space](https://developers.google.com/workspace/chat/get-space-
|
---|
| 46 | * event). (spaceEvents.get)
|
---|
| 47 | *
|
---|
| 48 | * @param string $name Required. The resource name of the space event. Format:
|
---|
| 49 | * `spaces/{space}/spaceEvents/{spaceEvent}`
|
---|
| 50 | * @param array $optParams Optional parameters.
|
---|
| 51 | * @return SpaceEvent
|
---|
| 52 | * @throws \Google\Service\Exception
|
---|
| 53 | */
|
---|
| 54 | public function get($name, $optParams = [])
|
---|
| 55 | {
|
---|
| 56 | $params = ['name' => $name];
|
---|
| 57 | $params = array_merge($params, $optParams);
|
---|
| 58 | return $this->call('get', [$params], SpaceEvent::class);
|
---|
| 59 | }
|
---|
| 60 | /**
|
---|
| 61 | * Lists events from a Google Chat space. For each event, the [payload](https://
|
---|
| 62 | * developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents
|
---|
| 63 | * #SpaceEvent.FIELDS.oneof_payload) contains the most recent version of the
|
---|
| 64 | * Chat resource. For example, if you list events about new space members, the
|
---|
| 65 | * server returns `Membership` resources that contain the latest membership
|
---|
| 66 | * details. If new members were removed during the requested period, the event
|
---|
| 67 | * payload contains an empty `Membership` resource. Requires [user
|
---|
| 68 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
| 69 | * authorize-chat-user). To list events, the authenticated user must be a member
|
---|
| 70 | * of the space. For an example, see [List events from a Google Chat
|
---|
| 71 | * space](https://developers.google.com/workspace/chat/list-space-events).
|
---|
| 72 | * (spaceEvents.listSpacesSpaceEvents)
|
---|
| 73 | *
|
---|
| 74 | * @param string $parent Required. Resource name of the [Google Chat space](http
|
---|
| 75 | * s://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) where
|
---|
| 76 | * the events occurred. Format: `spaces/{space}`.
|
---|
| 77 | * @param array $optParams Optional parameters.
|
---|
| 78 | *
|
---|
| 79 | * @opt_param string filter Required. A query filter. You must specify at least
|
---|
| 80 | * one event type (`event_type`) using the has `:` operator. To filter by
|
---|
| 81 | * multiple event types, use the `OR` operator. Omit batch event types in your
|
---|
| 82 | * filter. The request automatically returns any related batch events. For
|
---|
| 83 | * example, if you filter by new reactions
|
---|
| 84 | * (`google.workspace.chat.reaction.v1.created`), the server also returns batch
|
---|
| 85 | * new reactions events (`google.workspace.chat.reaction.v1.batchCreated`). For
|
---|
| 86 | * a list of supported event types, see the [`SpaceEvents` reference documentati
|
---|
| 87 | * on](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces
|
---|
| 88 | * .spaceEvents#SpaceEvent.FIELDS.event_type). Optionally, you can also filter
|
---|
| 89 | * by start time (`start_time`) and end time (`end_time`): * `start_time`:
|
---|
| 90 | * Exclusive timestamp from which to start listing space events. You can list
|
---|
| 91 | * events that occurred up to 28 days ago. If unspecified, lists space events
|
---|
| 92 | * from the past 28 days. * `end_time`: Inclusive timestamp until which space
|
---|
| 93 | * events are listed. If unspecified, lists events up to the time of the
|
---|
| 94 | * request. To specify a start or end time, use the equals `=` operator and
|
---|
| 95 | * format in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by
|
---|
| 96 | * both `start_time` and `end_time`, use the `AND` operator. For example, the
|
---|
| 97 | * following queries are valid: ``` start_time="2023-08-23T19:20:33+00:00" AND
|
---|
| 98 | * end_time="2023-08-23T19:21:54+00:00" ``` ```
|
---|
| 99 | * start_time="2023-08-23T19:20:33+00:00" AND
|
---|
| 100 | * (event_types:"google.workspace.chat.space.v1.updated" OR
|
---|
| 101 | * event_types:"google.workspace.chat.message.v1.created") ``` The following
|
---|
| 102 | * queries are invalid: ``` start_time="2023-08-23T19:20:33+00:00" OR
|
---|
| 103 | * end_time="2023-08-23T19:21:54+00:00" ``` ```
|
---|
| 104 | * event_types:"google.workspace.chat.space.v1.updated" AND
|
---|
| 105 | * event_types:"google.workspace.chat.message.v1.created" ``` Invalid queries
|
---|
| 106 | * are rejected by the server with an `INVALID_ARGUMENT` error.
|
---|
| 107 | * @opt_param int pageSize Optional. The maximum number of space events
|
---|
| 108 | * returned. The service might return fewer than this value. Negative values
|
---|
| 109 | * return an `INVALID_ARGUMENT` error.
|
---|
| 110 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
| 111 | * list space events call. Provide this to retrieve the subsequent page. When
|
---|
| 112 | * paginating, all other parameters provided to list space events must match the
|
---|
| 113 | * call that provided the page token. Passing different values to the other
|
---|
| 114 | * parameters might lead to unexpected results.
|
---|
| 115 | * @return ListSpaceEventsResponse
|
---|
| 116 | * @throws \Google\Service\Exception
|
---|
| 117 | */
|
---|
| 118 | public function listSpacesSpaceEvents($parent, $optParams = [])
|
---|
| 119 | {
|
---|
| 120 | $params = ['parent' => $parent];
|
---|
| 121 | $params = array_merge($params, $optParams);
|
---|
| 122 | return $this->call('list', [$params], ListSpaceEventsResponse::class);
|
---|
| 123 | }
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 127 | class_alias(SpacesSpaceEvents::class, 'Google_Service_HangoutsChat_Resource_SpacesSpaceEvents');
|
---|