Class CardWithId

CardWithId

CardWithId 物件的建構工具。傳送多張資訊卡時,這個類別是訊息中資訊卡的專屬 ID。

僅適用於 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);

方法

方法傳回類型簡短說明
setCard(card)CardWithId設定 cardWithId 的卡片。
setCardId(id)CardWithId設定 cardWithId 的專屬卡片 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:這個物件用於鏈結。