Method: users.spaces.updateSpaceReadState
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Yêu cầu HTTP
PATCH https://chat.googleapis.com/v1/{spaceReadState.name=users/*/spaces/*/spaceReadState}
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Thông số |
spaceReadState.name |
string
Tên tài nguyên của trạng thái đọc không gian. Định dạng users/{user}/spaces/{space}/spaceReadState
|
Tham số truy vấn
Thông số |
updateMask |
string (FieldMask format)
Bắt buộc. Đường dẫn trường cần cập nhật. Các đường dẫn trường hiện được hỗ trợ:
Khi lastReadTime nằm trước thời gian tạo tin nhắn mới nhất, không gian sẽ xuất hiện dưới dạng chưa đọc trong giao diện người dùng. Để đánh dấu không gian là đã đọc, hãy đặt lastReadTime thành bất kỳ giá trị nào sau (lớn hơn) thời gian tạo tin nhắn mới nhất. lastReadTime được buộc phải khớp với thời gian tạo tin nhắn gần đây nhất. Xin lưu ý rằng trạng thái đã đọc của không gian chỉ ảnh hưởng đến trạng thái đã đọc của những tin nhắn xuất hiện trong cuộc trò chuyện cấp cao nhất của không gian. Dấu thời gian này không ảnh hưởng đến các thư trả lời trong chuỗi thư mà thay vào đó là dựa vào trạng thái đã đọc của chuỗi thư.
|
Nội dung yêu cầu
Nội dung yêu cầu chứa một bản sao của SpaceReadState
.
Nội dung phản hồi
Nếu thành công, nội dung phản hồi sẽ chứa một phiên bản của SpaceReadState
.
Phạm vi uỷ quyền
Yêu cầu phạm vi OAuth sau:
https://www.googleapis.com/auth/chat.users.readstate
Để biết thêm thông tin, hãy xem Hướng dẫn uỷ quyền.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003eThis API updates a user's read state within a Google Chat space, marking messages as read or unread.\u003c/p\u003e\n"],["\u003cp\u003eIt requires user authentication and the \u003ccode\u003echat.users.readstate\u003c/code\u003e OAuth scope for authorization.\u003c/p\u003e\n"],["\u003cp\u003eThe request uses the PATCH method and specifies the space read state resource name in the URL path.\u003c/p\u003e\n"],["\u003cp\u003eYou can control which fields to update using the \u003ccode\u003eupdateMask\u003c/code\u003e query parameter, such as setting the \u003ccode\u003elastReadTime\u003c/code\u003e to mark a space as read.\u003c/p\u003e\n"],["\u003cp\u003eThe request and response bodies utilize the \u003ccode\u003eSpaceReadState\u003c/code\u003e object to represent the user's read state information.\u003c/p\u003e\n"]]],["This outlines updating a user's read state in a space using a PATCH request to `https://chat.googleapis.com/v1/{spaceReadState.name=users/*/spaces/*/spaceReadState}`. Key components include specifying the `spaceReadState.name` in the path, updating the `lastReadTime` via the `updateMask` query parameter, and providing a `SpaceReadState` instance in the request body. The response, if successful, returns a `SpaceReadState` instance. This operation requires user authentication and the `https://www.googleapis.com/auth/chat.users.readstate` authorization scope.\n"],null,["# Method: users.spaces.updateSpaceReadState\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUpdates a user's read state within a space, used to identify read and unread messages. For an example, see [Update a user's space read state](https://developers.google.com/workspace/chat/update-space-read-state).\n\nRequires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):\n\n- `https://www.googleapis.com/auth/chat.users.readstate`\n\n### HTTP request\n\n`PATCH https://chat.googleapis.com/v1/{spaceReadState.name=users/*/spaces/*/spaceReadState}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-----------------------|------------------------------------------------------------------------------------------------------|\n| `spaceReadState.name` | `string` Resource name of the space read state. Format: `users/{user}/spaces/{space}/spaceReadState` |\n\n### Query parameters\n\n| Parameters ||\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `updateMask` | `string (`[FieldMask](https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask)` format)` Required. The field paths to update. Currently supported field paths: - `lastReadTime` When the `lastReadTime` is before the latest message create time, the space appears as unread in the UI. To mark the space as read, set `lastReadTime` to any value later (larger) than the latest message create time. The `lastReadTime` is coerced to match the latest message create time. Note that the space read state only affects the read state of messages that are visible in the space's top-level conversation. Replies in threads are unaffected by this timestamp, and instead rely on the thread read state. |\n\n### Request body\n\nThe request body contains an instance of [SpaceReadState](/workspace/chat/api/reference/rest/v1/users.spaces#SpaceReadState).\n\n### Response body\n\nIf successful, the response body contains an instance of [SpaceReadState](/workspace/chat/api/reference/rest/v1/users.spaces#SpaceReadState).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/chat.users.readstate`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]