Class CardService

CardService

Usługa CardService umożliwia tworzenie ogólnych kart używanych w różnych usługach Google, takich jak dodatki do Google Workspace.

Poniżej znajdziesz przykład karty dodatków.

function createCard() {
  return CardService.newCardBuilder()
      .setHeader(CardService.newCardHeader().setTitle('CardTitle'))
      .build();
}

Możesz też zwrócić kilka kart w ten sposób:

function createCards() {
  return [
    CardService.newCardBuilder().build(),
    CardService.newCardBuilder().build(),
    CardService.newCardBuilder().build(),
  ];
}

Poniżej pokazujemy, jak zdefiniować kartę z nagłówkiem, tekstem, obrazem i elementem menu:

function createWidgetDemoCard() {
  return CardService.newCardBuilder()
      .setHeader(
          CardService.newCardHeader()
              .setTitle('Widget demonstration')
              .setSubtitle('Check out these widgets')
              .setImageStyle(CardService.ImageStyle.SQUARE)
              .setImageUrl('https://www.example.com/images/headerImage.png'),
          )
      .addSection(
          CardService.newCardSection()
              .setHeader('Simple widgets')  // optional
              .addWidget(
                  CardService.newTextParagraph().setText(
                      'These widgets are display-only. ' +
                          'A text paragraph can have multiple lines and ' +
                          'formatting.',
                      ),
                  )
              .addWidget(
                  CardService.newImage().setImageUrl(
                      'https://www.example.com/images/mapsImage.png',
                      ),
                  ),
          )
      .addCardAction(
          CardService.newCardAction().setText('Gmail').setOpenLink(
              CardService.newOpenLink().setUrl('https://mail.google.com/mail'),
              ),
          )
      .build();
}

Przykładowa karta aplikacji do obsługi czatu.

const cardHeader =
    CardService.newCardHeader()
        .setTitle('Sasha')
        .setSubtitle('Software Engineer')
        .setImageUrl(
            'https://developers.google.com/chat/images/quickstart-app-avatar.png',
            )
        .setImageStyle(CardService.ImageStyle.CIRCLE)
        .setImageAltText('Avatar for Sasha');

const cardSection =
    CardService.newCardSection()
        .setHeader('Contact Info')
        .setCollapsible(true)
        .setNumUncollapsibleWidgets(1)
        .addWidget(
            CardService.newDecoratedText()
                .setStartIcon(
                    CardService.newIconImage().setIcon(CardService.Icon.EMAIL))
                .setText('sasha@example.com'),
            )
        .addWidget(
            CardService.newDecoratedText()
                .setStartIcon(
                    CardService.newIconImage().setIcon(CardService.Icon.PERSON))
                .setText('<font color="#80e27e">Online</font>'),
            )
        .addWidget(
            CardService.newDecoratedText()
                .setStartIcon(
                    CardService.newIconImage().setIcon(CardService.Icon.PHONE))
                .setText('+1 (555) 555-1234'),
            )
        .addWidget(
            CardService.newButtonSet()
                .addButton(
                    CardService.newTextButton().setText('Share').setOpenLink(
                        CardService.newOpenLink().setUrl(
                            'https://example.com/share'),
                        ),
                    )
                .addButton(
                    CardService.newTextButton()
                        .setText('Edit')
                        .setOnClickAction(
                            CardService.newAction()
                                .setFunctionName('goToView')
                                .setParameters({viewType: 'EDIT'}),
                            ),
                    ),
        );

const card = CardService.newCardBuilder()
                 .setHeader(cardHeader)
                 .addSection(cardSection)
                 .build();

Właściwości

WłaściwośćTypOpis
BorderTypeBorderTypeWyliczenie BorderType.
ChipListLayoutChipListLayoutWyliczenie ChipListLayout.
CommonDataSourceCommonDataSourceCommonDataSource wyliczenie.
ComposedEmailTypeComposedEmailTypeWyliczenie ComposedEmailType.
ContentTypeContentTypeWyliczenie ContentType.
DriveItemTypeDriveItemTypeDriveItemType wyliczenie.
ExpressionDataActionTypeExpressionDataActionTypeWyliczenie ExpressionDataActionType.
ExpressionDataConditionTypeExpressionDataConditionTypeWyliczenie ExpressionDataConditionType.
GridItemLayoutGridItemLayoutWyliczenie GridItemLayout.
HorizontalAlignmentHorizontalAlignmentWyliczenie HorizontalAlignment.
IconIconWyliczenie Icon.
ImageButtonStyleImageButtonStyleImageButtonStyle wyliczenie.
ImageCropTypeImageCropTypeWyliczenie ImageCropType.
ImageStyleImageStyleWyliczenie ImageStyle.
InputTypeInputTypeWyliczenie InputType.
LoadIndicatorLoadIndicatorWyliczenie LoadIndicator.
OnCloseOnCloseOnClose wyliczenie.
OpenAsOpenAsWyliczenie OpenAs.
SelectionInputTypeSelectionInputTypeWyliczenie SelectionInputType.
TextButtonStyleTextButtonStyleTextButtonStyle wyliczenie.
TextInputModeTextInputModeWyliczenie TextInputMode.
UpdateDraftBodyTypeUpdateDraftBodyTypeWyliczenie UpdateDraftBodyType.
VariableButtonSizeVariableButtonSizeWyliczenie VariableButtonSize.
VisibilityVisibilityWyliczenie Visibility.
WorkflowDataSourceTypeWorkflowDataSourceTypeWyliczenie WorkflowDataSourceType.

Metody

MetodaZwracany typKrótki opis
newAction()ActionTworzy nowy element Action.
newActionResponseBuilder()ActionResponseBuilderTworzy nowy element ActionResponseBuilder.
newActionStatus()ActionStatusTworzy nowy element ActionStatus.
newAttachment()AttachmentTworzy nowy element Attachment.
newAuthorizationAction()AuthorizationActionTworzy nowy element AuthorizationAction.
newAuthorizationException()AuthorizationExceptionTworzy nowy element AuthorizationException.
newBorderStyle()BorderStyleTworzy nowy element BorderStyle.
newButtonSet()ButtonSetTworzy nowy element ButtonSet.
newCalendarEventActionResponseBuilder()CalendarEventActionResponseBuilderTworzy nowy element CalendarEventActionResponseBuilder.
newCardAction()CardActionTworzy nowy element CardAction.
newCardBuilder()CardBuilderTworzy nowy kreator kart.
newCardHeader()CardHeaderTworzy nowy element CardHeader.
newCardSection()CardSectionTworzy nowy element CardSection.
newCardWithId()CardWithIdTworzy nowy element CardWithId.
newCarousel()CarouselTworzy Carousel.
newCarouselCard()CarouselCardTworzy nowy element CarouselCard.
newChatActionResponse()ChatActionResponseTworzy nowy element ChatActionResponse.
newChatResponseBuilder()ChatResponseBuilderTworzy nowy element ChatResponseBuilder.
newChip()ChipTworzy nowy element Chip.
newChipList()ChipListTworzy nowy element ChipList.
newCollapseControl()CollapseControlTworzy nowy element CollapseControl.
newColumn()ColumnTworzy nowy element Column.
newColumns()ColumnsTworzy nowy zestaw Columns.
newCommonWidgetAction()CommonWidgetActionTworzy nowy element CommonWidgetAction.
newComposeActionResponseBuilder()ComposeActionResponseBuilderTworzy nowy element ComposeActionResponseBuilder.
newCondition()ConditionTworzy nowy obiekt Condition używany do weryfikacji po stronie klienta.
newDataSourceConfig()DataSourceConfigTworzy nowy, pusty DataSourceConfig.
newDatePicker()DatePickerTworzy nowy element DatePicker.
newDateTimePicker()DateTimePickerTworzy nowy element DateTimePicker.
newDecoratedText()DecoratedTextTworzy nowy element DecoratedText.
newDialog()DialogTworzy nowy element Dialog.
newDialogAction()DialogActionTworzy nowy element DialogAction.
newDivider()DividerTworzy nowy element Divider.
newDriveDataSourceSpec()DriveDataSourceSpecTworzy nowy element DriveDataSourceSpec.
newDriveItemsSelectedActionResponseBuilder()DriveItemsSelectedActionResponseBuilderTworzy nowy element DriveItemsSelectedActionResponseBuilder.
newEditorFileScopeActionResponseBuilder()EditorFileScopeActionResponseBuilderTworzy nowy element EditorFileScopeActionResponseBuilder.
newEventAction()EventActionTworzy nowy obiekt EventAction używany do weryfikacji po stronie klienta.
newExpressionData()ExpressionDataTworzy nowy obiekt ExpressionData używany do weryfikacji po stronie klienta.
newExpressionDataAction()ExpressionDataActionTworzy nowy obiekt ExpressionDataAction używany do weryfikacji po stronie klienta.
newExpressionDataCondition()ExpressionDataConditionTworzy nowy obiekt ExpressionDataCondition używany do weryfikacji po stronie klienta.
newFixedFooter()FixedFooterTworzy nowy element FixedFooter.
newGrid()GridTworzy nowy element Grid.
newGridItem()GridItemTworzy nowy element GridItem.
newHostAppDataSource()HostAppDataSourceTworzy nowy element HostAppDataSource.
newIconImage()IconImageTworzy nowy element IconImage.
newImage()ImageTworzy nowy element Image.
newImageButton()ImageButtonTworzy nowy element ImageButton.
newImageComponent()ImageComponentTworzy nowy element ImageComponent.
newImageCropStyle()ImageCropStyleTworzy nowy element ImageCropStyle.
newKeyValue()KeyValueTworzy nowy element KeyValue.
newLinkPreview()LinkPreviewTworzy nowy element LinkPreview.
newMaterialIcon()MaterialIconTworzy nowy element MaterialIcon.
newNavigation()NavigationTworzy nowy element Navigation.
newNotification()NotificationTworzy nowy element Notification.
newOpenLink()OpenLinkTworzy nowy element OpenLink.
newOverflowMenu()OverflowMenuTworzy nowy element OverflowMenu.
newOverflowMenuItem()OverflowMenuItemTworzy nowy element OverflowMenuItem.
newPlatformDataSource()PlatformDataSourceTworzy nowy element PlatformDataSource.
newSelectionInput()SelectionInputTworzy nowy element SelectionInput.
newSuggestions()SuggestionsTworzy nowy element Suggestions.
newSuggestionsResponseBuilder()SuggestionsResponseBuilderTworzy nowy element SuggestionsResponseBuilder.
newSwitch()SwitchTworzy nowy element Switch.
newTextButton()TextButtonTworzy nowy element TextButton.
newTextInput()TextInputTworzy nowy element TextInput.
newTextParagraph()TextParagraphTworzy nowy element TextParagraph.
newTimePicker()TimePickerTworzy nowy element TimePicker.
newTrigger()TriggerTworzy i zwraca nowy obiekt Trigger używany do weryfikacji po stronie klienta.
newUniversalActionResponseBuilder()UniversalActionResponseBuilderTworzy nowy element UniversalActionResponseBuilder.
newUpdateDraftActionResponseBuilder()UpdateDraftActionResponseBuilderTworzy nowy element UpdateDraftActionResponseBuilder.
newUpdateDraftBccRecipientsAction()UpdateDraftBccRecipientsActiontworzy nowy element UpdateDraftBccRecipientsAction;
newUpdateDraftBodyAction()UpdateDraftBodyActionTworzy nowy element UpdateDraftBodyAction.
newUpdateDraftCcRecipientsAction()UpdateDraftCcRecipientsActionTworzy nowy element UpdateDraftCcRecipientsAction.
newUpdateDraftSubjectAction()UpdateDraftSubjectActionTworzy nowy element UpdateDraftSubjectAction.
newUpdateDraftToRecipientsAction()UpdateDraftToRecipientsActionTworzy nowy element UpdateDraftToRecipientsAction.
newUpdateVisibilityAction()UpdateVisibilityActionTworzy nowy element UpdateVisibilityAction.
newValidation()ValidationTworzy nowy element Validation.
newWorkflowDataSource()WorkflowDataSourceTworzy nowy element WorkflowDataSource.

Szczegółowa dokumentacja

newAction()

Tworzy nowy element Action.

Powrót

Action – puste działanie.


newActionResponseBuilder()

Tworzy nowy element ActionResponseBuilder.

Powrót

ActionResponseBuilder – pusty konstruktor ActionResponse.


newActionStatus()

Tworzy nowy element ActionStatus.

Dostępne tylko w przypadku aplikacji Google Chat. Niedostępne w przypadku dodatków do Google Workspace.

const actionStatus = CardService.newActionStatus()
                         .setStatusCode(CardService.Status.OK)
                         .setUserFacingMessage('Success');

Powrót

ActionStatus – pusty stan ActionStatus.


newAttachment()

Tworzy nowy element Attachment.

Powrót

Attachment – pusty załącznik.


newAuthorizationAction()

Tworzy nowy element AuthorizationAction.

Powrót

AuthorizationAction – pusta wartość AuthorizationAction.


newAuthorizationException()

Tworzy nowy element AuthorizationException.

Powrót

AuthorizationException – pusty wyjątek AuthorizationException.


newBorderStyle()

Tworzy nowy element BorderStyle.

Powrót

BorderStyle – pusty styl obramowania.


newButtonSet()

Tworzy nowy element ButtonSet.

Powrót

ButtonSet – pusty ButtonSet.


newCalendarEventActionResponseBuilder()


newCardAction()

Tworzy nowy element CardAction.

Powrót

CardAction – pusta wartość CardAction.


newCardBuilder()

Tworzy nowy kreator kart.

Powrót

CardBuilder – pusty kreator kart.


newCardHeader()

Tworzy nowy element CardHeader.

Powrót

CardHeader – pusty element CardHeader.


newCardSection()

Tworzy nowy element CardSection.

Powrót

CardSection – pusta sekcja karty.


newCardWithId()

Tworzy nowy element CardWithId. Służy do wysyłania karty w wiadomości Google Chat. Identyfikator karty to unikalny identyfikator karty w wiadomości podczas wysyłania wielu kart.

Dostępne tylko w przypadku aplikacji Google Chat. Niedostępne w przypadku dodatków do Google Workspace.

const cardSection = CardService.newCardSection();
cardSection.addWidget(
    CardService.newTextParagraph().setText('This is a text paragraph widget.'),
);

const card = CardService.newCardBuilder()
                 .setHeader(CardService.newCardHeader().setTitle('Card title'))
                 .addSection(cardSection)
                 .build();

const cardWithId =
    CardService.newCardWithId().setCardId('card_id').setCard(card);

Powrót

CardWithId – pusty CardWithId.


newCarousel()

Tworzy Carousel.

const carousel =
    CardService.newCarousel()
        .addCarouselCard(CardService.newCarouselCard().addWidget(
            CardService.newTextParagraph().setText('The first text paragraph in carousel')))
        .addCarouselCard(CardService.newCarouselCard().addWidget(
            CardService.newTextParagraph().setText('The second text paragraph in carousel')))
        .addCarouselCard(CardService.newCarouselCard().addWidget(
            CardService.newTextParagraph().setText('The third text paragraph in carousel')))

Powrót

Carousel – pusta karuzela.


newCarouselCard()

Tworzy nowy element CarouselCard.

const carouselCard = CardService.newCarouselCard().addWidget(
    CardService.newTextParagraph().setText('Text paragraph in carousel'));

Powrót

CarouselCard – pusty element.


newChatActionResponse()

Tworzy nowy element ChatActionResponse.

Dostępne tylko w przypadku aplikacji Google Chat. Niedostępne w przypadku dodatków do Google Workspace.

const card = CardService.newCardBuilder()
                 .setHeader(CardService.newCardHeader().setTitle('Card title'))
                 .build();
const dialog = CardService.newDialog().setBody(card);

const dialogAction = CardService.newDialogAction().setDialog(dialog);

const chatActionResponse = CardService.newChatActionResponse()
                               .setResponseType(CardService.ResponseType.DIALOG)
                               .setDialogAction(dialogAction);

Powrót

ChatActionResponse – pusty ChatActionResponse.


newChatResponseBuilder()

Tworzy nowy element ChatResponseBuilder.

Dostępne tylko w przypadku aplikacji Google Chat. Niedostępne w przypadku dodatków do Google Workspace.

const cardSection = CardService.newCardSection();
cardSection.addWidget(
    CardService.newTextParagraph().setText('This is a text paragraph widget.'),
);

const card = CardService.newCardBuilder()
                 .setHeader(CardService.newCardHeader().setTitle('Card title'))
                 .addSection(cardSection)
                 .build();

const cardWithId =
    CardService.newCardWithId().setCardId('card_id').setCard(card);

const chatResponse =
    CardService.newChatResponseBuilder().addCardsV2(cardWithId).build();

Powrót

ChatResponseBuilder – pusty obiekt ChatResponseBuilder.


newChip()

Tworzy nowy element Chip.

Dostępne w przypadku aplikacji Google Chat. W wersji przedpremierowej dla programistów dodatków do Google Workspace.

const chip = CardService.newChip()
                 .setLabel('Open Link')
                 .setOpenLink(CardService.newOpenLink().setUrl(
                     'https://www.google.com'));

Powrót

Chip – pusty element.


newChipList()

Tworzy nowy element ChipList.

Dostępne w przypadku aplikacji Google Chat. W wersji przedpremierowej dla programistów dodatków do Google Workspace.

const chip = CardService.newChip();
// Finish building the text chip...

const chipList = CardService.newChipList()
                     .setLayout(CardService.ChipListLayout.WRAPPED)
                     .addChip(chip);

Powrót

ChipList – pusta lista ChipList.


newCollapseControl()

Tworzy nowy element CollapseControl.

Dostępne w przypadku aplikacji Google Chat. W wersji przedpremierowej dla programistów dodatków do Google Workspace.

const collapseControl =
    CardService.newCollapseControl()
        .setHorizontalAlign(CardService.HorizontalAlignment.START)
        .setExpandButton(CardService.newTextButton().setText('Expand'))
        .setCollapseButton(CardService.newTextButton().setText('Collapse'));

Powrót

CollapseControl – pusty element CollapseControl.


newColumn()

Tworzy nowy element Column.

Dostępne w przypadku aplikacji Google Chat i dodatków do Google Workspace.

const columnWidget = CardService.newTextParagraph();
const column =
    CardService.newColumn()
        .setHorizontalSizeStyle(
            CardService.HorizontalSizeStyle.FILL_AVAILABLE_SPACE)
        .setHorizontalAlignment(CardService.HorizontalAlignment.CENTER)
        .setVerticalAlignment(CardService.VerticalAlignment.CENTER)
        .addWidget(columnWidget);

Powrót

Column – pusta kolumna.


newColumns()

Tworzy nowy zestaw Columns.

Dostępne w przypadku aplikacji Google Chat i dodatków do Google Workspace.

const firstColumn =
    CardService.newColumn()
        .setHorizontalSizeStyle(
            CardService.HorizontalSizeStyle.FILL_AVAILABLE_SPACE)
        .setHorizontalAlignment(CardService.HorizontalAlignment.CENTER)
        .setVerticalAlignment(CardService.VerticalAlignment.CENTER);
const secondColumn =
    CardService.newColumn()
        .setHorizontalSizeStyle(
            CardService.HorizontalSizeStyle.FILL_AVAILABLE_SPACE)
        .setHorizontalAlignment(CardService.HorizontalAlignment.CENTER)
        .setVerticalAlignment(CardService.VerticalAlignment.CENTER);
const columns = CardService.newColumns()
                    .addColumn(firstColumn)
                    .addColumn(secondColumn)
                    .setWrapStyle(CardService.WrapStyle.WRAP);

Powrót

Columns – pusty zestaw kolumn.


newCommonWidgetAction()

Tworzy nowy element CommonWidgetAction.

Powrót

CommonWidgetAction – pusty CommonWidgetAction.


newComposeActionResponseBuilder()

Tworzy nowy element ComposeActionResponseBuilder.

Powrót

ComposeActionResponseBuilder – pusty konstruktor ComposeActionResponse.


newCondition()

Tworzy nowy obiekt Condition używany do weryfikacji po stronie klienta.

Powrót

Condition – pusty Condition.


newDataSourceConfig()

Tworzy nowy, pusty DataSourceConfig.

Powrót

DataSourceConfig – pusty DataSourceConfig.


newDatePicker()

Tworzy nowy element DatePicker.

Powrót

DatePicker – pusty selektor daty.


newDateTimePicker()

Tworzy nowy element DateTimePicker.

Powrót

DateTimePicker – pusty selektor daty i godziny.


newDecoratedText()

Tworzy nowy element DecoratedText.

Powrót

DecoratedText – pusty element DecoratedText.


newDialog()

Tworzy nowy element Dialog.

Dostępne tylko w przypadku aplikacji Google Chat. Niedostępne w przypadku dodatków do Google Workspace.

const card = CardService.newCardBuilder()
                 .setHeader(CardService.newCardHeader().setTitle('Card title'))
                 .build();

// Sets the card of the dialog.
const dialog = CardService.newDialog().setBody(card);

Powrót

Dialog – pusty Dialog.


newDialogAction()

Tworzy nowy element DialogAction.

Dostępne tylko w przypadku aplikacji Google Chat. Niedostępne w przypadku dodatków do Google Workspace.

const card = CardService.newCardBuilder()
                 .setHeader(CardService.newCardHeader().setTitle('Card title'))
                 .build();
const dialog = CardService.newDialog().setBody(card);

const dialogAction = CardService.newDialogAction().setDialog(dialog);

Powrót

DialogAction – pusty DialogAction.


newDivider()

Tworzy nowy element Divider. Poniższy przykład tworzy prostą kartę z 2 akapitami oddzielonymi separatorem.

function buildCard() {
  const cardSection1TextParagraph1 =
      CardService.newTextParagraph().setText('Hello world!');

  const cardSection1Divider1 = CardService.newDivider();

  const cardSection1TextParagraph2 =
      CardService.newTextParagraph().setText('Hello world!');

  const cardSection1 = CardService.newCardSection()
                           .addWidget(cardSection1TextParagraph1)
                           .addWidget(cardSection1Divider1)
                           .addWidget(cardSection1TextParagraph2);

  const card = CardService.newCardBuilder().addSection(cardSection1).build();

  return card;
}

Powrót

Divider – separator.


newDriveDataSourceSpec()

Tworzy nowy element DriveDataSourceSpec.

Powrót

DriveDataSourceSpec – pusty DriveDataSourceSpec.


newDriveItemsSelectedActionResponseBuilder()


newEditorFileScopeActionResponseBuilder()


newEventAction()

Tworzy nowy obiekt EventAction używany do weryfikacji po stronie klienta.

Powrót

EventAction – pusty EventAction.


newExpressionData()

Tworzy nowy obiekt ExpressionData używany do weryfikacji po stronie klienta.

Powrót

ExpressionData – pusty ExpressionData.


newExpressionDataAction()

Tworzy nowy obiekt ExpressionDataAction używany do weryfikacji po stronie klienta.

Powrót

ExpressionDataAction – pusty ExpressionDataAction.


newExpressionDataCondition()

Tworzy nowy obiekt ExpressionDataCondition używany do weryfikacji po stronie klienta.

Powrót

ExpressionDataCondition – pusty ExpressionDataCondition.


newFixedFooter()

Tworzy nowy element FixedFooter.

Powrót

FixedFooter – pusty element FixedFooter.


newGrid()

Tworzy nowy element Grid.

Powrót

Grid – pusta siatka.


newGridItem()

Tworzy nowy element GridItem.

Powrót

GridItem – pusty element GridItem.


newHostAppDataSource()

Tworzy nowy element HostAppDataSource.

Powrót

HostAppDataSource — A HostAppDataSource.


newIconImage()

Tworzy nowy element IconImage.

Powrót

IconImage – pusta ikona.


newImage()

Tworzy nowy element Image.

Powrót

Image – pusty obraz.


newImageButton()

Tworzy nowy element ImageButton.

Powrót

ImageButton – pusty komponent Przycisk Obraz.


newImageComponent()

Tworzy nowy element ImageComponent.

Powrót

ImageComponent – pusty komponent ImageComponent.


newImageCropStyle()

Tworzy nowy element ImageCropStyle.

Powrót

ImageCropStyle – pusty element ImageCropStyle.


newKeyValue()

Tworzy nowy element KeyValue.

Powrót

KeyValue – pusta para klucz-wartość.


newLinkPreview()

Tworzy nowy element LinkPreview.

const decoratedText =
    CardService.newDecoratedText().setTopLabel('Hello').setText('Hi!');

const cardSection = CardService.newCardSection().addWidget(decoratedText);

const card = CardService.newCardBuilder().addSection(cardSection).build();

const linkPreview = CardService.newLinkPreview().setPreviewCard(card).setTitle(
    'Smart chip title');

Powrót

LinkPreview – pusty obiekt LinkPreview.


newMaterialIcon()

Tworzy nowy element MaterialIcon.

Dostępne w przypadku aplikacji Google Chat i dodatków do Google Workspace.

const materialIcon =
    CardService.newMaterialIcon().setName('check_box').setFill(true);

const cardSection = CardService.newCardSection();
cardSection.addWidget(
    CardService.newDecoratedText()
        .setStartIcon(CardService.newIconImage().setMaterialIcon(materialIcon))
        .setText('sasha@example.com'),
);

const card = CardService.newCardBuilder()
                 .setHeader(CardService.newCardHeader().setTitle('Card Title'))
                 .addSection(cardSection)
                 .build();

Powrót

MaterialIcon – pusta ikona MaterialIcon.


newNavigation()

Tworzy nowy element Navigation.

Powrót

Navigation – pusta nawigacja.


newNotification()

Tworzy nowy element Notification.

Powrót

Notification – puste powiadomienie.


Tworzy nowy element OpenLink.

Powrót

OpenLink – pusty OpenLink.


newOverflowMenu()

Tworzy nowy element OverflowMenu.

Dostępne w przypadku aplikacji Google Chat. W wersji przedpremierowej dla programistów dodatków do Google Workspace.

const overflowMenuItem = CardService.newOverflowMenuItem();
// Finish building the overflow menu item...

const overflowMenu =
    CardService.newOverflowMenu().addMenuItem(overflowMenuItem);

Powrót

OverflowMenu – puste rozszerzone menu.


newOverflowMenuItem()

Tworzy nowy element OverflowMenuItem.

Dostępne w przypadku aplikacji Google Chat. W wersji przedpremierowej dla programistów dodatków do Google Workspace.

const overflowMenuItem =
    CardService.newOverflowMenuItem()
        .setStartIcon(
            CardService.newIconImage().setIconUrl(
                'https://www.google.com/images/branding/googleg/1x/googleg_standard_color_64dp.png',
                ),
            )
        .setText('Open Link')
        .setOpenLink(
            CardService.newOpenLink().setUrl('https://www.google.com'));

Powrót

OverflowMenuItem – pusty element OverflowMenuItem.


newPlatformDataSource()

Tworzy nowy element PlatformDataSource.

Powrót

PlatformDataSource – pusty PlatformDataSource.


newSelectionInput()

Tworzy nowy element SelectionInput.

Powrót

SelectionInput – puste pole SelectionInput.


newSuggestions()

Tworzy nowy element Suggestions.

Powrót

Suggestions – puste Sugestie.


newSuggestionsResponseBuilder()

Tworzy nowy element SuggestionsResponseBuilder.

Powrót

SuggestionsResponseBuilder – pusty konstruktor SuggestionsResponse.


newSwitch()

Tworzy nowy element Switch.

Powrót

Switch – pusty przełącznik.


newTextButton()

Tworzy nowy element TextButton.

Powrót

TextButton – pusty element TextButton.


newTextInput()

Tworzy nowy element TextInput.

Powrót

TextInput – puste pole TextInput.


newTextParagraph()

Tworzy nowy element TextParagraph.

Powrót

TextParagraph – pusty element TextParagraph.


newTimePicker()

Tworzy nowy element TimePicker.

Powrót

TimePicker – pusty selektor czasu.


newTrigger()

Tworzy i zwraca nowy obiekt Trigger używany do weryfikacji po stronie klienta.

Powrót

Trigger – pusty Trigger.


newUniversalActionResponseBuilder()

Tworzy nowy element UniversalActionResponseBuilder.

Powrót

UniversalActionResponseBuilder – pusty konstruktor UniversalActionResponse.


newUpdateDraftActionResponseBuilder()

Tworzy nowy element UpdateDraftActionResponseBuilder.

Powrót

UpdateDraftActionResponseBuilder – pusty obiekt UpdateDraftActionResponseBuilder.


newUpdateDraftBccRecipientsAction()

tworzy nowy element UpdateDraftBccRecipientsAction;

Powrót

UpdateDraftBccRecipientsAction – pusta wartość UpdateDraftBccRecipientsAction.


newUpdateDraftBodyAction()

Tworzy nowy element UpdateDraftBodyAction.

Powrót

UpdateDraftBodyAction – pusta wartość UpdateDraftBodyAction.


newUpdateDraftCcRecipientsAction()

Tworzy nowy element UpdateDraftCcRecipientsAction.

Powrót

UpdateDraftCcRecipientsAction – Empty UpdateDraftCcRecipientsAction.


newUpdateDraftSubjectAction()

Tworzy nowy element UpdateDraftSubjectAction.

Powrót

UpdateDraftSubjectAction – pusta wartość UpdateDraftSubjectAction.


newUpdateDraftToRecipientsAction()

Tworzy nowy element UpdateDraftToRecipientsAction.

Powrót

UpdateDraftToRecipientsAction – pusty obiekt UpdateDraftToRecipientsAction.


newUpdateVisibilityAction()

Tworzy nowy element UpdateVisibilityAction.

Powrót

UpdateVisibilityAction – pusty UpdateVisibilityAction.


newValidation()

Tworzy nowy element Validation.

Dostępne w przypadku aplikacji Google Chat i dodatków do Google Workspace.

const validation =
    CardService.newValidation().setCharacterLimit(5).setInputType(
        CardService.InputType.EMAIL);

Powrót

Validation – pusta weryfikacja.


newWorkflowDataSource()

Tworzy nowy element WorkflowDataSource.

Powrót

WorkflowDataSource – pusty WorkflowDataSource.