Method: spaces.search
根据管理员的搜索返回 Google Workspace 组织中的聊天室列表。
需要具有管理员权限的用户进行身份验证。在请求中,将 useAdminAccess
设置为 true
。
HTTP 请求
GET https://chat.googleapis.com/v1/spaces:search
网址采用 gRPC 转码语法。
查询参数
参数 |
useAdminAccess |
boolean
如果为 true ,此方法会以用户的 Google Workspace 管理员权限运行。 发起通话的用户必须是拥有管理聊天和聊天室对话权限的 Google Workspace 管理员。 需要 chat.admin.spaces.readonly 或 chat.admin.spaces OAuth 2.0 范围。 此方法目前仅支持管理员访问权限,因此此字段仅接受 true 。
|
pageSize |
integer
要返回的空格数上限。服务返回的数量可能小于此值。 如果未指定,则最多返回 100 个聊天室。 最大值为 1000。如果您使用的值大于 1000,则该值会自动更改为 1000。
|
pageToken |
string
从上一个搜索空间调用接收的令牌。请提供此参数以检索后续页面。 进行分页时,提供的所有其他参数都应与提供页面令牌的调用相一致。向其他参数传递不同的值可能会导致意外结果。
|
query |
string
必需。搜索查询。 您可以使用以下参数进行搜索:
createTime
customer
displayName
externalUserAllowed
lastActiveTime
spaceHistoryState
spaceType
createTime 和 lastActiveTime 接受 RFC-3339 格式的时间戳,支持的比较运算符包括:= 、< 、> 、<= 、>= 。
customer 是必需的,用于指明要从哪个客户中提取聊天室。customers/my_customer 是唯一支持的值。
displayName 仅接受 HAS (: ) 运算符。要匹配的文本首先会被分解为令牌,然后每个令牌都会作为聊天室 displayName 中的任意子字符串,以不区分大小写的方式独立进行前缀匹配。例如,Fun Eve 与 Fun event 或 The
evening was fun 匹配,但不匹配 notFun event 或 even 。
externalUserAllowed 接受 true 或 false 。
spaceHistoryState 仅接受 space 资源的 historyState 字段中的值。
spaceType 是必需的,且唯一的有效值为 SPACE 。
在不同字段中,仅支持 AND 运算符。有效示例为 spaceType = "SPACE" AND displayName:"Hello" ,无效示例为 spaceType = "SPACE" OR displayName:"Hello" 。 在同一字段中,spaceType 不支持 AND 或 OR 运算符。displayName 、“spaceHistoryState”和“externalUserAllowed”仅支持 OR 运算符。lastActiveTime 和 createTime 同时支持 AND 和 OR 运算符。AND 只能用于表示间隔,例如 lastActiveTime
< "2022-01-01T00:00:00+00:00" AND lastActiveTime >
"2023-01-01T00:00:00+00:00" 。 以下示例查询有效:
customer = "customers/my_customer" AND spaceType = "SPACE"
customer = "customers/my_customer" AND spaceType = "SPACE" AND
displayName:"Hello World"
customer = "customers/my_customer" AND spaceType = "SPACE" AND
(lastActiveTime < "2020-01-01T00:00:00+00:00" OR lastActiveTime >
"2022-01-01T00:00:00+00:00")
customer = "customers/my_customer" AND spaceType = "SPACE" AND
(displayName:"Hello World" OR displayName:"Fun event") AND
(lastActiveTime > "2020-01-01T00:00:00+00:00" AND lastActiveTime <
"2022-01-01T00:00:00+00:00")
customer = "customers/my_customer" AND spaceType = "SPACE" AND
(createTime > "2019-01-01T00:00:00+00:00" AND createTime <
"2020-01-01T00:00:00+00:00") AND (externalUserAllowed = "true") AND
(spaceHistoryState = "HISTORY_ON" OR spaceHistoryState = "HISTORY_OFF")
|
orderBy |
string
可选。聊天室列表的排序方式。 支持按以下属性排序:
membershipCount.joined_direct_human_user_count - 表示直接加入聊天室的真人用户数。
lastActiveTime - 表示上次将符合条件的项添加到此聊天室的任何主题的时间。
createTime - 表示聊天室的创建时间。
有效的排序操作值包括:
支持的语法如下:
membershipCount.joined_direct_human_user_count DESC
membershipCount.joined_direct_human_user_count ASC
lastActiveTime DESC
lastActiveTime ASC
createTime DESC
createTime ASC
|
响应正文
包含与搜索聊天室请求对应的聊天室列表的响应。
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"spaces": [
{
object (Space )
}
],
"nextPageToken": string,
"totalSize": integer
} |
字段 |
spaces[] |
object (Space )
请求的聊天室的页面。
|
nextPageToken |
string
可用于检索下一页的令牌。如果此字段为空,则不存在后续页面。
|
totalSize |
integer
所有网页中与查询匹配的聊天室的总数。如果结果超过 10,000 个空格,此值为估算值。
|
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/chat.admin.spaces
https://www.googleapis.com/auth/chat.admin.spaces.readonly
如需了解详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-11-08。
[null,null,["最后更新时间 (UTC):2024-11-08。"],[[["Returns a paginated list of Google Workspace spaces based on an administrator's search criteria, including parameters like displayName, createTime, and spaceType."],["Requires administrator privileges and the `useAdminAccess` parameter set to `true` in the request."],["Utilizes the `GET https://chat.googleapis.com/v1/spaces:search` HTTP request with query parameters for customization."],["Needs authorization with either the `chat.admin.spaces` or `chat.admin.spaces.readonly` OAuth scope."],["Response body includes an array of spaces, a token for pagination, and an estimate of the total number of matching spaces."]]],[]]