Class HostAppDataSource
主機應用程式資料來源
如果是使用多重選取選單的 SelectionInput
小工具,則為 Google Workspace 應用程式的資料來源。資料來源會為多重選取選單填入選項。
const chatSpaceDataSource =
CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);
const chatClientDataSource =
CardService.newChatClientDataSource().setSpaceDataSource(
chatSpaceDataSource);
const hostAppDataSource =
CardService.newHostAppDataSource().setChatDataSource(chatClientDataSource);
僅適用於 Google Chat 應用程式。不適用於 Google Workspace 外掛程式。
內容詳盡的說明文件
setChatDataSource(chatClientDataSource)
設定 Google Chat 的資料來源。
const chatSpaceDataSource =
CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);
const chatClientDataSource =
CardService.newChatClientDataSource().setSpaceDataSource(
chatSpaceDataSource);
const hostAppDataSource =
CardService.newHostAppDataSource().setChatDataSource(chatClientDataSource);
僅適用於 Google Chat 應用程式。不適用於 Google Workspace 外掛程式。
參數
回攻員
HostAppDataSource
:這個物件用於鏈結。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-01-30 (世界標準時間)。
[null,null,["上次更新時間:2025-01-30 (世界標準時間)。"],[[["`HostAppDataSource` is used for populating selection items in a multiselect menu within a Google Chat app."],["It leverages a data source from Google Chat, configured using `ChatClientDataSource` and `ChatSpaceDataSource`."],["This functionality is exclusive to Google Chat apps and is not available for Google Workspace Add-ons."],["The key method is `setChatDataSource()`, used for setting the Google Chat data source."]]],["`HostAppDataSource` provides a data source for multiselect menus in Google Chat apps, using `SelectionInput`. It's created via `CardService.newHostAppDataSource()`. `setChatDataSource()` is used to specify the data source, which must be a `ChatClientDataSource`. In turn, `ChatClientDataSource` is configured with a `ChatSpaceDataSource`. Only available for Chat apps, it sets the data source for populating selection items within the menu, and returns the current `HostAppDataSource` object.\n"]]