Class CardWithId

CardWithId

Compilateur pour les objets CardWithId. Cette classe est un identifiant unique pour une carte dans un message lorsque plusieurs cartes sont envoyées.

Uniquement disponible pour les applications Google Chat. Non disponible pour les modules complémentaires 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);

Méthodes

MéthodeType renvoyéBrève description
setCard(card)CardWithIdDéfinit la carte du cardWithId.
setCardId(id)CardWithIdDéfinit l'identifiant unique de la carte cardWithId.

Documentation détaillée

setCard(card)

Définit la carte du 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);

Paramètres

NomTypeDescription
cardCardLe Card à utiliser.

Renvois

CardWithId : cet objet, pour le chaînage.


setCardId(id)

Définit l'identifiant unique de la carte cardWithId.

const cardWithId = CardService.newCardWithId();

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

Paramètres

NomTypeDescription
idStringTexte à utiliser.

Renvois

CardWithId : cet objet, pour le chaînage.