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)PlatformDataSourceGoogle Workspace의 데이터 소스를 설정합니다.
setDriveDataSourceSpec(driveDataSourceSpec)PlatformDataSourceGoogle 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)를 추가해야 합니다.

매개변수

이름유형설명
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 - 연결을 위한 이 객체