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

วิธีการ

วิธีการประเภทการแสดงผลรายละเอียดแบบย่อ
setCard(card)CardWithIdตั้งค่าบัตรของ cardWithId
setCardId(id)CardWithIdตั้งค่ารหัสบัตรที่ไม่ซ้ำกันของ cardWithId

เอกสารโดยละเอียด

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

พารามิเตอร์

ชื่อประเภทคำอธิบาย
cardCardCard ที่จะใช้

รีเทิร์น

CardWithId — ออบเจ็กต์นี้สำหรับการทำเชน


setCardId(id)

ตั้งค่ารหัสบัตรที่ไม่ซ้ำกันของ cardWithId

const cardWithId = CardService.newCardWithId();

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

พารามิเตอร์

ชื่อประเภทคำอธิบาย
idStringข้อความที่จะใช้

รีเทิร์น

CardWithId — ออบเจ็กต์นี้สำหรับการทำเชน