1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.chat.v1; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/chat/v1/user.proto"; 22 23option csharp_namespace = "Google.Apps.Chat.V1"; 24option go_package = "cloud.google.com/go/chat/apiv1/chatpb;chatpb"; 25option java_multiple_files = true; 26option java_outer_classname = "ReactionProto"; 27option java_package = "com.google.chat.v1"; 28option php_namespace = "Google\\Apps\\Chat\\V1"; 29option ruby_package = "Google::Apps::Chat::V1"; 30 31// A reaction to a message. 32message Reaction { 33 option (google.api.resource) = { 34 type: "chat.googleapis.com/Reaction" 35 pattern: "spaces/{space}/messages/{message}/reactions/{reaction}" 36 }; 37 38 // The resource name of the reaction. 39 // 40 // Format: `spaces/{space}/messages/{message}/reactions/{reaction}` 41 string name = 1; 42 43 // Output only. The user who created the reaction. 44 User user = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 45 46 // The emoji used in the reaction. 47 Emoji emoji = 3; 48} 49 50// An emoji that is used as a reaction to a message. 51message Emoji { 52 // The content of the emoji. 53 oneof content { 54 // A basic emoji represented by a unicode string. 55 string unicode = 1; 56 57 // Output only. A custom emoji. 58 CustomEmoji custom_emoji = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 59 } 60} 61 62// Represents a custom emoji. 63message CustomEmoji { 64 // Unique key for the custom emoji resource. 65 string uid = 1; 66} 67 68// The number of people who reacted to a message with a specific emoji. 69message EmojiReactionSummary { 70 // Emoji associated with the reactions. 71 Emoji emoji = 1; 72 73 // The total number of reactions using the associated emoji. 74 optional int32 reaction_count = 2; 75} 76 77// Creates a reaction to a message. 78message CreateReactionRequest { 79 // Required. The message where the reaction is created. 80 // 81 // Format: `spaces/{space}/messages/{message}` 82 string parent = 1 [ 83 (google.api.field_behavior) = REQUIRED, 84 (google.api.resource_reference) = { 85 child_type: "chat.googleapis.com/Reaction" 86 } 87 ]; 88 89 // Required. The reaction to create. 90 Reaction reaction = 2 [(google.api.field_behavior) = REQUIRED]; 91} 92 93// Lists reactions to a message. 94message ListReactionsRequest { 95 // Required. The message users reacted to. 96 // 97 // Format: `spaces/{space}/messages/{message}` 98 string parent = 1 [ 99 (google.api.field_behavior) = REQUIRED, 100 (google.api.resource_reference) = { 101 child_type: "chat.googleapis.com/Reaction" 102 } 103 ]; 104 105 // Optional. The maximum number of reactions returned. The service can return 106 // fewer reactions than this value. If unspecified, the default value is 25. 107 // The maximum value is 200; values above 200 are changed to 200. 108 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 109 110 // Optional. (If resuming from a previous query.) 111 // 112 // A page token received from a previous list reactions call. Provide this 113 // to retrieve the subsequent page. 114 // 115 // When paginating, the filter value should match the call that provided the 116 // page token. Passing a different value might lead to unexpected results. 117 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 118 119 // Optional. A query filter. 120 // 121 // You can filter reactions by 122 // [emoji](https://developers.google.com/workspace/chat/api/reference/rest/v1/Emoji) 123 // (either `emoji.unicode` or `emoji.custom_emoji.uid`) and 124 // [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) 125 // (`user.name`). 126 // 127 // To filter reactions for multiple emojis or users, join similar fields 128 // with the `OR` operator, such as `emoji.unicode = "" OR emoji.unicode = 129 // ""` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`. 130 // 131 // To filter reactions by emoji and user, use the `AND` operator, such as 132 // `emoji.unicode = "" AND user.name = "users/AAAAAA"`. 133 // 134 // If your query uses both `AND` and `OR`, group them with parentheses. 135 // 136 // For example, the following queries are valid: 137 // 138 // ``` 139 // user.name = "users/{user}" 140 // emoji.unicode = "" 141 // emoji.custom_emoji.uid = "{uid}" 142 // emoji.unicode = "" OR emoji.unicode = "" 143 // emoji.unicode = "" OR emoji.custom_emoji.uid = "{uid}" 144 // emoji.unicode = "" AND user.name = "users/{user}" 145 // (emoji.unicode = "" OR emoji.custom_emoji.uid = "{uid}") 146 // AND user.name = "users/{user}" 147 // ``` 148 // 149 // The following queries are invalid: 150 // 151 // ``` 152 // emoji.unicode = "" AND emoji.unicode = "" 153 // emoji.unicode = "" AND emoji.custom_emoji.uid = "{uid}" 154 // emoji.unicode = "" OR user.name = "users/{user}" 155 // emoji.unicode = "" OR emoji.custom_emoji.uid = "{uid}" OR 156 // user.name = "users/{user}" 157 // emoji.unicode = "" OR emoji.custom_emoji.uid = "{uid}" 158 // AND user.name = "users/{user}" 159 // ``` 160 // 161 // Invalid queries are rejected by the server with an `INVALID_ARGUMENT` 162 // error. 163 string filter = 4 [(google.api.field_behavior) = OPTIONAL]; 164} 165 166// Response to a list reactions request. 167message ListReactionsResponse { 168 // List of reactions in the requested (or first) page. 169 repeated Reaction reactions = 1; 170 171 // Continuation token to retrieve the next page of results. It's empty 172 // for the last page of results. 173 string next_page_token = 2; 174} 175 176// Deletes a reaction to a message. 177message DeleteReactionRequest { 178 // Required. Name of the reaction to delete. 179 // 180 // Format: `spaces/{space}/messages/{message}/reactions/{reaction}` 181 string name = 1 [ 182 (google.api.field_behavior) = REQUIRED, 183 (google.api.resource_reference) = { type: "chat.googleapis.com/Reaction" } 184 ]; 185} 186