Class CardService

บริการเกี่ยวกับบัตร

CardService ช่วยให้สร้างการ์ดทั่วไปที่ใช้ในผลิตภัณฑ์ความสามารถในการขยายของ Google ต่างๆ ได้ เช่น ส่วนเสริมของ Google Workspace

ด้านล่างนี้คือตัวอย่างการ์ดส่วนเสริม

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

หรือจะคืนการ์ดหลายใบก็ได้ดังนี้

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

ตัวอย่างต่อไปนี้แสดงวิธีที่คุณกำหนดการ์ดที่มีส่วนหัว ข้อความ รูปภาพ และรายการเมนู

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

ตัวอย่างการ์ดแอป Chat

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

พร็อพเพอร์ตี้

พร็อพเพอร์ตี้ประเภทคำอธิบาย
BorderTypeBorderTypeBorderTypeการแจงนับ
ChipListLayoutChipListLayoutChipListLayoutการแจงนับ
ComposedEmailTypeComposedEmailTypeComposedEmailTypeการแจงนับ
ContentTypeContentTypeContentTypeการแจงนับ
ExpressionDataActionTypeExpressionDataActionTypeExpressionDataActionTypeการแจงนับ
ExpressionDataConditionTypeExpressionDataConditionTypeExpressionDataConditionTypeการแจงนับ
GridItemLayoutGridItemLayoutGridItemLayoutการแจงนับ
HorizontalAlignmentHorizontalAlignmentHorizontalAlignmentการแจงนับ
IconIconIconการแจงนับ
ImageButtonStyleImageButtonStyleImageButtonStyleการแจงนับ
ImageCropTypeImageCropTypeImageCropTypeการแจงนับ
ImageStyleImageStyleImageStyleการแจงนับ
InputTypeInputTypeInputTypeการแจงนับ
LoadIndicatorLoadIndicatorLoadIndicatorการแจงนับ
OnCloseOnCloseOnCloseการแจงนับ
OpenAsOpenAsOpenAsการแจงนับ
SelectionInputTypeSelectionInputTypeSelectionInputTypeการแจงนับ
TextButtonStyleTextButtonStyleTextButtonStyleการแจงนับ
UpdateDraftBodyTypeUpdateDraftBodyTypeUpdateDraftBodyTypeการแจงนับ
VisibilityVisibilityVisibilityการแจงนับ
WorkflowDataSourceTypeWorkflowDataSourceTypeWorkflowDataSourceTypeการแจงนับ

เมธอด

วิธีการประเภทการแสดงผลรายละเอียดแบบย่อ
newAction()Actionสร้าง Action ใหม่
newActionResponseBuilder()ActionResponseBuilderสร้าง ActionResponseBuilder ใหม่
newActionStatus()ActionStatusสร้าง ActionStatus ใหม่
newAttachment()Attachmentสร้าง Attachment ใหม่
newAuthorizationAction()AuthorizationActionสร้าง AuthorizationAction ใหม่
newAuthorizationException()AuthorizationExceptionสร้าง AuthorizationException ใหม่
newBorderStyle()BorderStyleสร้าง BorderStyle ใหม่
newButtonSet()ButtonSetสร้าง ButtonSet ใหม่
newCalendarEventActionResponseBuilder()CalendarEventActionResponseBuilderสร้าง CalendarEventActionResponseBuilder ใหม่
newCardAction()CardActionสร้าง CardAction ใหม่
newCardBuilder()CardBuilderสร้างเครื่องมือสร้างการ์ดใหม่
newCardHeader()CardHeaderสร้าง CardHeader ใหม่
newCardSection()CardSectionสร้าง CardSection ใหม่
newCardWithId()CardWithIdสร้าง CardWithId ใหม่
newCarousel()Carouselสร้าง Carousel
newCarouselCard()CarouselCardสร้าง CarouselCard ใหม่
newChatActionResponse()ChatActionResponseสร้าง ChatActionResponse ใหม่
newChatResponseBuilder()ChatResponseBuilderสร้าง ChatResponseBuilder ใหม่
newChip()Chipสร้าง Chip ใหม่
newChipList()ChipListสร้าง ChipList ใหม่
newCollapseControl()CollapseControlสร้าง CollapseControl ใหม่
newColumn()Columnสร้าง Column ใหม่
newColumns()Columnsสร้างชุด Columns ใหม่
newComposeActionResponseBuilder()ComposeActionResponseBuilderสร้าง ComposeActionResponseBuilder ใหม่
newDatePicker()DatePickerสร้าง DatePicker ใหม่
newDateTimePicker()DateTimePickerสร้าง DateTimePicker ใหม่
newDecoratedText()DecoratedTextสร้าง DecoratedText ใหม่
newDialog()Dialogสร้าง Dialog ใหม่
newDialogAction()DialogActionสร้าง DialogAction ใหม่
newDivider()Dividerสร้าง Divider ใหม่
newDriveItemsSelectedActionResponseBuilder()DriveItemsSelectedActionResponseBuilderสร้าง DriveItemsSelectedActionResponseBuilder ใหม่
newEditorFileScopeActionResponseBuilder()EditorFileScopeActionResponseBuilderสร้าง EditorFileScopeActionResponseBuilder ใหม่
newFixedFooter()FixedFooterสร้าง FixedFooter ใหม่
newGrid()Gridสร้าง Grid ใหม่
newGridItem()GridItemสร้าง GridItem ใหม่
newHostAppDataSource()HostAppDataSourceสร้าง HostAppDataSource ใหม่และแสดงผล HostAppDataSource ที่ว่างเปล่า
newIconImage()IconImageสร้าง IconImage ใหม่
newImage()Imageสร้าง Image ใหม่
newImageButton()ImageButtonสร้าง ImageButton ใหม่
newImageComponent()ImageComponentสร้าง ImageComponent ใหม่
newImageCropStyle()ImageCropStyleสร้าง ImageCropStyle ใหม่
newKeyValue()KeyValueสร้าง KeyValue ใหม่
newLinkPreview()LinkPreviewสร้าง LinkPreview ใหม่
newMaterialIcon()MaterialIconสร้าง MaterialIcon ใหม่
newNavigation()Navigationสร้าง Navigation ใหม่
newNotification()Notificationสร้าง Notification ใหม่
newOpenLink()OpenLinkสร้าง OpenLink ใหม่
newOverflowMenu()OverflowMenuสร้าง OverflowMenu ใหม่
newOverflowMenuItem()OverflowMenuItemสร้าง OverflowMenuItem ใหม่
newSelectionInput()SelectionInputสร้าง SelectionInput ใหม่
newSuggestions()Suggestionsสร้าง Suggestions ใหม่
newSuggestionsResponseBuilder()SuggestionsResponseBuilderสร้าง SuggestionsResponseBuilder ใหม่
newSwitch()Switchสร้าง Switch ใหม่
newTextButton()TextButtonสร้าง TextButton ใหม่
newTextInput()TextInputสร้าง TextInput ใหม่
newTextParagraph()TextParagraphสร้าง TextParagraph ใหม่
newTimePicker()TimePickerสร้าง TimePicker ใหม่
newUniversalActionResponseBuilder()UniversalActionResponseBuilderสร้าง UniversalActionResponseBuilder ใหม่
newUpdateDraftActionResponseBuilder()UpdateDraftActionResponseBuilderสร้าง UpdateDraftActionResponseBuilder ใหม่
newUpdateDraftBccRecipientsAction()UpdateDraftBccRecipientsActionสร้าง UpdateDraftBccRecipientsAction ใหม่
newUpdateDraftBodyAction()UpdateDraftBodyActionสร้าง UpdateDraftBodyAction ใหม่
newUpdateDraftCcRecipientsAction()UpdateDraftCcRecipientsActionสร้าง UpdateDraftCcRecipientsAction ใหม่
newUpdateDraftSubjectAction()UpdateDraftSubjectActionสร้าง UpdateDraftSubjectAction ใหม่
newUpdateDraftToRecipientsAction()UpdateDraftToRecipientsActionสร้าง UpdateDraftToRecipientsAction ใหม่
newValidation()Validationสร้าง Validation ใหม่

เอกสารโดยละเอียด

newAction()

สร้าง Action ใหม่

รีเทิร์น

Action — การดำเนินการที่ว่างเปล่า


newActionResponseBuilder()

สร้าง ActionResponseBuilder ใหม่

รีเทิร์น

ActionResponseBuilder — เครื่องมือสร้าง ActionResponse ที่ว่างเปล่า


newActionStatus()

สร้าง ActionStatus ใหม่

ใช้ได้กับแอป Google Chat เท่านั้น ไม่พร้อมใช้งานสำหรับส่วนเสริม Google Workspace

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

รีเทิร์น

ActionStatus — ActionStatus ที่ว่างเปล่า


newAttachment()

สร้าง Attachment ใหม่

รีเทิร์น

Attachment — ไฟล์แนบที่ว่างเปล่า


newAuthorizationAction()

สร้าง AuthorizationAction ใหม่

รีเทิร์น

AuthorizationAction - AuthorizationAction ที่ว่างเปล่า


newAuthorizationException()

สร้าง AuthorizationException ใหม่

รีเทิร์น

AuthorizationException — AuthorizationException ที่ว่างเปล่า


newBorderStyle()

สร้าง BorderStyle ใหม่

รีเทิร์น

BorderStyle — BorderStyle ที่ว่างเปล่า


newButtonSet()

สร้าง ButtonSet ใหม่

รีเทิร์น

ButtonSet — ButtonSet ที่ว่างเปล่า


newCalendarEventActionResponseBuilder()

สร้าง CalendarEventActionResponseBuilder ใหม่

รีเทิร์น

CalendarEventActionResponseBuilderCalendarEventActionResponseBuilder ว่างเปล่า


newCardAction()

สร้าง CardAction ใหม่

รีเทิร์น

CardAction - CardAction ที่ว่างเปล่า


newCardBuilder()

สร้างเครื่องมือสร้างการ์ดใหม่

รีเทิร์น

CardBuilder - เครื่องมือสร้างการ์ดที่ว่างเปล่า


newCardHeader()

สร้าง CardHeader ใหม่

รีเทิร์น

CardHeader — CardHeader ที่ว่างเปล่า


newCardSection()

สร้าง CardSection ใหม่

รีเทิร์น

CardSection — CardSection ที่ว่างเปล่า


newCardWithId()

สร้าง CardWithId ใหม่ ใช้เพื่อส่งการ์ดในข้อความ Google Chat รหัสการ์ด คือตัวระบุที่ไม่ซ้ำกันของการ์ดในข้อความเมื่อส่งการ์ดหลายใบ

ใช้ได้กับแอป Google Chat เท่านั้น ไม่พร้อมใช้งานสำหรับส่วนเสริม 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);

รีเทิร์น

CardWithIdCardWithId ว่างเปล่า


newCarousel()

สร้าง 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')))

รีเทิร์น

Carousel — ภาพสไลด์ที่ว่างเปล่า


newCarouselCard()

สร้าง CarouselCard ใหม่

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

รีเทิร์น

CarouselCard — ชิปที่ว่างเปล่า


newChatActionResponse()

สร้าง ChatActionResponse ใหม่

ใช้ได้กับแอป Google Chat เท่านั้น ไม่พร้อมใช้งานสำหรับส่วนเสริม 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);

รีเทิร์น

ChatActionResponseChatActionResponse ว่างเปล่า


newChatResponseBuilder()

สร้าง ChatResponseBuilder ใหม่

ใช้ได้กับแอป Google Chat เท่านั้น ไม่พร้อมใช้งานสำหรับส่วนเสริม 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();

รีเทิร์น

ChatResponseBuilder — ChatResponseBuilder ที่ว่างเปล่า


newChip()

สร้าง Chip ใหม่

ใช้ได้กับแอป Google Chat ในรุ่นตัวอย่างสำหรับนักพัฒนาแอปของส่วนเสริม Google Workspace

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

รีเทิร์น

Chip - ชิปที่ว่างเปล่า


newChipList()

สร้าง ChipList ใหม่

ใช้ได้กับแอป Google Chat ในรุ่นตัวอย่างสำหรับนักพัฒนาแอปของส่วนเสริม Google Workspace

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

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

รีเทิร์น

ChipList — ChipList ที่ว่างเปล่า


newCollapseControl()

สร้าง CollapseControl ใหม่

ใช้ได้กับแอป Google Chat ในรุ่นตัวอย่างสำหรับนักพัฒนาแอปของส่วนเสริม Google Workspace

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

รีเทิร์น

CollapseControl — CollapseControl ที่ว่างเปล่า


newColumn()

สร้าง Column ใหม่

พร้อมใช้งานสำหรับแอป Google Chat และส่วนเสริมของ 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);

รีเทิร์น

Column - คอลัมน์ว่าง


newColumns()

สร้างชุด Columns ใหม่

พร้อมใช้งานสำหรับแอป Google Chat และส่วนเสริมของ 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);

รีเทิร์น

Columns — ชุดคอลัมน์ว่าง


newComposeActionResponseBuilder()

สร้าง ComposeActionResponseBuilder ใหม่

รีเทิร์น

ComposeActionResponseBuilder — ตัวสร้าง ComposeActionResponse ที่ว่างเปล่า


newDatePicker()

สร้าง DatePicker ใหม่

รีเทิร์น

DatePicker — DatePicker ที่ว่างเปล่า


newDateTimePicker()

สร้าง DateTimePicker ใหม่

รีเทิร์น

DateTimePicker — DateTimePicker ที่ว่างเปล่า


newDecoratedText()

สร้าง DecoratedText ใหม่

รีเทิร์น

DecoratedText — DecoratedText ที่ว่างเปล่า


newDialog()

สร้าง Dialog ใหม่

ใช้ได้กับแอป Google Chat เท่านั้น ไม่พร้อมใช้งานสำหรับส่วนเสริม 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);

รีเทิร์น

DialogDialog ว่างเปล่า


newDialogAction()

สร้าง DialogAction ใหม่

ใช้ได้กับแอป Google Chat เท่านั้น ไม่พร้อมใช้งานสำหรับส่วนเสริม 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);

รีเทิร์น

DialogActionDialogAction ว่างเปล่า


newDivider()

สร้าง Divider ใหม่ ตัวอย่างต่อไปนี้สร้างการ์ดอย่างง่ายที่มี 2 ย่อหน้า คั่นด้วยเส้นแบ่ง

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

รีเทิร์น

Divider — ตัวแบ่ง


newDriveItemsSelectedActionResponseBuilder()

สร้าง DriveItemsSelectedActionResponseBuilder ใหม่

รีเทิร์น

DriveItemsSelectedActionResponseBuilderDriveItemsSelectedActionResponseBuilder ว่างเปล่า


newEditorFileScopeActionResponseBuilder()

สร้าง EditorFileScopeActionResponseBuilder ใหม่

รีเทิร์น

EditorFileScopeActionResponseBuilderEditorFileScopeActionResponseBuilder ว่างเปล่า


newFixedFooter()

สร้าง FixedFooter ใหม่

รีเทิร์น

FixedFooter - FixedFooter ที่ว่างเปล่า


newGrid()

สร้าง Grid ใหม่

รีเทิร์น

Grid - ตารางกริดที่ว่างเปล่า


newGridItem()

สร้าง GridItem ใหม่

รีเทิร์น

GridItem — GridItem ที่ว่างเปล่า


newHostAppDataSource()

สร้าง HostAppDataSource ใหม่และแสดงผล HostAppDataSource ที่ว่างเปล่า

รีเทิร์น

HostAppDataSource


newIconImage()

สร้าง IconImage ใหม่

รีเทิร์น

IconImage — รูปภาพไอคอนว่างเปล่า


newImage()

สร้าง Image ใหม่

รีเทิร์น

Image — รูปภาพที่ว่างเปล่า


newImageButton()

สร้าง ImageButton ใหม่

รีเทิร์น

ImageButton — ImageButton ที่ว่างเปล่า


newImageComponent()

สร้าง ImageComponent ใหม่

รีเทิร์น

ImageComponent - คอมโพเนนต์รูปภาพที่ว่างเปล่า


newImageCropStyle()

สร้าง ImageCropStyle ใหม่

รีเทิร์น

ImageCropStyle - ImageCropStyle ที่ว่างเปล่า


newKeyValue()

สร้าง KeyValue ใหม่

รีเทิร์น

KeyValue — KeyValue ที่ว่างเปล่า


newLinkPreview()

สร้าง 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');

รีเทิร์น

LinkPreview - LinkPreview ที่ว่างเปล่า


newMaterialIcon()

สร้าง MaterialIcon ใหม่

พร้อมใช้งานสำหรับแอป Google Chat และส่วนเสริมของ 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();

รีเทิร์น

MaterialIcon — MaterialIcon ที่ว่างเปล่า


newNavigation()

สร้าง Navigation ใหม่

รีเทิร์น

Navigation — การนำทางที่ว่างเปล่า


newNotification()

สร้าง Notification ใหม่

รีเทิร์น

Notification - การแจ้งเตือนที่ว่างเปล่า


สร้าง OpenLink ใหม่

รีเทิร์น

OpenLink — OpenLink ที่ว่างเปล่า


newOverflowMenu()

สร้าง OverflowMenu ใหม่

ใช้ได้กับแอป Google Chat ในรุ่นตัวอย่างสำหรับนักพัฒนาแอปของส่วนเสริม Google Workspace

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

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

รีเทิร์น

OverflowMenu — OverflowMenu ที่ว่างเปล่า


newOverflowMenuItem()

สร้าง OverflowMenuItem ใหม่

ใช้ได้กับแอป Google Chat ในรุ่นตัวอย่างสำหรับนักพัฒนาแอปของส่วนเสริม 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'));

รีเทิร์น

OverflowMenuItem - OverflowMenuItem ที่ว่างเปล่า


newSelectionInput()

สร้าง SelectionInput ใหม่

รีเทิร์น

SelectionInput — SelectionInput ที่ว่างเปล่า


newSuggestions()

สร้าง Suggestions ใหม่

รีเทิร์น

Suggestions — ไม่มีคำแนะนำ


newSuggestionsResponseBuilder()

สร้าง SuggestionsResponseBuilder ใหม่

รีเทิร์น

SuggestionsResponseBuilder — เครื่องมือสร้าง SuggestionsResponse ที่ว่างเปล่า


newSwitch()

สร้าง Switch ใหม่

รีเทิร์น

Switch — สวิตช์ที่ว่างเปล่า


newTextButton()

สร้าง TextButton ใหม่

รีเทิร์น

TextButton - TextButton ที่ว่างเปล่า


newTextInput()

สร้าง TextInput ใหม่

รีเทิร์น

TextInput — TextInput ที่ว่างเปล่า


newTextParagraph()

สร้าง TextParagraph ใหม่

รีเทิร์น

TextParagraph — TextParagraph ที่ว่างเปล่า


newTimePicker()

สร้าง TimePicker ใหม่

รีเทิร์น

TimePicker — ตัวเลือกเวลาที่ว่างเปล่า


newUniversalActionResponseBuilder()

สร้าง UniversalActionResponseBuilder ใหม่

รีเทิร์น

UniversalActionResponseBuilder — เครื่องมือสร้าง UniversalActionResponse ที่ว่างเปล่า


newUpdateDraftActionResponseBuilder()

สร้าง UpdateDraftActionResponseBuilder ใหม่

รีเทิร์น

UpdateDraftActionResponseBuilder - UpdateDraftActionResponseBuilder ที่ว่างเปล่า


newUpdateDraftBccRecipientsAction()

สร้าง UpdateDraftBccRecipientsAction ใหม่

รีเทิร์น

UpdateDraftBccRecipientsAction - การดำเนินการ UpdateDraftBccRecipientsAction ที่ว่างเปล่า


newUpdateDraftBodyAction()

สร้าง UpdateDraftBodyAction ใหม่

รีเทิร์น

UpdateDraftBodyAction — การดำเนินการ UpdateDraftBodyAction ที่ว่างเปล่า


newUpdateDraftCcRecipientsAction()

สร้าง UpdateDraftCcRecipientsAction ใหม่

รีเทิร์น

UpdateDraftCcRecipientsAction — An Empty UpdateDraftCcRecipientsAction.


newUpdateDraftSubjectAction()

สร้าง UpdateDraftSubjectAction ใหม่

รีเทิร์น

UpdateDraftSubjectAction - การดำเนินการ UpdateDraftSubjectAction ที่ว่างเปล่า


newUpdateDraftToRecipientsAction()

สร้าง UpdateDraftToRecipientsAction ใหม่

รีเทิร์น

UpdateDraftToRecipientsAction — การดำเนินการ UpdateDraftToRecipientsAction ที่ว่างเปล่า


newValidation()

สร้าง Validation ใหม่

พร้อมใช้งานสำหรับแอป Google Chat และส่วนเสริมของ Google Workspace

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

รีเทิร์น

Validation — การตรวจสอบที่ว่างเปล่า