Class CardService

CardService

CardService を使用すると、Google Workspace アドオンなど、さまざまな Google 拡張サービスで使用される汎用カードを作成できます。

return CardService.newCardBuilder()
         .setHeader(CardService.newCardHeader().setTitle("CardTitle"))
         .build();

または、次のように複数のカードを返すこともできます。

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

Properties

プロパティ種類説明
BorderTypeBorderTypeBorderType 列挙型。
ComposedEmailTypeComposedEmailTypeComposedEmailType 列挙型。
ContentTypeContentTypeContentType 列挙型。
GridItemLayoutGridItemLayoutGridItemLayout 列挙型。
HorizontalAlignmentHorizontalAlignmentHorizontalAlignment 列挙型。
IconIconIcon 列挙型。
ImageCropTypeImageCropTypeImageCropType 列挙型。
ImageStyleImageStyleImageStyle 列挙型。
LoadIndicatorLoadIndicatorLoadIndicator 列挙型。
OnCloseOnCloseOnClose 列挙型。
OpenAsOpenAsOpenAs 列挙型。
SelectionInputTypeSelectionInputTypeSelectionInputType 列挙型。
TextButtonStyleTextButtonStyleTextButtonStyle 列挙型。
UpdateDraftBodyTypeUpdateDraftBodyTypeUpdateDraftBodyType 列挙型。

Methods

方法戻り値の型概要
newAction()Action新しい Action を作成します。
newActionResponseBuilder()ActionResponseBuilder新しい ActionResponseBuilder を作成します。
newAttachment()Attachment新しい Attachment を作成します。
newAuthorizationAction()AuthorizationAction新しい AuthorizationAction を作成します。
newAuthorizationException()AuthorizationException新しい AuthorizationException を作成します。
newBorderStyle()BorderStyle新しい BorderStyle を作成します。
newButtonSet()ButtonSet新しい ButtonSet を作成します。
newCalendarEventActionResponseBuilder()CalendarEventActionResponseBuilder新しい CalendarEventActionResponseBuilder を作成します。
newCardAction()CardAction新しい CardAction を作成します。
newCardBuilder()CardBuilder新しい CardBuilder を作成します。
newCardHeader()CardHeader新しい CardHeader を作成します。
newCardSection()CardSection新しい CardSection を作成します。
newComposeActionResponseBuilder()ComposeActionResponseBuilder新しい ComposeActionResponseBuilder を作成します。
newDatePicker()DatePicker新しい DatePicker を作成します。
newDateTimePicker()DateTimePicker新しい DateTimePicker を作成します。
newDecoratedText()DecoratedText新しい DecoratedText を作成します。
newDivider()Divider新しい Divider を作成します。
newDriveItemsSelectedActionResponseBuilder()DriveItemsSelectedActionResponseBuilder新しい DriveItemsSelectedActionResponseBuilder を作成します。
newEditorFileScopeActionResponseBuilder()EditorFileScopeActionResponseBuilder新しい EditorFileScopeActionResponseBuilder を作成します。
newFixedFooter()FixedFooter新しい FixedFooter を作成します。
newGrid()Grid新しい Grid を作成します。
newGridItem()GridItem新しい GridItem を作成します。
newIconImage()IconImage新しい IconImage を作成します。
newImage()Image新しい Image を作成します。
newImageButton()ImageButton新しい ImageButton を作成します。
newImageComponent()ImageComponent新しい ImageComponent を作成します。
newImageCropStyle()ImageCropStyle新しい ImageCropStyle を作成します。
newKeyValue()KeyValue新しい KeyValue を作成します。
newNavigation()Navigation新しい Navigation を作成します。
newNotification()Notification新しい Notification を作成します。
newOpenLink()OpenLink新しい OpenLink を作成します。
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 を作成します。

詳細なドキュメント

newAction()

新しい Action を作成します。

戻る

Action - 空のアクション。


newActionResponseBuilder()

新しい ActionResponseBuilder を作成します。

戻る

ActionResponseBuilder - 空の ActionResponse ビルダー。


newAttachment()

新しい Attachment を作成します。

戻る

Attachment - 空のアタッチメント。


newAuthorizationAction()

新しい AuthorizationAction を作成します。

戻る

AuthorizationAction - 空の AuthorizationAction。


newAuthorizationException()

新しい AuthorizationException を作成します。

戻る

AuthorizationException - 空の AuthorizationException。


newBorderStyle()

新しい BorderStyle を作成します。

戻る

BorderStyle - 空の BorderStyle。


newButtonSet()

新しい ButtonSet を作成します。

戻る

ButtonSet - 空の ButtonSet。


newCalendarEventActionResponseBuilder()


newCardAction()

新しい CardAction を作成します。

戻る

CardAction - 空の CardAction。


newCardBuilder()

新しい CardBuilder を作成します。

戻る

CardBuilder - 空のカードビルダー。


newCardHeader()

新しい CardHeader を作成します。

戻る

CardHeader - 空の CardHeader。


newCardSection()

新しい CardSection を作成します。

戻る

CardSection - 空の CardSection。


newComposeActionResponseBuilder()

新しい ComposeActionResponseBuilder を作成します。

戻る

ComposeActionResponseBuilder - 空の ComposeActionResponse ビルダー。


newDatePicker()

新しい DatePicker を作成します。

戻る

DatePicker - 空の DatePicker。


newDateTimePicker()

新しい DateTimePicker を作成します。

戻る

DateTimePicker - 空の DateTimePicker。


newDecoratedText()

新しい DecoratedText を作成します。

戻る

DecoratedText - 空の DecoratedText。


newDivider()

新しい Divider を作成します。次のサンプルは、分割線で区切られた 2 つの段落からなる単純なカードを作成します。

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

    let cardSection1Divider1 = CardService.newDivider();

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

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

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

   return card;
}

戻る

Divider - 分割線。


newDriveItemsSelectedActionResponseBuilder()


newEditorFileScopeActionResponseBuilder()


newFixedFooter()

新しい FixedFooter を作成します。

戻る

FixedFooter - 空の FixedFooter です。


newGrid()

新しい Grid を作成します。

戻る

Grid - 空のグリッド。


newGridItem()

新しい GridItem を作成します。

戻る

GridItem - 空の GridItem。


newIconImage()

新しい IconImage を作成します。

戻る

IconImage - 空のアイコン画像です。


newImage()

新しい Image を作成します。

戻る

Image - 空の画像。


newImageButton()

新しい ImageButton を作成します。

戻る

ImageButton - 空の ImageButton。


newImageComponent()

新しい ImageComponent を作成します。

戻る

ImageComponent - 空の ImageComponent。


newImageCropStyle()

新しい ImageCropStyle を作成します。

戻る

ImageCropStyle - 空の ImageCropStyle。


newKeyValue()

新しい KeyValue を作成します。

戻る

KeyValue - 空の KeyValue。


newNavigation()

新しい Navigation を作成します。

戻る

Navigation - 空のナビゲーション。


newNotification()

新しい Notification を作成します。

戻る

Notification - 空の通知。


新しい OpenLink を作成します。

戻る

OpenLink - 空の OpenLink。


newSelectionInput()

新しい SelectionInput を作成します。

戻る

SelectionInput - 空の SelectionInput。


newSuggestions()

新しい Suggestions を作成します。

戻る

Suggestions - 空の候補。


newSuggestionsResponseBuilder()

新しい SuggestionsResponseBuilder を作成します。

戻る

SuggestionsResponseBuilder - 空の SuggestionResponse ビルダー。


newSwitch()

新しい Switch を作成します。

戻る

Switch - 空のスイッチ。


newTextButton()

新しい TextButton を作成します。

戻る

TextButton - 空の TextButton。


newTextInput()

新しい TextInput を作成します。

戻る

TextInput - 空の TextInput。


newTextParagraph()

新しい TextParagraph を作成します。

戻る

TextParagraph - 空の TextParagraph。


newTimePicker()

新しい TimePicker を作成します。

戻る

TimePicker - 空の TimePicker。


newUniversalActionResponseBuilder()

新しい UniversalActionResponseBuilder を作成します。

戻る

UniversalActionResponseBuilder - 空の UniversalActionResponse ビルダー。


newUpdateDraftActionResponseBuilder()

新しい UpdateDraftActionResponseBuilder を作成します。

戻る

UpdateDraftActionResponseBuilder - 空の Update ドラフト アクション ビルダー。


newUpdateDraftBccRecipientsAction()

新しい UpdateDraftBccRecipientsAction を作成します。

戻る

UpdateDraftBccRecipientsAction - 空の Update ドラフト BccReceivesAction です。


newUpdateDraftBodyAction()

新しい UpdateDraftBodyAction を作成します。

戻る

UpdateDraftBodyAction - 空の Update ドラフト本文アクション。


newUpdateDraftCcRecipientsAction()

新しい UpdateDraftCcRecipientsAction を作成します。

戻る

UpdateDraftCcRecipientsAction - 空の Update ドラフト CcReceivesAction。


newUpdateDraftSubjectAction()

新しい UpdateDraftSubjectAction を作成します。

戻る

UpdateDraftSubjectAction - 空の Update ドラフト サブジェクト アクション。


newUpdateDraftToRecipientsAction()

新しい UpdateDraftToRecipientsAction を作成します。

戻る

UpdateDraftToRecipientsAction - 空の Update ドラフト To 受信者アクション。