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)CardWithIdcardWithId의 카드를 설정합니다.
setCardId(id)CardWithIdcardWithId의 고유 카드 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: 체이닝용 객체입니다.