Class PlatformDataSource

PlatformDataSource

สำหรับวิดเจ็ต SelectionInput ที่ใช้เมนูแบบเลือกหลายรายการ ซึ่งเป็นแหล่งข้อมูลจาก 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 — ออบเจ็กต์นี้สำหรับการทำเชน