Class CardWithId

CardWithId

Kreator obiektów CardWithId. Ta klasa jest unikalnym identyfikatorem karty w wiadomości, gdy wysyłasz kilka kart.

Dostępne tylko w aplikacjach Google Chat. Opcja niedostępna w przypadku dodatków do 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);

Metody

MetodaTyp zwracanej wartościKrótki opis
setCard(card)CardWithIdUstawia kartę: cardWithId.
setCardId(id)CardWithIdUstawia unikalny identyfikator karty cardWithId.

Szczegółowa dokumentacja

setCard(card)

Ustawia kartę: 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);

Parametry

NazwaTypOpis
cardCardCard, którego należy użyć.

Powroty

CardWithId – ten obiekt do tworzenia łańcuchów.


setCardId(id)

Ustawia unikalny identyfikator karty cardWithId.

const cardWithId = CardService.newCardWithId();

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

Parametry

NazwaTypOpis
idStringTekst, którego chcesz użyć.

Powroty

CardWithId – ten obiekt do tworzenia łańcuchów.