Class CardWithId

CardWithId

Trình tạo cho các đối tượng CardWithId. Lớp này là giá trị nhận dạng duy nhất cho một thẻ trong một tin nhắn khi gửi nhiều thẻ.

Chỉ dành cho các ứng dụng Google Chat. Không sử dụng được với tiện ích bổ sung của 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);

Phương thức

Phương thứcKiểu dữ liệu trả vềMô tả ngắn
setCard(card)CardWithIdThiết lập thẻ của cardWithId.
setCardId(id)CardWithIdĐặt mã thẻ duy nhất của cardWithId.

Tài liệu chi tiết

setCard(card)

Thiết lập thẻ của 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);

Tham số

TênLoạiNội dung mô tả
cardCardCard để sử dụng.

Cầu thủ trả bóng

CardWithId – Đối tượng này để tạo chuỗi.


setCardId(id)

Đặt mã thẻ duy nhất của cardWithId.

const cardWithId = CardService.newCardWithId();

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

Tham số

TênLoạiNội dung mô tả
idStringVăn bản cần sử dụng.

Cầu thủ trả bóng

CardWithId – Đối tượng này để tạo chuỗi.