Class CardWithId

CardWithId

CardWithId オブジェクトのビルダー。このクラスは、複数のカードを送信する際のメッセージ内のカードの一意の識別子です。

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

Methods

メソッド戻り値の型概要
setCard(card)CardWithIdcardWithId のカードを設定します。
setCardId(id)CardWithIdcardWithId の一意のカード ID を設定します。

詳細なドキュメント

setCard(card)

cardWithId のカードを設定します。

const cardHeader = CardService.newCardHeader()
    .setTitle('Card Header Title')
    .setSubtitle('Card Header Subtitle');

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

const cardWithId = CardService.newCardWithId()
    .setCard(card);

パラメータ

名前説明
cardCard使用する Card

リターン

CardWithId - チェーン用のこのオブジェクト。


setCardId(id)

cardWithId の一意のカード ID を設定します。

const cardWithId = CardService.newCardWithId();

// Sets the card ID of the cardWithId.
cardWithId.setCardId('card_id');

パラメータ

名前説明
idString使用するテキスト。

リターン

CardWithId - チェーン用のこのオブジェクト。