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 thông báo khi gửi nhiều thẻ.
Chỉ dành cho các ứng dụng Google Chat. Không dùng được cho các 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 |
|---|---|---|
set | Card | Đặt thẻ của card. |
set | Card | Đặt mã nhận dạng duy nhất của thẻ card. |
Tài liệu chi tiết
setCard(card)
Đặt 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 | Mô tả |
|---|---|---|
card | Card | Card cần sử dụng. |
Cầu thủ trả bóng
CardWithId – Đối tượng này, để liên kết.
setCardId(id)
Đặt mã nhận dạng duy nhất của thẻ cardWithId.
const cardWithId = CardService.newCardWithId(); // Sets the card ID of the cardWithId. cardWithId.setCardId('card_id');
Tham số
| Tên | Loại | 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, để liên kết.