CardService provides the ability to create generic cards used across different Google extensibility products, such as Gmail add-ons.
return CardService.newCardBuilder() .setHeader(CardService.newCardHeader().setTitle("CardTitle")) .build();
Or you can return multiple Cards like so:
return [ CardService.newCardBuilder().build(), CardService.newCardBuilder().build(), CardService.newCardBuilder().build() ]
The following shows how you could define a card with a header, text, an image and a menu item:
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(); }
Properties
Property | Type | Description |
---|---|---|
ComposedEmailType | ComposedEmailType | The ComposedEmailType enumeration. |
ContentType | ContentType | The ContentType enumeration. |
Icon | Icon | The Icon enumeration. |
ImageStyle | ImageStyle | The ImageStyle enumeration. |
LoadIndicator | LoadIndicator | The LoadIndicator enumeration. |
OnClose | OnClose | The OnClose enumeration. |
OpenAs | OpenAs | The OpenAs enumeration. |
SelectionInputType | SelectionInputType | The SelectionInputType enumeration. |
TextButtonStyle | TextButtonStyle | The TextButtonStyle enumeration. |
UpdateDraftBodyType | UpdateDraftBodyType | The UpdateDraftBodyType enumeration. |
Methods
Detailed documentation
newActionResponseBuilder()
Creates a new ActionResponseBuilder
.
Return
ActionResponseBuilder
— An empty ActionResponse builder.
newAuthorizationAction()
newAuthorizationException()
Creates a new AuthorizationException
.
Return
AuthorizationException
— An empty AuthorizationException.
newCalendarEventActionResponseBuilder()
Creates a new CalendarEventActionResponseBuilder
.
Return
CalendarEventActionResponseBuilder
— An empty CalendarEventActionResponseBuilder
.
newCardAction()
newCardBuilder()
newCardHeader()
newCardSection()
newComposeActionResponseBuilder()
Creates a new ComposeActionResponseBuilder
.
Return
ComposeActionResponseBuilder
— An empty ComposeActionResponse builder.
newDatePicker()
newDateTimePicker()
newDecoratedText()
newDriveItemsSelectedActionResponseBuilder()
Creates a new DriveItemsSelectedActionResponseBuilder
.
Return
DriveItemsSelectedActionResponseBuilder
— An empty DriveItemsSelectedActionResponseBuilder
.
newEditorFileScopeActionResponseBuilder()
Creates a new EditorFileScopeActionResponseBuilder
.
Return
EditorFileScopeActionResponseBuilder
— An empty EditorFileScopeActionResponseBuilder
.
newImageButton()
newNotification()
newSelectionInput()
newSuggestions()
newSuggestionsResponseBuilder()
Creates a new SuggestionsResponseBuilder
.
Return
SuggestionsResponseBuilder
— An empty SuggestionsResponse builder.
newTextButton()
newTextParagraph()
newTimePicker()
newUniversalActionResponseBuilder()
Creates a new UniversalActionResponseBuilder
.
Return
UniversalActionResponseBuilder
— An empty UniversalActionResponse builder.
newUpdateDraftActionResponseBuilder()
Creates a new UpdateDraftActionResponseBuilder
.
Return
UpdateDraftActionResponseBuilder
— An empty UpdateDraftActionResponseBuilder.
newUpdateDraftBccRecipientsAction()
Creates a new UpdateDraftBccRecipientsAction
;
Return
UpdateDraftBccRecipientsAction
— An empty UpdateDraftBccRecipientsAction.
newUpdateDraftBodyAction()
newUpdateDraftCcRecipientsAction()
Creates a new UpdateDraftCcRecipientsAction
.
Return
UpdateDraftCcRecipientsAction
— An Empty UpdateDraftCcRecipientsAction.
newUpdateDraftSubjectAction()
Creates a new UpdateDraftSubjectAction
.
Return
UpdateDraftSubjectAction
— An empty UpdateDraftSubjectAction.
newUpdateDraftToRecipientsAction()
Creates a new UpdateDraftToRecipientsAction
.
Return
UpdateDraftToRecipientsAction
— An empty UpdateDraftToRecipientsAction.