Method: users.spaces.updateSpaceReadState
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
更新使用者在聊天室中的已讀狀態,用於識別已讀和未讀訊息。如需範例,請參閱「更新使用者的聊天室讀取狀態」。
需要使用授權範圍的使用者驗證:
https://www.googleapis.com/auth/chat.users.readstate
HTTP 要求
PATCH https://chat.googleapis.com/v1/{spaceReadState.name=users/*/spaces/*/spaceReadState}
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
spaceReadState.name |
string
聊天室讀取狀態的資源名稱。 格式:users/{user}/spaces/{space}/spaceReadState
|
查詢參數
參數 |
updateMask |
string (FieldMask format)
必要欄位。要更新的欄位路徑。目前支援的欄位路徑:
如果 lastReadTime 早於最新訊息建立時間,聊天室就會在 UI 中顯示為未讀。 如要將此空間標示為已讀取,請將 lastReadTime 設為大於 (晚於) 最新訊息建立時間的任何值。lastReadTime 會強制設為與最新訊息建立時間相符。請注意,聊天室已讀狀態只會影響在聊天室頂層對話中顯示的訊息的已讀狀態。討論串中的回覆不會受到這個時間戳記的影響,而是取決於討論串的讀取狀態。
|
要求主體
要求主體包含 SpaceReadState
的例項。
回應主體
如果成功,回應主體會包含 SpaceReadState
的執行例項。
授權範圍
需要下列 OAuth 範圍:
https://www.googleapis.com/auth/chat.users.readstate
詳情請參閱授權指南。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\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)."]]