HeroCard Class
A Hero card (card with a single, large image).
Constructor
pydantic model HeroCard
Parameters
| Name | Description |
|---|---|
|
title
Required
|
Title of the card |
|
subtitle
Required
|
Subtitle of the card |
|
text
Required
|
Text for the card |
|
images
Required
|
Array of images for the card |
|
buttons
Required
|
Set of actions applicable to the current card |
|
tap
Required
|
This action will be activated when user taps on the card itself |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
title
|
Default value: None
|
|
subtitle
|
Default value: None
|
|
text
|
Default value: None
|
|
images
|
Default value: None
|
|
buttons
|
Default value: None
|
|
tap
|
Default value: None
|
Methods
| add_button |
Adds a button and returns this card. |
| add_buttons |
Adds one or more buttons and returns this card. |
| add_image |
Adds an image and returns this card. |
| to_attachment |
Creates a new Attachment that wraps this card. |
| to_message |
Creates a new message activity that includes this card as an attachment. |
add_button
Adds a button and returns this card.
add_button(button: CardAction) -> HeroCard
Parameters
| Name | Description |
|---|---|
|
button
|
The button to add. Default value: None
|
|
title
Required
|
The title of the button, used when no button instance is provided. |
|
type
Required
|
The action type of the button built from a title. |
|
value
Required
|
The value of the button built from a title. Defaults to the title. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
title
|
Default value: None
|
|
type
|
Default value: ActionTypes.im_back
|
|
value
|
Default value: None
|
Returns
| Type | Description |
|---|---|
|
This card, to allow for method chaining. |
add_buttons
Adds one or more buttons and returns this card.
add_buttons(*buttons: CardAction) -> HeroCard
Parameters
| Name | Description |
|---|---|
|
buttons
Required
|
The buttons to add. |
Returns
| Type | Description |
|---|---|
|
This card, to allow for method chaining. |
add_image
Adds an image and returns this card.
add_image(image: CardImage) -> HeroCard
Parameters
| Name | Description |
|---|---|
|
image
|
The image to add. Default value: None
|
|
url
Required
|
The URL of the image, used when no image instance is provided. |
|
alt
Required
|
The alternate text for the image built from a URL. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
url
|
Default value: None
|
|
alt
|
Default value: None
|
Returns
| Type | Description |
|---|---|
|
This card, to allow for method chaining. |
to_attachment
Creates a new Attachment that wraps this card.
to_attachment() -> Attachment
Returns
| Type | Description |
|---|---|
|
The generated attachment. |
to_message
Creates a new message activity that includes this card as an attachment.
to_message() -> Activity
Returns
| Type | Description |
|---|---|
|
An Activity representing a message activity with the card attached. |
Attributes
buttons
field buttons: list[CardAction] = None
images
field images: list[CardImage] = None
subtitle
field subtitle: str = None
tap
field tap: CardAction = None
text
field text: str = None
title
field title: str = None