Class PlatformDataSource

PlatformDataSource

对于使用多选菜单的 SelectionInput widget,数据源为 Google Workspace。用于填充多选菜单中的项。

const platformDataSource = CardService.newPlatformDataSource()
     .setCommonDataSource(CardService.CommonDataSource.USER);

const multiSelect = CardService.newSelectionInput()
    .setType(CardService.SelectionInputType.MULTI_SELECT)
    .setFieldName("contacts")
    .setTitle("Selected contacts")
    .setMultiSelectMaxSelectedItems(5)
    .setMultiSelectMinQueryLength(1)
    .setPlatformDataSource(platformDataSource);

仅适用于 Google Chat 应用。不适用于 Google Workspace 插件。

方法

方法返回类型简介
setCommonDataSource(commonDataSource)PlatformDataSource从 Google Workspace 设置数据源。
setHostAppDataSource(hostAppDataSource)PlatformDataSource用于填充多选菜单中的空格。

详细文档

setCommonDataSource(commonDataSource)

从 Google Workspace 设置数据源。

const platformDataSource = CardService.newPlatformDataSource()
     .setCommonDataSource(CardService.CommonDataSource.USER);

const multiSelect = CardService.newSelectionInput()
    .setType(CardService.SelectionInputType.MULTI_SELECT)
    .setFieldName("contacts")
    .setTitle("Selected contacts")
    .setMultiSelectMaxSelectedItems(5)
    .setMultiSelectMinQueryLength(1)
    .setPlatformDataSource(platformDataSource);
仅适用于 Google Chat 应用。不适用于 Google Workspace 插件。

参数

名称类型说明
commonDataSourceCommonDataSource要设置的数据源。

弃踢回攻

PlatformDataSource - 此对象,用于链接。


setHostAppDataSource(hostAppDataSource)

用于填充多选菜单中的空格。

const chatSpaceDataSource = CardService.newChatSpaceDataSource()
    .setDefaultToCurrentSpace(true);

const chatClientDataSource = CardService.newChatClientDataSource()
    .setSpaceDataSource(chatSpaceDataSource);

const hostAppDataSource = CardService.newHostAppDataSource()
    .setChatDataSource(chatClientDataSource);

const platformDataSource = CardService.newPlatformDataSource()
    .setHostAppDataSource(hostAppDataSource);

const multiSelect = CardService.newSelectionInput()
    .setType(CardService.SelectionInputType.MULTI_SELECT)
    .setFieldName("contacts")
    .setTitle("Selected contacts")
    .setMultiSelectMaxSelectedItems(5)
    .setMultiSelectMinQueryLength(1)
    .setPlatformDataSource(platformDataSource);
仅适用于 Google Chat 应用。不适用于 Google Workspace 插件。

参数

名称类型说明
hostAppDataSourceHostAppDataSource要设置的数据源。

弃踢回攻

PlatformDataSource - 此对象,用于链接。