Class PlatformDataSource

Nguồndữliệunềntảng

Đối với tiện ích SelectionInput sử dụng một trình đơn chọn nhiều mục, nguồn dữ liệu từ Google Workspace. Dùng để điền các mục vào một trình đơn chọn nhiều.

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);

Chỉ dành cho các ứng dụng Google Chat. Không dùng được cho các tiện ích bổ sung của Google Workspace.

Phương thức

Phương thứcKiểu dữ liệu trả vềMô tả ngắn
setCommonDataSource(commonDataSource)PlatformDataSourceĐặt nguồn dữ liệu từ Google Workspace.
setDriveDataSourceSpec(driveDataSourceSpec)PlatformDataSourceĐặt thông số kỹ thuật nguồn dữ liệu ổ đĩa từ Google Workspace.
setHostAppDataSource(hostAppDataSource)PlatformDataSourceDùng để điền sẵn các không gian trong trình đơn chọn nhiều mục.

Tài liệu chi tiết

setCommonDataSource(commonDataSource)

Đặt nguồn dữ liệu từ 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);
Chỉ dành cho các ứng dụng Google Chat. Không dùng được cho các tiện ích bổ sung của Google Workspace.

Thông số

TênLoạiMô tả
commonDataSourceCommonDataSourceNguồn dữ liệu cần thiết lập.

Cầu thủ trả bóng

PlatformDataSource – Đối tượng này, để liên kết.


setDriveDataSourceSpec(driveDataSourceSpec)

Đặt thông số kỹ thuật nguồn dữ liệu ổ đĩa từ 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);
Có trong các ứng dụng Google Chat. Đối với các tiện ích bổ sung của Google Workspace, bạn cần thêm Phạm vi truy cập theo từng tệp(https://www.googleapis.com/auth/drive.file) vào tệp kê khai.

Thông số

TênLoạiMô tả
driveDataSourceSpecDriveDataSourceSpecThông số nguồn dữ liệu của ổ đĩa cần thiết lập.

Cầu thủ trả bóng

PlatformDataSource – Đối tượng này, để liên kết.


setHostAppDataSource(hostAppDataSource)

Dùng để điền sẵn các không gian trong trình đơn chọn nhiều mục.

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);
Chỉ dành cho các ứng dụng Google Chat. Không dùng được cho các tiện ích bổ sung của Google Workspace.

Thông số

TênLoạiMô tả
hostAppDataSourceHostAppDataSourceNguồn dữ liệu cần thiết lập.

Cầu thủ trả bóng

PlatformDataSource – Đối tượng này, để liên kết.