Class Card

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessageV3
com.google.apps.card.v1.Card
All Implemented Interfaces:
CardOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable

public final class Card extends com.google.protobuf.GeneratedMessageV3 implements CardOrBuilder
 A card interface displayed in a Google Chat message or Google Workspace
 Add-on.

 Cards support a defined layout, interactive UI elements like buttons, and
 rich media like images. Use cards to present detailed information,
 gather information from users, and guide users to take a next step.

 [Card builder](https://addons.gsuite.google.com/uikit/builder)

 To learn how
 to build cards, see the following documentation:

 * For Google Chat apps, see [Design the components of a card or
   dialog](https://developers.google.com/workspace/chat/design-components-card-dialog).
 * For Google Workspace Add-ons, see [Card-based
 interfaces](https://developers.google.com/apps-script/add-ons/concepts/cards).

 **Example: Card message for a Google Chat app**

 ![Example contact
 card](https://developers.google.com/workspace/chat/images/card_api_reference.png)

 To create the sample card message in Google Chat, use the following JSON:

 ```
 {
   "cardsV2": [
     {
       "cardId": "unique-card-id",
       "card": {
         "header": {
            "title": "Sasha",
            "subtitle": "Software Engineer",
            "imageUrl":
            "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png",
            "imageType": "CIRCLE",
            "imageAltText": "Avatar for Sasha"
          },
          "sections": [
            {
              "header": "Contact Info",
              "collapsible": true,
              "uncollapsibleWidgetsCount": 1,
              "widgets": [
                {
                  "decoratedText": {
                    "startIcon": {
                      "knownIcon": "EMAIL"
                    },
                    "text": "sasha@example.com"
                  }
                },
                {
                  "decoratedText": {
                    "startIcon": {
                      "knownIcon": "PERSON"
                    },
                    "text": "<font color=\"#80e27e\">Online</font>"
                  }
                },
                {
                  "decoratedText": {
                    "startIcon": {
                      "knownIcon": "PHONE"
                    },
                    "text": "+1 (555) 555-1234"
                  }
                },
                {
                  "buttonList": {
                    "buttons": [
                      {
                        "text": "Share",
                        "onClick": {
                         "openLink": {
                            "url": "https://example.com/share"
                          }
                        }
                      },
                      {
                        "text": "Edit",
                        "onClick": {
                          "action": {
                            "function": "goToView",
                            "parameters": [
                              {
                                "key": "viewType",
                                "value": "EDIT"
                              }
                            ]
                          }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          ]
        }
     }
   ]
 }
 ```
 
Protobuf type google.apps.card.v1.Card
See Also:
  • Field Details

    • HEADER_FIELD_NUMBER

      public static final int HEADER_FIELD_NUMBER
      See Also:
    • SECTIONS_FIELD_NUMBER

      public static final int SECTIONS_FIELD_NUMBER
      See Also:
    • SECTION_DIVIDER_STYLE_FIELD_NUMBER

      public static final int SECTION_DIVIDER_STYLE_FIELD_NUMBER
      See Also:
    • CARD_ACTIONS_FIELD_NUMBER

      public static final int CARD_ACTIONS_FIELD_NUMBER
      See Also:
    • NAME_FIELD_NUMBER

      public static final int NAME_FIELD_NUMBER
      See Also:
    • DISPLAY_STYLE_FIELD_NUMBER

      public static final int DISPLAY_STYLE_FIELD_NUMBER
      See Also:
    • PEEK_CARD_HEADER_FIELD_NUMBER

      public static final int PEEK_CARD_HEADER_FIELD_NUMBER
      See Also:
  • Method Details

    • newInstance

      protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
      Overrides:
      newInstance in class com.google.protobuf.GeneratedMessageV3
    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
    • hasHeader

      public boolean hasHeader()
       The header of the card. A header usually contains a leading image and a
       title. Headers always appear at the top of a card.
       
      .google.apps.card.v1.Card.CardHeader header = 1;
      Specified by:
      hasHeader in interface CardOrBuilder
      Returns:
      Whether the header field is set.
    • getHeader

      public Card.CardHeader getHeader()
       The header of the card. A header usually contains a leading image and a
       title. Headers always appear at the top of a card.
       
      .google.apps.card.v1.Card.CardHeader header = 1;
      Specified by:
      getHeader in interface CardOrBuilder
      Returns:
      The header.
    • getHeaderOrBuilder

      public Card.CardHeaderOrBuilder getHeaderOrBuilder()
       The header of the card. A header usually contains a leading image and a
       title. Headers always appear at the top of a card.
       
      .google.apps.card.v1.Card.CardHeader header = 1;
      Specified by:
      getHeaderOrBuilder in interface CardOrBuilder
    • getSectionsList

      public List<Card.Section> getSectionsList()
       Contains a collection of widgets. Each section has its own, optional
       header. Sections are visually separated by a line divider. For an example
       in Google Chat apps, see [Define a section of a
       card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card).
       
      repeated .google.apps.card.v1.Card.Section sections = 2;
      Specified by:
      getSectionsList in interface CardOrBuilder
    • getSectionsOrBuilderList

      public List<? extends Card.SectionOrBuilder> getSectionsOrBuilderList()
       Contains a collection of widgets. Each section has its own, optional
       header. Sections are visually separated by a line divider. For an example
       in Google Chat apps, see [Define a section of a
       card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card).
       
      repeated .google.apps.card.v1.Card.Section sections = 2;
      Specified by:
      getSectionsOrBuilderList in interface CardOrBuilder
    • getSectionsCount

      public int getSectionsCount()
       Contains a collection of widgets. Each section has its own, optional
       header. Sections are visually separated by a line divider. For an example
       in Google Chat apps, see [Define a section of a
       card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card).
       
      repeated .google.apps.card.v1.Card.Section sections = 2;
      Specified by:
      getSectionsCount in interface CardOrBuilder
    • getSections

      public Card.Section getSections(int index)
       Contains a collection of widgets. Each section has its own, optional
       header. Sections are visually separated by a line divider. For an example
       in Google Chat apps, see [Define a section of a
       card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card).
       
      repeated .google.apps.card.v1.Card.Section sections = 2;
      Specified by:
      getSections in interface CardOrBuilder
    • getSectionsOrBuilder

      public Card.SectionOrBuilder getSectionsOrBuilder(int index)
       Contains a collection of widgets. Each section has its own, optional
       header. Sections are visually separated by a line divider. For an example
       in Google Chat apps, see [Define a section of a
       card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card).
       
      repeated .google.apps.card.v1.Card.Section sections = 2;
      Specified by:
      getSectionsOrBuilder in interface CardOrBuilder
    • getSectionDividerStyleValue

      public int getSectionDividerStyleValue()
       The divider style between sections.
       
      .google.apps.card.v1.Card.DividerStyle section_divider_style = 9;
      Specified by:
      getSectionDividerStyleValue in interface CardOrBuilder
      Returns:
      The enum numeric value on the wire for sectionDividerStyle.
    • getSectionDividerStyle

      public Card.DividerStyle getSectionDividerStyle()
       The divider style between sections.
       
      .google.apps.card.v1.Card.DividerStyle section_divider_style = 9;
      Specified by:
      getSectionDividerStyle in interface CardOrBuilder
      Returns:
      The sectionDividerStyle.
    • getCardActionsList

      public List<Card.CardAction> getCardActionsList()
       The card's actions. Actions are added to the card's toolbar menu.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
      
       For example, the following JSON constructs a card action menu with
       `Settings` and `Send Feedback` options:
      
       ```
       "card_actions": [
         {
           "actionLabel": "Settings",
           "onClick": {
             "action": {
               "functionName": "goToView",
               "parameters": [
                 {
                   "key": "viewType",
                   "value": "SETTING"
                }
               ],
               "loadIndicator": "LoadIndicator.SPINNER"
             }
           }
         },
         {
           "actionLabel": "Send Feedback",
           "onClick": {
             "openLink": {
               "url": "https://example.com/feedback"
             }
           }
         }
       ]
       ```
       
      repeated .google.apps.card.v1.Card.CardAction card_actions = 3;
      Specified by:
      getCardActionsList in interface CardOrBuilder
    • getCardActionsOrBuilderList

      public List<? extends Card.CardActionOrBuilder> getCardActionsOrBuilderList()
       The card's actions. Actions are added to the card's toolbar menu.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
      
       For example, the following JSON constructs a card action menu with
       `Settings` and `Send Feedback` options:
      
       ```
       "card_actions": [
         {
           "actionLabel": "Settings",
           "onClick": {
             "action": {
               "functionName": "goToView",
               "parameters": [
                 {
                   "key": "viewType",
                   "value": "SETTING"
                }
               ],
               "loadIndicator": "LoadIndicator.SPINNER"
             }
           }
         },
         {
           "actionLabel": "Send Feedback",
           "onClick": {
             "openLink": {
               "url": "https://example.com/feedback"
             }
           }
         }
       ]
       ```
       
      repeated .google.apps.card.v1.Card.CardAction card_actions = 3;
      Specified by:
      getCardActionsOrBuilderList in interface CardOrBuilder
    • getCardActionsCount

      public int getCardActionsCount()
       The card's actions. Actions are added to the card's toolbar menu.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
      
       For example, the following JSON constructs a card action menu with
       `Settings` and `Send Feedback` options:
      
       ```
       "card_actions": [
         {
           "actionLabel": "Settings",
           "onClick": {
             "action": {
               "functionName": "goToView",
               "parameters": [
                 {
                   "key": "viewType",
                   "value": "SETTING"
                }
               ],
               "loadIndicator": "LoadIndicator.SPINNER"
             }
           }
         },
         {
           "actionLabel": "Send Feedback",
           "onClick": {
             "openLink": {
               "url": "https://example.com/feedback"
             }
           }
         }
       ]
       ```
       
      repeated .google.apps.card.v1.Card.CardAction card_actions = 3;
      Specified by:
      getCardActionsCount in interface CardOrBuilder
    • getCardActions

      public Card.CardAction getCardActions(int index)
       The card's actions. Actions are added to the card's toolbar menu.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
      
       For example, the following JSON constructs a card action menu with
       `Settings` and `Send Feedback` options:
      
       ```
       "card_actions": [
         {
           "actionLabel": "Settings",
           "onClick": {
             "action": {
               "functionName": "goToView",
               "parameters": [
                 {
                   "key": "viewType",
                   "value": "SETTING"
                }
               ],
               "loadIndicator": "LoadIndicator.SPINNER"
             }
           }
         },
         {
           "actionLabel": "Send Feedback",
           "onClick": {
             "openLink": {
               "url": "https://example.com/feedback"
             }
           }
         }
       ]
       ```
       
      repeated .google.apps.card.v1.Card.CardAction card_actions = 3;
      Specified by:
      getCardActions in interface CardOrBuilder
    • getCardActionsOrBuilder

      public Card.CardActionOrBuilder getCardActionsOrBuilder(int index)
       The card's actions. Actions are added to the card's toolbar menu.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
      
       For example, the following JSON constructs a card action menu with
       `Settings` and `Send Feedback` options:
      
       ```
       "card_actions": [
         {
           "actionLabel": "Settings",
           "onClick": {
             "action": {
               "functionName": "goToView",
               "parameters": [
                 {
                   "key": "viewType",
                   "value": "SETTING"
                }
               ],
               "loadIndicator": "LoadIndicator.SPINNER"
             }
           }
         },
         {
           "actionLabel": "Send Feedback",
           "onClick": {
             "openLink": {
               "url": "https://example.com/feedback"
             }
           }
         }
       ]
       ```
       
      repeated .google.apps.card.v1.Card.CardAction card_actions = 3;
      Specified by:
      getCardActionsOrBuilder in interface CardOrBuilder
    • getName

      public String getName()
       Name of the card. Used as a card identifier in card navigation.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
       
      string name = 4;
      Specified by:
      getName in interface CardOrBuilder
      Returns:
      The name.
    • getNameBytes

      public com.google.protobuf.ByteString getNameBytes()
       Name of the card. Used as a card identifier in card navigation.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
       
      string name = 4;
      Specified by:
      getNameBytes in interface CardOrBuilder
      Returns:
      The bytes for name.
    • hasFixedFooter

      public boolean hasFixedFooter()
       The fixed footer shown at the bottom of this card.
      
       Setting `fixedFooter` without specifying a `primaryButton` or a
       `secondaryButton` causes an error. For Chat apps, you can use fixed footers
       in
       [dialogs](https://developers.google.com/workspace/chat/dialogs), but not
       [card
       messages](https://developers.google.com/workspace/chat/create-messages#create).
      
       [Google Workspace Add-ons and Chat
       apps](https://developers.google.com/workspace/extend):
       
      .google.apps.card.v1.Card.CardFixedFooter fixed_footer = 5;
      Specified by:
      hasFixedFooter in interface CardOrBuilder
      Returns:
      Whether the fixedFooter field is set.
    • getFixedFooter

      public Card.CardFixedFooter getFixedFooter()
       The fixed footer shown at the bottom of this card.
      
       Setting `fixedFooter` without specifying a `primaryButton` or a
       `secondaryButton` causes an error. For Chat apps, you can use fixed footers
       in
       [dialogs](https://developers.google.com/workspace/chat/dialogs), but not
       [card
       messages](https://developers.google.com/workspace/chat/create-messages#create).
      
       [Google Workspace Add-ons and Chat
       apps](https://developers.google.com/workspace/extend):
       
      .google.apps.card.v1.Card.CardFixedFooter fixed_footer = 5;
      Specified by:
      getFixedFooter in interface CardOrBuilder
      Returns:
      The fixedFooter.
    • getFixedFooterOrBuilder

      public Card.CardFixedFooterOrBuilder getFixedFooterOrBuilder()
       The fixed footer shown at the bottom of this card.
      
       Setting `fixedFooter` without specifying a `primaryButton` or a
       `secondaryButton` causes an error. For Chat apps, you can use fixed footers
       in
       [dialogs](https://developers.google.com/workspace/chat/dialogs), but not
       [card
       messages](https://developers.google.com/workspace/chat/create-messages#create).
      
       [Google Workspace Add-ons and Chat
       apps](https://developers.google.com/workspace/extend):
       
      .google.apps.card.v1.Card.CardFixedFooter fixed_footer = 5;
      Specified by:
      getFixedFooterOrBuilder in interface CardOrBuilder
    • getDisplayStyleValue

      public int getDisplayStyleValue()
       In Google Workspace Add-ons, sets the display properties of the
       `peekCardHeader`.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
       
      .google.apps.card.v1.Card.DisplayStyle display_style = 6;
      Specified by:
      getDisplayStyleValue in interface CardOrBuilder
      Returns:
      The enum numeric value on the wire for displayStyle.
    • getDisplayStyle

      public Card.DisplayStyle getDisplayStyle()
       In Google Workspace Add-ons, sets the display properties of the
       `peekCardHeader`.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
       
      .google.apps.card.v1.Card.DisplayStyle display_style = 6;
      Specified by:
      getDisplayStyle in interface CardOrBuilder
      Returns:
      The displayStyle.
    • hasPeekCardHeader

      public boolean hasPeekCardHeader()
       When displaying contextual content, the peek card header acts as a
       placeholder so that the user can navigate forward between the homepage
       cards and the contextual cards.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
       
      .google.apps.card.v1.Card.CardHeader peek_card_header = 7;
      Specified by:
      hasPeekCardHeader in interface CardOrBuilder
      Returns:
      Whether the peekCardHeader field is set.
    • getPeekCardHeader

      public Card.CardHeader getPeekCardHeader()
       When displaying contextual content, the peek card header acts as a
       placeholder so that the user can navigate forward between the homepage
       cards and the contextual cards.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
       
      .google.apps.card.v1.Card.CardHeader peek_card_header = 7;
      Specified by:
      getPeekCardHeader in interface CardOrBuilder
      Returns:
      The peekCardHeader.
    • getPeekCardHeaderOrBuilder

      public Card.CardHeaderOrBuilder getPeekCardHeaderOrBuilder()
       When displaying contextual content, the peek card header acts as a
       placeholder so that the user can navigate forward between the homepage
       cards and the contextual cards.
      
       [Google Workspace
       Add-ons](https://developers.google.com/workspace/add-ons):
       
      .google.apps.card.v1.Card.CardHeader peek_card_header = 7;
      Specified by:
      getPeekCardHeaderOrBuilder in interface CardOrBuilder
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3
    • writeTo

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Overrides:
      writeTo in class com.google.protobuf.GeneratedMessageV3
      Throws:
      IOException
    • getSerializedSize

      public int getSerializedSize()
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
      Overrides:
      getSerializedSize in class com.google.protobuf.GeneratedMessageV3
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface com.google.protobuf.Message
      Overrides:
      equals in class com.google.protobuf.AbstractMessage
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.google.protobuf.Message
      Overrides:
      hashCode in class com.google.protobuf.AbstractMessage
    • parseFrom

      public static Card parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Card parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Card parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Card parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Card parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Card parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Card parseFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static Card parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static Card parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static Card parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static Card parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static Card parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilderForType

      public Card.Builder newBuilderForType()
      Specified by:
      newBuilderForType in interface com.google.protobuf.Message
      Specified by:
      newBuilderForType in interface com.google.protobuf.MessageLite
    • newBuilder

      public static Card.Builder newBuilder()
    • newBuilder

      public static Card.Builder newBuilder(Card prototype)
    • toBuilder

      public Card.Builder toBuilder()
      Specified by:
      toBuilder in interface com.google.protobuf.Message
      Specified by:
      toBuilder in interface com.google.protobuf.MessageLite
    • newBuilderForType

      protected Card.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
      Specified by:
      newBuilderForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstance

      public static Card getDefaultInstance()
    • parser

      public static com.google.protobuf.Parser<Card> parser()
    • getParserForType

      public com.google.protobuf.Parser<Card> getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.Message
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite
      Overrides:
      getParserForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstanceForType

      public Card getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder