Class CardService

CardService

CardService permet de créer des cartes génériques utilisées dans différents produits d'extensibilité Google, tels que les modules complémentaires Google Workspace.

return CardService.newCardBuilder()
         .setHeader(CardService.newCardHeader().setTitle("CardTitle"))
         .build();

Vous pouvez également renvoyer plusieurs cartes comme suit:

return [
  CardService.newCardBuilder().build(),
  CardService.newCardBuilder().build(),
  CardService.newCardBuilder().build()
]

Voici comment définir une fiche avec un en-tête, du texte, une image et un élément de menu:

function createWidgetDemoCard() {
  return CardService
     .newCardBuilder()
     .setHeader(
         CardService.newCardHeader()
             .setTitle('Widget demonstration')
             .setSubtitle('Check out these widgets')
             .setImageStyle(CardService.ImageStyle.SQUARE)
             .setImageUrl(
                 'https://www.example.com/images/headerImage.png'))
     .addSection(
          CardService.newCardSection()
              .setHeader('Simple widgets')  // optional
              .addWidget(CardService.newTextParagraph().setText(
                  'These widgets are display-only. ' +
                  'A text paragraph can have multiple lines and ' +
                  'formatting.'))
              .addWidget(CardService.newImage().setImageUrl(
                  'https://www.example.com/images/mapsImage.png')))
     .addCardAction(CardService.newCardAction().setText('Gmail').setOpenLink(
         CardService.newOpenLink().setUrl('https://mail.google.com/mail')))
     .build();
}

Propriétés

PropriétéTypeDescription
BorderTypeBorderTypeÉnumération BorderType.
ComposedEmailTypeComposedEmailTypeÉnumération ComposedEmailType.
ContentTypeContentTypeÉnumération ContentType.
GridItemLayoutGridItemLayoutÉnumération GridItemLayout.
HorizontalAlignmentHorizontalAlignmentÉnumération HorizontalAlignment.
IconIconÉnumération Icon.
ImageCropTypeImageCropTypeÉnumération ImageCropType.
ImageStyleImageStyleÉnumération ImageStyle.
LoadIndicatorLoadIndicatorÉnumération LoadIndicator.
OnCloseOnCloseÉnumération OnClose.
OpenAsOpenAsÉnumération OpenAs.
SelectionInputTypeSelectionInputTypeÉnumération SelectionInputType.
TextButtonStyleTextButtonStyleÉnumération TextButtonStyle.
UpdateDraftBodyTypeUpdateDraftBodyTypeÉnumération UpdateDraftBodyType.

Méthodes

MéthodeType renvoyéBrève description
newAction()Actioncrée un objet Action ;
newActionResponseBuilder()ActionResponseBuildercrée un objet ActionResponseBuilder ;
newAttachment()Attachmentcrée un objet Attachment ;
newAuthorizationAction()AuthorizationActioncrée un objet AuthorizationAction ;
newAuthorizationException()AuthorizationExceptioncrée un objet AuthorizationException ;
newBorderStyle()BorderStylecrée un objet BorderStyle ;
newButtonSet()ButtonSetcrée un objet ButtonSet ;
newCalendarEventActionResponseBuilder()CalendarEventActionResponseBuildercrée un objet CalendarEventActionResponseBuilder ;
newCardAction()CardActioncrée un objet CardAction ;
newCardBuilder()CardBuildercrée un objet CardBuilder ;
newCardHeader()CardHeadercrée un objet CardHeader ;
newCardSection()CardSectioncrée un objet CardSection ;
newComposeActionResponseBuilder()ComposeActionResponseBuildercrée un objet ComposeActionResponseBuilder ;
newDatePicker()DatePickercrée un objet DatePicker ;
newDateTimePicker()DateTimePickercrée un objet DateTimePicker ;
newDecoratedText()DecoratedTextcrée un objet DecoratedText ;
newDivider()Dividercrée un objet Divider ;
newDriveItemsSelectedActionResponseBuilder()DriveItemsSelectedActionResponseBuildercrée un objet DriveItemsSelectedActionResponseBuilder ;
newEditorFileScopeActionResponseBuilder()EditorFileScopeActionResponseBuildercrée un objet EditorFileScopeActionResponseBuilder ;
newFixedFooter()FixedFootercrée un objet FixedFooter ;
newGrid()Gridcrée un objet Grid ;
newGridItem()GridItemcrée un objet GridItem ;
newIconImage()IconImagecrée un objet IconImage ;
newImage()Imagecrée un objet Image ;
newImageButton()ImageButtoncrée un objet ImageButton ;
newImageComponent()ImageComponentcrée un objet ImageComponent ;
newImageCropStyle()ImageCropStylecrée un objet ImageCropStyle ;
newKeyValue()KeyValuecrée un objet KeyValue ;
newNavigation()Navigationcrée un objet Navigation ;
newNotification()Notificationcrée un objet Notification ;
newOpenLink()OpenLinkcrée un objet OpenLink ;
newSelectionInput()SelectionInputcrée un objet SelectionInput ;
newSuggestions()Suggestionscrée un objet Suggestions ;
newSuggestionsResponseBuilder()SuggestionsResponseBuildercrée un objet SuggestionsResponseBuilder ;
newSwitch()Switchcrée un objet Switch ;
newTextButton()TextButtoncrée un objet TextButton ;
newTextInput()TextInputcrée un objet TextInput ;
newTextParagraph()TextParagraphcrée un objet TextParagraph ;
newTimePicker()TimePickercrée un objet TimePicker ;
newUniversalActionResponseBuilder()UniversalActionResponseBuildercrée un objet UniversalActionResponseBuilder ;
newUpdateDraftActionResponseBuilder()UpdateDraftActionResponseBuildercrée un objet UpdateDraftActionResponseBuilder ;
newUpdateDraftBccRecipientsAction()UpdateDraftBccRecipientsActioncrée un objet UpdateDraftBccRecipientsAction ;
newUpdateDraftBodyAction()UpdateDraftBodyActioncrée un objet UpdateDraftBodyAction ;
newUpdateDraftCcRecipientsAction()UpdateDraftCcRecipientsActioncrée un objet UpdateDraftCcRecipientsAction ;
newUpdateDraftSubjectAction()UpdateDraftSubjectActioncrée un objet UpdateDraftSubjectAction ;
newUpdateDraftToRecipientsAction()UpdateDraftToRecipientsActioncrée un objet UpdateDraftToRecipientsAction ;

Documentation détaillée

newAction()

crée un objet Action ;

Renvois

Action : action vide.


newActionResponseBuilder()

crée un objet ActionResponseBuilder ;

Renvois

ActionResponseBuilder : compilateur ActionResponse vide.


newAttachment()

crée un objet Attachment ;

Renvois

Attachment : pièce jointe vide.


newAuthorizationAction()

crée un objet AuthorizationAction ;

Renvois

AuthorizationAction : une valeur AuthorizationAction vide.


newAuthorizationException()

crée un objet AuthorizationException ;

Renvois

AuthorizationException : une AuthorizationException vide.


newBorderStyle()

crée un objet BorderStyle ;

Renvois

BorderStyle : BorderStyle vide.


newButtonSet()

crée un objet ButtonSet ;

Renvois

ButtonSet : un ButtonSet vide.


newCalendarEventActionResponseBuilder()


newCardAction()

crée un objet CardAction ;

Renvois

CardAction : une CardAction vide.


newCardBuilder()

crée un objet CardBuilder ;

Renvois

CardBuilder : outil de création de cartes vide.


newCardHeader()

crée un objet CardHeader ;

Renvois

CardHeader : un élément CardHeader vide.


newCardSection()

crée un objet CardSection ;

Renvois

CardSection : une CardSection vide.


newComposeActionResponseBuilder()

crée un objet ComposeActionResponseBuilder ;

Renvois

ComposeActionResponseBuilder : compilateur ComposeActionResponse vide.


newDatePicker()

crée un objet DatePicker ;

Renvois

DatePicker : sélecteur de date vide.


newDateTimePicker()

crée un objet DateTimePicker ;

Renvois

DateTimePicker : sélecteur de date et heure vide.


newDecoratedText()

crée un objet DecoratedText ;

Renvois

DecoratedText : un élément DecoratedText vide.


newDivider()

crée un objet Divider ; L'exemple suivant crée une fiche simple avec deux paragraphes séparés par un séparateur.

function buildCard() {
    let cardSection1TextParagraph1 = CardService.newTextParagraph()
        .setText('Hello world!');

    let cardSection1Divider1 = CardService.newDivider();

    let cardSection1TextParagraph2 = CardService.newTextParagraph()
        .setText('Hello world!');

    let cardSection1 = CardService.newCardSection()
        .addWidget(cardSection1TextParagraph1)
        .addWidget(cardSection1Divider1)
        .addWidget(cardSection1TextParagraph2);

    let card = CardService.newCardBuilder()
        .addSection(cardSection1)
        .build();

   return card;
}

Renvois

Divider : séparateur.


newDriveItemsSelectedActionResponseBuilder()


newEditorFileScopeActionResponseBuilder()


newFixedFooter()

crée un objet FixedFooter ;

Renvois

FixedFooter : un pied de page fixe vide.


newGrid()

crée un objet Grid ;

Renvois

Grid : grille vide.


newGridItem()

crée un objet GridItem ;

Renvois

GridItem : un élément GridItem vide.


newIconImage()

crée un objet IconImage ;

Renvois

IconImage : image d'icône vide.


newImage()

crée un objet Image ;

Renvois

Image : image vide.


newImageButton()

crée un objet ImageButton ;

Renvois

ImageButton : un élément ImageButton vide.


newImageComponent()

crée un objet ImageComponent ;

Renvois

ImageComponent : composant ImageComponent vide.


newImageCropStyle()

crée un objet ImageCropStyle ;

Renvois

ImageCropStyle : style de recadrage d'image vide.


newKeyValue()

crée un objet KeyValue ;

Renvois

KeyValue : valeur clé vide.


newNavigation()

crée un objet Navigation ;

Renvois

Navigation : navigation vide.


newNotification()

crée un objet Notification ;

Renvois

Notification : notification vide.


crée un objet OpenLink ;

Renvois

OpenLink : un OpenLink vide.


newSelectionInput()

crée un objet SelectionInput ;

Renvois

SelectionInput : un SelectionInput vide.


newSuggestions()

crée un objet Suggestions ;

Renvois

Suggestions : suggestions vides.


newSuggestionsResponseBuilder()

crée un objet SuggestionsResponseBuilder ;

Renvois

SuggestionsResponseBuilder : compilateur SuggestionsResponse vide.


newSwitch()

crée un objet Switch ;

Renvois

Switch : commutateur vide.


newTextButton()

crée un objet TextButton ;

Renvois

TextButton : un TextButton vide.


newTextInput()

crée un objet TextInput ;

Renvois

TextInput : un TextInput vide.


newTextParagraph()

crée un objet TextParagraph ;

Renvois

TextParagraph : un TextParagraph vide.


newTimePicker()

crée un objet TimePicker ;

Renvois

TimePicker : un TimePicker vide.


newUniversalActionResponseBuilder()

crée un objet UniversalActionResponseBuilder ;

Renvois

UniversalActionResponseBuilder : compilateur UniversalActionResponse vide.


newUpdateDraftActionResponseBuilder()

crée un objet UpdateDraftActionResponseBuilder ;

Renvois

UpdateDraftActionResponseBuilder : UpdateBrouillonActionResponseBuilder vide.


newUpdateDraftBccRecipientsAction()

crée un objet UpdateDraftBccRecipientsAction ;

Renvois

UpdateDraftBccRecipientsAction : une action UpdateBrouillonBccRecipientsAction vide.


newUpdateDraftBodyAction()

crée un objet UpdateDraftBodyAction ;

Renvois

UpdateDraftBodyAction : UpdateBrouillonBodyAction vide.


newUpdateDraftCcRecipientsAction()

crée un objet UpdateDraftCcRecipientsAction ;

Renvois

UpdateDraftCcRecipientsAction : une valeur UpdateBrouillonCcRecipientsAction vide.


newUpdateDraftSubjectAction()

crée un objet UpdateDraftSubjectAction ;

Renvois

UpdateDraftSubjectAction : UpdateBrouillonSubjectAction vide.


newUpdateDraftToRecipientsAction()

crée un objet UpdateDraftToRecipientsAction ;

Renvois

UpdateDraftToRecipientsAction : UpdateBrouillonToRecipientsAction vide.