Enum google_api_proto::google::apps::card::v1::widget::Data

source ·
pub enum Data {
    TextParagraph(TextParagraph),
    Image(Image),
    DecoratedText(DecoratedText),
    ButtonList(ButtonList),
    TextInput(TextInput),
    SelectionInput(SelectionInput),
    DateTimePicker(DateTimePicker),
    Divider(Divider),
    Grid(Grid),
    Columns(Columns),
}
Expand description

A widget can only have one of the following items. You can use multiple widget fields to display more items.

Variants§

§

TextParagraph(TextParagraph)

Displays a text paragraph. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace Add-ons.

For example, the following JSON creates a bolded text:

"textParagraph": {
   "text": "  <b>bold text</b>"
}
§

Image(Image)

Displays an image.

For example, the following JSON creates an image with alternative text:

"image": {
   "imageUrl":
   "<https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png",>
   "altText": "Chat app avatar"
}
§

DecoratedText(DecoratedText)

Displays a decorated text item.

For example, the following JSON creates a decorated text widget showing email address:

"decoratedText": {
   "icon": {
     "knownIcon": "EMAIL"
   },
   "topLabel": "Email Address",
   "text": "sasha@example.com",
   "bottomLabel": "This is a new Email address!",
   "switchControl": {
     "name": "has_send_welcome_email_to_sasha",
     "selected": false,
     "controlType": "CHECKBOX"
   }
}
§

ButtonList(ButtonList)

A list of buttons.

For example, the following JSON creates two buttons. The first is a blue text button and the second is an image button that opens a link:

"buttonList": {
   "buttons": [
     {
       "text": "Edit",
       "color": {
         "red": 0,
         "green": 0,
         "blue": 1,
         "alpha": 1
       },
       "disabled": true,
     },
     {
       "icon": {
         "knownIcon": "INVITE",
         "altText": "check calendar"
       },
       "onClick": {
         "openLink": {
           "url": "<https://example.com/calendar">
         }
       }
     }
   ]
}
§

TextInput(TextInput)

Displays a text box that users can type into.

For example, the following JSON creates a text input for an email address:

"textInput": {
   "name": "mailing_address",
   "label": "Mailing Address"
}

As another example, the following JSON creates a text input for a programming language with static suggestions:

"textInput": {
   "name": "preferred_programing_language",
   "label": "Preferred Language",
   "initialSuggestions": {
     "items": [
       {
         "text": "C++"
       },
       {
         "text": "Java"
       },
       {
         "text": "JavaScript"
       },
       {
         "text": "Python"
       }
     ]
   }
}
§

SelectionInput(SelectionInput)

Displays a selection control that lets users select items. Selection controls can be checkboxes, radio buttons, switches, or dropdown menus.

For example, the following JSON creates a dropdown menu that lets users choose a size:

"selectionInput": {
   "name": "size",
   "label": "Size"
   "type": "DROPDOWN",
   "items": [
     {
       "text": "S",
       "value": "small",
       "selected": false
     },
     {
       "text": "M",
       "value": "medium",
       "selected": true
     },
     {
       "text": "L",
       "value": "large",
       "selected": false
     },
     {
       "text": "XL",
       "value": "extra_large",
       "selected": false
     }
   ]
}
§

DateTimePicker(DateTimePicker)

Displays a widget that lets users input a date, time, or date and time.

For example, the following JSON creates a date time picker to schedule an appointment:

"dateTimePicker": {
   "name": "appointment_time",
   "label": "Book your appointment at:",
   "type": "DATE_AND_TIME",
   "valueMsEpoch": "796435200000"
}
§

Divider(Divider)

Displays a horizontal line divider between widgets.

For example, the following JSON creates a divider:

"divider": {
}
§

Grid(Grid)

Displays a grid with a collection of items.

A grid supports any number of columns and items. The number of rows is determined by the upper bounds of the number items divided by the number of columns. A grid with 10 items and 2 columns has 5 rows. A grid with 11 items and 2 columns has 6 rows.

Google Workspace Add-ons and Chat apps:

For example, the following JSON creates a 2 column grid with a single item:

"grid": {
   "title": "A fine collection of items",
   "columnCount": 2,
   "borderStyle": {
     "type": "STROKE",
     "cornerRadius": 4
   },
   "items": [
     {
       "image": {
         "imageUri": "<https://www.example.com/image.png",>
         "cropStyle": {
           "type": "SQUARE"
         },
         "borderStyle": {
           "type": "STROKE"
         }
       },
       "title": "An item",
       "textAlignment": "CENTER"
     }
   ],
   "onClick": {
     "openLink": {
       "url": "<https://www.example.com">
     }
   }
}
§

Columns(Columns)

Displays up to 2 columns.

To include more than 2 columns, or to use rows, use the Grid widget.

For example, the following JSON creates 2 columns that each contain text paragraphs:

"columns": {
   "columnItems": [
     {
       "horizontalSizeStyle": "FILL_AVAILABLE_SPACE",
       "horizontalAlignment": "CENTER",
       "verticalAlignment": "CENTER",
       "widgets": [
         {
           "textParagraph": {
             "text": "First column text paragraph"
           }
         }
       ]
     },
     {
       "horizontalSizeStyle": "FILL_AVAILABLE_SPACE",
       "horizontalAlignment": "CENTER",
       "verticalAlignment": "CENTER",
       "widgets": [
         {
           "textParagraph": {
             "text": "Second column text paragraph"
           }
         }
       ]
     }
   ]
}

Implementations§

source§

impl Data

source

pub fn encode(&self, buf: &mut impl BufMut)

Encodes the message to a buffer.

source

pub fn merge( field: &mut Option<Data>, tag: u32, wire_type: WireType, buf: &mut impl Buf, ctx: DecodeContext, ) -> Result<(), DecodeError>

Decodes an instance of the message from a buffer, and merges it into self.

source

pub fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.

Trait Implementations§

source§

impl Clone for Data

source§

fn clone(&self) -> Data

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Data

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Data

source§

fn eq(&self, other: &Data) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Data

Auto Trait Implementations§

§

impl Freeze for Data

§

impl RefUnwindSafe for Data

§

impl Send for Data

§

impl Sync for Data

§

impl Unpin for Data

§

impl UnwindSafe for Data

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more