Class 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
setDriveDataSourceSpec(driveDataSourceSpec)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 - ออบเจ็กต์นี้สำหรับการเชื่อมโยง


setDriveDataSourceSpec(driveDataSourceSpec)

ตั้งค่าข้อกำหนดแหล่งข้อมูลไดรฟ์จาก Google Workspace

const driveDataSourceSpec =
    CardService.newDriveDataSourceSpec()
      .addItemType(CardService.DriveItemType.DOCUMENTS)
      .addItemType(CardService.DriveItemType.FORMS);

const platformDataSource =
    CardService.newPlatformDataSource().setCommonDataSource(
        CardService.CommonDataSource.DRIVE
    ).setDriveDataSourceSpec(driveDataSourceSpec);

const multiSelect = CardService.newSelectionInput()
                        .setType(CardService.SelectionInputType.MULTI_SELECT)
                        .setFieldName('files')
                        .setTitle('Drive Files')
                        .setMultiSelectMaxSelectedItems(5)
                        .setMultiSelectMinQueryLength(1)
                        .setPlatformDataSource(platformDataSource);
ใช้ได้กับแอป Google Chat สำหรับส่วนเสริมของ Google Workspace คุณต้องเพิ่มขอบเขตการเข้าถึง ต่อไฟล์(https://www.googleapis.com/auth/drive.file) ลงในไฟล์ Manifest

พารามิเตอร์

ชื่อประเภทคำอธิบาย
driveDataSourceSpecDriveDataSourceSpecระบุแหล่งข้อมูลไดรฟ์ที่จะตั้งค่า

รีเทิร์น

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 - ออบเจ็กต์นี้สำหรับการเชื่อมโยง