Method: spaces.spaceEvents.list
列出 Google Chat 聊天室中的事件。每个事件的载荷都包含最新版本的 Chat 资源。例如,如果您列出与新聊天室成员有关的事件,服务器会返回包含最新会员详细信息的 Membership
资源。如果在请求的时间段内移除了新成员,事件载荷将包含一个空的 Membership
资源。
要求进行用户身份验证。如需列出活动,经过身份验证的用户必须是聊天室的成员。
如需查看示例,请参阅列出 Google Chat 聊天室中的事件。
HTTP 请求
GET https://chat.googleapis.com/v1/{parent=spaces/*}/spaceEvents
网址采用 gRPC 转码语法。
路径参数
参数 |
parent |
string
必需。发生事件的 Google Chat 聊天室的资源名称。 格式:spaces/{space} 。
|
查询参数
参数 |
pageSize |
integer
可选。返回的聊天室事件的数量上限。服务返回的数量可能小于此值。 负值会返回 INVALID_ARGUMENT 错误。
|
pageToken |
string
可选。从上一个列表空间事件调用接收的页面令牌。利用其进行后续页面检索。 进行分页时,提供给列表空间事件的所有其他参数必须与提供页面令牌的调用相一致。向其他参数传递不同的值可能会导致意外结果。
|
filter |
string
必需。查询过滤条件。 您必须使用“has”: 运算符指定至少一种事件类型 (eventType )。如需按多个事件类型进行过滤,请使用 OR 运算符。在过滤条件中省略批量事件类型。请求会自动返回所有相关的批量事件。例如,如果您按新回应 (google.workspace.chat.reaction.v1.created ) 进行过滤,服务器还会返回批量新回应事件 (google.workspace.chat.reaction.v1.batchCreated )。如需查看受支持的事件类型的列表,请参阅 SpaceEvents 参考文档。 (可选)您还可以按开始时间 (startTime ) 和结束时间 (endTime ) 进行过滤:
startTime :用于开始列出聊天室事件的独占时间戳。您最多可以列出 28 天前发生的事件。如果未指定,系统会列出过去 28 天内的聊天室活动。
endTime :包含时间戳,此时间戳之前会列出聊天室事件。如果未指定,则列出请求发出前发生的事件。
如需指定开始时间或结束时间,请使用等于 = 运算符和 RFC-3339 格式。如需同时按 startTime 和 endTime 过滤,请使用 AND 运算符。 例如,以下查询是有效的:
startTime="2023-08-23T19:20:33+00:00" AND
endTime="2023-08-23T19:21:54+00:00"
startTime="2023-08-23T19:20:33+00:00" AND
(eventTypes:"google.workspace.chat.space.v1.updated" OR
eventTypes:"google.workspace.chat.message.v1.created")
以下查询无效:
startTime="2023-08-23T19:20:33+00:00" OR
endTime="2023-08-23T19:21:54+00:00"
eventTypes:"google.workspace.chat.space.v1.updated" AND
eventTypes:"google.workspace.chat.message.v1.created"
服务器拒绝无效查询并显示 INVALID_ARGUMENT 错误。
|
响应正文
列出聊天室活动的响应消息。
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"spaceEvents": [
{
object (SpaceEvent )
}
],
"nextPageToken": string
} |
字段 |
spaceEvents[] |
object (SpaceEvent )
结果会按时间顺序返回(最早的事件排在前面)。注意:对于列表请求,聊天室对象中不会返回 permissionSettings 字段。
|
nextPageToken |
string
用于提取更多事件的接续令牌。如果省略此字段,则不存在后续页面。
|
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/chat.spaces
https://www.googleapis.com/auth/chat.spaces.readonly
https://www.googleapis.com/auth/chat.messages
https://www.googleapis.com/auth/chat.messages.readonly
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.memberships.readonly
https://www.googleapis.com/auth/chat.messages.reactions
https://www.googleapis.com/auth/chat.messages.reactions.readonly
如需了解详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-11-08。
[null,null,["最后更新时间 (UTC):2024-11-08。"],[[["Lists events from a specified Google Chat space, including new members, messages, and reactions, with the payload containing the most recent version of the resource."],["Requires user authentication and membership in the space to list events, returning data chronologically with optional pagination."],["Allows filtering by event types, start time, and end time to refine the results of the listed events."],["The response includes an array of space events and a token for retrieving subsequent pages if available."],["Needs specific authorization scopes for accessing and retrieving the chat space data."]]],["This documentation outlines how to list events from a Google Chat space using the `GET` method. Key actions include: specifying the space via the `parent` path parameter, filtering events by type and time using the `filter` query parameter, and setting the number of events returned with `pageSize`. `pageToken` is used for pagination. Authentication requires user membership in the space and specific OAuth scopes. The response body includes a list of `spaceEvents` and a `nextPageToken` for further results.\n"]]