diff --git a/examples/cards/src/main.py b/examples/cards/src/main.py index efee8699..3dc5f9c5 100644 --- a/examples/cards/src/main.py +++ b/examples/cards/src/main.py @@ -20,6 +20,7 @@ ExecuteAction, NumberInput, OpenUrlAction, + SubmitActionData, TextBlock, ToggleInput, ) @@ -37,7 +38,9 @@ def create_basic_adaptive_card() -> AdaptiveCard: ToggleInput(label="Notify me").with_id("notify"), ActionSet( actions=[ - ExecuteAction(title="Submit").with_data({"action": "submit_basic"}).with_associated_inputs("auto") + ExecuteAction(title="Submit") + .with_data(SubmitActionData().with_data({"action": "submit_basic"})) + .with_associated_inputs("auto") ] ), ], @@ -110,7 +113,7 @@ def create_profile_card() -> AdaptiveCard: ActionSet( actions=[ ExecuteAction(title="Save") - .with_data({"action": "save_profile", "entity_id": "12345"}) + .with_data(SubmitActionData().with_data({"action": "save_profile", "entity_id": "12345"})) .with_associated_inputs("auto"), OpenUrlAction(url="https://adaptivecards.microsoft.com").with_title("Learn More"), ] @@ -134,7 +137,9 @@ def create_profile_card_input_validation() -> AdaptiveCard: TextInput(id="location").with_label("Location"), ActionSet( actions=[ - ExecuteAction(title="Save").with_data({"action": "save_profile"}).with_associated_inputs("auto") + ExecuteAction(title="Save") + .with_data(SubmitActionData().with_data({"action": "save_profile"})) + .with_associated_inputs("auto") ] ), ], @@ -156,7 +161,7 @@ def create_feedback_card() -> AdaptiveCard: ActionSet( actions=[ ExecuteAction(title="Submit Feedback") - .with_data({"action": "submit_feedback"}) + .with_data(SubmitActionData().with_data({"action": "submit_feedback"})) .with_associated_inputs("auto") ] ), @@ -207,7 +212,7 @@ async def handle_form(ctx: ActivityContext[MessageActivity]): ActionSet( actions=[ ExecuteAction(title="Create Task") - .with_data({"action": "create_task"}) + .with_data(SubmitActionData().with_data({"action": "create_task"})) .with_associated_inputs("auto") .with_style("positive") ] diff --git a/packages/cards/src/microsoft_teams/cards/actions/im_back_action.py b/packages/cards/src/microsoft_teams/cards/actions/im_back_action.py index d77cbe7e..2e0ded70 100644 --- a/packages/cards/src/microsoft_teams/cards/actions/im_back_action.py +++ b/packages/cards/src/microsoft_teams/cards/actions/im_back_action.py @@ -3,13 +3,22 @@ Licensed under the MIT License. """ +import warnings + from ..core import ImBackSubmitActionData, SubmitAction, SubmitActionData class IMBackAction(SubmitAction): - """Initial data that input fields will be combined with. These are essentially ‘hidden’ properties.""" + """This class is deprecated. Please use ImBackSubmitActionData instead. + This will be removed in version 2.0.0 GA.""" def __init__(self, value: str): + warnings.warn( + "IMBackAction is deprecated. Use ImBackSubmitActionData instead. " + "This will be removed in version 2.0.0 GA.", + DeprecationWarning, + stacklevel=2, + ) super().__init__() action_data = ImBackSubmitActionData().with_value(value) self.data = SubmitActionData(ms_teams=action_data.model_dump()) diff --git a/packages/cards/src/microsoft_teams/cards/actions/invoke_action.py b/packages/cards/src/microsoft_teams/cards/actions/invoke_action.py index 08af726f..b34eb64c 100644 --- a/packages/cards/src/microsoft_teams/cards/actions/invoke_action.py +++ b/packages/cards/src/microsoft_teams/cards/actions/invoke_action.py @@ -3,13 +3,23 @@ Licensed under the MIT License. """ +import warnings from typing import Any, Dict from ..core import InvokeSubmitActionData, SubmitAction, SubmitActionData class InvokeAction(SubmitAction): + """This class is deprecated. Please use InvokeSubmitActionData instead. + This will be removed in version 2.0.0 GA.""" + def __init__(self, value: Dict[str, Any]): + warnings.warn( + "InvokeAction is deprecated. Use InvokeSubmitActionData instead. " + "This will be removed in version 2.0.0 GA.", + DeprecationWarning, + stacklevel=2, + ) super().__init__() action_data = InvokeSubmitActionData().with_value(value) self.data = SubmitActionData(ms_teams=action_data.model_dump()) diff --git a/packages/cards/src/microsoft_teams/cards/actions/message_back_action.py b/packages/cards/src/microsoft_teams/cards/actions/message_back_action.py index 627c70da..62eb23b8 100644 --- a/packages/cards/src/microsoft_teams/cards/actions/message_back_action.py +++ b/packages/cards/src/microsoft_teams/cards/actions/message_back_action.py @@ -3,15 +3,26 @@ Licensed under the MIT License. """ -from typing import Optional +import warnings +from typing import Any, Dict, Optional, Union from ..core import MessageBackSubmitActionData, SubmitAction, SubmitActionData class MessageBackAction(SubmitAction): - def __init__(self, text: str, value: str, display_text: Optional[str] = None): + """This class is deprecated. Please use MessageBackSubmitActionData instead. + This will be removed in version 2.0.0 GA.""" + + def __init__(self, text: str, value: Union[str, Dict[str, Any]], display_text: Optional[str] = None): + warnings.warn( + "MessageBackAction is deprecated. Use MessageBackSubmitActionData instead. " + "This will be removed in version 2.0.0 GA.", + DeprecationWarning, + stacklevel=2, + ) super().__init__() - action_data = MessageBackSubmitActionData().with_value(value).with_text(text) + action_value = {"value": value} if isinstance(value, str) else value + action_data = MessageBackSubmitActionData().with_value(action_value).with_text(text) if display_text: action_data = action_data.with_display_text(display_text) diff --git a/packages/cards/src/microsoft_teams/cards/actions/sign_in_action.py b/packages/cards/src/microsoft_teams/cards/actions/sign_in_action.py index d81e8532..811b44d1 100644 --- a/packages/cards/src/microsoft_teams/cards/actions/sign_in_action.py +++ b/packages/cards/src/microsoft_teams/cards/actions/sign_in_action.py @@ -3,11 +3,22 @@ Licensed under the MIT License. """ +import warnings + from ..core import SigninSubmitActionData, SubmitAction, SubmitActionData class SignInAction(SubmitAction): + """This class is deprecated. Please use SigninSubmitActionData instead. + This will be removed in version 2.0.0 GA.""" + def __init__(self, value: str): + warnings.warn( + "SignInAction is deprecated. Use SigninSubmitActionData instead. " + "This will be removed in version 2.0.0 GA.", + DeprecationWarning, + stacklevel=2, + ) super().__init__() action_data = SigninSubmitActionData().with_value(value) self.data = SubmitActionData(ms_teams=action_data.model_dump()) diff --git a/packages/cards/src/microsoft_teams/cards/actions/task_fetch_action.py b/packages/cards/src/microsoft_teams/cards/actions/task_fetch_action.py index fc2cbd2d..e50acafd 100644 --- a/packages/cards/src/microsoft_teams/cards/actions/task_fetch_action.py +++ b/packages/cards/src/microsoft_teams/cards/actions/task_fetch_action.py @@ -3,13 +3,23 @@ Licensed under the MIT License. """ +import warnings from typing import Any, Dict from ..core import SubmitAction, SubmitActionData, TaskFetchSubmitActionData class TaskFetchAction(SubmitAction): + """This class is deprecated. Please use TaskFetchSubmitActionData instead. + This will be removed in version 2.0.0 GA.""" + def __init__(self, value: Dict[str, Any]): + warnings.warn( + "TaskFetchAction is deprecated. Use TaskFetchSubmitActionData instead. " + "This will be removed in version 2.0.0 GA.", + DeprecationWarning, + stacklevel=2, + ) super().__init__() # For task/fetch, the action data actually goes in the SubmitActionData, not with # msteams. msteams simply contains { type: 'task/fetch' } diff --git a/packages/cards/src/microsoft_teams/cards/core.py b/packages/cards/src/microsoft_teams/cards/core.py index 2677ee58..04d3e1e6 100644 --- a/packages/cards/src/microsoft_teams/cards/core.py +++ b/packages/cards/src/microsoft_teams/cards/core.py @@ -1,9 +1,4 @@ -""" -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the MIT License. -""" - -# This file was automatically generated by a tool on 08/20/2025, 10:35 PM UTC. +# This file was automatically generated by a tool on 03/19/2026, 9:27 PM UTC. DO NOT UPDATE MANUALLY. # It includes declarations for Adaptive Card features available in Teams, Copilot, Outlook, Word, Excel, PowerPoint. from typing import Any, Dict, List, Literal, Optional, Self, Union @@ -95,13 +90,13 @@ class ContainerLayout(SerializableObject): ActionMode = Literal["primary", "secondary"] -AssociatedInputs = Literal["auto", "none"] +ThemeName = Literal["Light", "Dark"] -ImageInsertPosition = Literal["Selection", "Top", "Bottom"] +ElementHeight = Literal["auto", "stretch"] -FallbackAction = Literal["drop"] +HorizontalAlignment = Literal["Left", "Center", "Right"] -ContainerStyle = Literal["default", "emphasis", "accent", "good", "attention", "warning"] +Spacing = Literal["None", "ExtraSmall", "Small", "Default", "Medium", "Large", "ExtraLarge", "Padding"] TargetWidth = Literal[ "VeryNarrow", @@ -118,24 +113,14 @@ class ContainerLayout(SerializableObject): "atMost:Wide", ] -HorizontalAlignment = Literal["Left", "Center", "Right"] +ContainerStyle = Literal["default", "emphasis", "accent", "good", "attention", "warning"] VerticalAlignment = Literal["Top", "Center", "Bottom"] FlowLayoutItemFit = Literal["Fit", "Fill"] -Spacing = Literal["None", "ExtraSmall", "Small", "Default", "Medium", "Large", "ExtraLarge", "Padding"] - FillMode = Literal["Cover", "RepeatHorizontally", "RepeatVertically", "Repeat"] -Version = Literal["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6"] - -TeamsCardWidth = Literal["full"] - -MentionType = Literal["Person", "Tag"] - -ElementHeight = Literal["auto", "stretch"] - TextSize = Literal["Small", "Default", "Medium", "Large", "ExtraLarge"] TextWeight = Literal["Lighter", "Default", "Bolder"] @@ -144,14 +129,20 @@ class ContainerLayout(SerializableObject): FontType = Literal["Default", "Monospace"] -StyleEnum = Literal["compact", "expanded", "filtered"] +TextBlockStyle = Literal["default", "columnHeader", "heading"] ImageStyle = Literal["Default", "Person", "RoundedCorners"] Size = Literal["Auto", "Stretch", "Small", "Medium", "Large"] +ImageFitMode = Literal["Cover", "Contain", "Fill"] + InputTextStyle = Literal["Text", "Tel", "Url", "Email", "Password"] +AssociatedInputs = Literal["auto", "none"] + +ChoiceSetInputStyle = Literal["compact", "expanded", "filtered"] + RatingSize = Literal["Medium", "Large"] RatingColor = Literal["Neutral", "Marigold"] @@ -174,7 +165,15 @@ class ContainerLayout(SerializableObject): BadgeStyle = Literal["Default", "Subtle", "Informative", "Accent", "Good", "Attention", "Warning"] -ChartColorSet = Literal["categorical", "sequential", "diverging"] +ProgressRingLabelPosition = Literal["Before", "After", "Above", "Below"] + +ProgressRingSize = Literal["Tiny", "Small", "Medium", "Large"] + +ProgressBarColor = Literal["Accent", "Good", "Warning", "Attention"] + +ChartColorSet = Literal[ + "categorical", "sequential", "sequentialred", "sequentialgreen", "sequentialyellow", "diverging" +] ChartColor = Literal[ "good", @@ -208,8 +207,34 @@ class ContainerLayout(SerializableObject): "divergingRed", "divergingMaroon", "divergingGray", + "sequentialRed1", + "sequentialRed2", + "sequentialRed3", + "sequentialRed4", + "sequentialRed5", + "sequentialRed6", + "sequentialRed7", + "sequentialRed8", + "sequentialGreen1", + "sequentialGreen2", + "sequentialGreen3", + "sequentialGreen4", + "sequentialGreen5", + "sequentialGreen6", + "sequentialGreen7", + "sequentialGreen8", + "sequentialYellow1", + "sequentialYellow2", + "sequentialYellow3", + "sequentialYellow4", + "sequentialYellow5", + "sequentialYellow6", + "sequentialYellow7", + "sequentialYellow8", ] +DonutThickness = Literal["Thin", "Thick"] + HorizontalBarChartDisplayMode = Literal["AbsoluteWithAxis", "AbsoluteNoAxis", "PartToWhole"] GaugeChartValueFormat = Literal["Percentage", "Fraction"] @@ -241,34 +266,90 @@ class ContainerLayout(SerializableObject): "Xml", ] +PersonaIconStyle = Literal["profilePicture", "contactCard", "none"] + +PersonaDisplayStyle = Literal["iconAndName", "iconOnly", "nameOnly"] + FallbackElement = Literal["drop"] ImageSize = Literal["Small", "Medium", "Large"] SizeEnum = Literal["Small", "Default", "Medium", "Large", "ExtraLarge"] -ThemeName = Literal["Light", "Dark"] +PopoverPosition = Literal["Above", "Below", "Before", "After"] + +FallbackAction = Literal["drop"] + +ImageInsertPosition = Literal["Selection", "Top", "Bottom"] + +Version = Literal["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6"] + +TeamsCardWidth = Literal["full"] + +MentionType = Literal["Person", "Tag"] class HostCapabilities(SerializableObject): """Represents a list of versioned capabilities a host application must support.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + +class ThemedUrl(SerializableObject): + """Defines a theme-specific URL.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + theme: Optional[ThemeName] = "Light" + """ The theme this URL applies to. """ + + url: Optional[str] = None + """ The URL to use for the associated theme. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_theme(self, value: ThemeName) -> Self: + self.theme = value + return self + + def with_url(self, value: str) -> Self: + self.url = value + return self + class BackgroundImage(SerializableObject): """Defines a container's background image and the way it should be rendered.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + url: Optional[str] = None """ The URL (or Base64-encoded Data URI) of the image. Acceptable formats are PNG, JPEG, GIF and SVG. """ - fill_mode: Optional[FillMode] = None + fill_mode: Optional[FillMode] = "Cover" """ Controls how the image should fill the area. """ - horizontal_alignment: Optional[HorizontalAlignment] = None + horizontal_alignment: Optional[HorizontalAlignment] = "Left" """ Controls how the image should be aligned if it must be cropped or if using repeat fill mode. """ - vertical_alignment: Optional[VerticalAlignment] = None + vertical_alignment: Optional[VerticalAlignment] = "Top" """ Controls how the image should be aligned if it must be cropped or if using repeat fill mode. """ + themed_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific image URLs. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_url(self, value: str) -> Self: self.url = value return self @@ -285,13 +366,24 @@ def with_vertical_alignment(self, value: VerticalAlignment) -> Self: self.vertical_alignment = value return self + def with_themed_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_urls = value + return self + class SubmitActionData(SerializableObject): """Represents the data of an Action.Submit. This model can include arbitrary data""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + ms_teams: Optional[Dict[str, Any]] = None """ Defines the optional Teams-specific portion of the action's data. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_ms_teams(self, value: Dict[str, Any]) -> Self: self.ms_teams = value return self @@ -305,6 +397,9 @@ def with_data(self, value: Dict[str, Any]) -> Self: class ExecuteAction(Action): """Gathers input values, merges them with the data property if specified, and sends them to the Bot via an Invoke activity. The Bot can respond synchronously and return an updated Adaptive Card to be displayed by the client. Action.Execute works in all Adaptive Card hosts.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Action.Execute"] = "Action.Execute" """ Must be **Action.Execute**. """ @@ -322,10 +417,10 @@ class ExecuteAction(Action): `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](topic:icon-catalog) instead of an image. """ - style: Optional[ActionStyle] = None + style: Optional[ActionStyle] = "default" """ Control the style of the action, affecting its visual and spoken representations. """ - mode: Optional[ActionMode] = None + mode: Optional[ActionMode] = "primary" """ Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. """ tooltip: Optional[str] = None @@ -334,7 +429,13 @@ class ExecuteAction(Action): is_enabled: Optional[bool] = True """ Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state. """ - data: Optional[Union[str, Dict[str, Any], SubmitActionData]] = None + menu_actions: Optional[List[SerializeAsAny[Action]]] = None + """ The actions to display in the overflow menu of a Split action button. """ + + themed_icon_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific icon URLs. """ + + data: Optional[Union[str, SubmitActionData]] = None """ The data to send to the Bot when the action is executed. When expressed as an object, `data` is sent back to the Bot when the action is executed, adorned with the values of the inputs expressed as key/value pairs, where the key is the Id of the input. If `data` is expressed as a string, input values are not sent to the Bot. """ associated_inputs: Optional[AssociatedInputs] = None @@ -349,6 +450,10 @@ class ExecuteAction(Action): fallback: Optional[Union[SerializeAsAny[Action], FallbackAction]] = None """ An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -381,7 +486,15 @@ def with_is_enabled(self, value: bool) -> Self: self.is_enabled = value return self - def with_data(self, value: Union[str, Dict[str, Any], SubmitActionData]) -> Self: + def with_menu_actions(self, value: List[Action]) -> Self: + self.menu_actions = value + return self + + def with_themed_icon_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_icon_urls = value + return self + + def with_data(self, value: Union[str, SubmitActionData]) -> Self: self.data = value return self @@ -405,12 +518,19 @@ def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: class RefreshDefinition(SerializableObject): """Defines how a card can be refreshed by making a request to the target Bot.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + action: Optional[ExecuteAction] = None """ The Action.Execute action to invoke to refresh the card. """ user_ids: Optional[List[str]] = None """ The list of user Ids for which the card will be automatically refreshed. In Teams, in chats or channels with more than 60 users, the card will automatically refresh only for users specified in the userIds list. Other users will have to manually click on a "refresh" button. In contexts with fewer than 60 users, the card will automatically refresh for all users. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_action(self, value: ExecuteAction) -> Self: self.action = value return self @@ -423,6 +543,9 @@ def with_user_ids(self, value: List[str]) -> Self: class AuthCardButton(SerializableObject): """Defines a button as displayed when prompting a user to authenticate. For more information, refer to the [Bot Framework CardAction type](https://docs.microsoft.com/dotnet/api/microsoft.bot.schema.cardaction).""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Optional[str] = None """ Must be **signin**. """ @@ -435,6 +558,10 @@ class AuthCardButton(SerializableObject): value: Optional[str] = None """ The value associated with the button. The meaning of value depends on the button’s type. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_type(self, value: str) -> Self: self.type = value return self @@ -455,6 +582,9 @@ def with_value(self, value: str) -> Self: class TokenExchangeResource(SerializableObject): """Defines information required to enable on-behalf-of single sign-on user authentication. For more information, refer to the [Bot Framework TokenExchangeResource type](https://docs.microsoft.com/dotnet/api/microsoft.bot.schema.tokenexchangeresource)""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + id: Optional[str] = None """ The unique identified of this token exchange instance. """ @@ -464,6 +594,10 @@ class TokenExchangeResource(SerializableObject): provider_id: Optional[str] = None """ An identifier for the identity provider with which to attempt a token exchange. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -480,6 +614,9 @@ def with_provider_id(self, value: str) -> Self: class Authentication(SerializableObject): """Defines authentication information associated with a card. For more information, refer to the [Bot Framework OAuthCard type](https://docs.microsoft.com/dotnet/api/microsoft.bot.schema.oauthcard)""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + text: Optional[str] = None """ The text that can be displayed to the end user when prompting them to authenticate. """ @@ -492,6 +629,10 @@ class Authentication(SerializableObject): token_exchange_resource: Optional[TokenExchangeResource] = None """ Provides information required to enable on-behalf-of single sign-on user authentication. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_text(self, value: str) -> Self: self.text = value return self @@ -512,15 +653,22 @@ def with_token_exchange_resource(self, value: TokenExchangeResource) -> Self: class MentionedEntity(SerializableObject): """Represents a mentioned person or tag.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + id: Optional[str] = None """ The Id of a person (typically a Microsoft Entra user Id) or tag. """ name: Optional[str] = None """ The name of the mentioned entity. """ - mention_type: Optional[MentionType] = None + mention_type: Optional[MentionType] = "Person" """ The type of the mentioned entity. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -537,6 +685,9 @@ def with_mention_type(self, value: MentionType) -> Self: class Mention(SerializableObject): """Represents a mention to a person.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["mention"] = "mention" """ Must be **mention**. """ @@ -546,6 +697,10 @@ class Mention(SerializableObject): mentioned: Optional[MentionedEntity] = None """ Defines the entity being mentioned. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_text(self, value: str) -> Self: self.text = value return self @@ -558,6 +713,9 @@ def with_mentioned(self, value: MentionedEntity) -> Self: class TeamsCardProperties(SerializableObject): """Represents a set of Teams-specific properties on a card.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + width: Optional[TeamsCardWidth] = None """ Controls the width of the card in a Teams chat. @@ -566,6 +724,10 @@ class TeamsCardProperties(SerializableObject): entities: Optional[List[Mention]] = None """ The Teams-specific entities associated with the card. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_width(self, value: TeamsCardWidth) -> Self: self.width = value return self @@ -578,17 +740,70 @@ def with_entities(self, value: List[Mention]) -> Self: class CardMetadata(SerializableObject): """Card-level metadata.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + web_url: Optional[str] = None """ The URL the card originates from. When `webUrl` is set, the card is dubbed an **Adaptive Card-based Loop Component** and, when pasted in Teams or other Loop Component-capable host applications, the URL will unfurl to the same exact card. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_web_url(self, value: str) -> Self: self.web_url = value return self +class StringResource(SerializableObject): + """Defines the replacement string values.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + default_value: Optional[str] = None + """ The default value of the string, which is used when no matching localized value is found. """ + + localized_values: Optional[Dict[str, str]] = None + """ Localized values of the string, where keys represent the locale (e.g. `en-US`) in the `(-)` format. `` is the 2-letter language code and `` is the optional 2-letter country code. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_default_value(self, value: str) -> Self: + self.default_value = value + return self + + def with_localized_values(self, value: Dict[str, str]) -> Self: + self.localized_values = value + return self + + +class Resources(SerializableObject): + """The resources that can be used in the body of the card.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + strings: Optional[Dict[str, StringResource]] = None + """ String resources that can provide translations in multiple languages. String resources make it possible to craft cards that are automatically localized according to the language settings of the application that displays the card. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_strings(self, value: Dict[str, StringResource]) -> Self: + self.strings = value + return self + + class AdaptiveCard(CardElement): """An Adaptive Card, containing a free-form body of card elements, and an optional set of actions.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["AdaptiveCard"] = "AdaptiveCard" """ Must be **AdaptiveCard**. """ @@ -628,7 +843,7 @@ class AdaptiveCard(CardElement): ac_schema: Optional[str] = Field(default=None, alias="schema") """ A URL to the Adaptive Card schema the card is authored against. """ - version: Optional[Version] = None + version: Optional[Version] = "1.5" """ The Adaptive Card schema version the card is authored against. """ fallback_text: Optional[str] = None @@ -649,6 +864,9 @@ class AdaptiveCard(CardElement): metadata: Optional[CardMetadata] = None """ Metadata associated with the card. """ + resources: Optional[Resources] = None + """ Resources card elements can reference. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ @@ -661,6 +879,10 @@ class AdaptiveCard(CardElement): actions: Optional[List[SerializeAsAny[Action]]] = None """ The card level actions, which always appear at the bottom of the card. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -705,7 +927,7 @@ def with_rtl(self, value: bool) -> Self: self.rtl = value return self - def withac_schema(self, value: str) -> Self: + def with_schema(self, value: str) -> Self: self.ac_schema = value return self @@ -737,6 +959,10 @@ def with_metadata(self, value: CardMetadata) -> Self: self.metadata = value return self + def with_resources(self, value: Resources) -> Self: + self.resources = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -754,117 +980,128 @@ def with_actions(self, value: List[Action]) -> Self: return self -class ImBackSubmitActionData(SerializableObject): - """Represents Teams-specific data in an Action.Submit to send an Instant Message back to the Bot.""" +class InsertImageAction(Action): + """Inserts an image into the host application's canvas.""" - type: Literal["imBack"] = "imBack" - """ Must be **imBack**. """ + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ - value: Optional[str] = None - """ The value that will be sent to the Bot. """ + type: Literal["Action.InsertImage"] = "Action.InsertImage" + """ Must be **Action.InsertImage**. """ - def with_value(self, value: str) -> Self: - self.value = value - return self + id: Optional[str] = None + """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ + requires: Optional[HostCapabilities] = Field(default_factory=HostCapabilities) + """ A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided). """ -class InvokeSubmitActionData(SerializableObject): - """Represents Teams-specific data in an Action.Submit to make an Invoke request to the Bot.""" + title: Optional[str] = None + """ The title of the action, as it appears on buttons. """ - type: Literal["invoke"] = "invoke" - """ Must be **invoke**. """ + icon_url: Optional[str] = None + """ A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title. - value: Optional[Dict[str, Any]] = None - """ The object to send to the Bot with the Invoke request. """ +`iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](topic:icon-catalog) instead of an image. """ - def with_value(self, value: Dict[str, Any]) -> Self: - self.value = value - return self + style: Optional[ActionStyle] = "default" + """ Control the style of the action, affecting its visual and spoken representations. """ + mode: Optional[ActionMode] = "primary" + """ Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. """ -class MessageBackSubmitActionData(SerializableObject): - """Represents Teams-specific data in an Action.Submit to send a message back to the Bot.""" + tooltip: Optional[str] = None + """ The tooltip text to display when the action is hovered over. """ - type: Literal["messageBack"] = "messageBack" - """ Must be **messageBack**. """ + is_enabled: Optional[bool] = True + """ Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state. """ - text: Optional[str] = None - """ The text that will be sent to the Bot. """ + menu_actions: Optional[List[SerializeAsAny[Action]]] = None + """ The actions to display in the overflow menu of a Split action button. """ - display_text: Optional[str] = None - """ The optional text that will be displayed as a new message in the conversation, as if the end-user sent it. `displayText` is not sent to the Bot. """ + themed_icon_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific icon URLs. """ - value: Optional[str] = None - """ Optional additional value that will be sent to the Bot. For instance, `value` can encode specific context for the action, such as unique identifiers or a JSON object. """ + url: Optional[str] = None + """ The URL of the image to insert. """ - def with_text(self, value: str) -> Self: - self.text = value + alt_text: Optional[str] = None + """ The alternate text for the image. """ + + insert_position: Optional[ImageInsertPosition] = "Selection" + """ The position at which to insert the image. """ + + fallback: Optional[Union[SerializeAsAny[Action], FallbackAction]] = None + """ An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + + def with_key(self, value: str) -> Self: + self.key = value return self - def with_display_text(self, value: str) -> Self: - self.display_text = value + def with_id(self, value: str) -> Self: + self.id = value return self - def with_value(self, value: str) -> Self: - self.value = value + def with_requires(self, value: HostCapabilities) -> Self: + self.requires = value return self + def with_title(self, value: str) -> Self: + self.title = value + return self -class SigninSubmitActionData(SerializableObject): - """Represents Teams-specific data in an Action.Submit to sign in a user.""" + def with_icon_url(self, value: str) -> Self: + self.icon_url = value + return self - type: Literal["signin"] = "signin" - """ Must be **signin**. """ + def with_style(self, value: ActionStyle) -> Self: + self.style = value + return self - value: Optional[str] = None - """ The URL to redirect the end-user for signing in. """ + def with_mode(self, value: ActionMode) -> Self: + self.mode = value + return self - def with_value(self, value: str) -> Self: - self.value = value + def with_tooltip(self, value: str) -> Self: + self.tooltip = value return self + def with_is_enabled(self, value: bool) -> Self: + self.is_enabled = value + return self -class TaskFetchSubmitActionData(SerializableObject): - """Represents Teams-specific data in an Action.Submit to open a task module.""" + def with_menu_actions(self, value: List[Action]) -> Self: + self.menu_actions = value + return self - type: Literal["task/fetch"] = "task/fetch" - """ Must be **task/fetch**. """ + def with_themed_icon_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_icon_urls = value + return self - value: Optional[Dict[str, Any]] = None - """ The contextual data sent to the Bot to specify which task module to open. """ + def with_url(self, value: str) -> Self: + self.url = value + return self - def with_value(self, value: Dict[str, Any]) -> Self: - self.value = value + def with_alt_text(self, value: str) -> Self: + self.alt_text = value return self + def with_insert_position(self, value: ImageInsertPosition) -> Self: + self.insert_position = value + return self -class TeamsSubmitActionFeedback(SerializableObject): - """Represents feedback options for an [Action.Submit](https://adaptivecards.microsoft.com/?topic=Action.Submit).""" + def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: + self.fallback = value + return self - hide: Optional[bool] = None - """ Defines if a feedback message should be displayed after the action is executed. """ - - def with_hide(self, value: bool) -> Self: - self.hide = value - return self - - -class TeamsSubmitActionProperties(SerializableObject): - """Teams-specific properties associated with the action.""" - - feedback: Optional[TeamsSubmitActionFeedback] = None - """ Defines how feedback is provided to the end-user when the action is executed. """ - - def with_feedback(self, value: TeamsSubmitActionFeedback) -> Self: - self.feedback = value - return self +class OpenUrlAction(Action): + """Opens the provided URL in either a separate browser tab or within the host application.""" -class SubmitAction(Action): - """Gathers input values, merges them with the data property if specified, and sends them to the Bot via an Invoke activity. The Bot can only acknowledge is has received the request.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ - type: Literal["Action.Submit"] = "Action.Submit" - """ Must be **Action.Submit**. """ + type: Literal["Action.OpenUrl"] = "Action.OpenUrl" + """ Must be **Action.OpenUrl**. """ id: Optional[str] = None """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ @@ -880,10 +1117,10 @@ class SubmitAction(Action): `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](topic:icon-catalog) instead of an image. """ - style: Optional[ActionStyle] = None + style: Optional[ActionStyle] = "default" """ Control the style of the action, affecting its visual and spoken representations. """ - mode: Optional[ActionMode] = None + mode: Optional[ActionMode] = "primary" """ Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. """ tooltip: Optional[str] = None @@ -892,21 +1129,22 @@ class SubmitAction(Action): is_enabled: Optional[bool] = True """ Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state. """ - data: Optional[Union[str, SubmitActionData]] = None - """ The data to send to the Bot when the action is executed. When expressed as an object, `data` is sent back to the Bot when the action is executed, adorned with the values of the inputs expressed as key/value pairs, where the key is the Id of the input. If `data` is expressed as a string, input values are not sent to the Bot. """ - - associated_inputs: Optional[AssociatedInputs] = None - """ The Ids of the inputs associated with the Action.Submit. When the action is executed, the values of the associated inputs are sent to the Bot. See [Input validation](topic:input-validation) for more details. """ + menu_actions: Optional[List[SerializeAsAny[Action]]] = None + """ The actions to display in the overflow menu of a Split action button. """ - conditionally_enabled: Optional[bool] = None - """ Controls if the action is enabled only if at least one required input has been filled by the user. """ + themed_icon_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific icon URLs. """ - ms_teams: Optional[TeamsSubmitActionProperties] = None - """ Teams-specific metadata associated with the action. """ + url: Optional[str] = None + """ The URL to open. """ fallback: Optional[Union[SerializeAsAny[Action], FallbackAction]] = None """ An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -939,20 +1177,16 @@ def with_is_enabled(self, value: bool) -> Self: self.is_enabled = value return self - def with_data(self, value: Union[str, SubmitActionData]) -> Self: - self.data = value - return self - - def with_associated_inputs(self, value: AssociatedInputs) -> Self: - self.associated_inputs = value + def with_menu_actions(self, value: List[Action]) -> Self: + self.menu_actions = value return self - def with_conditionally_enabled(self, value: bool) -> Self: - self.conditionally_enabled = value + def with_themed_icon_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_icon_urls = value return self - def with_ms_teams(self, value: TeamsSubmitActionProperties) -> Self: - self.ms_teams = value + def with_url(self, value: str) -> Self: + self.url = value return self def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: @@ -960,11 +1194,14 @@ def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: return self -class OpenUrlAction(Action): - """Opens the provided URL in either a separate browser tab or within the host application.""" +class OpenUrlDialogAction(Action): + """Opens a task module in a modal dialog hosting the content at a provided URL.""" - type: Literal["Action.OpenUrl"] = "Action.OpenUrl" - """ Must be **Action.OpenUrl**. """ + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["Action.OpenUrlDialog"] = "Action.OpenUrlDialog" + """ Must be **Action.OpenUrlDialog**. """ id: Optional[str] = None """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ @@ -980,10 +1217,10 @@ class OpenUrlAction(Action): `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](topic:icon-catalog) instead of an image. """ - style: Optional[ActionStyle] = None + style: Optional[ActionStyle] = "default" """ Control the style of the action, affecting its visual and spoken representations. """ - mode: Optional[ActionMode] = None + mode: Optional[ActionMode] = "primary" """ Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. """ tooltip: Optional[str] = None @@ -992,12 +1229,31 @@ class OpenUrlAction(Action): is_enabled: Optional[bool] = True """ Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state. """ + menu_actions: Optional[List[SerializeAsAny[Action]]] = None + """ The actions to display in the overflow menu of a Split action button. """ + + themed_icon_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific icon URLs. """ + + dialog_title: Optional[str] = None + """ The title of the dialog to be displayed in the dialog header. """ + + dialog_height: Optional[str] = None + """ The height of the dialog. To define height as a number of pixels, use the px format. """ + + dialog_width: Optional[str] = None + """ The width of the dialog. To define width as a number of pixels, use the px format. """ + url: Optional[str] = None """ The URL to open. """ fallback: Optional[Union[SerializeAsAny[Action], FallbackAction]] = None """ An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -1030,38 +1286,43 @@ def with_is_enabled(self, value: bool) -> Self: self.is_enabled = value return self - def with_url(self, value: str) -> Self: - self.url = value + def with_menu_actions(self, value: List[Action]) -> Self: + self.menu_actions = value return self - def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: - self.fallback = value + def with_themed_icon_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_icon_urls = value return self + def with_dialog_title(self, value: str) -> Self: + self.dialog_title = value + return self -class TargetElement(SerializableObject): - """Defines a target element in an Action.ToggleVisibility.""" - - element_id: Optional[str] = None - """ The Id of the element to change the visibility of. """ + def with_dialog_height(self, value: str) -> Self: + self.dialog_height = value + return self - is_visible: Optional[bool] = None - """ The new visibility state of the element. """ + def with_dialog_width(self, value: str) -> Self: + self.dialog_width = value + return self - def with_element_id(self, value: str) -> Self: - self.element_id = value + def with_url(self, value: str) -> Self: + self.url = value return self - def with_is_visible(self, value: bool) -> Self: - self.is_visible = value + def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: + self.fallback = value return self -class ToggleVisibilityAction(Action): - """Toggles the visibility of a set of elements. Action.ToggleVisibility is useful for creating "Show more" type UI patterns.""" +class ResetInputsAction(Action): + """Resets the values of the inputs in the card.""" - type: Literal["Action.ToggleVisibility"] = "Action.ToggleVisibility" - """ Must be **Action.ToggleVisibility**. """ + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["Action.ResetInputs"] = "Action.ResetInputs" + """ Must be **Action.ResetInputs**. """ id: Optional[str] = None """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ @@ -1077,10 +1338,10 @@ class ToggleVisibilityAction(Action): `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](topic:icon-catalog) instead of an image. """ - style: Optional[ActionStyle] = None + style: Optional[ActionStyle] = "default" """ Control the style of the action, affecting its visual and spoken representations. """ - mode: Optional[ActionMode] = None + mode: Optional[ActionMode] = "primary" """ Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. """ tooltip: Optional[str] = None @@ -1089,12 +1350,22 @@ class ToggleVisibilityAction(Action): is_enabled: Optional[bool] = True """ Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state. """ - target_elements: Optional[Union[List[str], List[TargetElement]]] = None - """ The Ids of the elements to toggle the visibility of. """ + menu_actions: Optional[List[SerializeAsAny[Action]]] = None + """ The actions to display in the overflow menu of a Split action button. """ + + themed_icon_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific icon URLs. """ + + target_input_ids: Optional[List[str]] = None + """ The Ids of the inputs that should be reset. """ fallback: Optional[Union[SerializeAsAny[Action], FallbackAction]] = None """ An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -1127,8 +1398,16 @@ def with_is_enabled(self, value: bool) -> Self: self.is_enabled = value return self - def with_target_elements(self, value: Union[List[str], List[TargetElement]]) -> Self: - self.target_elements = value + def with_menu_actions(self, value: List[Action]) -> Self: + self.menu_actions = value + return self + + def with_themed_icon_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_icon_urls = value + return self + + def with_target_input_ids(self, value: List[str]) -> Self: + self.target_input_ids = value return self def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: @@ -1136,11 +1415,50 @@ def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: return self -class ShowCardAction(Action): - """Expands or collapses an embedded card within the main card.""" +class TeamsSubmitActionFeedback(SerializableObject): + """Represents feedback options for an [Action.Submit](https://adaptivecards.microsoft.com/?topic=Action.Submit).""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + hide: Optional[bool] = None + """ Defines if a feedback message should be displayed after the action is executed. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_hide(self, value: bool) -> Self: + self.hide = value + return self + + +class TeamsSubmitActionProperties(SerializableObject): + """Teams-specific properties associated with the action.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + feedback: Optional[TeamsSubmitActionFeedback] = None + """ Defines how feedback is provided to the end-user when the action is executed. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_feedback(self, value: TeamsSubmitActionFeedback) -> Self: + self.feedback = value + return self - type: Literal["Action.ShowCard"] = "Action.ShowCard" - """ Must be **Action.ShowCard**. """ + +class SubmitAction(Action): + """Gathers input values, merges them with the data property if specified, and sends them to the Bot via an Invoke activity. The Bot can only acknowledge is has received the request.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["Action.Submit"] = "Action.Submit" + """ Must be **Action.Submit**. """ id: Optional[str] = None """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ @@ -1156,10 +1474,10 @@ class ShowCardAction(Action): `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](topic:icon-catalog) instead of an image. """ - style: Optional[ActionStyle] = None + style: Optional[ActionStyle] = "default" """ Control the style of the action, affecting its visual and spoken representations. """ - mode: Optional[ActionMode] = None + mode: Optional[ActionMode] = "primary" """ Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. """ tooltip: Optional[str] = None @@ -1168,11 +1486,30 @@ class ShowCardAction(Action): is_enabled: Optional[bool] = True """ Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state. """ + menu_actions: Optional[List[SerializeAsAny[Action]]] = None + """ The actions to display in the overflow menu of a Split action button. """ + + themed_icon_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific icon URLs. """ + + data: Optional[Union[str, SubmitActionData]] = None + """ The data to send to the Bot when the action is executed. When expressed as an object, `data` is sent back to the Bot when the action is executed, adorned with the values of the inputs expressed as key/value pairs, where the key is the Id of the input. If `data` is expressed as a string, input values are not sent to the Bot. """ + + associated_inputs: Optional[AssociatedInputs] = None + """ The Ids of the inputs associated with the Action.Submit. When the action is executed, the values of the associated inputs are sent to the Bot. See [Input validation](topic:input-validation) for more details. """ + + conditionally_enabled: Optional[bool] = None + """ Controls if the action is enabled only if at least one required input has been filled by the user. """ + + ms_teams: Optional[TeamsSubmitActionProperties] = None + """ Teams-specific metadata associated with the action. """ + fallback: Optional[Union[SerializeAsAny[Action], FallbackAction]] = None """ An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ - card: Optional[AdaptiveCard] = None - """ The card that should be displayed when the action is executed. """ + def with_key(self, value: str) -> Self: + self.key = value + return self def with_id(self, value: str) -> Self: self.id = value @@ -1206,20 +1543,61 @@ def with_is_enabled(self, value: bool) -> Self: self.is_enabled = value return self + def with_menu_actions(self, value: List[Action]) -> Self: + self.menu_actions = value + return self + + def with_themed_icon_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_icon_urls = value + return self + + def with_data(self, value: Union[str, SubmitActionData]) -> Self: + self.data = value + return self + + def with_associated_inputs(self, value: AssociatedInputs) -> Self: + self.associated_inputs = value + return self + + def with_conditionally_enabled(self, value: bool) -> Self: + self.conditionally_enabled = value + return self + + def with_ms_teams(self, value: TeamsSubmitActionProperties) -> Self: + self.ms_teams = value + return self + def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: self.fallback = value return self - def with_card(self, value: AdaptiveCard) -> Self: - self.card = value + +class TargetElement(SerializableObject): + """Defines a target element in an Action.ToggleVisibility.""" + + element_id: Optional[str] = None + """ The Id of the element to change the visibility of. """ + + is_visible: Optional[bool] = None + """ The new visibility state of the element. """ + + def with_element_id(self, value: str) -> Self: + self.element_id = value return self + def with_is_visible(self, value: bool) -> Self: + self.is_visible = value + return self -class ResetInputsAction(Action): - """Resets the values of the inputs in the card.""" - type: Literal["Action.ResetInputs"] = "Action.ResetInputs" - """ Must be **Action.ResetInputs**. """ +class ToggleVisibilityAction(Action): + """Toggles the visibility of a set of elements. Action.ToggleVisibility is useful for creating "Show more" type UI patterns.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["Action.ToggleVisibility"] = "Action.ToggleVisibility" + """ Must be **Action.ToggleVisibility**. """ id: Optional[str] = None """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ @@ -1235,10 +1613,10 @@ class ResetInputsAction(Action): `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](topic:icon-catalog) instead of an image. """ - style: Optional[ActionStyle] = None + style: Optional[ActionStyle] = "default" """ Control the style of the action, affecting its visual and spoken representations. """ - mode: Optional[ActionMode] = None + mode: Optional[ActionMode] = "primary" """ Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. """ tooltip: Optional[str] = None @@ -1247,12 +1625,22 @@ class ResetInputsAction(Action): is_enabled: Optional[bool] = True """ Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state. """ - target_input_ids: Optional[List[str]] = None - """ The Ids of the inputs that should be reset. """ + menu_actions: Optional[List[SerializeAsAny[Action]]] = None + """ The actions to display in the overflow menu of a Split action button. """ + + themed_icon_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific icon URLs. """ + + target_elements: Optional[Union[List[str], List[TargetElement]]] = None + """ The Ids of the elements to toggle the visibility of. """ fallback: Optional[Union[SerializeAsAny[Action], FallbackAction]] = None """ An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -1285,8 +1673,16 @@ def with_is_enabled(self, value: bool) -> Self: self.is_enabled = value return self - def with_target_input_ids(self, value: List[str]) -> Self: - self.target_input_ids = value + def with_menu_actions(self, value: List[Action]) -> Self: + self.menu_actions = value + return self + + def with_themed_icon_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_icon_urls = value + return self + + def with_target_elements(self, value: Union[List[str], List[TargetElement]]) -> Self: + self.target_elements = value return self def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: @@ -1294,11 +1690,14 @@ def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: return self -class InsertImageAction(Action): - """Inserts an image into the host application's canvas.""" +class ShowCardAction(Action): + """Expands or collapses an embedded card within the main card.""" - type: Literal["Action.InsertImage"] = "Action.InsertImage" - """ Must be **Action.InsertImage**. """ + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["Action.ShowCard"] = "Action.ShowCard" + """ Must be **Action.ShowCard**. """ id: Optional[str] = None """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ @@ -1314,10 +1713,10 @@ class InsertImageAction(Action): `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](topic:icon-catalog) instead of an image. """ - style: Optional[ActionStyle] = None + style: Optional[ActionStyle] = "default" """ Control the style of the action, affecting its visual and spoken representations. """ - mode: Optional[ActionMode] = None + mode: Optional[ActionMode] = "primary" """ Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. """ tooltip: Optional[str] = None @@ -1326,18 +1725,22 @@ class InsertImageAction(Action): is_enabled: Optional[bool] = True """ Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state. """ - url: Optional[str] = None - """ The URL of the image to insert. """ - - alt_text: Optional[str] = None - """ The alternate text for the image. """ + menu_actions: Optional[List[SerializeAsAny[Action]]] = None + """ The actions to display in the overflow menu of a Split action button. """ - insert_position: Optional[ImageInsertPosition] = None - """ The position at which to insert the image. """ + themed_icon_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific icon URLs. """ fallback: Optional[Union[SerializeAsAny[Action], FallbackAction]] = None """ An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + card: Optional[AdaptiveCard] = None + """ The card that should be displayed when the action is executed. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -1370,191 +1773,248 @@ def with_is_enabled(self, value: bool) -> Self: self.is_enabled = value return self - def with_url(self, value: str) -> Self: - self.url = value - return self - - def with_alt_text(self, value: str) -> Self: - self.alt_text = value + def with_menu_actions(self, value: List[Action]) -> Self: + self.menu_actions = value return self - def with_insert_position(self, value: ImageInsertPosition) -> Self: - self.insert_position = value + def with_themed_icon_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_icon_urls = value return self def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: self.fallback = value return self + def with_card(self, value: AdaptiveCard) -> Self: + self.card = value + return self -class StackLayout(ContainerLayout): - """A layout that stacks elements on top of each other. Layout.Stack is the default layout used by AdaptiveCard and all containers.""" - type: Literal["Layout.Stack"] = "Layout.Stack" - """ Must be **Layout.Stack**. """ +class PopoverAction(Action): + """Shows a popover to display more information to the user.""" - target_width: Optional[TargetWidth] = None - """ Controls for which card width the layout should be used. """ + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ - def with_target_width(self, value: TargetWidth) -> Self: - self.target_width = value - return self + type: Literal["Action.Popover"] = "Action.Popover" + """ Must be **Action.Popover**. """ + id: Optional[str] = None + """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ -class FlowLayout(ContainerLayout): - """A layout that spreads elements horizontally and wraps them across multiple rows, as needed.""" + requires: Optional[HostCapabilities] = Field(default_factory=HostCapabilities) + """ A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided). """ - type: Literal["Layout.Flow"] = "Layout.Flow" - """ Must be **Layout.Flow**. """ + title: Optional[str] = None + """ The title of the action, as it appears on buttons. """ - target_width: Optional[TargetWidth] = None - """ Controls for which card width the layout should be used. """ + icon_url: Optional[str] = None + """ A URL (or Base64-encoded Data URI) to a PNG, GIF, JPEG or SVG image to be displayed on the left of the action's title. - horizontal_items_alignment: Optional[HorizontalAlignment] = None - """ Controls how the content of the container should be horizontally aligned. """ +`iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](topic:icon-catalog) instead of an image. """ - vertical_items_alignment: Optional[VerticalAlignment] = None - """ Controls how the content of the container should be vertically aligned. """ + style: Optional[ActionStyle] = "default" + """ Control the style of the action, affecting its visual and spoken representations. """ - item_fit: Optional[FlowLayoutItemFit] = None - """ Controls how item should fit inside the container. """ + mode: Optional[ActionMode] = "primary" + """ Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. """ - min_item_width: Optional[str] = None - """ The minimum width, in pixels, of each item, in the `px` format. Should not be used if itemWidth is set. """ + tooltip: Optional[str] = None + """ The tooltip text to display when the action is hovered over. """ - max_item_width: Optional[str] = None - """ The maximum width, in pixels, of each item, in the `px` format. Should not be used if itemWidth is set. """ + is_enabled: Optional[bool] = True + """ Controls the enabled state of the action. A disabled action cannot be clicked. If the action is represented as a button, the button's style will reflect this state. """ - item_width: Optional[str] = None - """ The width, in pixels, of each item, in the `px` format. Should not be used if maxItemWidth and/or minItemWidth are set. """ + themed_icon_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific icon URLs. """ - column_spacing: Optional[Spacing] = None - """ The space between items. """ + content: Optional[CardElement] = None + """ The content of the popover, which can be any element. """ - row_spacing: Optional[Spacing] = None - """ The space between rows of items. """ + display_arrow: Optional[bool] = True + """ Controls if an arrow should be displayed towards the element that triggered the popover. """ - def with_target_width(self, value: TargetWidth) -> Self: - self.target_width = value + position: Optional[PopoverPosition] = "Above" + """ Controls where the popover should be displayed with regards to the element that triggered it. """ + + max_popover_width: Optional[str] = None + """ The maximum width of the popover in pixels, in the `px` format """ + + fallback: Optional[Union[SerializeAsAny[Action], FallbackAction]] = None + """ An alternate action to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + + def with_key(self, value: str) -> Self: + self.key = value return self - def with_horizontal_items_alignment(self, value: HorizontalAlignment) -> Self: - self.horizontal_items_alignment = value + def with_id(self, value: str) -> Self: + self.id = value return self - def with_vertical_items_alignment(self, value: VerticalAlignment) -> Self: - self.vertical_items_alignment = value + def with_requires(self, value: HostCapabilities) -> Self: + self.requires = value return self - def with_item_fit(self, value: FlowLayoutItemFit) -> Self: - self.item_fit = value + def with_title(self, value: str) -> Self: + self.title = value return self - def with_min_item_width(self, value: str) -> Self: - self.min_item_width = value + def with_icon_url(self, value: str) -> Self: + self.icon_url = value return self - def with_max_item_width(self, value: str) -> Self: - self.max_item_width = value + def with_style(self, value: ActionStyle) -> Self: + self.style = value return self - def with_item_width(self, value: str) -> Self: - self.item_width = value + def with_mode(self, value: ActionMode) -> Self: + self.mode = value return self - def with_column_spacing(self, value: Spacing) -> Self: - self.column_spacing = value + def with_tooltip(self, value: str) -> Self: + self.tooltip = value return self - def with_row_spacing(self, value: Spacing) -> Self: - self.row_spacing = value + def with_is_enabled(self, value: bool) -> Self: + self.is_enabled = value return self + def with_themed_icon_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_icon_urls = value + return self -class GridArea(SerializableObject): - """Defines an area in a Layout.AreaGrid layout.""" + def with_content(self, value: CardElement) -> Self: + self.content = value + return self - name: Optional[str] = None - """ The name of the area. To place an element in this area, set its `grid.area` property to match the name of the area. """ + def with_display_arrow(self, value: bool) -> Self: + self.display_arrow = value + return self - column: Optional[float] = 1 - """ The start column index of the area. Column indices start at 1. """ + def with_position(self, value: PopoverPosition) -> Self: + self.position = value + return self - column_span: Optional[float] = 1 - """ Defines how many columns the area should span. """ + def with_max_popover_width(self, value: str) -> Self: + self.max_popover_width = value + return self - row: Optional[float] = 1 - """ The start row index of the area. Row indices start at 1. """ + def with_fallback(self, value: Union[Action, FallbackAction]) -> Self: + self.fallback = value + return self - row_span: Optional[float] = 1 - """ Defines how many rows the area should span. """ - def with_name(self, value: str) -> Self: - self.name = value - return self +class ActionSet(CardElement): + """Displays a set of action, which can be placed anywhere in the card.""" - def with_column(self, value: float) -> Self: - self.column = value - return self + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ - def with_column_span(self, value: float) -> Self: - self.column_span = value - return self + type: Literal["ActionSet"] = "ActionSet" + """ Must be **ActionSet**. """ - def with_row(self, value: float) -> Self: - self.row = value - return self + id: Optional[str] = None + """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ - def with_row_span(self, value: float) -> Self: - self.row_span = value - return self + requires: Optional[HostCapabilities] = Field(default_factory=HostCapabilities) + """ A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided). """ + lang: Optional[str] = None + """ The locale associated with the element. """ -class AreaGridLayout(ContainerLayout): - """A layout that divides a container into named areas into which elements can be placed.""" + is_visible: Optional[bool] = True + """ Controls the visibility of the element. """ - type: Literal["Layout.AreaGrid"] = "Layout.AreaGrid" - """ Must be **Layout.AreaGrid**. """ + separator: Optional[bool] = None + """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ + + height: Optional[ElementHeight] = "auto" + """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ + + horizontal_alignment: Optional[HorizontalAlignment] = None + """ Controls how the element should be horizontally aligned. """ + + spacing: Optional[Spacing] = "Default" + """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None - """ Controls for which card width the layout should be used. """ + """ Controls for which card width the element should be displayed. If targetWidth isn't specified, the element is rendered at all card widths. Using targetWidth makes it possible to author responsive cards that adapt their layout to the available horizontal space. For more details, see [Responsive layout](topic:responsive-layout). """ - columns: Optional[Union[List[float], List[str]]] = None - """ The columns in the grid layout, defined as a percentage of the available width or in pixels using the `px` format. """ + is_sort_key: Optional[bool] = None + """ Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. """ - areas: Optional[List[GridArea]] = None - """ The areas in the grid layout. """ + grid_area: Optional[str] = None + """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ - column_spacing: Optional[Spacing] = None - """ The space between columns. """ + fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None + """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ - row_spacing: Optional[Spacing] = None - """ The space between rows. """ + actions: Optional[List[SerializeAsAny[Action]]] = None + """ The actions in the set. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_id(self, value: str) -> Self: + self.id = value + return self + + def with_requires(self, value: HostCapabilities) -> Self: + self.requires = value + return self + + def with_lang(self, value: str) -> Self: + self.lang = value + return self + + def with_is_visible(self, value: bool) -> Self: + self.is_visible = value + return self + + def with_separator(self, value: bool) -> Self: + self.separator = value + return self + + def with_height(self, value: ElementHeight) -> Self: + self.height = value + return self + + def with_horizontal_alignment(self, value: HorizontalAlignment) -> Self: + self.horizontal_alignment = value + return self + + def with_spacing(self, value: Spacing) -> Self: + self.spacing = value + return self def with_target_width(self, value: TargetWidth) -> Self: self.target_width = value return self - def with_columns(self, value: Union[List[float], List[str]]) -> Self: - self.columns = value + def with_is_sort_key(self, value: bool) -> Self: + self.is_sort_key = value return self - def with_areas(self, value: List[GridArea]) -> Self: - self.areas = value + def with_grid_area(self, value: str) -> Self: + self.grid_area = value return self - def with_column_spacing(self, value: Spacing) -> Self: - self.column_spacing = value + def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: + self.fallback = value return self - def with_row_spacing(self, value: Spacing) -> Self: - self.row_spacing = value + def with_actions(self, value: List[Action]) -> Self: + self.actions = value return self class Container(CardElement): """A container for other elements. Use containers for styling purposes and/or to logically group a set of elements together, which can be especially useful when used with Action.ToggleVisibility.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Container"] = "Container" """ Must be **Container**. """ @@ -1573,13 +2033,13 @@ class Container(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -1630,6 +2090,10 @@ class Container(CardElement): items: Optional[List[SerializeAsAny[CardElement]]] = None """ The elements in the container. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -1727,107 +2191,205 @@ def with_items(self, value: List[CardElement]) -> Self: return self -class ActionSet(CardElement): - """Displays a set of action, which can be placed anywhere in the card.""" +class StackLayout(ContainerLayout): + """A layout that stacks elements on top of each other. Layout.Stack is the default layout used by AdaptiveCard and all containers.""" - type: Literal["ActionSet"] = "ActionSet" - """ Must be **ActionSet**. """ + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ - id: Optional[str] = None - """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ + type: Literal["Layout.Stack"] = "Layout.Stack" + """ Must be **Layout.Stack**. """ - requires: Optional[HostCapabilities] = Field(default_factory=HostCapabilities) - """ A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided). """ + target_width: Optional[TargetWidth] = None + """ Controls for which card width the layout should be used. """ - lang: Optional[str] = None - """ The locale associated with the element. """ + def with_key(self, value: str) -> Self: + self.key = value + return self - is_visible: Optional[bool] = True - """ Controls the visibility of the element. """ + def with_target_width(self, value: TargetWidth) -> Self: + self.target_width = value + return self - separator: Optional[bool] = None - """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None - """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ +class FlowLayout(ContainerLayout): + """A layout that spreads elements horizontally and wraps them across multiple rows, as needed.""" - horizontal_alignment: Optional[HorizontalAlignment] = None - """ Controls how the element should be horizontally aligned. """ + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ - spacing: Optional[Spacing] = None - """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ + type: Literal["Layout.Flow"] = "Layout.Flow" + """ Must be **Layout.Flow**. """ target_width: Optional[TargetWidth] = None - """ Controls for which card width the element should be displayed. If targetWidth isn't specified, the element is rendered at all card widths. Using targetWidth makes it possible to author responsive cards that adapt their layout to the available horizontal space. For more details, see [Responsive layout](topic:responsive-layout). """ + """ Controls for which card width the layout should be used. """ - is_sort_key: Optional[bool] = None - """ Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. """ + horizontal_items_alignment: Optional[HorizontalAlignment] = "Center" + """ Controls how the content of the container should be horizontally aligned. """ - grid_area: Optional[str] = None - """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ + vertical_items_alignment: Optional[VerticalAlignment] = "Top" + """ Controls how the content of the container should be vertically aligned. """ - fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None - """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + item_fit: Optional[FlowLayoutItemFit] = "Fit" + """ Controls how item should fit inside the container. """ - actions: Optional[List[SerializeAsAny[Action]]] = None - """ The actions in the set. """ + min_item_width: Optional[str] = None + """ The minimum width, in pixels, of each item, in the `px` format. Should not be used if itemWidth is set. """ - def with_id(self, value: str) -> Self: - self.id = value + max_item_width: Optional[str] = None + """ The maximum width, in pixels, of each item, in the `px` format. Should not be used if itemWidth is set. """ + + item_width: Optional[str] = None + """ The width, in pixels, of each item, in the `px` format. Should not be used if maxItemWidth and/or minItemWidth are set. """ + + column_spacing: Optional[Spacing] = "Default" + """ The space between items. """ + + row_spacing: Optional[Spacing] = "Default" + """ The space between rows of items. """ + + def with_key(self, value: str) -> Self: + self.key = value return self - def with_requires(self, value: HostCapabilities) -> Self: - self.requires = value + def with_target_width(self, value: TargetWidth) -> Self: + self.target_width = value return self - def with_lang(self, value: str) -> Self: - self.lang = value + def with_horizontal_items_alignment(self, value: HorizontalAlignment) -> Self: + self.horizontal_items_alignment = value return self - def with_is_visible(self, value: bool) -> Self: - self.is_visible = value + def with_vertical_items_alignment(self, value: VerticalAlignment) -> Self: + self.vertical_items_alignment = value return self - def with_separator(self, value: bool) -> Self: - self.separator = value + def with_item_fit(self, value: FlowLayoutItemFit) -> Self: + self.item_fit = value return self - def with_height(self, value: ElementHeight) -> Self: - self.height = value + def with_min_item_width(self, value: str) -> Self: + self.min_item_width = value return self - def with_horizontal_alignment(self, value: HorizontalAlignment) -> Self: - self.horizontal_alignment = value + def with_max_item_width(self, value: str) -> Self: + self.max_item_width = value return self - def with_spacing(self, value: Spacing) -> Self: - self.spacing = value + def with_item_width(self, value: str) -> Self: + self.item_width = value + return self + + def with_column_spacing(self, value: Spacing) -> Self: + self.column_spacing = value + return self + + def with_row_spacing(self, value: Spacing) -> Self: + self.row_spacing = value + return self + + +class GridArea(SerializableObject): + """Defines an area in a Layout.AreaGrid layout.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + name: Optional[str] = None + """ The name of the area. To place an element in this area, set its `grid.area` property to match the name of the area. """ + + column: Optional[float] = 1 + """ The start column index of the area. Column indices start at 1. """ + + column_span: Optional[float] = 1 + """ Defines how many columns the area should span. """ + + row: Optional[float] = 1 + """ The start row index of the area. Row indices start at 1. """ + + row_span: Optional[float] = 1 + """ Defines how many rows the area should span. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_name(self, value: str) -> Self: + self.name = value + return self + + def with_column(self, value: float) -> Self: + self.column = value + return self + + def with_column_span(self, value: float) -> Self: + self.column_span = value + return self + + def with_row(self, value: float) -> Self: + self.row = value + return self + + def with_row_span(self, value: float) -> Self: + self.row_span = value + return self + + +class AreaGridLayout(ContainerLayout): + """A layout that divides a container into named areas into which elements can be placed.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["Layout.AreaGrid"] = "Layout.AreaGrid" + """ Must be **Layout.AreaGrid**. """ + + target_width: Optional[TargetWidth] = None + """ Controls for which card width the layout should be used. """ + + columns: Optional[Union[List[float], List[str]]] = None + """ The columns in the grid layout, defined as a percentage of the available width or in pixels using the `px` format. """ + + areas: Optional[List[GridArea]] = None + """ The areas in the grid layout. """ + + column_spacing: Optional[Spacing] = "Default" + """ The space between columns. """ + + row_spacing: Optional[Spacing] = "Default" + """ The space between rows. """ + + def with_key(self, value: str) -> Self: + self.key = value return self def with_target_width(self, value: TargetWidth) -> Self: self.target_width = value return self - def with_is_sort_key(self, value: bool) -> Self: - self.is_sort_key = value + def with_columns(self, value: Union[List[float], List[str]]) -> Self: + self.columns = value return self - def with_grid_area(self, value: str) -> Self: - self.grid_area = value + def with_areas(self, value: List[GridArea]) -> Self: + self.areas = value return self - def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: - self.fallback = value + def with_column_spacing(self, value: Spacing) -> Self: + self.column_spacing = value return self - def with_actions(self, value: List[Action]) -> Self: - self.actions = value + def with_row_spacing(self, value: Spacing) -> Self: + self.row_spacing = value return self class Column(CardElement): """A column in a ColumnSet element.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Column"] = "Column" """ Optional. If specified, must be **Column**. """ @@ -1846,13 +2408,13 @@ class Column(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -1894,7 +2456,7 @@ class Column(CardElement): max_height: Optional[str] = None """ The maximum height, in pixels, of the container, in the `px` format. When the content of a container exceeds the container's maximum height, a vertical scrollbar is displayed. """ - width: Optional[Union[str, float]] = "stretch" + width: Optional[Union[str, float]] = None """ The width of the column. If expressed as a number, represents the relative weight of the column in the set. If expressed as a string, `auto` will automatically adjust the column's width according to its content, `stretch` will make the column use the remaining horizontal space (shared with other columns with width set to `stretch`) and using the `px` format will give the column an explicit width in pixels. """ grid_area: Optional[str] = None @@ -1906,6 +2468,10 @@ class Column(CardElement): items: Optional[List[SerializeAsAny[CardElement]]] = None """ The elements in the column. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -2010,6 +2576,9 @@ def with_items(self, value: List[CardElement]) -> Self: class ColumnSet(CardElement): """Splits the available horizontal space into separate columns, so elements can be organized in a row.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["ColumnSet"] = "ColumnSet" """ Must be **ColumnSet**. """ @@ -2028,13 +2597,13 @@ class ColumnSet(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -2061,6 +2630,9 @@ class ColumnSet(CardElement): min_height: Optional[str] = None """ The minimum height, in pixels, of the container, in the `px` format. """ + min_width: Optional[str] = None + """ The minimum width of the column set. `auto` will automatically adjust the column set's minimum width according to its content and using the `px` format will give the column set an explicit minimum width in pixels. A scrollbar will be displayed if the available width is less than the specified minimum width. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ @@ -2070,6 +2642,10 @@ class ColumnSet(CardElement): columns: Optional[List[Column]] = None """ The columns in the set. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -2134,6 +2710,10 @@ def with_min_height(self, value: str) -> Self: self.min_height = value return self + def with_min_width(self, value: str) -> Self: + self.min_width = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -2150,12 +2730,19 @@ def with_columns(self, value: List[Column]) -> Self: class MediaSource(SerializableObject): """Defines the source URL of a media stream. YouTube, Dailymotion, Vimeo and Microsoft Stream URLs are supported.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + mime_type: Optional[str] = None """ The MIME type of the source. """ url: Optional[str] = None """ The URL of the source. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_mime_type(self, value: str) -> Self: self.mime_type = value return self @@ -2168,6 +2755,9 @@ def with_url(self, value: str) -> Self: class CaptionSource(SerializableObject): """Defines a source URL for a video captions.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + mime_type: Optional[str] = None """ The MIME type of the source. """ @@ -2177,6 +2767,10 @@ class CaptionSource(SerializableObject): label: Optional[str] = None """ The label of this caption source. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_mime_type(self, value: str) -> Self: self.mime_type = value return self @@ -2193,6 +2787,9 @@ def with_label(self, value: str) -> Self: class Media(CardElement): """A media element, that makes it possible to embed videos inside a card.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Media"] = "Media" """ Must be **Media**. """ @@ -2211,10 +2808,10 @@ class Media(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -2241,6 +2838,10 @@ class Media(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -2305,6 +2906,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class RichTextBlock(CardElement): """A rich text block that displays formatted text.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["RichTextBlock"] = "RichTextBlock" """ Must be **RichTextBlock**. """ @@ -2323,13 +2927,13 @@ class RichTextBlock(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -2338,6 +2942,9 @@ class RichTextBlock(CardElement): is_sort_key: Optional[bool] = None """ Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. """ + label_for: Optional[str] = None + """ The Id of the input the RichTextBlock should act as the label of. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ @@ -2347,6 +2954,10 @@ class RichTextBlock(CardElement): inlines: Optional[Union[List[SerializeAsAny[CardElement]], List[str]]] = None """ The inlines making up the rich text block. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -2387,6 +2998,10 @@ def with_is_sort_key(self, value: bool) -> Self: self.is_sort_key = value return self + def with_label_for(self, value: str) -> Self: + self.label_for = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -2403,6 +3018,9 @@ def with_inlines(self, value: Union[List[CardElement], List[str]]) -> Self: class ColumnDefinition(SerializableObject): """Defines a column in a Table element.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + horizontal_cell_content_alignment: Optional[HorizontalAlignment] = None """ Controls how the content of every cell in the table should be horizontally aligned by default. This property overrides the horizontalCellContentAlignment property of the table. """ @@ -2410,7 +3028,11 @@ class ColumnDefinition(SerializableObject): """ Controls how the content of every cell in the column should be vertically aligned by default. This property overrides the verticalCellContentAlignment property of the table. """ width: Optional[Union[str, float]] = None - """ The width of the column in the table, expressed as either a percentage of the available width or in pixels, using the `px` format. """ + """ The width of the column in the table. If expressed as a number, represents the relative weight of the column in the table. If expressed as a string, `auto` will automatically adjust the column's width according to its content and using the `px` format will give the column an explicit width in pixels. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self def with_horizontal_cell_content_alignment(self, value: HorizontalAlignment) -> Self: self.horizontal_cell_content_alignment = value @@ -2428,6 +3050,9 @@ def with_width(self, value: Union[str, float]) -> Self: class TableCell(CardElement): """Represents a cell in a table row.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["TableCell"] = "TableCell" """ Must be **TableCell**. """ @@ -2446,10 +3071,10 @@ class TableCell(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -2494,6 +3119,10 @@ class TableCell(CardElement): items: Optional[List[SerializeAsAny[CardElement]]] = None """ The items (elements) in the cell. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -2582,6 +3211,9 @@ def with_items(self, value: List[CardElement]) -> Self: class TableRow(CardElement): """Represents a row of cells in a table.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["TableRow"] = "TableRow" """ Must be **TableRow**. """ @@ -2600,13 +3232,13 @@ class TableRow(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -2639,6 +3271,10 @@ class TableRow(CardElement): cells: Optional[List[TableCell]] = None """ The cells in the row. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -2715,6 +3351,9 @@ def with_cells(self, value: List[TableCell]) -> Self: class Table(CardElement): """Use tables to display data in a tabular way, with rows, columns and cells.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Table"] = "Table" """ Must be **Table**. """ @@ -2733,13 +3372,13 @@ class Table(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -2760,6 +3399,9 @@ class Table(CardElement): columns: Optional[List[ColumnDefinition]] = None """ The columns in the table. """ + min_width: Optional[str] = None + """ The minimum width of the table in pixels. `auto` will automatically adjust the table's minimum width according to its content and using the `px` format will give the table an explicit minimum width in pixels. A scrollbar will be displayed if the available width is less than the specified minimum width. """ + first_row_as_headers: Optional[bool] = True """ Controls whether the first row of the table should be treated as a header. """ @@ -2784,6 +3426,10 @@ class Table(CardElement): rows: Optional[List[TableRow]] = None """ The rows of the table. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -2840,6 +3486,10 @@ def with_columns(self, value: List[ColumnDefinition]) -> Self: self.columns = value return self + def with_min_width(self, value: str) -> Self: + self.min_width = value + return self + def with_first_row_as_headers(self, value: bool) -> Self: self.first_row_as_headers = value return self @@ -2876,6 +3526,9 @@ def with_rows(self, value: List[TableRow]) -> Self: class TextBlock(CardElement): """A block of text, optionally formatted using Markdown.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["TextBlock"] = "TextBlock" """ Must be **TextBlock**. """ @@ -2894,13 +3547,13 @@ class TextBlock(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -2933,15 +3586,22 @@ class TextBlock(CardElement): max_lines: Optional[float] = None """ The maximum number of lines to display. """ - style: Optional[StyleEnum] = None + style: Optional[TextBlockStyle] = None """ The style of the text. """ + label_for: Optional[str] = None + """ The Id of the input the TextBlock should act as the label of. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -3014,10 +3674,14 @@ def with_max_lines(self, value: float) -> Self: self.max_lines = value return self - def with_style(self, value: StyleEnum) -> Self: + def with_style(self, value: TextBlockStyle) -> Self: self.style = value return self + def with_label_for(self, value: str) -> Self: + self.label_for = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -3030,12 +3694,19 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class Fact(SerializableObject): """A fact in a FactSet element.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + title: Optional[str] = None """ The fact's title. """ value: Optional[str] = None """ The fact's value. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_title(self, value: str) -> Self: self.title = value return self @@ -3048,6 +3719,9 @@ def with_value(self, value: str) -> Self: class FactSet(CardElement): """A set of facts, displayed as a table or a vertical list when horizontal space is constrained.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["FactSet"] = "FactSet" """ Must be **FactSet**. """ @@ -3066,10 +3740,10 @@ class FactSet(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -3087,6 +3761,10 @@ class FactSet(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -3139,9 +3817,16 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class TeamsImageProperties(SerializableObject): """Represents a set of Teams-specific properties on an image.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + allow_expand: Optional[bool] = None """ Controls if the image is expandable in Teams. This property is equivalent to the Image.allowExpand property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_allow_expand(self, value: bool) -> Self: self.allow_expand = value return self @@ -3150,6 +3835,9 @@ def with_allow_expand(self, value: bool) -> Self: class Image(CardElement): """A standalone image element.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Image"] = "Image" """ Must be **Image**. """ @@ -3171,7 +3859,7 @@ class Image(CardElement): horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -3189,10 +3877,10 @@ class Image(CardElement): background_color: Optional[str] = None """ The background color of the image. """ - style: Optional[ImageStyle] = None + style: Optional[ImageStyle] = "Default" """ The style of the image. """ - size: Optional[Size] = None + size: Optional[Size] = "Auto" """ The size of the image. """ width: Optional[str] = "auto" @@ -3207,6 +3895,18 @@ class Image(CardElement): ms_teams: Optional[TeamsImageProperties] = None """ Teams-specific metadata associated with the image. """ + themed_urls: Optional[List[ThemedUrl]] = None + """ A set of theme-specific image URLs. """ + + fit_mode: Optional[ImageFitMode] = "Fill" + """ Controls how the image should be fitted inside its bounding box. imageFit is only meaningful when both the width and height properties are set. When fitMode is set to contain, the default style is always used. """ + + horizontal_content_alignment: Optional[HorizontalAlignment] = "Left" + """ Controls the horizontal position of the image within its bounding box. horizontalContentAlignment is only meaningful when both the width and height properties are set and fitMode is set to either cover or contain. """ + + vertical_content_alignment: Optional[VerticalAlignment] = "Top" + """ Controls the vertical position of the image within its bounding box. verticalContentAlignment is only meaningful when both the width and height properties are set and fitMode is set to either cover or contain. """ + height: Optional[str] = "auto" """ The height of the image. """ @@ -3216,6 +3916,10 @@ class Image(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -3288,6 +3992,22 @@ def with_ms_teams(self, value: TeamsImageProperties) -> Self: self.ms_teams = value return self + def with_themed_urls(self, value: List[ThemedUrl]) -> Self: + self.themed_urls = value + return self + + def with_fit_mode(self, value: ImageFitMode) -> Self: + self.fit_mode = value + return self + + def with_horizontal_content_alignment(self, value: HorizontalAlignment) -> Self: + self.horizontal_content_alignment = value + return self + + def with_vertical_content_alignment(self, value: VerticalAlignment) -> Self: + self.vertical_content_alignment = value + return self + def with_height(self, value: str) -> Self: self.height = value return self @@ -3304,6 +4024,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class ImageSet(CardElement): """A set of images, displayed side-by-side and wrapped across multiple rows as needed.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["ImageSet"] = "ImageSet" """ Must be **ImageSet**. """ @@ -3322,13 +4045,13 @@ class ImageSet(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -3340,7 +4063,7 @@ class ImageSet(CardElement): images: Optional[List[Image]] = None """ The images in the set. """ - image_size: Optional[ImageSize] = None + image_size: Optional[ImageSize] = "Medium" """ The size to use to render all images in the set. """ grid_area: Optional[str] = None @@ -3349,6 +4072,10 @@ class ImageSet(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -3409,6 +4136,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class TextInput(CardElement): """An input to allow the user to enter text.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Input.Text"] = "Input.Text" """ Must be **Input.Text**. """ @@ -3427,10 +4157,10 @@ class TextInput(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -3450,7 +4180,7 @@ class TextInput(CardElement): error_message: Optional[str] = None """ The error message to display when the input fails validation. See [Input validation](topic:input-validation) for more details. """ - value_changed_action: Optional[ResetInputsAction] = None + value_changed_action: Optional[Action] = None """ An Action.ResetInputs action that will be executed when the value of the input changes. """ value: Optional[str] = None @@ -3465,7 +4195,7 @@ class TextInput(CardElement): placeholder: Optional[str] = None """ The text to display as a placeholder when the user hasn't entered a value. """ - style: Optional[InputTextStyle] = None + style: Optional[InputTextStyle] = "Text" """ The style of the input. """ inline_action: Optional[Action] = None @@ -3480,6 +4210,10 @@ class TextInput(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -3528,7 +4262,7 @@ def with_error_message(self, value: str) -> Self: self.error_message = value return self - def with_value_changed_action(self, value: ResetInputsAction) -> Self: + def with_value_changed_action(self, value: Action) -> Self: self.value_changed_action = value return self @@ -3572,6 +4306,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class DateInput(CardElement): """An input to allow the user to select a date.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Input.Date"] = "Input.Date" """ Must be **Input.Date**. """ @@ -3590,10 +4327,10 @@ class DateInput(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -3613,7 +4350,7 @@ class DateInput(CardElement): error_message: Optional[str] = None """ The error message to display when the input fails validation. See [Input validation](topic:input-validation) for more details. """ - value_changed_action: Optional[ResetInputsAction] = None + value_changed_action: Optional[Action] = None """ An Action.ResetInputs action that will be executed when the value of the input changes. """ value: Optional[str] = None @@ -3634,6 +4371,10 @@ class DateInput(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -3682,7 +4423,7 @@ def with_error_message(self, value: str) -> Self: self.error_message = value return self - def with_value_changed_action(self, value: ResetInputsAction) -> Self: + def with_value_changed_action(self, value: Action) -> Self: self.value_changed_action = value return self @@ -3714,6 +4455,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class TimeInput(CardElement): """An input to allow the user to select a time.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Input.Time"] = "Input.Time" """ Must be **Input.Time**. """ @@ -3732,10 +4476,10 @@ class TimeInput(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -3755,7 +4499,7 @@ class TimeInput(CardElement): error_message: Optional[str] = None """ The error message to display when the input fails validation. See [Input validation](topic:input-validation) for more details. """ - value_changed_action: Optional[ResetInputsAction] = None + value_changed_action: Optional[Action] = None """ An Action.ResetInputs action that will be executed when the value of the input changes. """ value: Optional[str] = None @@ -3776,6 +4520,10 @@ class TimeInput(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -3824,7 +4572,7 @@ def with_error_message(self, value: str) -> Self: self.error_message = value return self - def with_value_changed_action(self, value: ResetInputsAction) -> Self: + def with_value_changed_action(self, value: Action) -> Self: self.value_changed_action = value return self @@ -3856,6 +4604,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class NumberInput(CardElement): """An input to allow the user to enter a number.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Input.Number"] = "Input.Number" """ Must be **Input.Number**. """ @@ -3874,10 +4625,10 @@ class NumberInput(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -3897,7 +4648,7 @@ class NumberInput(CardElement): error_message: Optional[str] = None """ The error message to display when the input fails validation. See [Input validation](topic:input-validation) for more details. """ - value_changed_action: Optional[ResetInputsAction] = None + value_changed_action: Optional[Action] = None """ An Action.ResetInputs action that will be executed when the value of the input changes. """ value: Optional[float] = None @@ -3918,6 +4669,10 @@ class NumberInput(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -3966,7 +4721,7 @@ def with_error_message(self, value: str) -> Self: self.error_message = value return self - def with_value_changed_action(self, value: ResetInputsAction) -> Self: + def with_value_changed_action(self, value: Action) -> Self: self.value_changed_action = value return self @@ -3998,6 +4753,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class ToggleInput(CardElement): """An input to allow the user to select between on/off states.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Input.Toggle"] = "Input.Toggle" """ Must be **Input.Toggle**. """ @@ -4016,10 +4774,10 @@ class ToggleInput(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -4039,7 +4797,7 @@ class ToggleInput(CardElement): error_message: Optional[str] = None """ The error message to display when the input fails validation. See [Input validation](topic:input-validation) for more details. """ - value_changed_action: Optional[ResetInputsAction] = None + value_changed_action: Optional[Action] = None """ An Action.ResetInputs action that will be executed when the value of the input changes. """ value: Optional[str] = "false" @@ -4057,12 +4815,19 @@ class ToggleInput(CardElement): wrap: Optional[bool] = True """ Controls if the title should wrap. """ + show_title: Optional[bool] = True + """ Controls whether the title is visually displayed. When set to false, the title is hidden from view but remains accessible to screen readers for accessibility purposes. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -4111,7 +4876,7 @@ def with_error_message(self, value: str) -> Self: self.error_message = value return self - def with_value_changed_action(self, value: ResetInputsAction) -> Self: + def with_value_changed_action(self, value: Action) -> Self: self.value_changed_action = value return self @@ -4135,6 +4900,10 @@ def with_wrap(self, value: bool) -> Self: self.wrap = value return self + def with_show_title(self, value: bool) -> Self: + self.show_title = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -4147,12 +4916,19 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class Choice(SerializableObject): """A choice as used by the Input.ChoiceSet input.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + title: Optional[str] = None """ The text to display for the choice. """ value: Optional[str] = None """ The value associated with the choice, as sent to the Bot when an Action.Submit or Action.Execute is invoked """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_title(self, value: str) -> Self: self.title = value return self @@ -4165,6 +4941,9 @@ def with_value(self, value: str) -> Self: class QueryData(SerializableObject): """Defines a query to dynamically fetch data from a Bot.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Data.Query"] = "Data.Query" """ Must be **Data.Query**. """ @@ -4180,6 +4959,10 @@ class QueryData(SerializableObject): skip: Optional[float] = None """ The number of data items to be skipped by the query. Card authors should not specify this property in their card payload. It is determined by the client and sent to the Bot to enable pagination. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_dataset(self, value: str) -> Self: self.dataset = value return self @@ -4200,6 +4983,9 @@ def with_skip(self, value: float) -> Self: class ChoiceSetInput(CardElement): """An input to allow the user to select one or more values.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Input.ChoiceSet"] = "Input.ChoiceSet" """ Must be **Input.ChoiceSet**. """ @@ -4218,10 +5004,10 @@ class ChoiceSetInput(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -4241,7 +5027,7 @@ class ChoiceSetInput(CardElement): error_message: Optional[str] = None """ The error message to display when the input fails validation. See [Input validation](topic:input-validation) for more details. """ - value_changed_action: Optional[ResetInputsAction] = None + value_changed_action: Optional[Action] = None """ An Action.ResetInputs action that will be executed when the value of the input changes. """ value: Optional[str] = None @@ -4253,7 +5039,7 @@ class ChoiceSetInput(CardElement): choices_data: Optional[QueryData] = None """ A Data.Query object that defines the dataset from which to dynamically fetch the choices for the input. """ - style: Optional[StyleEnum] = None + style: Optional[ChoiceSetInputStyle] = "compact" """ Controls whether the input should be displayed as a dropdown (compact) or a list of radio buttons or checkboxes (expanded). """ is_multi_select: Optional[bool] = None @@ -4265,12 +5051,22 @@ class ChoiceSetInput(CardElement): wrap: Optional[bool] = True """ Controls if choice titles should wrap. """ + use_multiple_columns: Optional[bool] = None + """ Controls whether choice items are arranged in multiple columns in expanded mode, or in a single column. Default is false. """ + + min_column_width: Optional[str] = None + """ The minimum width, in pixels, for each column when using a multi-column layout. This ensures that choice items remain readable even when horizontal space is limited. Default is 100 pixels. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -4319,7 +5115,7 @@ def with_error_message(self, value: str) -> Self: self.error_message = value return self - def with_value_changed_action(self, value: ResetInputsAction) -> Self: + def with_value_changed_action(self, value: Action) -> Self: self.value_changed_action = value return self @@ -4335,7 +5131,7 @@ def with_choices_data(self, value: QueryData) -> Self: self.choices_data = value return self - def with_style(self, value: StyleEnum) -> Self: + def with_style(self, value: ChoiceSetInputStyle) -> Self: self.style = value return self @@ -4351,6 +5147,14 @@ def with_wrap(self, value: bool) -> Self: self.wrap = value return self + def with_use_multiple_columns(self, value: bool) -> Self: + self.use_multiple_columns = value + return self + + def with_min_column_width(self, value: str) -> Self: + self.min_column_width = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -4363,6 +5167,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class RatingInput(CardElement): """An input to allow the user to rate something using stars.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Input.Rating"] = "Input.Rating" """ Must be **Input.Rating**. """ @@ -4381,10 +5188,10 @@ class RatingInput(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -4404,7 +5211,7 @@ class RatingInput(CardElement): error_message: Optional[str] = None """ The error message to display when the input fails validation. See [Input validation](topic:input-validation) for more details. """ - value_changed_action: Optional[ResetInputsAction] = None + value_changed_action: Optional[Action] = None """ An Action.ResetInputs action that will be executed when the value of the input changes. """ value: Optional[float] = None @@ -4416,10 +5223,10 @@ class RatingInput(CardElement): allow_half_steps: Optional[bool] = None """ Controls if the user can select half stars. """ - size: Optional[RatingSize] = None + size: Optional[RatingSize] = "Large" """ The size of the stars. """ - color: Optional[RatingColor] = None + color: Optional[RatingColor] = "Neutral" """ The color of the stars. """ grid_area: Optional[str] = None @@ -4428,6 +5235,10 @@ class RatingInput(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -4476,7 +5287,7 @@ def with_error_message(self, value: str) -> Self: self.error_message = value return self - def with_value_changed_action(self, value: ResetInputsAction) -> Self: + def with_value_changed_action(self, value: Action) -> Self: self.value_changed_action = value return self @@ -4512,6 +5323,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class Rating(CardElement): """A read-only star rating element, to display the rating of something.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Rating"] = "Rating" """ Must be **Rating**. """ @@ -4530,13 +5344,13 @@ class Rating(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -4554,13 +5368,13 @@ class Rating(CardElement): max: Optional[float] = 5 """ The number of stars to display. """ - size: Optional[RatingSize] = None + size: Optional[RatingSize] = "Large" """ The size of the stars. """ - color: Optional[RatingColor] = None + color: Optional[RatingColor] = "Neutral" """ The color of the stars. """ - style: Optional[RatingStyle] = None + style: Optional[RatingStyle] = "Default" """ The style of the stars. """ grid_area: Optional[str] = None @@ -4569,6 +5383,10 @@ class Rating(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -4645,18 +5463,25 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class IconInfo(SerializableObject): """Defines information about a Fluent icon and how it should be rendered.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + name: Optional[str] = None """ The name of the icon to display. """ - size: Optional[IconSize] = None + size: Optional[IconSize] = "xSmall" """ The size of the icon. """ - style: Optional[IconStyle] = None + style: Optional[IconStyle] = "Regular" """ The style of the icon. """ - color: Optional[TextColor] = None + color: Optional[TextColor] = "Default" """ The color of the icon. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_name(self, value: str) -> Self: self.name = value return self @@ -4677,6 +5502,9 @@ def with_color(self, value: TextColor) -> Self: class CompoundButton(CardElement): """A special type of button with an icon, title and description.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["CompoundButton"] = "CompoundButton" """ Must be **CompoundButton**. """ @@ -4695,13 +5523,13 @@ class CompoundButton(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -4731,6 +5559,10 @@ class CompoundButton(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -4803,6 +5635,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class Icon(CardElement): """A standalone icon element. Icons can be picked from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog).""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Icon"] = "Icon" """ Must be **Icon**. """ @@ -4824,7 +5659,7 @@ class Icon(CardElement): horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -4836,13 +5671,13 @@ class Icon(CardElement): name: Optional[str] = None """ The name of the icon to display. """ - size: Optional[IconSize] = None + size: Optional[IconSize] = "Standard" """ The size of the icon. """ - style: Optional[IconStyle] = None + style: Optional[IconStyle] = "Regular" """ The style of the icon. """ - color: Optional[TextColor] = None + color: Optional[TextColor] = "Default" """ The color of the icon. """ select_action: Optional[Action] = None @@ -4854,6 +5689,10 @@ class Icon(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -4922,6 +5761,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class CarouselPage(CardElement): """A page inside a Carousel element.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["CarouselPage"] = "CarouselPage" """ Must be **CarouselPage**. """ @@ -4937,7 +5779,7 @@ class CarouselPage(CardElement): is_visible: Optional[bool] = True """ Controls the visibility of the element. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ target_width: Optional[TargetWidth] = None @@ -4985,6 +5827,10 @@ class CarouselPage(CardElement): items: Optional[List[SerializeAsAny[CardElement]]] = None """ The elements in the page. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -5041,16 +5887,293 @@ def with_background_image(self, value: Union[str, BackgroundImage]) -> Self: self.background_image = value return self - def with_vertical_content_alignment(self, value: VerticalAlignment) -> Self: - self.vertical_content_alignment = value + def with_vertical_content_alignment(self, value: VerticalAlignment) -> Self: + self.vertical_content_alignment = value + return self + + def with_rtl(self, value: bool) -> Self: + self.rtl = value + return self + + def with_max_height(self, value: str) -> Self: + self.max_height = value + return self + + def with_grid_area(self, value: str) -> Self: + self.grid_area = value + return self + + def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: + self.fallback = value + return self + + def with_items(self, value: List[CardElement]) -> Self: + self.items = value + return self + + +class Carousel(CardElement): + """A carousel with sliding pages.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["Carousel"] = "Carousel" + """ Must be **Carousel**. """ + + id: Optional[str] = None + """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ + + requires: Optional[HostCapabilities] = Field(default_factory=HostCapabilities) + """ A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided). """ + + lang: Optional[str] = None + """ The locale associated with the element. """ + + is_visible: Optional[bool] = True + """ Controls the visibility of the element. """ + + separator: Optional[bool] = None + """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ + + height: Optional[ElementHeight] = "auto" + """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ + + spacing: Optional[Spacing] = "Default" + """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ + + target_width: Optional[TargetWidth] = None + """ Controls for which card width the element should be displayed. If targetWidth isn't specified, the element is rendered at all card widths. Using targetWidth makes it possible to author responsive cards that adapt their layout to the available horizontal space. For more details, see [Responsive layout](topic:responsive-layout). """ + + is_sort_key: Optional[bool] = None + """ Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. """ + + bleed: Optional[bool] = None + """ Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. """ + + min_height: Optional[str] = None + """ The minimum height, in pixels, of the container, in the `px` format. """ + + page_animation: Optional[CarouselPageAnimation] = "Slide" + """ Controls the type of animation to use to navigate between pages. """ + + grid_area: Optional[str] = None + """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ + + fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None + """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + + pages: Optional[List[CarouselPage]] = None + """ The pages in the carousel. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_id(self, value: str) -> Self: + self.id = value + return self + + def with_requires(self, value: HostCapabilities) -> Self: + self.requires = value + return self + + def with_lang(self, value: str) -> Self: + self.lang = value + return self + + def with_is_visible(self, value: bool) -> Self: + self.is_visible = value + return self + + def with_separator(self, value: bool) -> Self: + self.separator = value + return self + + def with_height(self, value: ElementHeight) -> Self: + self.height = value + return self + + def with_spacing(self, value: Spacing) -> Self: + self.spacing = value + return self + + def with_target_width(self, value: TargetWidth) -> Self: + self.target_width = value + return self + + def with_is_sort_key(self, value: bool) -> Self: + self.is_sort_key = value + return self + + def with_bleed(self, value: bool) -> Self: + self.bleed = value + return self + + def with_min_height(self, value: str) -> Self: + self.min_height = value + return self + + def with_page_animation(self, value: CarouselPageAnimation) -> Self: + self.page_animation = value + return self + + def with_grid_area(self, value: str) -> Self: + self.grid_area = value + return self + + def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: + self.fallback = value + return self + + def with_pages(self, value: List[CarouselPage]) -> Self: + self.pages = value + return self + + +class Badge(CardElement): + """A badge element to show an icon and/or text in a compact form over a colored background.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["Badge"] = "Badge" + """ Must be **Badge**. """ + + id: Optional[str] = None + """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ + + requires: Optional[HostCapabilities] = Field(default_factory=HostCapabilities) + """ A list of capabilities the element requires the host application to support. If the host application doesn't support at least one of the listed capabilities, the element is not rendered (or its fallback is rendered if provided). """ + + lang: Optional[str] = None + """ The locale associated with the element. """ + + is_visible: Optional[bool] = True + """ Controls the visibility of the element. """ + + separator: Optional[bool] = None + """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ + + height: Optional[ElementHeight] = "auto" + """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ + + horizontal_alignment: Optional[HorizontalAlignment] = None + """ Controls how the element should be horizontally aligned. """ + + spacing: Optional[Spacing] = "Default" + """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ + + target_width: Optional[TargetWidth] = None + """ Controls for which card width the element should be displayed. If targetWidth isn't specified, the element is rendered at all card widths. Using targetWidth makes it possible to author responsive cards that adapt their layout to the available horizontal space. For more details, see [Responsive layout](topic:responsive-layout). """ + + is_sort_key: Optional[bool] = None + """ Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. """ + + text: Optional[str] = None + """ The text to display. """ + + icon: Optional[str] = None + """ The name of an icon from the [Adaptive Card icon catalog](topic:icon-catalog) to display, in the `[,regular|filled]` format. If the style is not specified, the regular style is used. """ + + icon_position: Optional[BadgeIconPosition] = "Before" + """ Controls the position of the icon. """ + + appearance: Optional[BadgeAppearance] = "Filled" + """ Controls the strength of the background color. """ + + size: Optional[BadgeSize] = "Medium" + """ The size of the badge. """ + + shape: Optional[BadgeShape] = "Circular" + """ Controls the shape of the badge. """ + + style: Optional[BadgeStyle] = "Default" + """ The style of the badge. """ + + tooltip: Optional[str] = None + """ Controls the tooltip text to display when the badge is hovered over. """ + + grid_area: Optional[str] = None + """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ + + fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None + """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_id(self, value: str) -> Self: + self.id = value + return self + + def with_requires(self, value: HostCapabilities) -> Self: + self.requires = value + return self + + def with_lang(self, value: str) -> Self: + self.lang = value + return self + + def with_is_visible(self, value: bool) -> Self: + self.is_visible = value + return self + + def with_separator(self, value: bool) -> Self: + self.separator = value + return self + + def with_height(self, value: ElementHeight) -> Self: + self.height = value + return self + + def with_horizontal_alignment(self, value: HorizontalAlignment) -> Self: + self.horizontal_alignment = value + return self + + def with_spacing(self, value: Spacing) -> Self: + self.spacing = value + return self + + def with_target_width(self, value: TargetWidth) -> Self: + self.target_width = value + return self + + def with_is_sort_key(self, value: bool) -> Self: + self.is_sort_key = value + return self + + def with_text(self, value: str) -> Self: + self.text = value + return self + + def with_icon(self, value: str) -> Self: + self.icon = value + return self + + def with_icon_position(self, value: BadgeIconPosition) -> Self: + self.icon_position = value + return self + + def with_appearance(self, value: BadgeAppearance) -> Self: + self.appearance = value + return self + + def with_size(self, value: BadgeSize) -> Self: + self.size = value + return self + + def with_shape(self, value: BadgeShape) -> Self: + self.shape = value return self - def with_rtl(self, value: bool) -> Self: - self.rtl = value + def with_style(self, value: BadgeStyle) -> Self: + self.style = value return self - def with_max_height(self, value: str) -> Self: - self.max_height = value + def with_tooltip(self, value: str) -> Self: + self.tooltip = value return self def with_grid_area(self, value: str) -> Self: @@ -5061,16 +6184,15 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: self.fallback = value return self - def with_items(self, value: List[CardElement]) -> Self: - self.items = value - return self +class ProgressRing(CardElement): + """A spinning ring element, to indicate progress.""" -class Carousel(CardElement): - """A carousel with sliding pages.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ - type: Literal["Carousel"] = "Carousel" - """ Must be **Carousel**. """ + type: Literal["ProgressRing"] = "ProgressRing" + """ Must be **ProgressRing**. """ id: Optional[str] = None """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ @@ -5087,10 +6209,13 @@ class Carousel(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ - spacing: Optional[Spacing] = None + horizontal_alignment: Optional[HorizontalAlignment] = None + """ Controls how the element should be horizontally aligned. """ + + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -5099,14 +6224,14 @@ class Carousel(CardElement): is_sort_key: Optional[bool] = None """ Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. """ - bleed: Optional[bool] = None - """ Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. """ + label: Optional[str] = None + """ The label of the progress ring. """ - min_height: Optional[str] = None - """ The minimum height, in pixels, of the container, in the `px` format. """ + label_position: Optional[ProgressRingLabelPosition] = "Below" + """ Controls the relative position of the label to the progress ring. """ - page_animation: Optional[CarouselPageAnimation] = None - """ Controls the type of animation to use to navigate between pages. """ + size: Optional[ProgressRingSize] = "Medium" + """ The size of the progress ring. """ grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ @@ -5114,8 +6239,9 @@ class Carousel(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ - pages: Optional[List[CarouselPage]] = None - """ The pages in the carousel. """ + def with_key(self, value: str) -> Self: + self.key = value + return self def with_id(self, value: str) -> Self: self.id = value @@ -5141,6 +6267,10 @@ def with_height(self, value: ElementHeight) -> Self: self.height = value return self + def with_horizontal_alignment(self, value: HorizontalAlignment) -> Self: + self.horizontal_alignment = value + return self + def with_spacing(self, value: Spacing) -> Self: self.spacing = value return self @@ -5153,16 +6283,16 @@ def with_is_sort_key(self, value: bool) -> Self: self.is_sort_key = value return self - def with_bleed(self, value: bool) -> Self: - self.bleed = value + def with_label(self, value: str) -> Self: + self.label = value return self - def with_min_height(self, value: str) -> Self: - self.min_height = value + def with_label_position(self, value: ProgressRingLabelPosition) -> Self: + self.label_position = value return self - def with_page_animation(self, value: CarouselPageAnimation) -> Self: - self.page_animation = value + def with_size(self, value: ProgressRingSize) -> Self: + self.size = value return self def with_grid_area(self, value: str) -> Self: @@ -5173,16 +6303,15 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: self.fallback = value return self - def with_pages(self, value: List[CarouselPage]) -> Self: - self.pages = value - return self +class ProgressBar(CardElement): + """A progress bar element, to represent a value within a range.""" -class Badge(CardElement): - """A badge element to show an icon and/or text in a compact form over a colored background.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ - type: Literal["Badge"] = "Badge" - """ Must be **Badge**. """ + type: Literal["ProgressBar"] = "ProgressBar" + """ Must be **ProgressBar**. """ id: Optional[str] = None """ A unique identifier for the element or action. Input elements must have an id, otherwise they will not be validated and their values will not be sent to the Bot. """ @@ -5199,13 +6328,13 @@ class Badge(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -5214,29 +6343,14 @@ class Badge(CardElement): is_sort_key: Optional[bool] = None """ Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. """ - text: Optional[str] = None - """ The text to display. """ - - icon: Optional[str] = None - """ The name of an icon from the [Adaptive Card icon catalog](topic:icon-catalog) to display, in the `[,regular|filled]` format. If the style is not specified, the regular style is used. """ - - icon_position: Optional[BadgeIconPosition] = None - """ Controls the position of the icon. """ - - appearance: Optional[BadgeAppearance] = None - """ Controls the strength of the background color. """ - - size: Optional[BadgeSize] = None - """ The size of the badge. """ - - shape: Optional[BadgeShape] = None - """ Controls the shape of the badge. """ + value: Optional[float] = None + """ The value of the progress bar. Must be between 0 and max. """ - style: Optional[BadgeStyle] = None - """ The style of the badge. """ + max: Optional[float] = 100 + """ The maximum value of the progress bar. """ - tooltip: Optional[str] = None - """ Controls the tooltip text to display when the badge is hovered over. """ + color: Optional[ProgressBarColor] = "Accent" + """ The color of the progress bar. `color` has no effect when the `ProgressBar` is in indeterminate mode, in which case the "accent" color is always used. """ grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ @@ -5244,6 +6358,10 @@ class Badge(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -5284,36 +6402,16 @@ def with_is_sort_key(self, value: bool) -> Self: self.is_sort_key = value return self - def with_text(self, value: str) -> Self: - self.text = value - return self - - def with_icon(self, value: str) -> Self: - self.icon = value - return self - - def with_icon_position(self, value: BadgeIconPosition) -> Self: - self.icon_position = value - return self - - def with_appearance(self, value: BadgeAppearance) -> Self: - self.appearance = value - return self - - def with_size(self, value: BadgeSize) -> Self: - self.size = value - return self - - def with_shape(self, value: BadgeShape) -> Self: - self.shape = value + def with_value(self, value: float) -> Self: + self.value = value return self - def with_style(self, value: BadgeStyle) -> Self: - self.style = value + def with_max(self, value: float) -> Self: + self.max = value return self - def with_tooltip(self, value: str) -> Self: - self.tooltip = value + def with_color(self, value: ProgressBarColor) -> Self: + self.color = value return self def with_grid_area(self, value: str) -> Self: @@ -5328,6 +6426,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class DonutChartData(SerializableObject): """A data point in a Donut chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + legend: Optional[str] = None """ The legend of the chart. """ @@ -5337,6 +6438,10 @@ class DonutChartData(SerializableObject): color: Optional[ChartColor] = None """ The color to use for the data point. See [Chart colors reference](topic:chart-colors-reference). """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_legend(self, value: str) -> Self: self.legend = value return self @@ -5353,6 +6458,9 @@ def with_color(self, value: ChartColor) -> Self: class DonutChart(CardElement): """A donut chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Chart.Donut"] = "Chart.Donut" """ Must be **Chart.Donut**. """ @@ -5371,13 +6479,13 @@ class DonutChart(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -5389,18 +6497,43 @@ class DonutChart(CardElement): title: Optional[str] = None """ The title of the chart. """ + show_title: Optional[bool] = None + """ Controls whether the chart's title should be displayed. Defaults to `false`. """ + color_set: Optional[ChartColorSet] = None """ The name of the set of colors to use to render the chart. See [Chart colors reference](topic:chart-colors-reference). """ + max_width: Optional[str] = None + """ The maximum width, in pixels, of the chart, in the `px` format. """ + + show_legend: Optional[bool] = True + """ Controls whether the chart's legend should be displayed. """ + data: Optional[List[DonutChartData]] = None """ The data to display in the chart. """ + value: Optional[str] = None + """ The value that should be displayed in the center of a Donut chart. `value` is ignored for Pie charts. """ + + value_color: Optional[ChartColor] = None + """ Controls the color of the value displayed in the center of a Donut chart. """ + + thickness: Optional[DonutThickness] = None + """ Controls the thickness of the donut segments. Default is **Thick**. """ + + show_outlines: Optional[bool] = True + """ Controls whether the outlines of the donut segments are displayed. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -5445,14 +6578,42 @@ def with_title(self, value: str) -> Self: self.title = value return self + def with_show_title(self, value: bool) -> Self: + self.show_title = value + return self + def with_color_set(self, value: ChartColorSet) -> Self: self.color_set = value return self + def with_max_width(self, value: str) -> Self: + self.max_width = value + return self + + def with_show_legend(self, value: bool) -> Self: + self.show_legend = value + return self + def with_data(self, value: List[DonutChartData]) -> Self: self.data = value return self + def with_value(self, value: str) -> Self: + self.value = value + return self + + def with_value_color(self, value: ChartColor) -> Self: + self.value_color = value + return self + + def with_thickness(self, value: DonutThickness) -> Self: + self.thickness = value + return self + + def with_show_outlines(self, value: bool) -> Self: + self.show_outlines = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -5465,6 +6626,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class PieChart(CardElement): """A pie chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Chart.Pie"] = "Chart.Pie" """ Must be **Chart.Pie**. """ @@ -5483,13 +6647,13 @@ class PieChart(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -5501,18 +6665,43 @@ class PieChart(CardElement): title: Optional[str] = None """ The title of the chart. """ + show_title: Optional[bool] = None + """ Controls whether the chart's title should be displayed. Defaults to `false`. """ + color_set: Optional[ChartColorSet] = None """ The name of the set of colors to use to render the chart. See [Chart colors reference](topic:chart-colors-reference). """ + max_width: Optional[str] = None + """ The maximum width, in pixels, of the chart, in the `px` format. """ + + show_legend: Optional[bool] = True + """ Controls whether the chart's legend should be displayed. """ + data: Optional[List[DonutChartData]] = None """ The data to display in the chart. """ + value: Optional[str] = None + """ The value that should be displayed in the center of a Donut chart. `value` is ignored for Pie charts. """ + + value_color: Optional[ChartColor] = None + """ Controls the color of the value displayed in the center of a Donut chart. """ + + thickness: Optional[DonutThickness] = None + """ Controls the thickness of the donut segments. Default is **Thick**. """ + + show_outlines: Optional[bool] = True + """ Controls whether the outlines of the donut segments are displayed. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -5557,14 +6746,42 @@ def with_title(self, value: str) -> Self: self.title = value return self + def with_show_title(self, value: bool) -> Self: + self.show_title = value + return self + def with_color_set(self, value: ChartColorSet) -> Self: self.color_set = value return self + def with_max_width(self, value: str) -> Self: + self.max_width = value + return self + + def with_show_legend(self, value: bool) -> Self: + self.show_legend = value + return self + def with_data(self, value: List[DonutChartData]) -> Self: self.data = value return self + def with_value(self, value: str) -> Self: + self.value = value + return self + + def with_value_color(self, value: ChartColor) -> Self: + self.value_color = value + return self + + def with_thickness(self, value: DonutThickness) -> Self: + self.thickness = value + return self + + def with_show_outlines(self, value: bool) -> Self: + self.show_outlines = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -5577,12 +6794,19 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class BarChartDataValue(SerializableObject): """A single data point in a bar chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + x: Optional[str] = None """ The x axis value of the data point. """ y: Optional[float] = None """ The y axis value of the data point. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_x(self, value: str) -> Self: self.x = value return self @@ -5595,6 +6819,9 @@ def with_y(self, value: float) -> Self: class GroupedVerticalBarChartData(SerializableObject): """Represents a series of data points.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + legend: Optional[str] = None """ The legend of the chart. """ @@ -5604,6 +6831,10 @@ class GroupedVerticalBarChartData(SerializableObject): color: Optional[ChartColor] = None """ The color to use for all data points in the series. See [Chart colors reference](topic:chart-colors-reference). """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_legend(self, value: str) -> Self: self.legend = value return self @@ -5620,6 +6851,9 @@ def with_color(self, value: ChartColor) -> Self: class GroupedVerticalBarChart(CardElement): """A grouped vertical bar chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Chart.VerticalBar.Grouped"] = "Chart.VerticalBar.Grouped" """ Must be **Chart.VerticalBar.Grouped**. """ @@ -5638,13 +6872,13 @@ class GroupedVerticalBarChart(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -5656,9 +6890,18 @@ class GroupedVerticalBarChart(CardElement): title: Optional[str] = None """ The title of the chart. """ + show_title: Optional[bool] = None + """ Controls whether the chart's title should be displayed. Defaults to `false`. """ + color_set: Optional[ChartColorSet] = None """ The name of the set of colors to use to render the chart. See [Chart colors reference](topic:chart-colors-reference). """ + max_width: Optional[str] = None + """ The maximum width, in pixels, of the chart, in the `px` format. """ + + show_legend: Optional[bool] = True + """ Controls whether the chart's legend should be displayed. """ + x_axis_title: Optional[str] = None """ The title of the x axis. """ @@ -5669,7 +6912,9 @@ class GroupedVerticalBarChart(CardElement): """ The color to use for all data points. See [Chart colors reference](topic:chart-colors-reference). """ stacked: Optional[bool] = None - """ Controls if bars in the chart should be displayed as stacked instead of grouped. """ + """ Controls if bars in the chart should be displayed as stacks instead of groups. + +**Note:** stacked vertical bar charts do not support custom Y ranges nor negative Y values. """ data: Optional[List[GroupedVerticalBarChartData]] = None """ The data points in a series. """ @@ -5677,12 +6922,26 @@ class GroupedVerticalBarChart(CardElement): show_bar_values: Optional[bool] = None """ Controls if values should be displayed on each bar. """ + y_min: Optional[float] = None + """ The requested minimum for the Y axis range. The value used at runtime may be different to optimize visual presentation. + +`yMin` is ignored if `stacked` is set to `true`. """ + + y_max: Optional[float] = None + """ The requested maximum for the Y axis range. The value used at runtime may be different to optimize visual presentation. + +`yMax` is ignored if `stacked` is set to `true`. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -5727,10 +6986,22 @@ def with_title(self, value: str) -> Self: self.title = value return self + def with_show_title(self, value: bool) -> Self: + self.show_title = value + return self + def with_color_set(self, value: ChartColorSet) -> Self: self.color_set = value return self + def with_max_width(self, value: str) -> Self: + self.max_width = value + return self + + def with_show_legend(self, value: bool) -> Self: + self.show_legend = value + return self + def with_x_axis_title(self, value: str) -> Self: self.x_axis_title = value return self @@ -5755,6 +7026,14 @@ def with_show_bar_values(self, value: bool) -> Self: self.show_bar_values = value return self + def with_y_min(self, value: float) -> Self: + self.y_min = value + return self + + def with_y_max(self, value: float) -> Self: + self.y_max = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -5767,6 +7046,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class VerticalBarChartDataValue(SerializableObject): """Represents a data point in a vertical bar chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + x: Optional[Union[str, float]] = None """ The x axis value of the data point. """ @@ -5776,6 +7058,10 @@ class VerticalBarChartDataValue(SerializableObject): color: Optional[ChartColor] = None """ The color to use for the bar associated with the data point. See [Chart colors reference](topic:chart-colors-reference). """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_x(self, value: Union[str, float]) -> Self: self.x = value return self @@ -5792,6 +7078,9 @@ def with_color(self, value: ChartColor) -> Self: class VerticalBarChart(CardElement): """A vertical bar chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Chart.VerticalBar"] = "Chart.VerticalBar" """ Must be **Chart.VerticalBar**. """ @@ -5810,13 +7099,13 @@ class VerticalBarChart(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -5828,9 +7117,18 @@ class VerticalBarChart(CardElement): title: Optional[str] = None """ The title of the chart. """ + show_title: Optional[bool] = None + """ Controls whether the chart's title should be displayed. Defaults to `false`. """ + color_set: Optional[ChartColorSet] = None """ The name of the set of colors to use to render the chart. See [Chart colors reference](topic:chart-colors-reference). """ + max_width: Optional[str] = None + """ The maximum width, in pixels, of the chart, in the `px` format. """ + + show_legend: Optional[bool] = True + """ Controls whether the chart's legend should be displayed. """ + x_axis_title: Optional[str] = None """ The title of the x axis. """ @@ -5846,12 +7144,22 @@ class VerticalBarChart(CardElement): show_bar_values: Optional[bool] = None """ Controls if the bar values should be displayed. """ + y_min: Optional[float] = None + """ The requested minimum for the Y axis range. The value used at runtime may be different to optimize visual presentation. """ + + y_max: Optional[float] = None + """ The requested maximum for the Y axis range. The value used at runtime may be different to optimize visual presentation. """ + grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -5896,10 +7204,22 @@ def with_title(self, value: str) -> Self: self.title = value return self + def with_show_title(self, value: bool) -> Self: + self.show_title = value + return self + def with_color_set(self, value: ChartColorSet) -> Self: self.color_set = value return self + def with_max_width(self, value: str) -> Self: + self.max_width = value + return self + + def with_show_legend(self, value: bool) -> Self: + self.show_legend = value + return self + def with_x_axis_title(self, value: str) -> Self: self.x_axis_title = value return self @@ -5920,6 +7240,14 @@ def with_show_bar_values(self, value: bool) -> Self: self.show_bar_values = value return self + def with_y_min(self, value: float) -> Self: + self.y_min = value + return self + + def with_y_max(self, value: float) -> Self: + self.y_max = value + return self + def with_grid_area(self, value: str) -> Self: self.grid_area = value return self @@ -5932,6 +7260,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class HorizontalBarChartDataValue(SerializableObject): """Represents a single data point in a horizontal bar chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + x: Optional[str] = None """ The x axis value of the data point. """ @@ -5941,6 +7272,10 @@ class HorizontalBarChartDataValue(SerializableObject): color: Optional[ChartColor] = None """ The color of the bar associated with the data point. See [Chart colors reference](topic:chart-colors-reference). """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_x(self, value: str) -> Self: self.x = value return self @@ -5957,6 +7292,9 @@ def with_color(self, value: ChartColor) -> Self: class HorizontalBarChart(CardElement): """A horizontal bar chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Chart.HorizontalBar"] = "Chart.HorizontalBar" """ Must be **Chart.HorizontalBar**. """ @@ -5975,13 +7313,13 @@ class HorizontalBarChart(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -5993,9 +7331,18 @@ class HorizontalBarChart(CardElement): title: Optional[str] = None """ The title of the chart. """ + show_title: Optional[bool] = None + """ Controls whether the chart's title should be displayed. Defaults to `false`. """ + color_set: Optional[ChartColorSet] = None """ The name of the set of colors to use to render the chart. See [Chart colors reference](topic:chart-colors-reference). """ + max_width: Optional[str] = None + """ The maximum width, in pixels, of the chart, in the `px` format. """ + + show_legend: Optional[bool] = True + """ Controls whether the chart's legend should be displayed. """ + x_axis_title: Optional[str] = None """ The title of the x axis. """ @@ -6008,7 +7355,7 @@ class HorizontalBarChart(CardElement): data: Optional[List[HorizontalBarChartDataValue]] = None """ The data points in the chart. """ - display_mode: Optional[HorizontalBarChartDisplayMode] = None + display_mode: Optional[HorizontalBarChartDisplayMode] = "AbsoluteWithAxis" """ Controls how the chart should be visually laid out. """ grid_area: Optional[str] = None @@ -6017,6 +7364,10 @@ class HorizontalBarChart(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -6061,10 +7412,22 @@ def with_title(self, value: str) -> Self: self.title = value return self + def with_show_title(self, value: bool) -> Self: + self.show_title = value + return self + def with_color_set(self, value: ChartColorSet) -> Self: self.color_set = value return self + def with_max_width(self, value: str) -> Self: + self.max_width = value + return self + + def with_show_legend(self, value: bool) -> Self: + self.show_legend = value + return self + def with_x_axis_title(self, value: str) -> Self: self.x_axis_title = value return self @@ -6097,6 +7460,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class StackedHorizontalBarChartDataPoint(SerializableObject): """A data point in a series.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + legend: Optional[str] = None """ The legend associated with the data point. """ @@ -6106,6 +7472,10 @@ class StackedHorizontalBarChartDataPoint(SerializableObject): color: Optional[ChartColor] = None """ The color to use to render the bar associated with the data point. See [Chart colors reference](topic:chart-colors-reference). """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_legend(self, value: str) -> Self: self.legend = value return self @@ -6122,12 +7492,19 @@ def with_color(self, value: ChartColor) -> Self: class StackedHorizontalBarChartData(SerializableObject): """Defines the collection of data series to display in as a stacked horizontal bar chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + title: Optional[str] = None """ The title of the series. """ data: Optional[List[StackedHorizontalBarChartDataPoint]] = None """ The data points in the series. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_title(self, value: str) -> Self: self.title = value return self @@ -6140,6 +7517,9 @@ def with_data(self, value: List[StackedHorizontalBarChartDataPoint]) -> Self: class StackedHorizontalBarChart(CardElement): """A stacked horizontal bar chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Chart.HorizontalBar.Stacked"] = "Chart.HorizontalBar.Stacked" """ Must be **Chart.HorizontalBar.Stacked**. """ @@ -6158,13 +7538,13 @@ class StackedHorizontalBarChart(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -6176,9 +7556,18 @@ class StackedHorizontalBarChart(CardElement): title: Optional[str] = None """ The title of the chart. """ + show_title: Optional[bool] = None + """ Controls whether the chart's title should be displayed. Defaults to `false`. """ + color_set: Optional[ChartColorSet] = None """ The name of the set of colors to use to render the chart. See [Chart colors reference](topic:chart-colors-reference). """ + max_width: Optional[str] = None + """ The maximum width, in pixels, of the chart, in the `px` format. """ + + show_legend: Optional[bool] = True + """ Controls whether the chart's legend should be displayed. """ + x_axis_title: Optional[str] = None """ The title of the x axis. """ @@ -6197,6 +7586,10 @@ class StackedHorizontalBarChart(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -6241,10 +7634,22 @@ def with_title(self, value: str) -> Self: self.title = value return self + def with_show_title(self, value: bool) -> Self: + self.show_title = value + return self + def with_color_set(self, value: ChartColorSet) -> Self: self.color_set = value return self + def with_max_width(self, value: str) -> Self: + self.max_width = value + return self + + def with_show_legend(self, value: bool) -> Self: + self.show_legend = value + return self + def with_x_axis_title(self, value: str) -> Self: self.x_axis_title = value return self @@ -6273,6 +7678,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class LineChartValue(SerializableObject): """Represents a single data point in a line chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + x: Optional[Union[float, str]] = None """ The x axis value of the data point. @@ -6283,6 +7691,10 @@ class LineChartValue(SerializableObject): y: Optional[float] = None """ The y axis value of the data point. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_x(self, value: Union[float, str]) -> Self: self.x = value return self @@ -6295,6 +7707,9 @@ def with_y(self, value: float) -> Self: class LineChartData(SerializableObject): """Represents a collection of data points series in a line chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + legend: Optional[str] = None """ The legend of the chart. """ @@ -6304,6 +7719,10 @@ class LineChartData(SerializableObject): color: Optional[ChartColor] = None """ The color all data points in the series. See [Chart colors reference](topic:chart-colors-reference). """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_legend(self, value: str) -> Self: self.legend = value return self @@ -6320,6 +7739,9 @@ def with_color(self, value: ChartColor) -> Self: class LineChart(CardElement): """A line chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Chart.Line"] = "Chart.Line" """ Must be **Chart.Line**. """ @@ -6338,13 +7760,13 @@ class LineChart(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -6356,9 +7778,18 @@ class LineChart(CardElement): title: Optional[str] = None """ The title of the chart. """ + show_title: Optional[bool] = None + """ Controls whether the chart's title should be displayed. Defaults to `false`. """ + color_set: Optional[ChartColorSet] = None """ The name of the set of colors to use to render the chart. See [Chart colors reference](topic:chart-colors-reference). """ + max_width: Optional[str] = None + """ The maximum width, in pixels, of the chart, in the `px` format. """ + + show_legend: Optional[bool] = True + """ Controls whether the chart's legend should be displayed. """ + x_axis_title: Optional[str] = None """ The title of the x axis. """ @@ -6383,6 +7814,10 @@ class LineChart(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -6427,10 +7862,22 @@ def with_title(self, value: str) -> Self: self.title = value return self + def with_show_title(self, value: bool) -> Self: + self.show_title = value + return self + def with_color_set(self, value: ChartColorSet) -> Self: self.color_set = value return self + def with_max_width(self, value: str) -> Self: + self.max_width = value + return self + + def with_show_legend(self, value: bool) -> Self: + self.show_legend = value + return self + def with_x_axis_title(self, value: str) -> Self: self.x_axis_title = value return self @@ -6467,6 +7914,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class GaugeChartLegend(SerializableObject): """The legend of the chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + size: Optional[float] = None """ The size of the segment. """ @@ -6476,6 +7926,10 @@ class GaugeChartLegend(SerializableObject): color: Optional[ChartColor] = None """ The color to use for the segment. See [Chart colors reference](topic:chart-colors-reference). """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_size(self, value: float) -> Self: self.size = value return self @@ -6492,6 +7946,9 @@ def with_color(self, value: ChartColor) -> Self: class GaugeChart(CardElement): """A gauge chart.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Chart.Gauge"] = "Chart.Gauge" """ Must be **Chart.Gauge**. """ @@ -6510,13 +7967,13 @@ class GaugeChart(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -6528,9 +7985,18 @@ class GaugeChart(CardElement): title: Optional[str] = None """ The title of the chart. """ + show_title: Optional[bool] = None + """ Controls whether the chart's title should be displayed. Defaults to `false`. """ + color_set: Optional[ChartColorSet] = None """ The name of the set of colors to use to render the chart. See [Chart colors reference](topic:chart-colors-reference). """ + max_width: Optional[str] = None + """ The maximum width, in pixels, of the chart, in the `px` format. """ + + show_legend: Optional[bool] = True + """ Controls whether the chart's legend should be displayed. """ + min: Optional[float] = None """ The minimum value of the gauge. """ @@ -6541,10 +8007,13 @@ class GaugeChart(CardElement): """ The sub-label of the gauge. """ show_min_max: Optional[bool] = True - """ Controls if the min/max values should be displayed. """ + """ Controls whether the min/max values should be displayed. """ - show_legend: Optional[bool] = True - """ Controls if the legend should be displayed. """ + show_needle: Optional[bool] = True + """ Controls whether the gauge's needle is displayed. Default is **true**. """ + + show_outlines: Optional[bool] = True + """ Controls whether the outlines of the gauge segments are displayed. """ segments: Optional[List[GaugeChartLegend]] = None """ The segments to display in the gauge. """ @@ -6552,7 +8021,7 @@ class GaugeChart(CardElement): value: Optional[float] = None """ The value of the gauge. """ - value_format: Optional[GaugeChartValueFormat] = None + value_format: Optional[GaugeChartValueFormat] = "Percentage" """ The format used to display the gauge's value. """ grid_area: Optional[str] = None @@ -6561,6 +8030,10 @@ class GaugeChart(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -6605,10 +8078,22 @@ def with_title(self, value: str) -> Self: self.title = value return self + def with_show_title(self, value: bool) -> Self: + self.show_title = value + return self + def with_color_set(self, value: ChartColorSet) -> Self: self.color_set = value return self + def with_max_width(self, value: str) -> Self: + self.max_width = value + return self + + def with_show_legend(self, value: bool) -> Self: + self.show_legend = value + return self + def with_min(self, value: float) -> Self: self.min = value return self @@ -6625,8 +8110,12 @@ def with_show_min_max(self, value: bool) -> Self: self.show_min_max = value return self - def with_show_legend(self, value: bool) -> Self: - self.show_legend = value + def with_show_needle(self, value: bool) -> Self: + self.show_needle = value + return self + + def with_show_outlines(self, value: bool) -> Self: + self.show_outlines = value return self def with_segments(self, value: List[GaugeChartLegend]) -> Self: @@ -6653,6 +8142,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class CodeBlock(CardElement): """A formatted and syntax-colored code block.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["CodeBlock"] = "CodeBlock" """ Must be **CodeBlock**. """ @@ -6671,13 +8163,13 @@ class CodeBlock(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -6689,7 +8181,7 @@ class CodeBlock(CardElement): code_snippet: Optional[str] = None """ The code snippet to display. """ - language: Optional[CodeLanguage] = None + language: Optional[CodeLanguage] = "PlainText" """ The language the code snippet is expressed in. """ start_line_number: Optional[float] = 1 @@ -6701,6 +8193,10 @@ class CodeBlock(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -6765,12 +8261,32 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class PersonaProperties(SerializableObject): """Represents the properties of a Persona component.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + id: Optional[str] = None + """ The Id of the persona. """ + user_principal_name: Optional[str] = None """ The UPN of the persona. """ display_name: Optional[str] = None """ The display name of the persona. """ + icon_style: Optional[PersonaIconStyle] = None + """ Defines the style of the icon for the persona. """ + + style: Optional[PersonaDisplayStyle] = None + """ Defines how the persona should be displayed. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_id(self, value: str) -> Self: + self.id = value + return self + def with_user_principal_name(self, value: str) -> Self: self.user_principal_name = value return self @@ -6779,10 +8295,21 @@ def with_display_name(self, value: str) -> Self: self.display_name = value return self + def with_icon_style(self, value: PersonaIconStyle) -> Self: + self.icon_style = value + return self + + def with_style(self, value: PersonaDisplayStyle) -> Self: + self.style = value + return self + class ComUserMicrosoftGraphComponent(CardElement): """Displays a user's information, including their profile picture.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Component"] = "Component" """ Must be **Component**. """ @@ -6801,13 +8328,13 @@ class ComUserMicrosoftGraphComponent(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -6820,7 +8347,7 @@ class ComUserMicrosoftGraphComponent(CardElement): """ Must be **graph.microsoft.com/user**. """ properties: Optional[PersonaProperties] = None - """ The properties of the user. """ + """ The properties of the Persona component. """ grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ @@ -6828,6 +8355,10 @@ class ComUserMicrosoftGraphComponent(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -6884,17 +8415,41 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class PersonaSetProperties(SerializableObject): """Represents the properties of a PersonaSet component.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + users: Optional[List[PersonaProperties]] = None """ The users a PersonaSet component should display. """ + icon_style: Optional[PersonaIconStyle] = None + """ Defines the style of the icon for the personas in the set. """ + + style: Optional[PersonaDisplayStyle] = None + """ Defines how each persona in the set should be displayed. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_users(self, value: List[PersonaProperties]) -> Self: self.users = value return self + def with_icon_style(self, value: PersonaIconStyle) -> Self: + self.icon_style = value + return self + + def with_style(self, value: PersonaDisplayStyle) -> Self: + self.style = value + return self + class ComUsersMicrosoftGraphComponent(CardElement): """Displays multiple users' information, including their profile pictures.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Component"] = "Component" """ Must be **Component**. """ @@ -6913,13 +8468,13 @@ class ComUsersMicrosoftGraphComponent(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -6932,7 +8487,7 @@ class ComUsersMicrosoftGraphComponent(CardElement): """ Must be **graph.microsoft.com/users**. """ properties: Optional[PersonaSetProperties] = None - """ The properties of the set. """ + """ The properties of the PersonaSet component. """ grid_area: Optional[str] = None """ The area of a Layout.AreaGrid layout in which an element should be displayed. """ @@ -6940,6 +8495,10 @@ class ComUsersMicrosoftGraphComponent(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -6996,9 +8555,16 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class ResourceVisualization(SerializableObject): """Represents a visualization of a resource.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + media: Optional[str] = None """ The media associated with the resource. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_media(self, value: str) -> Self: self.media = value return self @@ -7007,6 +8573,9 @@ def with_media(self, value: str) -> Self: class ResourceProperties(SerializableObject): """Represents the properties of a resource component.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + id: Optional[str] = None """ The Id of the resource. """ @@ -7016,6 +8585,10 @@ class ResourceProperties(SerializableObject): resource_visualization: Optional[ResourceVisualization] = None """ The visualization of the resource. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -7032,6 +8605,9 @@ def with_resource_visualization(self, value: ResourceVisualization) -> Self: class ComResourceMicrosoftGraphComponent(CardElement): """Displays information about a generic graph resource.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Component"] = "Component" """ Must be **Component**. """ @@ -7050,13 +8626,13 @@ class ComResourceMicrosoftGraphComponent(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -7077,6 +8653,10 @@ class ComResourceMicrosoftGraphComponent(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -7133,6 +8713,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class FileProperties(SerializableObject): """Represents the properties of a file component.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + name: Optional[str] = None """ The name of the file. """ @@ -7142,6 +8725,10 @@ class FileProperties(SerializableObject): url: Optional[str] = None """ The URL of the file. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_name(self, value: str) -> Self: self.name = value return self @@ -7158,6 +8745,9 @@ def with_url(self, value: str) -> Self: class ComFileMicrosoftGraphComponent(CardElement): """Displays information about a file resource.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Component"] = "Component" """ Must be **Component**. """ @@ -7176,13 +8766,13 @@ class ComFileMicrosoftGraphComponent(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -7203,6 +8793,10 @@ class ComFileMicrosoftGraphComponent(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -7259,6 +8853,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class CalendarEventAttendee(SerializableObject): """Represents a calendar event attendee.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + name: Optional[str] = None """ The name of the attendee. """ @@ -7274,6 +8871,10 @@ class CalendarEventAttendee(SerializableObject): status: Optional[str] = None """ The status of the attendee. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_name(self, value: str) -> Self: self.name = value return self @@ -7298,6 +8899,9 @@ def with_status(self, value: str) -> Self: class CalendarEventProperties(SerializableObject): """The properties of a calendar event.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + id: Optional[str] = None """ The ID of the event. """ @@ -7334,6 +8938,10 @@ class CalendarEventProperties(SerializableObject): organizer: Optional[CalendarEventAttendee] = None """ The organizer of the event. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -7386,6 +8994,9 @@ def with_organizer(self, value: CalendarEventAttendee) -> Self: class ComEventMicrosoftGraphComponent(CardElement): """Displays information about a calendar event.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["Component"] = "Component" """ Must be **Component**. """ @@ -7404,13 +9015,13 @@ class ComEventMicrosoftGraphComponent(CardElement): separator: Optional[bool] = None """ Controls whether a separator line should be displayed above the element to visually separate it from the previous element. No separator will be displayed for the first element in a container, even if this property is set to true. """ - height: Optional[ElementHeight] = None + height: Optional[ElementHeight] = "auto" """ The height of the element. When set to stretch, the element will use the remaining vertical space in its container. """ horizontal_alignment: Optional[HorizontalAlignment] = None """ Controls how the element should be horizontally aligned. """ - spacing: Optional[Spacing] = None + spacing: Optional[Spacing] = "Default" """ Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. """ target_width: Optional[TargetWidth] = None @@ -7431,6 +9042,10 @@ class ComEventMicrosoftGraphComponent(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -7487,6 +9102,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class TextRun(CardElement): """A block of text inside a RichTextBlock element.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["TextRun"] = "TextRun" """ Must be **TextRun**. """ @@ -7541,6 +9159,10 @@ class TextRun(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -7613,6 +9235,9 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: class IconRun(CardElement): """An inline icon inside a RichTextBlock element.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["IconRun"] = "IconRun" """ Must be **IconRun**. """ @@ -7631,13 +9256,13 @@ class IconRun(CardElement): name: Optional[str] = None """ The name of the inline icon to display. """ - size: Optional[SizeEnum] = None + size: Optional[SizeEnum] = "Default" """ The size of the inline icon. """ - style: Optional[IconStyle] = None + style: Optional[IconStyle] = "Regular" """ The style of the inline icon. """ - color: Optional[TextColor] = None + color: Optional[TextColor] = "Default" """ The color of the inline icon. """ select_action: Optional[Action] = None @@ -7649,6 +9274,10 @@ class IconRun(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -7694,27 +9323,12 @@ def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: return self -class ThemedUrl(SerializableObject): - """Defines a theme-specific URL.""" - - theme: Optional[ThemeName] = None - """ The theme this URL applies to. """ - - url: Optional[str] = None - """ The URL to use for the associated theme. """ - - def with_theme(self, value: ThemeName) -> Self: - self.theme = value - return self - - def with_url(self, value: str) -> Self: - self.url = value - return self - - class ImageRun(CardElement): """An inline image inside a RichTextBlock element.""" + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + type: Literal["ImageRun"] = "ImageRun" """ Must be **ImageRun**. """ @@ -7733,10 +9347,10 @@ class ImageRun(CardElement): url: Optional[str] = None """ The URL (or Base64-encoded Data URI) of the image. Acceptable formats are PNG, JPEG, GIF and SVG. """ - size: Optional[SizeEnum] = None + size: Optional[SizeEnum] = "Default" """ The size of the inline image. """ - style: Optional[ImageStyle] = None + style: Optional[ImageStyle] = "Default" """ The style of the inline image. """ select_action: Optional[Action] = None @@ -7751,6 +9365,10 @@ class ImageRun(CardElement): fallback: Optional[Union[SerializeAsAny[CardElement], FallbackElement]] = None """ An alternate element to render if the type of this one is unsupported or if the host application doesn't support all the capabilities specified in the requires property. """ + def with_key(self, value: str) -> Self: + self.key = value + return self + def with_id(self, value: str) -> Self: self.id = value return self @@ -7794,3 +9412,161 @@ def with_grid_area(self, value: str) -> Self: def with_fallback(self, value: Union[CardElement, FallbackElement]) -> Self: self.fallback = value return self + + +class ImBackSubmitActionData(SerializableObject): + """Represents Teams-specific data in an Action.Submit to send an Instant Message back to the Bot.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["imBack"] = "imBack" + """ Must be **imBack**. """ + + value: Optional[str] = None + """ The value that will be sent to the Bot. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_value(self, value: str) -> Self: + self.value = value + return self + + +class TabInfo(SerializableObject): + """Represents information about the iFrame content, rendered in the collab stage popout window.""" + + name: Optional[str] = None + """ The name for the content. This will be displayed as the title of the window hosting the iFrame. """ + + content_url: Optional[str] = None + """ The URL to open in an iFrame. """ + + entity_id: Optional[str] = None + """ The unique entity id for this content (e.g., random UUID). """ + + website_url: Optional[str] = None + """ An optional website URL to the content, allowing users to open this content in the browser (if they prefer). """ + + def with_name(self, value: str) -> Self: + self.name = value + return self + + def with_content_url(self, value: str) -> Self: + self.content_url = value + return self + + def with_entity_id(self, value: str) -> Self: + self.entity_id = value + return self + + def with_website_url(self, value: str) -> Self: + self.website_url = value + return self + + +class CollabStageInvokeDataValue(SerializableObject): + """Data for invoking a collaboration stage action.""" + + type: Literal["tab/tabInfoAction"] = "tab/tabInfoAction" + """ Must be **tab/tabInfoAction**. """ + + tab_info: Optional[TabInfo] = None + """ Provides information about the iFrame content, rendered in the collab stage popout window. """ + + def with_tab_info(self, value: TabInfo) -> Self: + self.tab_info = value + return self + + +class InvokeSubmitActionData(SerializableObject): + """Represents Teams-specific data in an Action.Submit to make an Invoke request to the Bot.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["invoke"] = "invoke" + """ Must be **invoke**. """ + + value: Optional[Union[Dict[str, Any], CollabStageInvokeDataValue]] = None + """ The object to send to the Bot with the Invoke request. Can be strongly typed as one of the below values to trigger a specific action in Teams. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_value(self, value: Union[Dict[str, Any], CollabStageInvokeDataValue]) -> Self: + self.value = value + return self + + +class MessageBackSubmitActionData(SerializableObject): + """Represents Teams-specific data in an Action.Submit to send a message back to the Bot.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["messageBack"] = "messageBack" + """ Must be **messageBack**. """ + + text: Optional[str] = None + """ The text that will be sent to the Bot. """ + + display_text: Optional[str] = None + """ The optional text that will be displayed as a new message in the conversation, as if the end-user sent it. `displayText` is not sent to the Bot. """ + + value: Optional[Dict[str, Any]] = None + """ Optional additional value that will be sent to the Bot. For instance, `value` can encode specific context for the action, such as unique identifiers or a JSON object. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_text(self, value: str) -> Self: + self.text = value + return self + + def with_display_text(self, value: str) -> Self: + self.display_text = value + return self + + def with_value(self, value: Dict[str, Any]) -> Self: + self.value = value + return self + + +class SigninSubmitActionData(SerializableObject): + """Represents Teams-specific data in an Action.Submit to sign in a user.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["signin"] = "signin" + """ Must be **signin**. """ + + value: Optional[str] = None + """ The URL to redirect the end-user for signing in. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self + + def with_value(self, value: str) -> Self: + self.value = value + return self + + +class TaskFetchSubmitActionData(SerializableObject): + """Represents Teams-specific data in an Action.Submit to open a task module.""" + + key: Optional[str] = None + """ Defines an optional key for the object. Keys are seldom needed, but in some scenarios, specifying keys can help maintain visual state in the host application. """ + + type: Literal["task/fetch"] = "task/fetch" + """ Must be **task/fetch**. """ + + def with_key(self, value: str) -> Self: + self.key = value + return self diff --git a/packages/cards/tests/test_message_back_action.py b/packages/cards/tests/test_message_back_action.py index 321891c5..5a62e805 100644 --- a/packages/cards/tests/test_message_back_action.py +++ b/packages/cards/tests/test_message_back_action.py @@ -10,6 +10,6 @@ def test_message_back_action_initialization(): action = MessageBackAction(text="Message Back Test", value="Test Value", display_text="Test Text") assert isinstance(action.data, SubmitActionData) assert action.data.ms_teams is not None - assert action.data.ms_teams["value"] == "Test Value" + assert action.data.ms_teams["value"] == {"value": "Test Value"} assert action.data.ms_teams["text"] == "Message Back Test" assert action.data.ms_teams["displayText"] == "Test Text"