Class Card.Section.Builder (2.38.0)

public static final class Card.Section.Builder extends GeneratedMessageV3.Builder<Card.Section.Builder> implements Card.SectionOrBuilder

A section contains a collection of widgets that are rendered vertically in the order that they're specified.

Google Workspace Add-ons and Chat apps:

Protobuf type google.apps.card.v1.Card.Section

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addAllWidgets(Iterable<? extends Widget> values)

public Card.Section.Builder addAllWidgets(Iterable<? extends Widget> values)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
values Iterable<? extends com.google.apps.card.v1.Widget>
Returns
Type Description
Card.Section.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Card.Section.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Card.Section.Builder
Overrides

addWidgets(Widget value)

public Card.Section.Builder addWidgets(Widget value)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
value Widget
Returns
Type Description
Card.Section.Builder

addWidgets(Widget.Builder builderForValue)

public Card.Section.Builder addWidgets(Widget.Builder builderForValue)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
builderForValue Widget.Builder
Returns
Type Description
Card.Section.Builder

addWidgets(int index, Widget value)

public Card.Section.Builder addWidgets(int index, Widget value)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameters
Name Description
index int
value Widget
Returns
Type Description
Card.Section.Builder

addWidgets(int index, Widget.Builder builderForValue)

public Card.Section.Builder addWidgets(int index, Widget.Builder builderForValue)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameters
Name Description
index int
builderForValue Widget.Builder
Returns
Type Description
Card.Section.Builder

addWidgetsBuilder()

public Widget.Builder addWidgetsBuilder()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
Widget.Builder

addWidgetsBuilder(int index)

public Widget.Builder addWidgetsBuilder(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
Widget.Builder

build()

public Card.Section build()
Returns
Type Description
Card.Section

buildPartial()

public Card.Section buildPartial()
Returns
Type Description
Card.Section

clear()

public Card.Section.Builder clear()
Returns
Type Description
Card.Section.Builder
Overrides

clearCollapsible()

public Card.Section.Builder clearCollapsible()

Indicates whether this section is collapsible.

Collapsible sections hide some or all widgets, but users can expand the section to reveal the hidden widgets by clicking Show more. Users can hide the widgets again by clicking Show less.

To determine which widgets are hidden, specify uncollapsibleWidgetsCount.

bool collapsible = 5;

Returns
Type Description
Card.Section.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public Card.Section.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
Card.Section.Builder
Overrides

clearHeader()

public Card.Section.Builder clearHeader()

Text that appears at the top of a section. 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.

string header = 1;

Returns
Type Description
Card.Section.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public Card.Section.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
Card.Section.Builder
Overrides

clearUncollapsibleWidgetsCount()

public Card.Section.Builder clearUncollapsibleWidgetsCount()

The number of uncollapsible widgets which remain visible even when a section is collapsed.

For example, when a section contains five widgets and the uncollapsibleWidgetsCount is set to 2, the first two widgets are always shown and the last three are collapsed by default. The uncollapsibleWidgetsCount is taken into account only when collapsible is true.

int32 uncollapsible_widgets_count = 6;

Returns
Type Description
Card.Section.Builder

This builder for chaining.

clearWidgets()

public Card.Section.Builder clearWidgets()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
Card.Section.Builder

clone()

public Card.Section.Builder clone()
Returns
Type Description
Card.Section.Builder
Overrides

getCollapsible()

public boolean getCollapsible()

Indicates whether this section is collapsible.

Collapsible sections hide some or all widgets, but users can expand the section to reveal the hidden widgets by clicking Show more. Users can hide the widgets again by clicking Show less.

To determine which widgets are hidden, specify uncollapsibleWidgetsCount.

bool collapsible = 5;

Returns
Type Description
boolean

The collapsible.

getDefaultInstanceForType()

public Card.Section getDefaultInstanceForType()
Returns
Type Description
Card.Section

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getHeader()

public String getHeader()

Text that appears at the top of a section. 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.

string header = 1;

Returns
Type Description
String

The header.

getHeaderBytes()

public ByteString getHeaderBytes()

Text that appears at the top of a section. 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.

string header = 1;

Returns
Type Description
ByteString

The bytes for header.

getUncollapsibleWidgetsCount()

public int getUncollapsibleWidgetsCount()

The number of uncollapsible widgets which remain visible even when a section is collapsed.

For example, when a section contains five widgets and the uncollapsibleWidgetsCount is set to 2, the first two widgets are always shown and the last three are collapsed by default. The uncollapsibleWidgetsCount is taken into account only when collapsible is true.

int32 uncollapsible_widgets_count = 6;

Returns
Type Description
int

The uncollapsibleWidgetsCount.

getWidgets(int index)

public Widget getWidgets(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
Widget

getWidgetsBuilder(int index)

public Widget.Builder getWidgetsBuilder(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
Widget.Builder

getWidgetsBuilderList()

public List<Widget.Builder> getWidgetsBuilderList()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
List<Builder>

getWidgetsCount()

public int getWidgetsCount()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
int

getWidgetsList()

public List<Widget> getWidgetsList()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
List<Widget>

getWidgetsOrBuilder(int index)

public WidgetOrBuilder getWidgetsOrBuilder(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
WidgetOrBuilder

getWidgetsOrBuilderList()

public List<? extends WidgetOrBuilder> getWidgetsOrBuilderList()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
List<? extends com.google.apps.card.v1.WidgetOrBuilder>

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(Card.Section other)

public Card.Section.Builder mergeFrom(Card.Section other)
Parameter
Name Description
other Card.Section
Returns
Type Description
Card.Section.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Card.Section.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Card.Section.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public Card.Section.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
Card.Section.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Card.Section.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Card.Section.Builder
Overrides

removeWidgets(int index)

public Card.Section.Builder removeWidgets(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
Card.Section.Builder

setCollapsible(boolean value)

public Card.Section.Builder setCollapsible(boolean value)

Indicates whether this section is collapsible.

Collapsible sections hide some or all widgets, but users can expand the section to reveal the hidden widgets by clicking Show more. Users can hide the widgets again by clicking Show less.

To determine which widgets are hidden, specify uncollapsibleWidgetsCount.

bool collapsible = 5;

Parameter
Name Description
value boolean

The collapsible to set.

Returns
Type Description
Card.Section.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public Card.Section.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Card.Section.Builder
Overrides

setHeader(String value)

public Card.Section.Builder setHeader(String value)

Text that appears at the top of a section. 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.

string header = 1;

Parameter
Name Description
value String

The header to set.

Returns
Type Description
Card.Section.Builder

This builder for chaining.

setHeaderBytes(ByteString value)

public Card.Section.Builder setHeaderBytes(ByteString value)

Text that appears at the top of a section. 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.

string header = 1;

Parameter
Name Description
value ByteString

The bytes for header to set.

Returns
Type Description
Card.Section.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public Card.Section.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
Card.Section.Builder
Overrides

setUncollapsibleWidgetsCount(int value)

public Card.Section.Builder setUncollapsibleWidgetsCount(int value)

The number of uncollapsible widgets which remain visible even when a section is collapsed.

For example, when a section contains five widgets and the uncollapsibleWidgetsCount is set to 2, the first two widgets are always shown and the last three are collapsed by default. The uncollapsibleWidgetsCount is taken into account only when collapsible is true.

int32 uncollapsible_widgets_count = 6;

Parameter
Name Description
value int

The uncollapsibleWidgetsCount to set.

Returns
Type Description
Card.Section.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final Card.Section.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Card.Section.Builder
Overrides

setWidgets(int index, Widget value)

public Card.Section.Builder setWidgets(int index, Widget value)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameters
Name Description
index int
value Widget
Returns
Type Description
Card.Section.Builder

setWidgets(int index, Widget.Builder builderForValue)

public Card.Section.Builder setWidgets(int index, Widget.Builder builderForValue)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameters
Name Description
index int
builderForValue Widget.Builder
Returns
Type Description
Card.Section.Builder