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ức | Kiểu dữ liệu trả về | Mô tả ngắn |
---|---|---|
setCard(card) | CardWithId | Thiế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ên | Loại | Nội dung mô tả |
---|---|---|
card | Card | Card để 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ên | Loại | Nội dung mô tả |
---|---|---|
id | String | Văn bản cần sử dụng. |
Cầu thủ trả bóng
CardWithId
– Đối tượng này để tạo chuỗi.