Method: spaces.spaceEvents.list
列出 Google Chat 聊天室中的事件。每個事件的酬載都包含最新版本的 Chat 資源。舉例來說,如果您列出新聊天室成員的事件,伺服器會傳回包含最新會員詳細資料的 Membership
資源。如果在要求期間移除了新成員,事件酬載就會包含空白的 Membership
資源。
需要使用者驗證。如要列出活動,已驗證的使用者必須是聊天室的成員。
如需範例,請參閱「列出 Google Chat 聊天室中的事件」。
HTTP 要求
GET https://chat.googleapis.com/v1/{parent=spaces/*}/spaceEvents
這個網址使用 gRPC 轉碼語法。
查詢參數
參數 |
pageSize |
integer
選用設定。傳回的空格事件數量上限。服務傳回的產品數量可能會少於這個值。 負值會傳回 INVALID_ARGUMENT 錯誤。
|
pageToken |
string
選用設定。從先前 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 格式。如要同時依 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 )
結果會依時間順序傳回 (最早的事件會列在最前面)。注意:清單要求不會在 Space 物件中傳回 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
詳情請參閱授權指南。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-27 (世界標準時間)。
[null,null,["上次更新時間:2025-02-27 (世界標準時間)。"],[[["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"]]