[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\ChatEmpty;
|
---|
| 21 | use Google\Service\HangoutsChat\ListReactionsResponse;
|
---|
| 22 | use Google\Service\HangoutsChat\Reaction;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "reactions" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $chatService = new Google\Service\HangoutsChat(...);
|
---|
| 29 | * $reactions = $chatService->spaces_messages_reactions;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class SpacesMessagesReactions extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Creates a reaction and adds it to a message. Only unicode emojis are
|
---|
| 36 | * supported. For an example, see [Add a reaction to a
|
---|
| 37 | * message](https://developers.google.com/workspace/chat/create-reactions).
|
---|
| 38 | * Requires [user
|
---|
| 39 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
| 40 | * authorize-chat-user). (reactions.create)
|
---|
| 41 | *
|
---|
| 42 | * @param string $parent Required. The message where the reaction is created.
|
---|
| 43 | * Format: `spaces/{space}/messages/{message}`
|
---|
| 44 | * @param Reaction $postBody
|
---|
| 45 | * @param array $optParams Optional parameters.
|
---|
| 46 | * @return Reaction
|
---|
| 47 | * @throws \Google\Service\Exception
|
---|
| 48 | */
|
---|
| 49 | public function create($parent, Reaction $postBody, $optParams = [])
|
---|
| 50 | {
|
---|
| 51 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 52 | $params = array_merge($params, $optParams);
|
---|
| 53 | return $this->call('create', [$params], Reaction::class);
|
---|
| 54 | }
|
---|
| 55 | /**
|
---|
| 56 | * Deletes a reaction to a message. Only unicode emojis are supported. For an
|
---|
| 57 | * example, see [Delete a
|
---|
| 58 | * reaction](https://developers.google.com/workspace/chat/delete-reactions).
|
---|
| 59 | * Requires [user
|
---|
| 60 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
| 61 | * authorize-chat-user). (reactions.delete)
|
---|
| 62 | *
|
---|
| 63 | * @param string $name Required. Name of the reaction to delete. Format:
|
---|
| 64 | * `spaces/{space}/messages/{message}/reactions/{reaction}`
|
---|
| 65 | * @param array $optParams Optional parameters.
|
---|
| 66 | * @return ChatEmpty
|
---|
| 67 | * @throws \Google\Service\Exception
|
---|
| 68 | */
|
---|
| 69 | public function delete($name, $optParams = [])
|
---|
| 70 | {
|
---|
| 71 | $params = ['name' => $name];
|
---|
| 72 | $params = array_merge($params, $optParams);
|
---|
| 73 | return $this->call('delete', [$params], ChatEmpty::class);
|
---|
| 74 | }
|
---|
| 75 | /**
|
---|
| 76 | * Lists reactions to a message. For an example, see [List reactions for a
|
---|
| 77 | * message](https://developers.google.com/workspace/chat/list-reactions).
|
---|
| 78 | * Requires [user
|
---|
| 79 | * authentication](https://developers.google.com/workspace/chat/authenticate-
|
---|
| 80 | * authorize-chat-user). (reactions.listSpacesMessagesReactions)
|
---|
| 81 | *
|
---|
| 82 | * @param string $parent Required. The message users reacted to. Format:
|
---|
| 83 | * `spaces/{space}/messages/{message}`
|
---|
| 84 | * @param array $optParams Optional parameters.
|
---|
| 85 | *
|
---|
| 86 | * @opt_param string filter Optional. A query filter. You can filter reactions
|
---|
| 87 | * by [emoji](https://developers.google.com/workspace/chat/api/reference/rest/v1
|
---|
| 88 | * /Emoji) (either `emoji.unicode` or `emoji.custom_emoji.uid`) and [user](https
|
---|
| 89 | * ://developers.google.com/workspace/chat/api/reference/rest/v1/User)
|
---|
| 90 | * (`user.name`). To filter reactions for multiple emojis or users, join similar
|
---|
| 91 | * fields with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode
|
---|
| 92 | * = "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`. To
|
---|
| 93 | * filter reactions by emoji and user, use the `AND` operator, such as
|
---|
| 94 | * `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. If your query uses both
|
---|
| 95 | * `AND` and `OR`, group them with parentheses. For example, the following
|
---|
| 96 | * queries are valid: ``` user.name = "users/{user}" emoji.unicode = "🙂"
|
---|
| 97 | * emoji.custom_emoji.uid = "{uid}" emoji.unicode = "🙂" OR emoji.unicode = "👍"
|
---|
| 98 | * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" emoji.unicode = "🙂"
|
---|
| 99 | * AND user.name = "users/{user}" (emoji.unicode = "🙂" OR emoji.custom_emoji.uid
|
---|
| 100 | * = "{uid}") AND user.name = "users/{user}" ``` The following queries are
|
---|
| 101 | * invalid: ``` emoji.unicode = "🙂" AND emoji.unicode = "👍" emoji.unicode = "🙂"
|
---|
| 102 | * AND emoji.custom_emoji.uid = "{uid}" emoji.unicode = "🙂" OR user.name =
|
---|
| 103 | * "users/{user}" emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" OR
|
---|
| 104 | * user.name = "users/{user}" emoji.unicode = "🙂" OR emoji.custom_emoji.uid =
|
---|
| 105 | * "{uid}" AND user.name = "users/{user}" ``` Invalid queries are rejected by
|
---|
| 106 | * the server with an `INVALID_ARGUMENT` error.
|
---|
| 107 | * @opt_param int pageSize Optional. The maximum number of reactions returned.
|
---|
| 108 | * The service can return fewer reactions than this value. If unspecified, the
|
---|
| 109 | * default value is 25. The maximum value is 200; values above 200 are changed
|
---|
| 110 | * to 200.
|
---|
| 111 | * @opt_param string pageToken Optional. (If resuming from a previous query.) A
|
---|
| 112 | * page token received from a previous list reactions call. Provide this to
|
---|
| 113 | * retrieve the subsequent page. When paginating, the filter value should match
|
---|
| 114 | * the call that provided the page token. Passing a different value might lead
|
---|
| 115 | * to unexpected results.
|
---|
| 116 | * @return ListReactionsResponse
|
---|
| 117 | * @throws \Google\Service\Exception
|
---|
| 118 | */
|
---|
| 119 | public function listSpacesMessagesReactions($parent, $optParams = [])
|
---|
| 120 | {
|
---|
| 121 | $params = ['parent' => $parent];
|
---|
| 122 | $params = array_merge($params, $optParams);
|
---|
| 123 | return $this->call('list', [$params], ListReactionsResponse::class);
|
---|
| 124 | }
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 128 | class_alias(SpacesMessagesReactions::class, 'Google_Service_HangoutsChat_Resource_SpacesMessagesReactions');
|
---|