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 早于最新消息的创建时间,聊天室会在界面中显示为“未读”。 如需将聊天室标记为已读,请将 lastReadTime 设置为晚于(大于)最新消息创建时间的任何值。lastReadTime 会强制转换为与最新消息创建时间一致的时间。请注意,聊天室的已读状态只会影响聊天室顶级对话中显示的消息的已读状态。会话中的回复不会受此时间戳影响,而是依赖于会话读取状态。
|
请求正文
请求正文包含一个 SpaceReadState
实例。
响应正文
如果成功,则响应正文包含一个 SpaceReadState
实例。
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/chat.users.readstate
如需了解详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):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)."]]