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/protobuf/field_mask.proto"; 22import "google/protobuf/timestamp.proto"; 23 24option csharp_namespace = "Google.Apps.Chat.V1"; 25option go_package = "cloud.google.com/go/chat/apiv1/chatpb;chatpb"; 26option java_multiple_files = true; 27option java_outer_classname = "SpaceReadStateProto"; 28option java_package = "com.google.chat.v1"; 29option php_namespace = "Google\\Apps\\Chat\\V1"; 30option ruby_package = "Google::Apps::Chat::V1"; 31 32// A user's read state within a space, used to identify read and unread 33// messages. 34message SpaceReadState { 35 option (google.api.resource) = { 36 type: "chat.googleapis.com/SpaceReadState" 37 pattern: "users/{user}/spaces/{space}/spaceReadState" 38 singular: "spaceReadState" 39 }; 40 41 // Resource name of the space read state. 42 // 43 // Format: `users/{user}/spaces/{space}/spaceReadState` 44 string name = 1; 45 46 // Optional. The time when the user's space read state was updated. Usually 47 // this corresponds with either the timestamp of the last read message, or a 48 // timestamp specified by the user to mark the last read position in a space. 49 google.protobuf.Timestamp last_read_time = 2 50 [(google.api.field_behavior) = OPTIONAL]; 51} 52 53// Request message for GetSpaceReadState API. 54message GetSpaceReadStateRequest { 55 // Required. Resource name of the space read state to retrieve. 56 // 57 // Only supports getting read state for the calling user. 58 // 59 // To refer to the calling user, set one of the following: 60 // 61 // - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`. 62 // 63 // - Their Workspace email address. For example, 64 // `users/user@example.com/spaces/{space}/spaceReadState`. 65 // 66 // - Their user id. For example, 67 // `users/123456789/spaces/{space}/spaceReadState`. 68 // 69 // Format: users/{user}/spaces/{space}/spaceReadState 70 string name = 1 [ 71 (google.api.field_behavior) = REQUIRED, 72 (google.api.resource_reference) = { 73 type: "chat.googleapis.com/SpaceReadState" 74 } 75 ]; 76} 77 78// Request message for UpdateSpaceReadState API. 79message UpdateSpaceReadStateRequest { 80 // Required. The space read state and fields to update. 81 // 82 // Only supports updating read state for the calling user. 83 // 84 // To refer to the calling user, set one of the following: 85 // 86 // - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`. 87 // 88 // - Their Workspace email address. For example, 89 // `users/user@example.com/spaces/{space}/spaceReadState`. 90 // 91 // - Their user id. For example, 92 // `users/123456789/spaces/{space}/spaceReadState`. 93 // 94 // Format: users/{user}/spaces/{space}/spaceReadState 95 SpaceReadState space_read_state = 1 [(google.api.field_behavior) = REQUIRED]; 96 97 // Required. The field paths to update. Currently supported field paths: 98 // 99 // - `last_read_time` 100 // 101 // When the `last_read_time` is before the latest message create time, the 102 // space appears as unread in the UI. 103 // 104 // To mark the space as read, set `last_read_time` to any value later (larger) 105 // than the latest message create time. The `last_read_time` is coerced to 106 // match the latest message create time. Note that the space read state only 107 // affects the read state of messages that are visible in the space's 108 // top-level conversation. Replies in threads are unaffected by this 109 // timestamp, and instead rely on the thread read state. 110 google.protobuf.FieldMask update_mask = 2 111 [(google.api.field_behavior) = REQUIRED]; 112} 113