Method: spaces.spaceEvents.list

列出 Google Chat 聊天室中的活动。对于每个事件,载荷都包含聊天资源的最最新版本。例如,如果您列出有关新聊天室成员的活动,服务器会返回包含最新成员资格详细信息的 Membership 资源。如果新会员在请求的时间段内被移除,则事件载荷包含一个空的 Membership 资源。

支持以下类型的身份验证,并提供适合读取所请求数据的授权范围

  • 开发者预览版中,通过管理员批准进行应用身份验证,并使用以下授权范围之一:

    • https://www.googleapis.com/auth/chat.app.spaces
    • https://www.googleapis.com/auth/chat.app.messages.readonly
    • https://www.googleapis.com/auth/chat.app.memberships
  • 使用以下授权范围之一进行用户身份验证

    • https://www.googleapis.com/auth/chat.spaces.readonly
    • https://www.googleapis.com/auth/chat.spaces
    • https://www.googleapis.com/auth/chat.messages.readonly
    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.messages.reactions.readonly
    • https://www.googleapis.com/auth/chat.messages.reactions
    • https://www.googleapis.com/auth/chat.memberships.readonly
    • https://www.googleapis.com/auth/chat.memberships

如需列出活动,已通过身份验证的调用者必须是相应聊天室的成员。

如需查看示例,请参阅列出 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

可选。从之前的 list space events 调用接收的页面令牌。利用其进行后续页面检索。

进行分页时,提供给 list space events 的所有其他参数必须与提供页面令牌的调用相一致。向其他参数传递不同的值可能会导致意外结果。

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 格式。如需同时按 startTimeendTime 进行过滤,请使用 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)

结果按时间先后顺序返回(最旧的事件排在最前面)。注意:对于列表请求,系统不会在 Space 对象中返回 permissionSettings 字段。

nextPageToken

string

用于提取更多活动的连续令牌。如果省略此字段,则不存在后续页面。

授权范围

需要以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/chat.app.memberships
  • https://www.googleapis.com/auth/chat.app.messages.readonly
  • https://www.googleapis.com/auth/chat.app.spaces
  • 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

如需了解详情,请参阅授权指南