From 0ee1e6e165878e0d8d692ee9660c3c622f8d07fe Mon Sep 17 00:00:00 2001 From: Rido Date: Tue, 21 Apr 2026 19:56:25 +0000 Subject: [PATCH 1/2] merge from main --- .azdo/publish.yaml | 227 + .azdo/publish.yml | 87 - .gitignore | 4 +- .../Activities/Activity.cs | 19 - .../Auth/ClientCredentials.cs | 5 +- .../Auth/CloudEnvironment.cs | 184 + .../Microsoft.Teams.Api/Clients/ApiClient.cs | 4 + .../Clients/BotSignInClient.cs | 6 +- .../Clients/BotTokenClient.cs | 6 +- .../Clients/UserTokenClient.cs | 12 +- Libraries/Microsoft.Teams.Api/Conversation.cs | 25 + .../Activities/Activity.cs | 8 + .../Activities/CommandActivity.cs | 1 + .../Activities/CommandResultActivity.cs | 1 + .../Conversations/ChannelCreatedActivity.cs | 1 + .../Conversations/ChannelDeletedActivity.cs | 1 + .../ChannelMemberAddedActivity.cs | 1 + .../ChannelMemberRemovedActivity.cs | 1 + .../Conversations/ChannelRenamedActivity.cs | 1 + .../Conversations/ChannelRestoredActivity.cs | 1 + .../Conversations/ChannelSharedActivity.cs | 1 + .../Conversations/ChannelUnsharedActivity.cs | 1 + .../Conversations/ConversationEndActivity.cs | 1 + .../ConversationUpdateActivity.cs | 1 + .../Conversations/MembersAddedActivity.cs | 1 + .../Conversations/MembersRemovedActivity.cs | 1 + .../Conversations/TeamArchivedActivity.cs | 1 + .../Conversations/TeamDeletedActivity.cs | 2 + .../Conversations/TeamRenamedActivity.cs | 1 + .../Conversations/TeamRestoredActivity.cs | 1 + .../Conversations/TeamUnArchivedActivity.cs | 1 + .../Activities/Events/EventActivity.cs | 1 + .../Activities/Events/MeetingEndActivity.cs | 1 + .../Activities/Events/MeetingJoinActivity.cs | 1 + .../Activities/Events/MeetingLeaveActivity.cs | 1 + .../Activities/Events/MeetingStartActivity.cs | 1 + .../Activities/Events/ReadReceiptActivity.cs | 1 + .../Activities/Installs/InstallActivity.cs | 1 + .../Installs/InstallUpdateActivity.cs | 1 + .../Activities/Installs/UnInstallActivity.cs | 1 + .../Invokes/AdaptiveCards/ActionActivity.cs | 3 + .../Invokes/Configs/FetchActivity.cs | 3 + .../Invokes/Configs/SubmitActivity.cs | 3 + .../Invokes/ExecuteActionActivity.cs | 2 + .../Activities/Invokes/FileConsentActivity.cs | 2 + .../Activities/Invokes/HandoffActivity.cs | 2 + .../Activities/Invokes/InvokeActivity.cs | 3 + .../AnonQueryLinkActivity.cs | 3 + .../CardButtonClickedActivity.cs | 1 + .../MessageExtensions/FetchTaskActivity.cs | 3 + .../MessageExtensions/QueryActivity.cs | 3 + .../MessageExtensions/QueryLinkActivity.cs | 3 + .../QuerySettingsUrlActivity.cs | 3 + .../MessageExtensions/SelectItemActivity.cs | 3 + .../MessageExtensions/SettingsActivity.cs | 1 + .../MessageExtensions/SubmitActionActivity.cs | 3 + .../Invokes/Messages/FeedbackActivity.cs | 1 + .../Invokes/Messages/SubmitActionActivity.cs | 2 + .../Invokes/Search/AnswerSearchActivity.cs | 3 + .../Invokes/Search/SearchActivity.cs | 3 + .../Invokes/Search/TypeaheadSearchActivity.cs | 3 + .../Invokes/SignIn/FailureActivity.cs | 3 + .../Invokes/SignIn/TokenExchangeActivity.cs | 4 + .../Invokes/SignIn/VerifyStateAcitivity.cs | 3 + .../Activities/Invokes/Tabs/FetchActivity.cs | 3 + .../Activities/Invokes/Tabs/SubmitActivity.cs | 3 + .../Activities/Invokes/Tasks/FetchActivity.cs | 3 + .../Invokes/Tasks/SubmitActivity.cs | 3 + .../Activities/Messages/MessageActivity.cs | 3 + .../Messages/MessageDeleteActivity.cs | 1 + .../Messages/MessageReactionActivity.cs | 3 + .../Messages/MessageUpdateActivity.cs | 1 + .../Activities/TypingActivity.cs | 1 + Libraries/Microsoft.Teams.Apps/App.cs | 112 +- Libraries/Microsoft.Teams.Apps/AppBuilder.cs | 7 + Libraries/Microsoft.Teams.Apps/AppOptions.cs | 8 + Libraries/Microsoft.Teams.Apps/AppRouting.cs | 19 +- .../Contexts/Context.Send.cs | 10 +- .../ServiceUrlValidator.cs | 41 + .../Actions/IMBackAction.cs | 4 + .../Actions/InvokeAction.cs | 5 +- .../Actions/MessageBackAction.cs | 4 + .../Actions/SignInAction.cs | 4 + .../Actions/TaskFetchAction.cs | 4 + Libraries/Microsoft.Teams.Cards/Core.cs | 15383 ++++++++++------ .../Utilities/OpenDialogData.cs | 34 + .../Utilities/SubmitData.cs | 32 + .../TeamsSettings.cs | 67 +- .../HostApplicationBuilder.cs | 22 +- .../DevToolsPlugin.cs | 11 + .../Extensions/HostApplicationBuilder.cs | 3 +- .../Extensions/TeamsValidationSettings.cs | 35 +- .../version.json | 2 +- .../version.json | 2 +- RELEASE.md | 89 +- Samples/Samples.Cards/Program.cs | 10 +- Samples/Samples.Dialogs/Program.cs | 36 +- Samples/Samples.TargetedMessages/Program.cs | 2 +- Samples/Samples.Threading/Program.cs | 87 + Samples/Samples.Threading/README.md | 38 + .../Samples.Threading.csproj | 19 + Samples/Samples.Threading/appsettings.json | 17 + .../Auth/CloudEnvironmentTests.cs | 195 + .../Clients/BotTokenClientTests.cs | 45 + .../ConversationTests.cs | 70 + Tests/Microsoft.Teams.Apps.Tests/AppTests.cs | 67 + .../ServiceUrlValidatorTests.cs | 121 + .../AdaptiveCardsTest.cs | 117 +- .../TeamsValidationSettingsTests.cs | 107 + .../CitationEntityDeepCopyTests.cs | 69 + version.json | 3 +- 111 files changed, 11533 insertions(+), 6068 deletions(-) create mode 100644 .azdo/publish.yaml delete mode 100644 .azdo/publish.yml create mode 100644 Libraries/Microsoft.Teams.Api/Auth/CloudEnvironment.cs create mode 100644 Libraries/Microsoft.Teams.Apps/ServiceUrlValidator.cs create mode 100644 Libraries/Microsoft.Teams.Cards/Utilities/OpenDialogData.cs create mode 100644 Libraries/Microsoft.Teams.Cards/Utilities/SubmitData.cs create mode 100644 Samples/Samples.Threading/Program.cs create mode 100644 Samples/Samples.Threading/README.md create mode 100644 Samples/Samples.Threading/Samples.Threading.csproj create mode 100644 Samples/Samples.Threading/appsettings.json create mode 100644 Tests/Microsoft.Teams.Api.Tests/Auth/CloudEnvironmentTests.cs create mode 100644 Tests/Microsoft.Teams.Api.Tests/ConversationTests.cs create mode 100644 Tests/Microsoft.Teams.Apps.Tests/ServiceUrlValidatorTests.cs create mode 100644 Tests/Microsoft.Teams.Plugins.AspNetCore.Tests/Extensions/TeamsValidationSettingsTests.cs create mode 100644 core/test/Microsoft.Teams.Bot.Apps.UnitTests/CitationEntityDeepCopyTests.cs diff --git a/.azdo/publish.yaml b/.azdo/publish.yaml new file mode 100644 index 00000000..4706f331 --- /dev/null +++ b/.azdo/publish.yaml @@ -0,0 +1,227 @@ +# ============================================================================= +# This pipeline publishes NuGet packages. Manually triggered only. +# - "Internal": pushes unsigned packages to the internal TeamsSDKPreviews feed. +# - "Public": signs (Authenticode + NuGet) and pushes to nuget.org (requires approval). +# Version is determined by Nerdbank.GitVersioning (nbgv) from version.json. +# +# MIGRATED TO 1ES OFFICIAL PIPELINE TEMPLATE: This pipeline now extends from +# 1ES.Official.PipelineTemplate to ensure compliance with M365 security requirements. +# ============================================================================= + +resources: + repositories: + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +trigger: none + +pr: none + +parameters: +- name: publishType + displayName: 'Publish Type' + type: string + default: 'Internal' + values: + - Internal + - Public + +variables: + buildConfiguration: 'Release' + folderPath: '$(Build.SourcesDirectory)' + ${{ if eq(parameters.publishType, 'Public') }}: + appRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' + authenticodeSignId: '2d5c4ab9-0b7e-4f60-bb92-70322df77b94' + nugetSignId: 'a94a770a-9a7b-4888-a3ea-24584b851e49' + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + pool: + name: Azure-Pipelines-1ESPT-ExDShared + image: ubuntu-22.04 + os: linux + + sdl: + sourceAnalysisPool: + name: Azure-Pipelines-1ESPT-ExDShared + image: windows-2022 + os: windows + + # Required for M365PT tracking and drift management + customBuildTags: + - ES365AIMigrationTooling + + stages: + + - ${{ if eq(parameters.publishType, 'Internal') }}: + - stage: Build_Test_Pack_Push_Internal + displayName: 'Build, Test, Pack, and Push (Internal)' + jobs: + - job: BuildTestPackPush + displayName: 'Build, Test, Pack, and Push to Internal Feed' + steps: + - checkout: self + - task: UseDotNet@2 + displayName: 'Use .NET 8' + inputs: + packageType: 'sdk' + version: '8.0.x' + + - task: UseDotNet@2 + displayName: 'Use .NET 10' + inputs: + packageType: 'sdk' + version: '10.0.x' + + - pwsh: | + $nugetConfig = @" + + + + + + + + "@ + $nugetConfig | Out-File -FilePath "$(Build.SourcesDirectory)/nuget.config" -Encoding utf8 + displayName: 'Create nuget.config' + + - task: NuGetAuthenticate@1 + displayName: 'Authenticate with NuGet feeds' + + - script: dotnet restore + displayName: 'Restore' + + - script: dotnet build --no-restore --configuration $(buildConfiguration) + displayName: 'Build' + + - script: dotnet test --no-build --verbosity normal --logger trx --configuration $(buildConfiguration) + displayName: 'Test' + + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + condition: succeededOrFailed() + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '**/*.trx' + mergeTestResults: true + + - task: DotNetCoreCLI@2 + displayName: 'Pack' + inputs: + command: 'pack' + packagesToPack: 'Libraries/**/*.csproj' + nobuild: true + configuration: '$(buildConfiguration)' + outputDir: '$(Build.ArtifactStagingDirectory)' + buildProperties: 'SymbolPackageFormat=snupkg' + + - task: 1ES.PublishNuget@1 + displayName: 'Push NuGet Packages to Internal Feed' + inputs: + useDotNetTask: false + packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg' + packageParentPath: '$(Build.ArtifactStagingDirectory)' + publishVstsFeed: '$(System.TeamProject)/TeamsSDKPreviews' + nuGetFeedType: internal + allowPackageConflicts: false # Allow duplicate versions for preview testing + publishPackageMetadata: true + retryCountOnTaskFailure: 2 + + - task: 1ES.PublishPipelineArtifact@1 + displayName: 'Publish NuGet Packages as Pipeline Artifact' + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)' + artifactName: 'Packages' + + - ${{ if eq(parameters.publishType, 'Public') }}: + - stage: Build_Test_Sign_Pack + displayName: 'Build, Test, Sign, and Pack (Public)' + jobs: + - job: BuildTestSignPack + displayName: 'Build, Test, Sign, and Pack' + steps: + - checkout: self + + - task: UseDotNet@2 + displayName: 'Use .NET 8' + inputs: + packageType: 'sdk' + version: '8.0.x' + + - task: UseDotNet@2 + displayName: 'Use .NET 10' + inputs: + packageType: 'sdk' + version: '10.0.x' + + - pwsh: | + $nugetConfig = @" + + + + + + + + "@ + $nugetConfig | Out-File -FilePath "$(Build.SourcesDirectory)/nuget.config" -Encoding utf8 + displayName: 'Create nuget.config' + + - task: NuGetAuthenticate@1 + displayName: 'Authenticate with NuGet feeds' + + - script: dotnet restore + displayName: 'Restore' + + - script: dotnet build --no-restore --configuration $(buildConfiguration) + displayName: 'Build' + + - script: dotnet test --no-build --verbosity normal --logger trx --configuration $(buildConfiguration) + displayName: 'Test' + + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + condition: succeededOrFailed() + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '**/*.trx' + mergeTestResults: true + + - template: .azdo/templates/sign-and-pack.yaml@self + + - task: 1ES.PublishPipelineArtifact@1 + displayName: 'Publish NuGet Packages as Pipeline Artifact' + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)' + artifactName: 'Packages' + + - ${{ if eq(parameters.publishType, 'Public') }}: + - stage: PushToNuGet + displayName: 'Push Packages to nuget.org' + dependsOn: Build_Test_Sign_Pack + jobs: + - deployment: PushPackages + displayName: 'Manual Approval Required to Push Packages' + environment: + name: 'teams-net-publish' + strategy: + runOnce: + deploy: + steps: + - download: current + artifact: Packages + + - task: 1ES.PublishNuget@1 + displayName: 'Push Packages to nuget.org' + inputs: + useDotNetTask: false + packagesToPush: '$(Pipeline.Workspace)/Packages/*.nupkg' + packageParentPath: '$(Pipeline.Workspace)/Packages' + nuGetFeedType: external + publishFeedCredentials: 'Microsoft.Teams.*' + publishPackageMetadata: true + retryCountOnTaskFailure: 2 diff --git a/.azdo/publish.yml b/.azdo/publish.yml deleted file mode 100644 index f33373a9..00000000 --- a/.azdo/publish.yml +++ /dev/null @@ -1,87 +0,0 @@ -# ============================================================================= -# For public releases, this pipeline (teams.net) is triggered manually. -# It builds, tests, signs (Authenticode + NuGet), and packs the code, then pushes to nuget.org (requires approval). -# ============================================================================= - -trigger: none - -pr: none - -pool: - vmImage: 'ubuntu-22.04' - -variables: - buildConfiguration: 'Release' - folderPath: '$(Build.SourcesDirectory)' - appRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - authenticodeSignId: '2d5c4ab9-0b7e-4f60-bb92-70322df77b94' - nugetSignId: 'a94a770a-9a7b-4888-a3ea-24584b851e49' - -stages: -- stage: Build_Test_Sign_Pack - jobs: - - job: BuildTestSignPack - displayName: 'Build, Test, Sign, and Pack' - steps: - - checkout: self - - - task: UseDotNet@2 - displayName: 'Use .NET 8' - inputs: - packageType: 'sdk' - version: '8.0.x' - - - task: UseDotNet@2 - displayName: 'Use .NET 10' - inputs: - packageType: 'sdk' - version: '10.0.x' - - - script: dotnet restore - displayName: 'Restore' - - - script: dotnet build --no-restore --configuration $(buildConfiguration) - displayName: 'Build' - - - script: dotnet test --no-build --verbosity normal --logger trx --configuration $(buildConfiguration) - displayName: 'Test' - - - task: PublishTestResults@2 - displayName: 'Publish Test Results' - condition: succeededOrFailed() - inputs: - testResultsFormat: 'VSTest' - testResultsFiles: '**/*.trx' - mergeTestResults: true - - - template: templates/sign-and-pack.yaml - - - task: PublishPipelineArtifact@1 - displayName: 'Publish NuGet Packages as Pipeline Artifact' - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)' - artifact: 'Packages' - publishLocation: 'pipeline' - -- stage: PushToNuGet - displayName: 'Push NuGet Packages to nuget.org' - dependsOn: Build_Test_Sign_Pack - jobs: - - deployment: PushPackages - displayName: 'Manual Approval Required to Push Packages' - environment: - name: 'teams-net-publish' - strategy: - runOnce: - deploy: - steps: - - download: current - artifact: Packages - - - task: NuGetCommand@2 - displayName: 'Push NuGet Packages' - inputs: - command: push - packagesToPush: '$(Pipeline.Workspace)/Packages/*.nupkg' - nuGetFeedType: external - publishFeedCredentials: 'Microsoft.Teams.*' \ No newline at end of file diff --git a/.gitignore b/.gitignore index 95247ceb..def52263 100644 --- a/.gitignore +++ b/.gitignore @@ -9,9 +9,7 @@ # local app settings files appsettings.Local.json appsettings.Development.json -launchSettings.json - -.claude/ +launchsettings.json # User-specific files *.rsuser diff --git a/Libraries/Microsoft.Teams.Api/Activities/Activity.cs b/Libraries/Microsoft.Teams.Api/Activities/Activity.cs index 2d526cb1..6c7dc4a6 100644 --- a/Libraries/Microsoft.Teams.Api/Activities/Activity.cs +++ b/Libraries/Microsoft.Teams.Api/Activities/Activity.cs @@ -146,10 +146,6 @@ public partial class Activity : IActivity [JsonPropertyOrder(130)] public ChannelData? ChannelData { get; set; } - [JsonIgnore] - [Experimental("ExperimentalTeamsTargeted")] - public bool IsTargeted { get; set; } - [JsonExtensionData] public IDictionary Properties { get; set; } = new Dictionary(); @@ -227,14 +223,6 @@ public virtual Activity WithRelatesTo(ConversationReference value) } public virtual Activity WithRecipient(Account value) - { - #pragma warning disable ExperimentalTeamsTargeted - return WithRecipient(value, false); - #pragma warning restore ExperimentalTeamsTargeted - } - - [Experimental("ExperimentalTeamsTargeted")] - public virtual Activity WithRecipient(Account value, bool isTargeted) { Recipient = value; #pragma warning disable ExperimentalTeamsTargeted @@ -440,13 +428,6 @@ public Activity Merge(Activity from) LocalTimestamp ??= from.LocalTimestamp; AddEntity(from.Entities?.ToArray() ?? []); - #pragma warning disable ExperimentalTeamsTargeted - if (from.IsTargeted) - { - IsTargeted = true; - } - #pragma warning restore ExperimentalTeamsTargeted - if (from.ChannelData is not null) { WithData(from.ChannelData); diff --git a/Libraries/Microsoft.Teams.Api/Auth/ClientCredentials.cs b/Libraries/Microsoft.Teams.Api/Auth/ClientCredentials.cs index 7ae6d974..e198eb73 100644 --- a/Libraries/Microsoft.Teams.Api/Auth/ClientCredentials.cs +++ b/Libraries/Microsoft.Teams.Api/Auth/ClientCredentials.cs @@ -10,6 +10,7 @@ public class ClientCredentials : IHttpCredentials public string ClientId { get; set; } public string ClientSecret { get; set; } public string? TenantId { get; set; } + public CloudEnvironment Cloud { get; set; } = CloudEnvironment.Public; public ClientCredentials(string clientId, string clientSecret) { @@ -26,9 +27,9 @@ public ClientCredentials(string clientId, string clientSecret, string? tenantId) public async Task Resolve(IHttpClient client, string[] scopes, CancellationToken cancellationToken = default) { - var tenantId = TenantId ?? "botframework.com"; + var tenantId = TenantId ?? Cloud.LoginTenant; var request = HttpRequest.Post( - $"https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token" + $"{Cloud.LoginEndpoint}/{tenantId}/oauth2/v2.0/token" ); request.Headers.Add("Content-Type", ["application/x-www-form-urlencoded"]); diff --git a/Libraries/Microsoft.Teams.Api/Auth/CloudEnvironment.cs b/Libraries/Microsoft.Teams.Api/Auth/CloudEnvironment.cs new file mode 100644 index 00000000..a251373f --- /dev/null +++ b/Libraries/Microsoft.Teams.Api/Auth/CloudEnvironment.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Teams.Api.Auth; + +/// +/// Bundles all cloud-specific service endpoints for a given Azure environment. +/// Use predefined instances (, , , ) +/// or construct a custom one. +/// +public class CloudEnvironment +{ + /// + /// The Azure AD login endpoint (e.g. "https://login.microsoftonline.com"). + /// + public string LoginEndpoint { get; } + + /// + /// The default multi-tenant login tenant (e.g. "botframework.com"). + /// + public string LoginTenant { get; } + + /// + /// The Bot Framework OAuth scope (e.g. "https://api.botframework.com/.default"). + /// + public string BotScope { get; } + + /// + /// The Bot Framework token service base URL (e.g. "https://token.botframework.com"). + /// + public string TokenServiceUrl { get; } + + /// + /// The OpenID metadata URL for token validation (e.g. "https://login.botframework.com/v1/.well-known/openidconfiguration"). + /// + public string OpenIdMetadataUrl { get; } + + /// + /// The token issuer for Bot Framework tokens (e.g. "https://api.botframework.com"). + /// + public string TokenIssuer { get; } + + /// + /// The Microsoft Graph token scope (e.g. "https://graph.microsoft.com/.default"). + /// + public string GraphScope { get; } + + /// + /// Allowed service URL hostnames for this cloud environment. + /// + public IReadOnlyList AllowedServiceUrls { get; } + + public CloudEnvironment( + string loginEndpoint, + string loginTenant, + string botScope, + string tokenServiceUrl, + string openIdMetadataUrl, + string tokenIssuer, + string graphScope, + string[]? allowedServiceUrls = null) + { + LoginEndpoint = loginEndpoint.TrimEnd('/'); + LoginTenant = loginTenant; + BotScope = botScope; + TokenServiceUrl = tokenServiceUrl.TrimEnd('/'); + OpenIdMetadataUrl = openIdMetadataUrl; + TokenIssuer = tokenIssuer; + GraphScope = graphScope; + AllowedServiceUrls = allowedServiceUrls is not null ? Array.AsReadOnly(allowedServiceUrls) : []; + } + + /// + /// Microsoft public (commercial) cloud. + /// + public static readonly CloudEnvironment Public = new( + loginEndpoint: "https://login.microsoftonline.com", + loginTenant: "botframework.com", + botScope: "https://api.botframework.com/.default", + tokenServiceUrl: "https://token.botframework.com", + openIdMetadataUrl: "https://login.botframework.com/v1/.well-known/openidconfiguration", + tokenIssuer: "https://api.botframework.com", + graphScope: "https://graph.microsoft.com/.default", + allowedServiceUrls: ["smba.trafficmanager.net", "smba.onyx.prod.teams.trafficmanager.net", "smba.infra.gcc.teams.microsoft.com"] + ); + + /// + /// US Government Community Cloud High (GCCH). + /// + public static readonly CloudEnvironment USGov = new( + loginEndpoint: "https://login.microsoftonline.us", + loginTenant: "MicrosoftServices.onmicrosoft.us", + botScope: "https://api.botframework.us/.default", + tokenServiceUrl: "https://tokengcch.botframework.azure.us", + openIdMetadataUrl: "https://login.botframework.azure.us/v1/.well-known/openidconfiguration", + tokenIssuer: "https://api.botframework.us", + graphScope: "https://graph.microsoft.us/.default", + allowedServiceUrls: ["smba.infra.gov.teams.microsoft.us"] + ); + + /// + /// US Government Department of Defense (DoD). + /// + public static readonly CloudEnvironment USGovDoD = new( + loginEndpoint: "https://login.microsoftonline.us", + loginTenant: "MicrosoftServices.onmicrosoft.us", + botScope: "https://api.botframework.us/.default", + tokenServiceUrl: "https://apiDoD.botframework.azure.us", + openIdMetadataUrl: "https://login.botframework.azure.us/v1/.well-known/openidconfiguration", + tokenIssuer: "https://api.botframework.us", + graphScope: "https://dod-graph.microsoft.us/.default", + allowedServiceUrls: ["smba.infra.dod.teams.microsoft.us"] + ); + + /// + /// China cloud (21Vianet). + /// + public static readonly CloudEnvironment China = new( + loginEndpoint: "https://login.partner.microsoftonline.cn", + loginTenant: "microsoftservices.partner.onmschina.cn", + botScope: "https://api.botframework.azure.cn/.default", + tokenServiceUrl: "https://token.botframework.azure.cn", + openIdMetadataUrl: "https://login.botframework.azure.cn/v1/.well-known/openidconfiguration", + tokenIssuer: "https://api.botframework.azure.cn", + graphScope: "https://microsoftgraph.chinacloudapi.cn/.default", + allowedServiceUrls: ["frontend.botapi.msg.infra.teams.microsoftonline.cn"] + ); + + /// + /// Creates a new by applying non-null overrides on top of this instance. + /// Returns the same instance if all overrides are null (no allocation). + /// + public CloudEnvironment WithOverrides( + string? loginEndpoint = null, + string? loginTenant = null, + string? botScope = null, + string? tokenServiceUrl = null, + string? openIdMetadataUrl = null, + string? tokenIssuer = null, + string? graphScope = null, + string[]? allowedServiceUrls = null) + { + if (loginEndpoint is null && loginTenant is null && botScope is null && + tokenServiceUrl is null && openIdMetadataUrl is null && tokenIssuer is null && + graphScope is null && allowedServiceUrls is null) + { + return this; + } + + return new CloudEnvironment( + loginEndpoint ?? LoginEndpoint, + loginTenant ?? LoginTenant, + botScope ?? BotScope, + tokenServiceUrl ?? TokenServiceUrl, + openIdMetadataUrl ?? OpenIdMetadataUrl, + tokenIssuer ?? TokenIssuer, + graphScope ?? GraphScope, + allowedServiceUrls ?? [.. AllowedServiceUrls] + ); + } + + /// + /// Resolves a cloud environment name (case-insensitive) to its corresponding instance. + /// Valid names: "Public", "USGov", "USGovDoD", "China". + /// + public static CloudEnvironment FromName(string name) + { + ArgumentNullException.ThrowIfNull(name); + + if (string.IsNullOrWhiteSpace(name)) + { + throw new ArgumentException("Cloud environment name cannot be empty or whitespace.", nameof(name)); + } + + return name.ToLowerInvariant() switch + { + "public" => Public, + "usgov" => USGov, + "usgovdod" => USGovDoD, + "china" => China, + _ => throw new ArgumentException($"Unknown cloud environment: '{name}'. Valid values are: Public, USGov, USGovDoD, China.", nameof(name)) + }; + } +} diff --git a/Libraries/Microsoft.Teams.Api/Clients/ApiClient.cs b/Libraries/Microsoft.Teams.Api/Clients/ApiClient.cs index b1588d2a..c61222ce 100644 --- a/Libraries/Microsoft.Teams.Api/Clients/ApiClient.cs +++ b/Libraries/Microsoft.Teams.Api/Clients/ApiClient.cs @@ -83,8 +83,12 @@ public ApiClient(ApiClient client, CancellationToken cancellationToken) : base(c { ServiceUrl = client.ServiceUrl; Bots = new BotClient(_http, cancellationToken); + Bots.Token.ActiveBotScope = client.Bots.Token.ActiveBotScope; + Bots.Token.ActiveGraphScope = client.Bots.Token.ActiveGraphScope; + Bots.SignIn.TokenServiceUrl = client.Bots.SignIn.TokenServiceUrl; Conversations = new ConversationClient(ServiceUrl, _http, cancellationToken); Users = new UserClient(_http, cancellationToken); + Users.Token.TokenServiceUrl = client.Users.Token.TokenServiceUrl; Teams = new TeamClient(ServiceUrl, _http, cancellationToken); Meetings = new MeetingClient(ServiceUrl, _http, cancellationToken); } diff --git a/Libraries/Microsoft.Teams.Api/Clients/BotSignInClient.cs b/Libraries/Microsoft.Teams.Api/Clients/BotSignInClient.cs index d1d8d792..716b0294 100644 --- a/Libraries/Microsoft.Teams.Api/Clients/BotSignInClient.cs +++ b/Libraries/Microsoft.Teams.Api/Clients/BotSignInClient.cs @@ -7,6 +7,8 @@ namespace Microsoft.Teams.Api.Clients; public class BotSignInClient : Client { + public string TokenServiceUrl { get; set; } = "https://token.botframework.com"; + public BotSignInClient() : base() { @@ -32,7 +34,7 @@ public async Task GetUrlAsync(GetUrlRequest request, CancellationToken c var token = cancellationToken != default ? cancellationToken : _cancellationToken; var query = QueryString.Serialize(request); var req = HttpRequest.Get( - $"https://token.botframework.com/api/botsignin/GetSignInUrl?{query}" + $"{TokenServiceUrl}/api/botsignin/GetSignInUrl?{query}" ); var res = await _http.SendAsync(req, token); @@ -44,7 +46,7 @@ public async Task GetUrlAsync(GetUrlRequest request, CancellationToken c var token = cancellationToken != default ? cancellationToken : _cancellationToken; var query = QueryString.Serialize(request); var req = HttpRequest.Get( - $"https://token.botframework.com/api/botsignin/GetSignInResource?{query}" + $"{TokenServiceUrl}/api/botsignin/GetSignInResource?{query}" ); var res = await _http.SendAsync(req, token); diff --git a/Libraries/Microsoft.Teams.Api/Clients/BotTokenClient.cs b/Libraries/Microsoft.Teams.Api/Clients/BotTokenClient.cs index a7deef3f..e4870df5 100644 --- a/Libraries/Microsoft.Teams.Api/Clients/BotTokenClient.cs +++ b/Libraries/Microsoft.Teams.Api/Clients/BotTokenClient.cs @@ -9,6 +9,8 @@ public class BotTokenClient : Client { public static readonly string BotScope = "https://api.botframework.com/.default"; public static readonly string GraphScope = "https://graph.microsoft.com/.default"; + public string ActiveBotScope { get; set; } = BotScope; + public string ActiveGraphScope { get; set; } = GraphScope; public BotTokenClient() : this(default) { @@ -38,12 +40,12 @@ public BotTokenClient(IHttpClientFactory factory, CancellationToken cancellation public virtual async Task GetAsync(IHttpCredentials credentials, IHttpClient? http = null, CancellationToken cancellationToken = default) { var token = cancellationToken != default ? cancellationToken : _cancellationToken; - return await credentials.Resolve(http ?? _http, [BotScope], token); + return await credentials.Resolve(http ?? _http, [ActiveBotScope], token); } public async Task GetGraphAsync(IHttpCredentials credentials, IHttpClient? http = null, CancellationToken cancellationToken = default) { var token = cancellationToken != default ? cancellationToken : _cancellationToken; - return await credentials.Resolve(http ?? _http, [GraphScope], token); + return await credentials.Resolve(http ?? _http, [ActiveGraphScope], token); } } \ No newline at end of file diff --git a/Libraries/Microsoft.Teams.Api/Clients/UserTokenClient.cs b/Libraries/Microsoft.Teams.Api/Clients/UserTokenClient.cs index 51808761..2a476dfc 100644 --- a/Libraries/Microsoft.Teams.Api/Clients/UserTokenClient.cs +++ b/Libraries/Microsoft.Teams.Api/Clients/UserTokenClient.cs @@ -10,6 +10,8 @@ namespace Microsoft.Teams.Api.Clients; public class UserTokenClient : Client { + public string TokenServiceUrl { get; set; } = "https://token.botframework.com"; + private readonly JsonSerializerOptions _jsonSerializerOptions = new() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull @@ -39,7 +41,7 @@ public UserTokenClient(IHttpClientFactory factory, CancellationToken cancellatio { var token = cancellationToken != default ? cancellationToken : _cancellationToken; var query = QueryString.Serialize(request); - var req = HttpRequest.Get($"https://token.botframework.com/api/usertoken/GetToken?{query}"); + var req = HttpRequest.Get($"{TokenServiceUrl}/api/usertoken/GetToken?{query}"); var res = await _http.SendAsync(req, token); return res.Body; } @@ -48,7 +50,7 @@ public UserTokenClient(IHttpClientFactory factory, CancellationToken cancellatio { var token = cancellationToken != default ? cancellationToken : _cancellationToken; var query = QueryString.Serialize(request); - var req = HttpRequest.Post($"https://token.botframework.com/api/usertoken/GetAadTokens?{query}", body: request); + var req = HttpRequest.Post($"{TokenServiceUrl}/api/usertoken/GetAadTokens?{query}", body: request); var res = await _http.SendAsync>(req, token); return res.Body; } @@ -57,7 +59,7 @@ public UserTokenClient(IHttpClientFactory factory, CancellationToken cancellatio { var token = cancellationToken != default ? cancellationToken : _cancellationToken; var query = QueryString.Serialize(request); - var req = HttpRequest.Get($"https://token.botframework.com/api/usertoken/GetTokenStatus?{query}"); + var req = HttpRequest.Get($"{TokenServiceUrl}/api/usertoken/GetTokenStatus?{query}"); var res = await _http.SendAsync>(req, token); return res.Body; } @@ -66,7 +68,7 @@ public async Task SignOutAsync(SignOutRequest request, CancellationToken cancell { var token = cancellationToken != default ? cancellationToken : _cancellationToken; var query = QueryString.Serialize(request); - var req = HttpRequest.Delete($"https://token.botframework.com/api/usertoken/SignOut?{query}"); + var req = HttpRequest.Delete($"{TokenServiceUrl}/api/usertoken/SignOut?{query}"); await _http.SendAsync(req, token); } @@ -84,7 +86,7 @@ public async Task SignOutAsync(SignOutRequest request, CancellationToken cancell // This is required for the Bot Framework Token Service to process the request correctly. var body = JsonSerializer.Serialize(request.GetBody(), _jsonSerializerOptions); - var req = HttpRequest.Post($"https://token.botframework.com/api/usertoken/exchange?{query}", body); + var req = HttpRequest.Post($"{TokenServiceUrl}/api/usertoken/exchange?{query}", body); req.Headers.Add("Content-Type", new List() { "application/json" }); var res = await _http.SendAsync(req, token); diff --git a/Libraries/Microsoft.Teams.Api/Conversation.cs b/Libraries/Microsoft.Teams.Api/Conversation.cs index 3cb0b152..a2cb8f53 100644 --- a/Libraries/Microsoft.Teams.Api/Conversation.cs +++ b/Libraries/Microsoft.Teams.Api/Conversation.cs @@ -64,6 +64,31 @@ public string ThreadId } } + /// + /// Construct a threaded conversation ID by appending ;messageid={messageId} + /// to the conversation ID. This is the format APX uses to route messages + /// to a specific thread in a channel. + /// + /// the conversation to thread into (e.g. 19:abc@thread.skype) + /// the thread root message ID (must be a non-zero numeric string) + /// the threaded conversation ID (e.g. 19:abc@thread.skype;messageid=123) + public static string ToThreadedConversationId(string conversationId, string messageId) + { + if (string.IsNullOrEmpty(conversationId)) + { + throw new ArgumentException("conversationId must be a non-empty string", nameof(conversationId)); + } + + if (string.IsNullOrEmpty(messageId) || !ulong.TryParse(messageId, out var parsed) || parsed == 0) + { + throw new ArgumentException($"Invalid messageId \"{messageId}\": must be a non-zero numeric value", nameof(messageId)); + } + + // Strip any existing ;messageid= suffix (mirrors APX's NormalizeConversationId) + var baseId = conversationId.Split(';')[0]; + return $"{baseId};messageid={messageId}"; + } + public object Clone() => MemberwiseClone(); public Conversation Copy() => (Conversation)Clone(); } diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Activity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Activity.cs index 2e941671..ef110d9e 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Activity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Activity.cs @@ -18,6 +18,7 @@ public class ActivityAttribute(string? name = null, Type? type = null) : Attribu public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnActivity(this App app, Func, Task> handler) { app.Router.Register(async (context) => @@ -40,6 +41,7 @@ public static App OnActivity(this App app, Func, Cancellatio return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnActivity(this App app, Func, Task> handler) { app.Router.Register(handler); @@ -52,6 +54,7 @@ public static App OnActivity(this App app, Func, Cancellatio return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnActivity(this App app, ActivityType type, Func, Task> handler) { app.Router.Register(new Route() @@ -86,6 +89,7 @@ public static App OnActivity(this App app, ActivityType type, Func, Task> handler) { app.Router.Register(new Route() @@ -112,6 +116,7 @@ public static App OnActivity(this App app, ActivityType type, Func(this App app, Func, Task> handler) where TActivity : IActivity { app.Router.Register(new Route() @@ -146,6 +151,7 @@ public static App OnActivity(this App app, Func, return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnActivity(this App app, Func, Task> handler) where TActivity : IActivity { app.Router.Register(new Route() @@ -172,6 +178,7 @@ public static App OnActivity(this App app, Func, return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnActivity(this App app, Func select, Func, Task> handler) { app.Router.Register(new Route() @@ -206,6 +213,7 @@ public static App OnActivity(this App app, Func select, Func select, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/CommandActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/CommandActivity.cs index 868f486c..5099b24e 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/CommandActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/CommandActivity.cs @@ -14,6 +14,7 @@ public class CommandAttribute() : ActivityAttribute(ActivityType.Command, type: public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnCommand(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/CommandResultActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/CommandResultActivity.cs index 556cc2f3..80e6c260 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/CommandResultActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/CommandResultActivity.cs @@ -14,6 +14,7 @@ public class CommandResultAttribute() : ActivityAttribute(ActivityType.CommandRe public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnCommandResult(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelCreatedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelCreatedActivity.cs index 21f8c16a..06b30f8c 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelCreatedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelCreatedActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnChannelCreated(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelDeletedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelDeletedActivity.cs index be6c0830..16e0180e 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelDeletedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelDeletedActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnChannelDeleted(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelMemberAddedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelMemberAddedActivity.cs index 30965c21..ffb6d6bd 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelMemberAddedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelMemberAddedActivity.cs @@ -22,6 +22,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnChannelMemberAdded(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelMemberRemovedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelMemberRemovedActivity.cs index e91ddd05..70df3b6c 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelMemberRemovedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelMemberRemovedActivity.cs @@ -22,6 +22,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnChannelMemberRemoved(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelRenamedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelRenamedActivity.cs index 2a37b40a..44464560 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelRenamedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelRenamedActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnChannelRenamed(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelRestoredActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelRestoredActivity.cs index c15314ec..9eacc7cd 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelRestoredActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelRestoredActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnChannelRestored(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelSharedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelSharedActivity.cs index f8fc3c63..1d151800 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelSharedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelSharedActivity.cs @@ -22,6 +22,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnChannelShared(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelUnsharedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelUnsharedActivity.cs index dd7df020..0c534d81 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelUnsharedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ChannelUnsharedActivity.cs @@ -22,6 +22,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnChannelUnShared(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ConversationEndActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ConversationEndActivity.cs index dd42e2c7..113305f0 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ConversationEndActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ConversationEndActivity.cs @@ -17,6 +17,7 @@ public class EndAttribute() : ActivityAttribute(ActivityType.EndOfConversation, public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnConversationEnd(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ConversationUpdateActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ConversationUpdateActivity.cs index d732388f..1819d58f 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ConversationUpdateActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/ConversationUpdateActivity.cs @@ -27,6 +27,7 @@ public UpdateAttribute(ConversationUpdateActivity.EventType eventType) : base(st public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnConversationUpdate(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/MembersAddedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/MembersAddedActivity.cs index 9d28783e..480fa56a 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/MembersAddedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/MembersAddedActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMembersAdded(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/MembersRemovedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/MembersRemovedActivity.cs index 60fcf0a2..f599348a 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/MembersRemovedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/MembersRemovedActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMembersRemoved(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamArchivedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamArchivedActivity.cs index 17dbdc67..c72d5655 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamArchivedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamArchivedActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTeamArchived(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamDeletedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamDeletedActivity.cs index d51f536e..3f1e1d77 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamDeletedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamDeletedActivity.cs @@ -27,6 +27,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTeamDeleted(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -52,6 +53,7 @@ public static App OnTeamDeleted(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamRenamedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamRenamedActivity.cs index 48d1cdd7..e5bd1e94 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamRenamedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamRenamedActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTeamRenamed(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamRestoredActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamRestoredActivity.cs index a66b48a6..dc39d907 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamRestoredActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamRestoredActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTeamRestored(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamUnArchivedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamUnArchivedActivity.cs index 5bee7e71..500113e6 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamUnArchivedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Conversations/TeamUnArchivedActivity.cs @@ -25,6 +25,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTeamUnArchived(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Events/EventActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Events/EventActivity.cs index 4a4d0e7d..3c41630e 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Events/EventActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Events/EventActivity.cs @@ -25,6 +25,7 @@ public EventAttribute(Name name) : base(string.Join("/", [ActivityType.Event, na public static partial class AppEventActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnEvent(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingEndActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingEndActivity.cs index ae7859c4..34fcc412 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingEndActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingEndActivity.cs @@ -27,6 +27,7 @@ public override bool Select(IActivity activity) public static partial class AppEventActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMeetingEnd(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingJoinActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingJoinActivity.cs index ccb28fb9..a72a7e4b 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingJoinActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingJoinActivity.cs @@ -27,6 +27,7 @@ public override bool Select(IActivity activity) public static partial class AppEventActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMeetingJoin(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingLeaveActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingLeaveActivity.cs index e17df268..14ffe8c8 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingLeaveActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingLeaveActivity.cs @@ -27,6 +27,7 @@ public override bool Select(IActivity activity) public static partial class AppEventActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMeetingLeave(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingStartActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingStartActivity.cs index 8c9e6798..e5f30f34 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingStartActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Events/MeetingStartActivity.cs @@ -27,6 +27,7 @@ public override bool Select(IActivity activity) public static partial class AppEventActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMeetingStart(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Events/ReadReceiptActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Events/ReadReceiptActivity.cs index 86274b98..255a85f6 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Events/ReadReceiptActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Events/ReadReceiptActivity.cs @@ -27,6 +27,7 @@ public override bool Select(IActivity activity) public static partial class AppEventActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnReadReceipt(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Installs/InstallActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Installs/InstallActivity.cs index f65d3c23..39234f49 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Installs/InstallActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Installs/InstallActivity.cs @@ -22,6 +22,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnInstall(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Installs/InstallUpdateActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Installs/InstallUpdateActivity.cs index dbcf3ce5..791087c3 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Installs/InstallUpdateActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Installs/InstallUpdateActivity.cs @@ -24,6 +24,7 @@ public InstallUpdateAttribute(InstallUpdateAction action) : base(string.Join("/" public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnInstallUpdate(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Installs/UnInstallActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Installs/UnInstallActivity.cs index 55ff3af3..663ba917 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Installs/UnInstallActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Installs/UnInstallActivity.cs @@ -22,6 +22,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnUnInstall(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/AdaptiveCards/ActionActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/AdaptiveCards/ActionActivity.cs index 2df8ce56..a0580dd0 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/AdaptiveCards/ActionActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/AdaptiveCards/ActionActivity.cs @@ -19,6 +19,7 @@ public class ActionAttribute() : InvokeAttribute(Api.Activities.Invokes.Name.Ada public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnAdaptiveCardAction(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -36,6 +37,7 @@ public static App OnAdaptiveCardAction(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -49,6 +51,7 @@ public static App OnAdaptiveCardAction(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Configs/FetchActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Configs/FetchActivity.cs index 070bca21..07b72504 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Configs/FetchActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Configs/FetchActivity.cs @@ -19,6 +19,7 @@ public class FetchAttribute() : InvokeAttribute(Api.Activities.Invokes.Name.Conf public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnConfigFetch(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -36,6 +37,7 @@ public static App OnConfigFetch(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -49,6 +51,7 @@ public static App OnConfigFetch(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Configs/SubmitActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Configs/SubmitActivity.cs index 7ab3d8b5..103e42af 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Configs/SubmitActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Configs/SubmitActivity.cs @@ -19,6 +19,7 @@ public class SubmitAttribute() : InvokeAttribute(Api.Activities.Invokes.Name.Con public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnConfigSubmit(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -36,6 +37,7 @@ public static App OnConfigSubmit(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -49,6 +51,7 @@ public static App OnConfigSubmit(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/ExecuteActionActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/ExecuteActionActivity.cs index e04183b3..68917f16 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/ExecuteActionActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/ExecuteActionActivity.cs @@ -15,6 +15,7 @@ public class ExecuteActionAttribute() : InvokeAttribute(Api.Activities.Invokes.N public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnExecuteAction(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -32,6 +33,7 @@ public static App OnExecuteAction(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/FileConsentActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/FileConsentActivity.cs index fa3ee7c8..c08d809a 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/FileConsentActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/FileConsentActivity.cs @@ -15,6 +15,7 @@ public class FileConsentAttribute() : InvokeAttribute(Api.Activities.Invokes.Nam public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnFileConsent(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -32,6 +33,7 @@ public static App OnFileConsent(this App app, Func return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnFileConsent(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/HandoffActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/HandoffActivity.cs index 1b0a3ee3..d15dc821 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/HandoffActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/HandoffActivity.cs @@ -15,6 +15,7 @@ public class HandoffAttribute() : InvokeAttribute(Api.Activities.Invokes.Name.Ha public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnHandoff(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -32,6 +33,7 @@ public static App OnHandoff(this App app, Func, Task> return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnHandoff(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/InvokeActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/InvokeActivity.cs index c3763c91..0ecc9ee7 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/InvokeActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/InvokeActivity.cs @@ -31,6 +31,7 @@ public override bool Select(IActivity activity) public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnInvoke(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -48,6 +49,7 @@ public static App OnInvoke(this App app, Func, Task> ha return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnInvoke(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -61,6 +63,7 @@ public static App OnInvoke(this App app, Func, Task, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/AnonQueryLinkActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/AnonQueryLinkActivity.cs index ef17799d..2fb05245 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/AnonQueryLinkActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/AnonQueryLinkActivity.cs @@ -18,6 +18,7 @@ public class AnonQueryLinkAttribute() : InvokeAttribute(Api.Activities.Invokes.N public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnAnonQueryLink(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnAnonQueryLink(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -48,6 +50,7 @@ public static App OnAnonQueryLink(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/CardButtonClickedActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/CardButtonClickedActivity.cs index 63d6ffcf..1f14523e 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/CardButtonClickedActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/CardButtonClickedActivity.cs @@ -18,6 +18,7 @@ public class CardButtonClickedAttribute() : InvokeAttribute(Api.Activities.Invok public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnCardButtonClicked(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/FetchTaskActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/FetchTaskActivity.cs index b1755444..1cf7c765 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/FetchTaskActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/FetchTaskActivity.cs @@ -18,6 +18,7 @@ public class FetchTaskAttribute() : InvokeAttribute(Api.Activities.Invokes.Name. public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnFetchTask(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnFetchTask(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -48,6 +50,7 @@ public static App OnFetchTask(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QueryActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QueryActivity.cs index 1f682293..c8190fdf 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QueryActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QueryActivity.cs @@ -18,6 +18,7 @@ public class QueryAttribute() : InvokeAttribute(Api.Activities.Invokes.Name.Mess public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnQuery(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnQuery(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -48,6 +50,7 @@ public static App OnQuery(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QueryLinkActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QueryLinkActivity.cs index 4dd6a440..e9485470 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QueryLinkActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QueryLinkActivity.cs @@ -18,6 +18,7 @@ public class QueryLinkAttribute() : InvokeAttribute(Api.Activities.Invokes.Name. public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnQueryLink(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnQueryLink(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -48,6 +50,7 @@ public static App OnQueryLink(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QuerySettingsUrlActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QuerySettingsUrlActivity.cs index 465ea84e..646d42c5 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QuerySettingsUrlActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/QuerySettingsUrlActivity.cs @@ -18,6 +18,7 @@ public class QuerySettingsUrlAttribute() : InvokeAttribute(Api.Activities.Invoke public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnQuerySettingsUrl(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnQuerySettingsUrl(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -48,6 +50,7 @@ public static App OnQuerySettingsUrl(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SelectItemActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SelectItemActivity.cs index 3c19e743..87af1ad2 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SelectItemActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SelectItemActivity.cs @@ -18,6 +18,7 @@ public class SelectItemAttribute() : InvokeAttribute(Api.Activities.Invokes.Name public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnSelectItem(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnSelectItem(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -48,6 +50,7 @@ public static App OnSelectItem(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SettingsActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SettingsActivity.cs index 0f316168..67bdc97a 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SettingsActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SettingsActivity.cs @@ -18,6 +18,7 @@ public class SettingAttribute() : InvokeAttribute(Api.Activities.Invokes.Name.Me public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnSetting(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SubmitActionActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SubmitActionActivity.cs index 1878e2e3..06783020 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SubmitActionActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/MessageExtensions/SubmitActionActivity.cs @@ -18,6 +18,7 @@ public class SubmitActionAttribute() : InvokeAttribute(Api.Activities.Invokes.Na public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnSubmitAction(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnSubmitAction(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -48,6 +50,7 @@ public static App OnSubmitAction(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Messages/FeedbackActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Messages/FeedbackActivity.cs index f3c89eb3..96835a56 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Messages/FeedbackActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Messages/FeedbackActivity.cs @@ -29,6 +29,7 @@ public static partial class AppInvokeActivityExtensions /// /// Registers a handler for message feedback activities /// + [Obsolete("Use the handler with the cancellation token")] public static App OnFeedback(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Messages/SubmitActionActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Messages/SubmitActionActivity.cs index 38f700d5..6e911e1f 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Messages/SubmitActionActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Messages/SubmitActionActivity.cs @@ -18,6 +18,7 @@ public class SubmitActionAttribute() : InvokeAttribute(Api.Activities.Invokes.Na public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnSubmitAction(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnSubmitAction(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/AnswerSearchActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/AnswerSearchActivity.cs index 3d047891..9a2647ad 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/AnswerSearchActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/AnswerSearchActivity.cs @@ -24,6 +24,7 @@ public override bool Select(IActivity activity) public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnAnswerSearch(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -49,6 +50,7 @@ public static App OnAnswerSearch(this App app, Func, Ta return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnAnswerSearch(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -70,6 +72,7 @@ public static App OnAnswerSearch(this App app, Func, Ta return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnAnswerSearch(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/SearchActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/SearchActivity.cs index fcc2a012..263f3670 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/SearchActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/SearchActivity.cs @@ -13,6 +13,7 @@ public class SearchAttribute() : InvokeAttribute(Api.Activities.Invokes.Name.Sea public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnSearch(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -30,6 +31,7 @@ public static App OnSearch(this App app, Func, Task> ha return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnSearch(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -43,6 +45,7 @@ public static App OnSearch(this App app, Func, Task, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/TypeaheadSearchActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/TypeaheadSearchActivity.cs index 2d697684..3af40931 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/TypeaheadSearchActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Search/TypeaheadSearchActivity.cs @@ -24,6 +24,7 @@ public override bool Select(IActivity activity) public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTypeaheadSearch(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -49,6 +50,7 @@ public static App OnTypeaheadSearch(this App app, Func, return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTypeaheadSearch(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -70,6 +72,7 @@ public static App OnTypeaheadSearch(this App app, Func, return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTypeaheadSearch(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/FailureActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/FailureActivity.cs index 5fed8f77..ffc2d42f 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/FailureActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/FailureActivity.cs @@ -21,6 +21,7 @@ public static partial class AppInvokeActivityExtensions /// /// Registers a handler for signin/failure invoke activities sent when SSO token exchange fails. /// + [Obsolete("Use the handler with the cancellation token")] public static App OnSignInFailure(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -41,6 +42,7 @@ public static App OnSignInFailure(this App app, Func /// Registers a handler for signin/failure invoke activities sent when SSO token exchange fails. /// + [Obsolete("Use the handler with the cancellation token")] public static App OnSignInFailure(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -57,6 +59,7 @@ public static App OnSignInFailure(this App app, Func /// Registers a handler for signin/failure invoke activities sent when SSO token exchange fails. /// + [Obsolete("Use the handler with the cancellation token")] public static App OnSignInFailure(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/TokenExchangeActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/TokenExchangeActivity.cs index b563e325..c4c5b9f1 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/TokenExchangeActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/TokenExchangeActivity.cs @@ -15,6 +15,7 @@ public class TokenExchangeAttribute() : InvokeAttribute(Api.Activities.Invokes.N public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTokenExchange(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -32,6 +33,7 @@ public static App OnTokenExchange(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -45,6 +47,7 @@ public static App OnTokenExchange(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -58,6 +61,7 @@ public static App OnTokenExchange(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/VerifyStateAcitivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/VerifyStateAcitivity.cs index 2304b306..961fefd8 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/VerifyStateAcitivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/SignIn/VerifyStateAcitivity.cs @@ -15,6 +15,7 @@ public class VerifyStateAttribute() : InvokeAttribute(Api.Activities.Invokes.Nam public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnVerifyState(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -32,6 +33,7 @@ public static App OnVerifyState(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -45,6 +47,7 @@ public static App OnVerifyState(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tabs/FetchActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tabs/FetchActivity.cs index 07e64e29..25e9344c 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tabs/FetchActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tabs/FetchActivity.cs @@ -18,6 +18,7 @@ public class FetchAttribute() : InvokeAttribute(Api.Activities.Invokes.Name.Tabs public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTabFetch(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnTabFetch(this App app, Func, Ta return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTabFetch(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -48,6 +50,7 @@ public static App OnTabFetch(this App app, Func, Ta return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTabFetch(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tabs/SubmitActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tabs/SubmitActivity.cs index 2003d5d8..0b96b1cf 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tabs/SubmitActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tabs/SubmitActivity.cs @@ -18,6 +18,7 @@ public class SubmitAttribute() : InvokeAttribute(Api.Activities.Invokes.Name.Tab public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTabSubmit(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -35,6 +36,7 @@ public static App OnTabSubmit(this App app, Func, return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTabSubmit(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -48,6 +50,7 @@ public static App OnTabSubmit(this App app, Func, return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTabSubmit(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tasks/FetchActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tasks/FetchActivity.cs index 9b2d7ee4..3aa618c5 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tasks/FetchActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tasks/FetchActivity.cs @@ -15,6 +15,7 @@ public class TaskFetchAttribute() : InvokeAttribute(Api.Activities.Invokes.Name. public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTaskFetch(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -32,6 +33,7 @@ public static App OnTaskFetch(this App app, Func, return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTaskFetch(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -45,6 +47,7 @@ public static App OnTaskFetch(this App app, Func, return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTaskFetch(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tasks/SubmitActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tasks/SubmitActivity.cs index e50d1c7a..8c0ee347 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tasks/SubmitActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Invokes/Tasks/SubmitActivity.cs @@ -15,6 +15,7 @@ public class TaskSubmitAttribute() : InvokeAttribute(Api.Activities.Invokes.Name public static partial class AppInvokeActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTaskSubmit(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -32,6 +33,7 @@ public static App OnTaskSubmit(this App app, Func return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTaskSubmit(this App app, Func, Task>> handler) { app.Router.Register(new Route() @@ -45,6 +47,7 @@ public static App OnTaskSubmit(this App app, Func return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnTaskSubmit(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageActivity.cs index dc8b7505..d469f8b5 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageActivity.cs @@ -36,6 +36,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMessage(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -70,6 +71,7 @@ public static App OnMessage(this App app, Func, Cancel return app; } + [Obsolete("Use the handler with the cancellation token")] public static App OnMessage(this App app, string pattern, Func, Task> handler) { app.Router.Register(new Route() @@ -121,6 +123,7 @@ public static App OnMessage(this App app, string pattern, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageDeleteActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageDeleteActivity.cs index c210247e..ff15acb1 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageDeleteActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageDeleteActivity.cs @@ -17,6 +17,7 @@ public class DeleteAttribute() : ActivityAttribute(ActivityType.MessageDelete, t public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMessageDelete(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageReactionActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageReactionActivity.cs index 05aa4d47..6d2f018a 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageReactionActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageReactionActivity.cs @@ -45,6 +45,7 @@ public override bool Select(IActivity activity) public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMessageReaction(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -79,6 +80,7 @@ public static App OnMessageReaction(this App app, Func, Task> handler) { app.Router.Register(new Route() @@ -129,6 +131,7 @@ public static App OnMessageReactionAdded(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageUpdateActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageUpdateActivity.cs index cf126b2e..b3028f20 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageUpdateActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/Messages/MessageUpdateActivity.cs @@ -17,6 +17,7 @@ public class UpdateAttribute() : ActivityAttribute(ActivityType.MessageUpdate, t public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnMessageUpdate(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/Activities/TypingActivity.cs b/Libraries/Microsoft.Teams.Apps/Activities/TypingActivity.cs index a4bb7c7b..9a7d5b46 100644 --- a/Libraries/Microsoft.Teams.Apps/Activities/TypingActivity.cs +++ b/Libraries/Microsoft.Teams.Apps/Activities/TypingActivity.cs @@ -14,6 +14,7 @@ public class TypingAttribute() : ActivityAttribute(ActivityType.Typing, typeof(T public static partial class AppActivityExtensions { + [Obsolete("Use the handler with the cancellation token")] public static App OnTyping(this App app, Func, Task> handler) { app.Router.Register(new Route() diff --git a/Libraries/Microsoft.Teams.Apps/App.cs b/Libraries/Microsoft.Teams.Apps/App.cs index c8cd4476..7bee0280 100644 --- a/Libraries/Microsoft.Teams.Apps/App.cs +++ b/Libraries/Microsoft.Teams.Apps/App.cs @@ -40,6 +40,9 @@ public partial class App internal IHttpClient TokenClient { get; set; } internal IServiceProvider? Provider { get; set; } internal IContainer Container { get; set; } + + private readonly IEnumerable? _additionalAllowedDomains; + private readonly CloudEnvironment _cloud; internal string UserAgent { get @@ -51,12 +54,21 @@ internal string UserAgent public App(AppOptions? options = null) { + var cloud = options?.Cloud ?? CloudEnvironment.Public; + _cloud = cloud; + Logger = options?.Logger ?? new ConsoleLogger(); Storage = options?.Storage ?? new LocalStorage(); Credentials = options?.Credentials; Plugins = options?.Plugins ?? []; OAuth = options?.OAuth ?? new OAuthSettings(); Provider = options?.Provider; + _additionalAllowedDomains = options?.AdditionalAllowedDomains; + + if (_additionalAllowedDomains?.Contains("*") == true) + { + Logger.Warn("Service URL validation is disabled via wildcard in AdditionalAllowedDomains"); + } TokenClient = new Common.Http.HttpClient(); Client = options?.Client ?? options?.ClientFactory?.CreateClient() ?? new Common.Http.HttpClient(); @@ -77,7 +89,7 @@ public App(AppOptions? options = null) if (Token.IsExpired) { - var res = Credentials.Resolve(TokenClient, [.. Token.Scopes.DefaultIfEmpty(BotTokenClient.BotScope)]) + var res = Credentials.Resolve(TokenClient, [.. Token.Scopes.DefaultIfEmpty(Api!.Bots.Token.ActiveBotScope)]) .ConfigureAwait(false) .GetAwaiter() .GetResult(); @@ -90,6 +102,10 @@ public App(AppOptions? options = null) }; Api = new ApiClient("https://smba.trafficmanager.net/teams/", Client); + Api.Bots.Token.ActiveBotScope = cloud.BotScope; + Api.Bots.Token.ActiveGraphScope = cloud.GraphScope; + Api.Bots.SignIn.TokenServiceUrl = cloud.TokenServiceUrl; + Api.Users.Token.TokenServiceUrl = cloud.TokenServiceUrl; Container = new Container(); Container.Register(Logger); Container.Register(Storage); @@ -167,9 +183,12 @@ await Events.Emit( } /// - /// send an activity to the conversation + /// send an activity proactively to a conversation. + /// Sends to the exact conversation ID provided. For channel threads, + /// the conversation ID must include ;messageid= -- use + /// to construct it, or use + /// which handles this automatically. /// - /// activity activity to send public async Task Send(string conversationId, T activity, ConversationType? conversationType = null, string? serviceUrl = null, CancellationToken cancellationToken = default) where T : IActivity { if (Id is null) @@ -177,14 +196,6 @@ public async Task Send(string conversationId, T activity, ConversationType throw new InvalidOperationException("app not started"); } - // Validate targeted messages in proactive context - #pragma warning disable ExperimentalTeamsTargeted - if (activity is MessageActivity messageActivity && messageActivity.IsTargeted == true && messageActivity.Recipient is null) - { - throw new InvalidOperationException("Targeted messages sent proactively must specify an explicit recipient ID. Use WithRecipient(new Account { Id = recipientId }, true) with an explicit recipient."); - } - #pragma warning restore ExperimentalTeamsTargeted - var reference = new ConversationReference() { ChannelId = ChannelId.MsTeams, @@ -198,7 +209,7 @@ public async Task Send(string conversationId, T activity, ConversationType Conversation = new() { Id = conversationId, - Type = conversationType ?? ConversationType.Personal + Type = conversationType } }; @@ -239,6 +250,74 @@ public async Task Send(string conversationId, Cards.AdaptiveCar return await Send(conversationId, new MessageActivity().AddAttachment(card), conversationType, serviceUrl, cancellationToken); } + /// + /// send an activity proactively to a channel thread. + /// In channels, constructs a threaded conversation ID from the conversation ID + /// and message ID, then sends to that thread. + /// In scopes that do not support threading (group chat, meetings), sends as a normal message - + /// the message ID is ignored. + /// + /// the channel or conversation ID + /// the thread root message ID + /// the activity to send + /// optional cancellation token + public Task Reply(string conversationId, string messageId, T activity, CancellationToken cancellationToken = default) where T : IActivity + { + var baseId = conversationId.Split(';')[0]; + // Channels use @thread.tacv2 or @thread.skype, 1:1 chats use @unq.gbl.spaces. + // Group chats and meetings use @thread.v2 which does not support threading. + var supportsThreading = baseId.EndsWith("@thread.tacv2", StringComparison.Ordinal) || baseId.EndsWith("@thread.skype", StringComparison.Ordinal) || baseId.EndsWith("@unq.gbl.spaces", StringComparison.Ordinal); + var targetId = supportsThreading + ? Conversation.ToThreadedConversationId(conversationId, messageId) + : conversationId; + return Send(targetId, activity, cancellationToken: cancellationToken); + } + + /// + /// send an activity proactively to a conversation. + /// Sends to the exact conversation ID provided - threaded if + /// it contains ;messageid=, flat otherwise. + /// + /// the conversation to send to + /// the activity to send + /// optional cancellation token + public Task Reply(string conversationId, T activity, CancellationToken cancellationToken = default) where T : IActivity + { + return Send(conversationId, activity, cancellationToken: cancellationToken); + } + + /// + /// send a message proactively to a thread + /// + public Task Reply(string conversationId, string messageId, string text, CancellationToken cancellationToken = default) + { + return Reply(conversationId, messageId, new MessageActivity(text), cancellationToken); + } + + /// + /// send a message proactively to a conversation + /// + public Task Reply(string conversationId, string text, CancellationToken cancellationToken = default) + { + return Reply(conversationId, new MessageActivity(text), cancellationToken); + } + + /// + /// send a card proactively to a thread + /// + public Task Reply(string conversationId, string messageId, Cards.AdaptiveCard card, CancellationToken cancellationToken = default) + { + return Reply(conversationId, messageId, new MessageActivity().AddAttachment(card), cancellationToken); + } + + /// + /// send a card proactively to a conversation + /// + public Task Reply(string conversationId, Cards.AdaptiveCard card, CancellationToken cancellationToken = default) + { + return Reply(conversationId, new MessageActivity().AddAttachment(card), cancellationToken); + } + /// /// process an activity /// @@ -313,9 +392,16 @@ private async Task Process(ISenderPlugin sender, ActivityEvent @event, var path = @event.Activity.GetPath(); Logger.Debug(path); + var serviceUrl = @event.Activity.ServiceUrl ?? @event.Token.ServiceUrl; + if (!ServiceUrlValidator.IsAllowed(serviceUrl, _cloud, _additionalAllowedDomains)) + { + Logger.Warn($"Rejected service URL: {serviceUrl}"); + throw new InvalidOperationException("Service URL is not from an allowed domain"); + } + var reference = new ConversationReference() { - ServiceUrl = @event.Activity.ServiceUrl ?? @event.Token.ServiceUrl, + ServiceUrl = serviceUrl, ChannelId = @event.Activity.ChannelId, Bot = @event.Activity.Recipient, User = @event.Activity.From, diff --git a/Libraries/Microsoft.Teams.Apps/AppBuilder.cs b/Libraries/Microsoft.Teams.Apps/AppBuilder.cs index 63e5d6f5..8af2e0e7 100644 --- a/Libraries/Microsoft.Teams.Apps/AppBuilder.cs +++ b/Libraries/Microsoft.Teams.Apps/AppBuilder.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Microsoft.Teams.Api.Auth; using Microsoft.Teams.Apps.Plugins; namespace Microsoft.Teams.Apps; @@ -98,6 +99,12 @@ public AppBuilder AddOAuth(string defaultConnectionName) return this; } + public AppBuilder AddCloud(CloudEnvironment cloud) + { + _options.Cloud = cloud; + return this; + } + public App Build() { return new App(_options); diff --git a/Libraries/Microsoft.Teams.Apps/AppOptions.cs b/Libraries/Microsoft.Teams.Apps/AppOptions.cs index b923afa2..e887cf12 100644 --- a/Libraries/Microsoft.Teams.Apps/AppOptions.cs +++ b/Libraries/Microsoft.Teams.Apps/AppOptions.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Microsoft.Teams.Api.Auth; using Microsoft.Teams.Apps.Plugins; namespace Microsoft.Teams.Apps; @@ -15,6 +16,13 @@ public class AppOptions public Common.Http.IHttpCredentials? Credentials { get; set; } public IList Plugins { get; set; } = []; public OAuthSettings OAuth { get; set; } = new OAuthSettings(); + public CloudEnvironment? Cloud { get; set; } + + /// + /// Additional allowed service URL hostnames beyond the built-in defaults. + /// Use this if your bot receives activities from non-standard channels. + /// + public IEnumerable? AdditionalAllowedDomains { get; set; } public AppOptions() { diff --git a/Libraries/Microsoft.Teams.Apps/AppRouting.cs b/Libraries/Microsoft.Teams.Apps/AppRouting.cs index ca061352..511cb84c 100644 --- a/Libraries/Microsoft.Teams.Apps/AppRouting.cs +++ b/Libraries/Microsoft.Teams.Apps/AppRouting.cs @@ -66,7 +66,7 @@ public App AddController(T controller) where T : class return this; } - protected async Task OnTokenExchangeActivity(IContext context) + protected async Task OnTokenExchangeActivity(IContext context, CancellationToken cancellationToken = default) { var connectionName = context.Activity.Value.ConnectionName; @@ -83,7 +83,7 @@ protected async Task OnTokenExchangeActivity(IContext(), Token = res - } + }, cancellationToken ); return new Response(HttpStatusCode.OK); @@ -109,7 +109,7 @@ await Events.Emit( Exception = ex, Context = context.ToActivityType() }, - context.CancellationToken + cancellationToken ); if (ex.StatusCode != HttpStatusCode.NotFound && ex.StatusCode != HttpStatusCode.BadRequest && ex.StatusCode != HttpStatusCode.PreconditionFailed) @@ -126,7 +126,7 @@ await Events.Emit( } } - protected async Task OnVerifyStateActivity(IContext context) + protected async Task OnVerifyStateActivity(IContext context, CancellationToken cancellationToken = default) { try { @@ -142,7 +142,7 @@ await Events.Emit( UserId = context.Activity.From.Id, ConnectionName = OAuth.DefaultConnectionName, Code = context.Activity.Value.State - }); + }, cancellationToken); context.UserGraphToken = new JsonWebToken(res); @@ -153,7 +153,8 @@ await Events.Emit( { Context = context.ToActivityType(), Token = res - } + }, + cancellationToken ); return new Response(HttpStatusCode.OK); } @@ -198,7 +199,7 @@ await Events.Emit( /// interactionrequiredUser interaction is required (handled via OAuth card fallback, does not typically reach the bot). /// /// - protected async Task OnSignInFailureActivity(IContext context) + protected async Task OnSignInFailureActivity(IContext context, CancellationToken cancellationToken = default) { var failure = context.Activity.Value; @@ -218,7 +219,7 @@ await Events.Emit( Exception = new Exception($"Sign-in failure: {failure.Code} — {failure.Message}"), Context = context.ToActivityType() }, - context.CancellationToken + cancellationToken ); return new Response(HttpStatusCode.OK); diff --git a/Libraries/Microsoft.Teams.Apps/Contexts/Context.Send.cs b/Libraries/Microsoft.Teams.Apps/Contexts/Context.Send.cs index 6828c7d3..594a85c2 100644 --- a/Libraries/Microsoft.Teams.Apps/Contexts/Context.Send.cs +++ b/Libraries/Microsoft.Teams.Apps/Contexts/Context.Send.cs @@ -8,7 +8,10 @@ namespace Microsoft.Teams.Apps; public partial interface IContext { /// - /// send an activity to the conversation + /// send an activity in the current conversation without quoting. + /// In channels, sends to the current thread. In scopes that do not + /// support threading (group chat, meetings), sends as a normal message. + /// To send with a visual quote of the inbound message, use . /// /// activity activity to send /// optional cancellation token @@ -29,7 +32,10 @@ public partial interface IContext public Task Send(Cards.AdaptiveCard card, CancellationToken cancellationToken = default); /// - /// send an activity to the conversation as a reply + /// send an activity in the current conversation with a visual quote + /// of the inbound message. In channels, sends to the current thread + /// with a quoted reply. In other scopes, sends with a quoted reply. + /// To send without quoting, use . /// /// activity activity to send /// optional cancellation token diff --git a/Libraries/Microsoft.Teams.Apps/ServiceUrlValidator.cs b/Libraries/Microsoft.Teams.Apps/ServiceUrlValidator.cs new file mode 100644 index 00000000..a8b8828d --- /dev/null +++ b/Libraries/Microsoft.Teams.Apps/ServiceUrlValidator.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.Teams.Api.Auth; + +namespace Microsoft.Teams.Apps; + +/// +/// Validates service URLs against known allowed domains. +/// +public static class ServiceUrlValidator +{ + /// + /// Validates that a service URL hostname is allowed. + /// Checks against the cloud environment's allowed service URLs, + /// plus any additional domains provided by the caller. + /// Localhost is always allowed for local development. + /// + public static bool IsAllowed(string? serviceUrl, CloudEnvironment cloud, IEnumerable? additionalDomains = null) + { + if (string.IsNullOrEmpty(serviceUrl)) + return true; // No URL to validate + + if (!Uri.TryCreate(serviceUrl, UriKind.Absolute, out var uri)) + return false; + + var hostname = uri.Host.ToLowerInvariant(); + + if (hostname is "localhost" or "127.0.0.1") + return true; + + if (!string.Equals(uri.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)) + return false; + + var allowed = cloud.AllowedServiceUrls.Concat(additionalDomains ?? []).Select(d => d.ToLowerInvariant()).ToList(); + if (allowed.Contains("*")) + return true; + + return allowed.Contains(hostname); + } +} diff --git a/Libraries/Microsoft.Teams.Cards/Actions/IMBackAction.cs b/Libraries/Microsoft.Teams.Cards/Actions/IMBackAction.cs index ebe6cd54..31ed445a 100644 --- a/Libraries/Microsoft.Teams.Cards/Actions/IMBackAction.cs +++ b/Libraries/Microsoft.Teams.Cards/Actions/IMBackAction.cs @@ -5,6 +5,10 @@ namespace Microsoft.Teams.Cards; +/// +/// This class is deprecated. Please use instead. This will be removed in a future version of the SDK. +/// +[Obsolete("This class is deprecated. Use ImBackSubmitActionData instead. This will be removed in a future version of the SDK.")] public class IMBackAction : SubmitAction { /// diff --git a/Libraries/Microsoft.Teams.Cards/Actions/InvokeAction.cs b/Libraries/Microsoft.Teams.Cards/Actions/InvokeAction.cs index c416cf55..9009b8d2 100644 --- a/Libraries/Microsoft.Teams.Cards/Actions/InvokeAction.cs +++ b/Libraries/Microsoft.Teams.Cards/Actions/InvokeAction.cs @@ -6,8 +6,9 @@ namespace Microsoft.Teams.Cards; /// -/// Defines an invoke action. This action is used to trigger a bot action. +/// This class is deprecated. Please use instead. This will be removed in a future version of the SDK. /// +[Obsolete("This class is deprecated. Use InvokeSubmitActionData instead. This will be removed in a future version of the SDK.")] public class InvokeAction : SubmitAction { /// @@ -18,7 +19,7 @@ public InvokeAction(object value) { Data = new Union(new SubmitActionData { - Msteams = new InvokeSubmitActionData(value) + Msteams = new InvokeSubmitActionData(new Union(value)) }); } } \ No newline at end of file diff --git a/Libraries/Microsoft.Teams.Cards/Actions/MessageBackAction.cs b/Libraries/Microsoft.Teams.Cards/Actions/MessageBackAction.cs index 4628f120..207b0889 100644 --- a/Libraries/Microsoft.Teams.Cards/Actions/MessageBackAction.cs +++ b/Libraries/Microsoft.Teams.Cards/Actions/MessageBackAction.cs @@ -5,6 +5,10 @@ namespace Microsoft.Teams.Cards; +/// +/// This class is deprecated. Please use instead. This will be removed in a future version of the SDK. +/// +[Obsolete("This class is deprecated. Use MessageBackSubmitActionData instead. This will be removed in a future version of the SDK.")] public class MessageBackAction : SubmitAction { public MessageBackAction(string text, string value) diff --git a/Libraries/Microsoft.Teams.Cards/Actions/SignInAction.cs b/Libraries/Microsoft.Teams.Cards/Actions/SignInAction.cs index bf5cd4ec..bd614523 100644 --- a/Libraries/Microsoft.Teams.Cards/Actions/SignInAction.cs +++ b/Libraries/Microsoft.Teams.Cards/Actions/SignInAction.cs @@ -5,6 +5,10 @@ namespace Microsoft.Teams.Cards; +/// +/// This class is deprecated. Please use instead. This will be removed in a future version of the SDK. +/// +[Obsolete("This class is deprecated. Use SigninSubmitActionData instead. This will be removed in a future version of the SDK.")] public class SignInAction : SubmitAction { public SignInAction(string value) diff --git a/Libraries/Microsoft.Teams.Cards/Actions/TaskFetchAction.cs b/Libraries/Microsoft.Teams.Cards/Actions/TaskFetchAction.cs index 8b4bf71b..a55e1262 100644 --- a/Libraries/Microsoft.Teams.Cards/Actions/TaskFetchAction.cs +++ b/Libraries/Microsoft.Teams.Cards/Actions/TaskFetchAction.cs @@ -5,6 +5,10 @@ namespace Microsoft.Teams.Cards; +/// +/// This class is deprecated. Please use instead. This will be removed in a future version of the SDK. +/// +[Obsolete("This class is deprecated. Use TaskFetchSubmitActionData instead. This will be removed in a future version of the SDK.")] public class TaskFetchAction : SubmitAction { public TaskFetchAction(IDictionary? value = null) diff --git a/Libraries/Microsoft.Teams.Cards/Core.cs b/Libraries/Microsoft.Teams.Cards/Core.cs index 5605bb3f..6f968580 100644 --- a/Libraries/Microsoft.Teams.Cards/Core.cs +++ b/Libraries/Microsoft.Teams.Cards/Core.cs @@ -1,4 +1,4 @@ -// This file was automatically generated by a tool on 09/16/2025, 10:37 PM UTC. DO NOT UPDATE MANUALLY. +// This file was automatically generated by a tool on 04/06/2026, 11:50 PM UTC. DO NOT UPDATE MANUALLY. // It includes declarations for Adaptive Card features available in Teams, Copilot, Outlook, Word, Excel, PowerPoint. #pragma warning disable IDE0290 @@ -33,56 +33,65 @@ public class ActionMode(string value) : StringEnum(value, caseSensitive: false) public bool IsSecondary => Secondary.Equals(Value); } -[JsonConverter(typeof(JsonConverter))] -public class AssociatedInputs(string value) : StringEnum(value, caseSensitive: false) +[JsonConverter(typeof(JsonConverter))] +public class ThemeName(string value) : StringEnum(value, caseSensitive: false) { - public static readonly AssociatedInputs Auto = new("auto"); - public bool IsAuto => Auto.Equals(Value); + public static readonly ThemeName Light = new("Light"); + public bool IsLight => Light.Equals(Value); - public static readonly AssociatedInputs None = new("none"); - public bool IsNone => None.Equals(Value); + public static readonly ThemeName Dark = new("Dark"); + public bool IsDark => Dark.Equals(Value); } -[JsonConverter(typeof(JsonConverter))] -public class ImageInsertPosition(string value) : StringEnum(value, caseSensitive: false) +[JsonConverter(typeof(JsonConverter))] +public class ElementHeight(string value) : StringEnum(value, caseSensitive: false) { - public static readonly ImageInsertPosition Selection = new("Selection"); - public bool IsSelection => Selection.Equals(Value); - - public static readonly ImageInsertPosition Top = new("Top"); - public bool IsTop => Top.Equals(Value); + public static readonly ElementHeight Auto = new("auto"); + public bool IsAuto => Auto.Equals(Value); - public static readonly ImageInsertPosition Bottom = new("Bottom"); - public bool IsBottom => Bottom.Equals(Value); + public static readonly ElementHeight Stretch = new("stretch"); + public bool IsStretch => Stretch.Equals(Value); } -[JsonConverter(typeof(JsonConverter))] -public class FallbackAction(string value) : StringEnum(value, caseSensitive: false) +[JsonConverter(typeof(JsonConverter))] +public class HorizontalAlignment(string value) : StringEnum(value, caseSensitive: false) { - public static readonly FallbackAction Drop = new("drop"); - public bool IsDrop => Drop.Equals(Value); + public static readonly HorizontalAlignment Left = new("Left"); + public bool IsLeft => Left.Equals(Value); + + public static readonly HorizontalAlignment Center = new("Center"); + public bool IsCenter => Center.Equals(Value); + + public static readonly HorizontalAlignment Right = new("Right"); + public bool IsRight => Right.Equals(Value); } -[JsonConverter(typeof(JsonConverter))] -public class ContainerStyle(string value) : StringEnum(value, caseSensitive: false) +[JsonConverter(typeof(JsonConverter))] +public class Spacing(string value) : StringEnum(value, caseSensitive: false) { - public static readonly ContainerStyle Default = new("default"); - public bool IsDefault => Default.Equals(Value); + public static readonly Spacing None = new("None"); + public bool IsNone => None.Equals(Value); - public static readonly ContainerStyle Emphasis = new("emphasis"); - public bool IsEmphasis => Emphasis.Equals(Value); + public static readonly Spacing ExtraSmall = new("ExtraSmall"); + public bool IsExtraSmall => ExtraSmall.Equals(Value); - public static readonly ContainerStyle Accent = new("accent"); - public bool IsAccent => Accent.Equals(Value); + public static readonly Spacing Small = new("Small"); + public bool IsSmall => Small.Equals(Value); - public static readonly ContainerStyle Good = new("good"); - public bool IsGood => Good.Equals(Value); + public static readonly Spacing Default = new("Default"); + public bool IsDefault => Default.Equals(Value); - public static readonly ContainerStyle Attention = new("attention"); - public bool IsAttention => Attention.Equals(Value); + public static readonly Spacing Medium = new("Medium"); + public bool IsMedium => Medium.Equals(Value); - public static readonly ContainerStyle Warning = new("warning"); - public bool IsWarning => Warning.Equals(Value); + public static readonly Spacing Large = new("Large"); + public bool IsLarge => Large.Equals(Value); + + public static readonly Spacing ExtraLarge = new("ExtraLarge"); + public bool IsExtraLarge => ExtraLarge.Equals(Value); + + public static readonly Spacing Padding = new("Padding"); + public bool IsPadding => Padding.Equals(Value); } [JsonConverter(typeof(JsonConverter))] @@ -125,17 +134,26 @@ public class TargetWidth(string value) : StringEnum(value, caseSensitive: false) public bool IsAtMostWide => AtMostWide.Equals(Value); } -[JsonConverter(typeof(JsonConverter))] -public class HorizontalAlignment(string value) : StringEnum(value, caseSensitive: false) +[JsonConverter(typeof(JsonConverter))] +public class ContainerStyle(string value) : StringEnum(value, caseSensitive: false) { - public static readonly HorizontalAlignment Left = new("Left"); - public bool IsLeft => Left.Equals(Value); + public static readonly ContainerStyle Default = new("default"); + public bool IsDefault => Default.Equals(Value); - public static readonly HorizontalAlignment Center = new("Center"); - public bool IsCenter => Center.Equals(Value); + public static readonly ContainerStyle Emphasis = new("emphasis"); + public bool IsEmphasis => Emphasis.Equals(Value); - public static readonly HorizontalAlignment Right = new("Right"); - public bool IsRight => Right.Equals(Value); + public static readonly ContainerStyle Accent = new("accent"); + public bool IsAccent => Accent.Equals(Value); + + public static readonly ContainerStyle Good = new("good"); + public bool IsGood => Good.Equals(Value); + + public static readonly ContainerStyle Attention = new("attention"); + public bool IsAttention => Attention.Equals(Value); + + public static readonly ContainerStyle Warning = new("warning"); + public bool IsWarning => Warning.Equals(Value); } [JsonConverter(typeof(JsonConverter))] @@ -161,34 +179,6 @@ public class FlowLayoutItemFit(string value) : StringEnum(value, caseSensitive: public bool IsFill => Fill.Equals(Value); } -[JsonConverter(typeof(JsonConverter))] -public class Spacing(string value) : StringEnum(value, caseSensitive: false) -{ - public static readonly Spacing None = new("None"); - public bool IsNone => None.Equals(Value); - - public static readonly Spacing ExtraSmall = new("ExtraSmall"); - public bool IsExtraSmall => ExtraSmall.Equals(Value); - - public static readonly Spacing Small = new("Small"); - public bool IsSmall => Small.Equals(Value); - - public static readonly Spacing Default = new("Default"); - public bool IsDefault => Default.Equals(Value); - - public static readonly Spacing Medium = new("Medium"); - public bool IsMedium => Medium.Equals(Value); - - public static readonly Spacing Large = new("Large"); - public bool IsLarge => Large.Equals(Value); - - public static readonly Spacing ExtraLarge = new("ExtraLarge"); - public bool IsExtraLarge => ExtraLarge.Equals(Value); - - public static readonly Spacing Padding = new("Padding"); - public bool IsPadding => Padding.Equals(Value); -} - [JsonConverter(typeof(JsonConverter))] public class FillMode(string value) : StringEnum(value, caseSensitive: false) { @@ -205,58 +195,6 @@ public class FillMode(string value) : StringEnum(value, caseSensitive: false) public bool IsRepeat => Repeat.Equals(Value); } -[JsonConverter(typeof(JsonConverter))] -public class Version(string value) : StringEnum(value, caseSensitive: false) -{ - public static readonly Version Version1_0 = new("1.0"); - public bool IsVersion1_0 => Version1_0.Equals(Value); - - public static readonly Version Version1_1 = new("1.1"); - public bool IsVersion1_1 => Version1_1.Equals(Value); - - public static readonly Version Version1_2 = new("1.2"); - public bool IsVersion1_2 => Version1_2.Equals(Value); - - public static readonly Version Version1_3 = new("1.3"); - public bool IsVersion1_3 => Version1_3.Equals(Value); - - public static readonly Version Version1_4 = new("1.4"); - public bool IsVersion1_4 => Version1_4.Equals(Value); - - public static readonly Version Version1_5 = new("1.5"); - public bool IsVersion1_5 => Version1_5.Equals(Value); - - public static readonly Version Version1_6 = new("1.6"); - public bool IsVersion1_6 => Version1_6.Equals(Value); -} - -[JsonConverter(typeof(JsonConverter))] -public class TeamsCardWidth(string value) : StringEnum(value, caseSensitive: false) -{ - public static readonly TeamsCardWidth Full = new("full"); - public bool IsFull => Full.Equals(Value); -} - -[JsonConverter(typeof(JsonConverter))] -public class MentionType(string value) : StringEnum(value, caseSensitive: false) -{ - public static readonly MentionType Person = new("Person"); - public bool IsPerson => Person.Equals(Value); - - public static readonly MentionType Tag = new("Tag"); - public bool IsTag => Tag.Equals(Value); -} - -[JsonConverter(typeof(JsonConverter))] -public class ElementHeight(string value) : StringEnum(value, caseSensitive: false) -{ - public static readonly ElementHeight Auto = new("auto"); - public bool IsAuto => Auto.Equals(Value); - - public static readonly ElementHeight Stretch = new("stretch"); - public bool IsStretch => Stretch.Equals(Value); -} - [JsonConverter(typeof(JsonConverter))] public class TextSize(string value) : StringEnum(value, caseSensitive: false) { @@ -324,17 +262,17 @@ public class FontType(string value) : StringEnum(value, caseSensitive: false) public bool IsMonospace => Monospace.Equals(Value); } -[JsonConverter(typeof(JsonConverter))] -public class StyleEnum(string value) : StringEnum(value, caseSensitive: false) +[JsonConverter(typeof(JsonConverter))] +public class TextBlockStyle(string value) : StringEnum(value, caseSensitive: false) { - public static readonly StyleEnum Compact = new("compact"); - public bool IsCompact => Compact.Equals(Value); + public static readonly TextBlockStyle Default = new("default"); + public bool IsDefault => Default.Equals(Value); - public static readonly StyleEnum Expanded = new("expanded"); - public bool IsExpanded => Expanded.Equals(Value); + public static readonly TextBlockStyle ColumnHeader = new("columnHeader"); + public bool IsColumnHeader => ColumnHeader.Equals(Value); - public static readonly StyleEnum Filtered = new("filtered"); - public bool IsFiltered => Filtered.Equals(Value); + public static readonly TextBlockStyle Heading = new("heading"); + public bool IsHeading => Heading.Equals(Value); } [JsonConverter(typeof(JsonConverter))] @@ -369,6 +307,19 @@ public class Size(string value) : StringEnum(value, caseSensitive: false) public bool IsLarge => Large.Equals(Value); } +[JsonConverter(typeof(JsonConverter))] +public class ImageFitMode(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly ImageFitMode Cover = new("Cover"); + public bool IsCover => Cover.Equals(Value); + + public static readonly ImageFitMode Contain = new("Contain"); + public bool IsContain => Contain.Equals(Value); + + public static readonly ImageFitMode Fill = new("Fill"); + public bool IsFill => Fill.Equals(Value); +} + [JsonConverter(typeof(JsonConverter))] public class InputTextStyle(string value) : StringEnum(value, caseSensitive: false) { @@ -388,6 +339,29 @@ public class InputTextStyle(string value) : StringEnum(value, caseSensitive: fal public bool IsPassword => Password.Equals(Value); } +[JsonConverter(typeof(JsonConverter))] +public class AssociatedInputs(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly AssociatedInputs Auto = new("auto"); + public bool IsAuto => Auto.Equals(Value); + + public static readonly AssociatedInputs None = new("none"); + public bool IsNone => None.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class ChoiceSetInputStyle(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly ChoiceSetInputStyle Compact = new("compact"); + public bool IsCompact => Compact.Equals(Value); + + public static readonly ChoiceSetInputStyle Expanded = new("expanded"); + public bool IsExpanded => Expanded.Equals(Value); + + public static readonly ChoiceSetInputStyle Filtered = new("filtered"); + public bool IsFiltered => Filtered.Equals(Value); +} + [JsonConverter(typeof(JsonConverter))] public class RatingSize(string value) : StringEnum(value, caseSensitive: false) { @@ -540,6 +514,54 @@ public class BadgeStyle(string value) : StringEnum(value, caseSensitive: false) public bool IsWarning => Warning.Equals(Value); } +[JsonConverter(typeof(JsonConverter))] +public class ProgressRingLabelPosition(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly ProgressRingLabelPosition Before = new("Before"); + public bool IsBefore => Before.Equals(Value); + + public static readonly ProgressRingLabelPosition After = new("After"); + public bool IsAfter => After.Equals(Value); + + public static readonly ProgressRingLabelPosition Above = new("Above"); + public bool IsAbove => Above.Equals(Value); + + public static readonly ProgressRingLabelPosition Below = new("Below"); + public bool IsBelow => Below.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class ProgressRingSize(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly ProgressRingSize Tiny = new("Tiny"); + public bool IsTiny => Tiny.Equals(Value); + + public static readonly ProgressRingSize Small = new("Small"); + public bool IsSmall => Small.Equals(Value); + + public static readonly ProgressRingSize Medium = new("Medium"); + public bool IsMedium => Medium.Equals(Value); + + public static readonly ProgressRingSize Large = new("Large"); + public bool IsLarge => Large.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class ProgressBarColor(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly ProgressBarColor Accent = new("Accent"); + public bool IsAccent => Accent.Equals(Value); + + public static readonly ProgressBarColor Good = new("Good"); + public bool IsGood => Good.Equals(Value); + + public static readonly ProgressBarColor Warning = new("Warning"); + public bool IsWarning => Warning.Equals(Value); + + public static readonly ProgressBarColor Attention = new("Attention"); + public bool IsAttention => Attention.Equals(Value); +} + [JsonConverter(typeof(JsonConverter))] public class ChartColorSet(string value) : StringEnum(value, caseSensitive: false) { @@ -549,6 +571,15 @@ public class ChartColorSet(string value) : StringEnum(value, caseSensitive: fals public static readonly ChartColorSet Sequential = new("sequential"); public bool IsSequential => Sequential.Equals(Value); + public static readonly ChartColorSet Sequentialred = new("sequentialred"); + public bool IsSequentialred => Sequentialred.Equals(Value); + + public static readonly ChartColorSet Sequentialgreen = new("sequentialgreen"); + public bool IsSequentialgreen => Sequentialgreen.Equals(Value); + + public static readonly ChartColorSet Sequentialyellow = new("sequentialyellow"); + public bool IsSequentialyellow => Sequentialyellow.Equals(Value); + public static readonly ChartColorSet Diverging = new("diverging"); public bool IsDiverging => Diverging.Equals(Value); } @@ -648,28 +679,110 @@ public class ChartColor(string value) : StringEnum(value, caseSensitive: false) public static readonly ChartColor DivergingGray = new("divergingGray"); public bool IsDivergingGray => DivergingGray.Equals(Value); -} -[JsonConverter(typeof(JsonConverter))] -public class HorizontalBarChartDisplayMode(string value) : StringEnum(value, caseSensitive: false) -{ - public static readonly HorizontalBarChartDisplayMode AbsoluteWithAxis = new("AbsoluteWithAxis"); - public bool IsAbsoluteWithAxis => AbsoluteWithAxis.Equals(Value); + public static readonly ChartColor SequentialRed1 = new("sequentialRed1"); + public bool IsSequentialRed1 => SequentialRed1.Equals(Value); - public static readonly HorizontalBarChartDisplayMode AbsoluteNoAxis = new("AbsoluteNoAxis"); - public bool IsAbsoluteNoAxis => AbsoluteNoAxis.Equals(Value); + public static readonly ChartColor SequentialRed2 = new("sequentialRed2"); + public bool IsSequentialRed2 => SequentialRed2.Equals(Value); - public static readonly HorizontalBarChartDisplayMode PartToWhole = new("PartToWhole"); - public bool IsPartToWhole => PartToWhole.Equals(Value); -} + public static readonly ChartColor SequentialRed3 = new("sequentialRed3"); + public bool IsSequentialRed3 => SequentialRed3.Equals(Value); -[JsonConverter(typeof(JsonConverter))] -public class GaugeChartValueFormat(string value) : StringEnum(value, caseSensitive: false) -{ - public static readonly GaugeChartValueFormat Percentage = new("Percentage"); - public bool IsPercentage => Percentage.Equals(Value); + public static readonly ChartColor SequentialRed4 = new("sequentialRed4"); + public bool IsSequentialRed4 => SequentialRed4.Equals(Value); - public static readonly GaugeChartValueFormat Fraction = new("Fraction"); + public static readonly ChartColor SequentialRed5 = new("sequentialRed5"); + public bool IsSequentialRed5 => SequentialRed5.Equals(Value); + + public static readonly ChartColor SequentialRed6 = new("sequentialRed6"); + public bool IsSequentialRed6 => SequentialRed6.Equals(Value); + + public static readonly ChartColor SequentialRed7 = new("sequentialRed7"); + public bool IsSequentialRed7 => SequentialRed7.Equals(Value); + + public static readonly ChartColor SequentialRed8 = new("sequentialRed8"); + public bool IsSequentialRed8 => SequentialRed8.Equals(Value); + + public static readonly ChartColor SequentialGreen1 = new("sequentialGreen1"); + public bool IsSequentialGreen1 => SequentialGreen1.Equals(Value); + + public static readonly ChartColor SequentialGreen2 = new("sequentialGreen2"); + public bool IsSequentialGreen2 => SequentialGreen2.Equals(Value); + + public static readonly ChartColor SequentialGreen3 = new("sequentialGreen3"); + public bool IsSequentialGreen3 => SequentialGreen3.Equals(Value); + + public static readonly ChartColor SequentialGreen4 = new("sequentialGreen4"); + public bool IsSequentialGreen4 => SequentialGreen4.Equals(Value); + + public static readonly ChartColor SequentialGreen5 = new("sequentialGreen5"); + public bool IsSequentialGreen5 => SequentialGreen5.Equals(Value); + + public static readonly ChartColor SequentialGreen6 = new("sequentialGreen6"); + public bool IsSequentialGreen6 => SequentialGreen6.Equals(Value); + + public static readonly ChartColor SequentialGreen7 = new("sequentialGreen7"); + public bool IsSequentialGreen7 => SequentialGreen7.Equals(Value); + + public static readonly ChartColor SequentialGreen8 = new("sequentialGreen8"); + public bool IsSequentialGreen8 => SequentialGreen8.Equals(Value); + + public static readonly ChartColor SequentialYellow1 = new("sequentialYellow1"); + public bool IsSequentialYellow1 => SequentialYellow1.Equals(Value); + + public static readonly ChartColor SequentialYellow2 = new("sequentialYellow2"); + public bool IsSequentialYellow2 => SequentialYellow2.Equals(Value); + + public static readonly ChartColor SequentialYellow3 = new("sequentialYellow3"); + public bool IsSequentialYellow3 => SequentialYellow3.Equals(Value); + + public static readonly ChartColor SequentialYellow4 = new("sequentialYellow4"); + public bool IsSequentialYellow4 => SequentialYellow4.Equals(Value); + + public static readonly ChartColor SequentialYellow5 = new("sequentialYellow5"); + public bool IsSequentialYellow5 => SequentialYellow5.Equals(Value); + + public static readonly ChartColor SequentialYellow6 = new("sequentialYellow6"); + public bool IsSequentialYellow6 => SequentialYellow6.Equals(Value); + + public static readonly ChartColor SequentialYellow7 = new("sequentialYellow7"); + public bool IsSequentialYellow7 => SequentialYellow7.Equals(Value); + + public static readonly ChartColor SequentialYellow8 = new("sequentialYellow8"); + public bool IsSequentialYellow8 => SequentialYellow8.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class DonutThickness(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly DonutThickness Thin = new("Thin"); + public bool IsThin => Thin.Equals(Value); + + public static readonly DonutThickness Thick = new("Thick"); + public bool IsThick => Thick.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class HorizontalBarChartDisplayMode(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly HorizontalBarChartDisplayMode AbsoluteWithAxis = new("AbsoluteWithAxis"); + public bool IsAbsoluteWithAxis => AbsoluteWithAxis.Equals(Value); + + public static readonly HorizontalBarChartDisplayMode AbsoluteNoAxis = new("AbsoluteNoAxis"); + public bool IsAbsoluteNoAxis => AbsoluteNoAxis.Equals(Value); + + public static readonly HorizontalBarChartDisplayMode PartToWhole = new("PartToWhole"); + public bool IsPartToWhole => PartToWhole.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class GaugeChartValueFormat(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly GaugeChartValueFormat Percentage = new("Percentage"); + public bool IsPercentage => Percentage.Equals(Value); + + public static readonly GaugeChartValueFormat Fraction = new("Fraction"); public bool IsFraction => Fraction.Equals(Value); } @@ -749,6 +862,32 @@ public class CodeLanguage(string value) : StringEnum(value, caseSensitive: false public bool IsXml => Xml.Equals(Value); } +[JsonConverter(typeof(JsonConverter))] +public class PersonaIconStyle(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly PersonaIconStyle ProfilePicture = new("profilePicture"); + public bool IsProfilePicture => ProfilePicture.Equals(Value); + + public static readonly PersonaIconStyle ContactCard = new("contactCard"); + public bool IsContactCard => ContactCard.Equals(Value); + + public static readonly PersonaIconStyle None = new("none"); + public bool IsNone => None.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class PersonaDisplayStyle(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly PersonaDisplayStyle IconAndName = new("iconAndName"); + public bool IsIconAndName => IconAndName.Equals(Value); + + public static readonly PersonaDisplayStyle IconOnly = new("iconOnly"); + public bool IsIconOnly => IconOnly.Equals(Value); + + public static readonly PersonaDisplayStyle NameOnly = new("nameOnly"); + public bool IsNameOnly => NameOnly.Equals(Value); +} + [JsonConverter(typeof(JsonConverter))] public class FallbackElement(string value) : StringEnum(value, caseSensitive: false) { @@ -788,14 +927,82 @@ public class SizeEnum(string value) : StringEnum(value, caseSensitive: false) public bool IsExtraLarge => ExtraLarge.Equals(Value); } -[JsonConverter(typeof(JsonConverter))] -public class ThemeName(string value) : StringEnum(value, caseSensitive: false) +[JsonConverter(typeof(JsonConverter))] +public class PopoverPosition(string value) : StringEnum(value, caseSensitive: false) { - public static readonly ThemeName Light = new("Light"); - public bool IsLight => Light.Equals(Value); + public static readonly PopoverPosition Above = new("Above"); + public bool IsAbove => Above.Equals(Value); - public static readonly ThemeName Dark = new("Dark"); - public bool IsDark => Dark.Equals(Value); + public static readonly PopoverPosition Below = new("Below"); + public bool IsBelow => Below.Equals(Value); + + public static readonly PopoverPosition Before = new("Before"); + public bool IsBefore => Before.Equals(Value); + + public static readonly PopoverPosition After = new("After"); + public bool IsAfter => After.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class FallbackAction(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly FallbackAction Drop = new("drop"); + public bool IsDrop => Drop.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class ImageInsertPosition(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly ImageInsertPosition Selection = new("Selection"); + public bool IsSelection => Selection.Equals(Value); + + public static readonly ImageInsertPosition Top = new("Top"); + public bool IsTop => Top.Equals(Value); + + public static readonly ImageInsertPosition Bottom = new("Bottom"); + public bool IsBottom => Bottom.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class Version(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly Version Version1_0 = new("1.0"); + public bool IsVersion1_0 => Version1_0.Equals(Value); + + public static readonly Version Version1_1 = new("1.1"); + public bool IsVersion1_1 => Version1_1.Equals(Value); + + public static readonly Version Version1_2 = new("1.2"); + public bool IsVersion1_2 => Version1_2.Equals(Value); + + public static readonly Version Version1_3 = new("1.3"); + public bool IsVersion1_3 => Version1_3.Equals(Value); + + public static readonly Version Version1_4 = new("1.4"); + public bool IsVersion1_4 => Version1_4.Equals(Value); + + public static readonly Version Version1_5 = new("1.5"); + public bool IsVersion1_5 => Version1_5.Equals(Value); + + public static readonly Version Version1_6 = new("1.6"); + public bool IsVersion1_6 => Version1_6.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class TeamsCardWidth(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly TeamsCardWidth Full = new("full"); + public bool IsFull => Full.Equals(Value); +} + +[JsonConverter(typeof(JsonConverter))] +public class MentionType(string value) : StringEnum(value, caseSensitive: false) +{ + public static readonly MentionType Person = new("Person"); + public bool IsPerson => Person.Equals(Value); + + public static readonly MentionType Tag = new("Tag"); + public bool IsTag => Tag.Equals(Value); } internal record ObjectType(string[] DiscriminatorPropertyNames, string DiscriminatorValue, Type Type) { } @@ -807,8 +1014,8 @@ internal sealed class CardElementJsonConverter : JsonConverter private static readonly List _typeMap = new() { new ObjectType(["type"], "AdaptiveCard", typeof(AdaptiveCard)), - new ObjectType(["type"], "Container", typeof(Container)), new ObjectType(["type"], "ActionSet", typeof(ActionSet)), + new ObjectType(["type"], "Container", typeof(Container)), new ObjectType(["type"], "ColumnSet", typeof(ColumnSet)), new ObjectType(["type"], "Media", typeof(Media)), new ObjectType(["type"], "RichTextBlock", typeof(RichTextBlock)), @@ -829,6 +1036,8 @@ internal sealed class CardElementJsonConverter : JsonConverter new ObjectType(["type"], "Icon", typeof(Icon)), new ObjectType(["type"], "Carousel", typeof(Carousel)), new ObjectType(["type"], "Badge", typeof(Badge)), + new ObjectType(["type"], "ProgressRing", typeof(ProgressRing)), + new ObjectType(["type"], "ProgressBar", typeof(ProgressBar)), new ObjectType(["type"], "Chart.Donut", typeof(DonutChart)), new ObjectType(["type"], "Chart.Pie", typeof(PieChart)), new ObjectType(["type"], "Chart.VerticalBar.Grouped", typeof(GroupedVerticalBarChart)), @@ -894,12 +1103,14 @@ internal sealed class ActionJsonConverter : JsonConverter private static readonly List _typeMap = new() { new ObjectType(["type"], "Action.Execute", typeof(ExecuteAction)), - new ObjectType(["type"], "Action.Submit", typeof(SubmitAction)), + new ObjectType(["type"], "Action.InsertImage", typeof(InsertImageAction)), new ObjectType(["type"], "Action.OpenUrl", typeof(OpenUrlAction)), + new ObjectType(["type"], "Action.OpenUrlDialog", typeof(OpenUrlDialogAction)), + new ObjectType(["type"], "Action.ResetInputs", typeof(ResetInputsAction)), + new ObjectType(["type"], "Action.Submit", typeof(SubmitAction)), new ObjectType(["type"], "Action.ToggleVisibility", typeof(ToggleVisibilityAction)), new ObjectType(["type"], "Action.ShowCard", typeof(ShowCardAction)), - new ObjectType(["type"], "Action.ResetInputs", typeof(ResetInputsAction)), - new ObjectType(["type"], "Action.InsertImage", typeof(InsertImageAction)), + new ObjectType(["type"], "Action.Popover", typeof(PopoverAction)), }; public override Action? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) @@ -998,6 +1209,12 @@ public class AdaptiveCard : CardElement return JsonSerializer.Deserialize(json); } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + /// /// Must be **AdaptiveCard**. /// @@ -1014,7 +1231,7 @@ public class AdaptiveCard : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -1026,7 +1243,7 @@ public class AdaptiveCard : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. @@ -1080,7 +1297,7 @@ public class AdaptiveCard : CardElement /// The Adaptive Card schema version the card is authored against. /// [JsonPropertyName("version")] - public Version? Version { get; set; } + public Version? Version { get; set; } = Version.Version1_5; /// /// The text that should be displayed if the client is not able to render the card. @@ -1106,6 +1323,9 @@ public class AdaptiveCard : CardElement [JsonPropertyName("authentication")] public Authentication? Authentication { get; set; } + /// + /// Teams-specific metadata associated with the card. + /// [JsonPropertyName("msteams")] public TeamsCardProperties? Msteams { get; set; } @@ -1115,6 +1335,12 @@ public class AdaptiveCard : CardElement [JsonPropertyName("metadata")] public CardMetadata? Metadata { get; set; } + /// + /// Resources card elements can reference. + /// + [JsonPropertyName("resources")] + public Resources? Resources { get; set; } + /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. /// @@ -1139,7 +1365,14 @@ public class AdaptiveCard : CardElement [JsonPropertyName("actions")] public IList? Actions { get; set; } - public AdaptiveCard(params IList body) + public AdaptiveCard() { } + + public AdaptiveCard(params CardElement[] body) + { + this.Body = new List(body); + } + + public AdaptiveCard(IList body) { this.Body = body; } @@ -1159,6 +1392,12 @@ public string Serialize() ); } + public AdaptiveCard WithKey(string value) + { + this.Key = value; + return this; + } + public AdaptiveCard WithId(string value) { this.Id = value; @@ -1195,7 +1434,13 @@ public AdaptiveCard WithStyle(ContainerStyle value) return this; } - public AdaptiveCard WithLayouts(params IList value) + public AdaptiveCard WithLayouts(params ContainerLayout[] value) + { + this.Layouts = new List(value); + return this; + } + + public AdaptiveCard WithLayouts(IList value) { this.Layouts = value; return this; @@ -1273,6 +1518,12 @@ public AdaptiveCard WithMetadata(CardMetadata value) return this; } + public AdaptiveCard WithResources(Resources value) + { + this.Resources = value; + return this; + } + public AdaptiveCard WithGridArea(string value) { this.GridArea = value; @@ -1285,13 +1536,25 @@ public AdaptiveCard WithFallback(IUnion value) return this; } - public AdaptiveCard WithBody(params IList value) + public AdaptiveCard WithBody(params CardElement[] value) + { + this.Body = new List(value); + return this; + } + + public AdaptiveCard WithBody(IList value) { this.Body = value; return this; } - public AdaptiveCard WithActions(params IList value) + public AdaptiveCard WithActions(params Action[] value) + { + this.Actions = new List(value); + return this; + } + + public AdaptiveCard WithActions(IList value) { this.Actions = value; return this; @@ -1311,6 +1574,11 @@ public class HostCapabilities : SerializableObject return JsonSerializer.Deserialize(json); } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } /// /// Serializes this HostCapabilities into a JSON string. @@ -1326,6 +1594,12 @@ public string Serialize() } ); } + + public HostCapabilities WithKey(string value) + { + this.Key = value; + return this; + } [JsonExtensionData] public IDictionary NonSchemaProperties { get; set; } = new Dictionary(); } @@ -1343,6 +1617,12 @@ public class ExecuteAction : Action return JsonSerializer.Deserialize(json); } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + /// /// Must be **Action.Execute**. /// @@ -1359,7 +1639,7 @@ public class ExecuteAction : Action /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The title of the action, as it appears on buttons. @@ -1379,13 +1659,13 @@ public class ExecuteAction : Action /// Control the style of the action, affecting its visual and spoken representations. /// [JsonPropertyName("style")] - public ActionStyle? Style { get; set; } + public ActionStyle? Style { get; set; } = ActionStyle.Default; /// /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. /// [JsonPropertyName("mode")] - public ActionMode? Mode { get; set; } + public ActionMode? Mode { get; set; } = ActionMode.Primary; /// /// The tooltip text to display when the action is hovered over. @@ -1397,7 +1677,19 @@ public class ExecuteAction : Action /// 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. /// [JsonPropertyName("isEnabled")] - public bool? IsEnabled { get; set; } + public bool? IsEnabled { get; set; } = true; + + /// + /// The actions to display in the overflow menu of a Split action button. + /// + [JsonPropertyName("menuActions")] + public IList? MenuActions { get; set; } + + /// + /// A set of theme-specific icon URLs. + /// + [JsonPropertyName("themedIconUrls")] + public IList? ThemedIconUrls { get; set; } /// /// 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. @@ -1415,7 +1707,7 @@ public class ExecuteAction : Action /// Controls if the action is enabled only if at least one required input has been filled by the user. /// [JsonPropertyName("conditionallyEnabled")] - public bool? ConditionallyEnabled { get; set; } + public bool? ConditionallyEnabled { get; set; } = false; /// /// The verb of the action. @@ -1444,6 +1736,12 @@ public string Serialize() ); } + public ExecuteAction WithKey(string value) + { + this.Key = value; + return this; + } + public ExecuteAction WithId(string value) { this.Id = value; @@ -1492,6 +1790,30 @@ public ExecuteAction WithIsEnabled(bool value) return this; } + public ExecuteAction WithMenuActions(params Action[] value) + { + this.MenuActions = new List(value); + return this; + } + + public ExecuteAction WithMenuActions(IList value) + { + this.MenuActions = value; + return this; + } + + public ExecuteAction WithThemedIconUrls(params ThemedUrl[] value) + { + this.ThemedIconUrls = new List(value); + return this; + } + + public ExecuteAction WithThemedIconUrls(IList value) + { + this.ThemedIconUrls = value; + return this; + } + public ExecuteAction WithData(IUnion value) { this.Data = value; @@ -1524,188 +1846,118 @@ public ExecuteAction WithFallback(IUnion value) } /// -/// Represents the data of an Action.Submit. +/// Inserts an image into the host application's canvas. /// -public class SubmitActionData : SerializableObject +public class InsertImageAction : Action { /// - /// Deserializes a JSON string into an object of type SubmitActionData. + /// Deserializes a JSON string into an object of type InsertImageAction. /// - public static SubmitActionData? Deserialize(string json) + public static InsertImageAction? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } - [JsonPropertyName("msteams")] - public object? Msteams { get; set; } - /// - /// Serializes this SubmitActionData into a JSON string. + /// 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. /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } - - public SubmitActionData WithMsteams(object value) - { - this.Msteams = value; - return this; - } - [JsonExtensionData] - public IDictionary NonSchemaProperties { get; set; } = new Dictionary(); -} + [JsonPropertyName("key")] + public string? Key { get; set; } -/// -/// Represents Teams-specific data in an Action.Submit to send an Instant Message back to the Bot. -/// -public class ImBackSubmitActionData : SerializableObject -{ /// - /// Deserializes a JSON string into an object of type ImBackSubmitActionData. + /// Must be **Action.InsertImage**. /// - public static ImBackSubmitActionData? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } + [JsonPropertyName("type")] + public string Type { get; } = "Action.InsertImage"; /// - /// Must be **imBack**. + /// 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. /// - [JsonPropertyName("type")] - public string Type { get; } = "imBack"; + [JsonPropertyName("id")] + public string? Id { get; set; } /// - /// The value that will be sent to the Bot. + /// 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). /// - [JsonPropertyName("value")] - public string? Value { get; set; } - - public ImBackSubmitActionData(string value) - { - this.Value = value; - } + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// - /// Serializes this ImBackSubmitActionData into a JSON string. + /// The title of the action, as it appears on buttons. /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } - - public ImBackSubmitActionData WithValue(string value) - { - this.Value = value; - return this; - } -} + [JsonPropertyName("title")] + public string? Title { get; set; } -/// -/// Represents Teams-specific data in an Action.Submit to make an Invoke request to the Bot. -/// -public class InvokeSubmitActionData : SerializableObject -{ /// - /// Deserializes a JSON string into an object of type InvokeSubmitActionData. + /// 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. + /// + /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. /// - public static InvokeSubmitActionData? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } + [JsonPropertyName("iconUrl")] + public string? IconUrl { get; set; } /// - /// Must be **invoke**. + /// Control the style of the action, affecting its visual and spoken representations. /// - [JsonPropertyName("type")] - public string Type { get; } = "invoke"; + [JsonPropertyName("style")] + public ActionStyle? Style { get; set; } = ActionStyle.Default; /// - /// The object to send to the Bot with the Invoke request. + /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. /// - [JsonPropertyName("value")] - public object? Value { get; set; } + [JsonPropertyName("mode")] + public ActionMode? Mode { get; set; } = ActionMode.Primary; - public InvokeSubmitActionData(object value) - { - this.Value = value; - } + /// + /// The tooltip text to display when the action is hovered over. + /// + [JsonPropertyName("tooltip")] + public string? Tooltip { get; set; } /// - /// Serializes this InvokeSubmitActionData into a JSON string. + /// 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. /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } + [JsonPropertyName("isEnabled")] + public bool? IsEnabled { get; set; } = true; - public InvokeSubmitActionData WithValue(object value) - { - this.Value = value; - return this; - } -} + /// + /// The actions to display in the overflow menu of a Split action button. + /// + [JsonPropertyName("menuActions")] + public IList? MenuActions { get; set; } -/// -/// Represents Teams-specific data in an Action.Submit to send a message back to the Bot. -/// -public class MessageBackSubmitActionData : SerializableObject -{ /// - /// Deserializes a JSON string into an object of type MessageBackSubmitActionData. + /// A set of theme-specific icon URLs. /// - public static MessageBackSubmitActionData? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } + [JsonPropertyName("themedIconUrls")] + public IList? ThemedIconUrls { get; set; } /// - /// Must be **messageBack**. + /// The URL of the image to insert. /// - [JsonPropertyName("type")] - public string Type { get; } = "messageBack"; + [JsonPropertyName("url")] + public string? Url { get; set; } /// - /// The text that will be sent to the Bot. + /// The alternate text for the image. /// - [JsonPropertyName("text")] - public string? Text { get; set; } + [JsonPropertyName("altText")] + public string? AltText { get; set; } /// - /// 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. + /// The position at which to insert the image. /// - [JsonPropertyName("displayText")] - public string? DisplayText { get; set; } + [JsonPropertyName("insertPosition")] + public ImageInsertPosition? InsertPosition { get; set; } = ImageInsertPosition.Selection; /// - /// 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. + /// 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. /// - [JsonPropertyName("value")] - public string? Value { get; set; } + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } /// - /// Serializes this MessageBackSubmitActionData into a JSON string. + /// Serializes this InsertImageAction into a JSON string. /// public string Serialize() { @@ -1719,210 +1971,2169 @@ public string Serialize() ); } - public MessageBackSubmitActionData WithText(string value) + public InsertImageAction WithKey(string value) { - this.Text = value; + this.Key = value; return this; } - public MessageBackSubmitActionData WithDisplayText(string value) + public InsertImageAction WithId(string value) { - this.DisplayText = value; + this.Id = value; return this; } - public MessageBackSubmitActionData WithValue(string value) + public InsertImageAction WithRequires(HostCapabilities value) { - this.Value = value; + this.Requires = value; return this; } -} -/// -/// Represents Teams-specific data in an Action.Submit to sign in a user. -/// -public class SigninSubmitActionData : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type SigninSubmitActionData. - /// - public static SigninSubmitActionData? Deserialize(string json) + public InsertImageAction WithTitle(string value) { - return JsonSerializer.Deserialize(json); + this.Title = value; + return this; } - /// - /// Must be **signin**. - /// - [JsonPropertyName("type")] - public string Type { get; } = "signin"; + public InsertImageAction WithIconUrl(string value) + { + this.IconUrl = value; + return this; + } - /// - /// The URL to redirect the end-user for signing in. - /// - [JsonPropertyName("value")] - public string? Value { get; set; } + public InsertImageAction WithStyle(ActionStyle value) + { + this.Style = value; + return this; + } - public SigninSubmitActionData(string value) + public InsertImageAction WithMode(ActionMode value) { - this.Value = value; + this.Mode = value; + return this; } - /// - /// Serializes this SigninSubmitActionData into a JSON string. - /// - public string Serialize() + public InsertImageAction WithTooltip(string value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.Tooltip = value; + return this; } - public SigninSubmitActionData WithValue(string value) + public InsertImageAction WithIsEnabled(bool value) { - this.Value = value; + this.IsEnabled = value; + return this; + } + + public InsertImageAction WithMenuActions(params Action[] value) + { + this.MenuActions = new List(value); + return this; + } + + public InsertImageAction WithMenuActions(IList value) + { + this.MenuActions = value; + return this; + } + + public InsertImageAction WithThemedIconUrls(params ThemedUrl[] value) + { + this.ThemedIconUrls = new List(value); + return this; + } + + public InsertImageAction WithThemedIconUrls(IList value) + { + this.ThemedIconUrls = value; + return this; + } + + public InsertImageAction WithUrl(string value) + { + this.Url = value; + return this; + } + + public InsertImageAction WithAltText(string value) + { + this.AltText = value; + return this; + } + + public InsertImageAction WithInsertPosition(ImageInsertPosition value) + { + this.InsertPosition = value; + return this; + } + + public InsertImageAction WithFallback(IUnion value) + { + this.Fallback = value; return this; } } /// -/// Represents Teams-specific data in an Action.Submit to open a task module. +/// Opens the provided URL in either a separate browser tab or within the host application. /// -public class TaskFetchSubmitActionData : SerializableObject +public class OpenUrlAction : Action { /// - /// Deserializes a JSON string into an object of type TaskFetchSubmitActionData. + /// Deserializes a JSON string into an object of type OpenUrlAction. /// - public static TaskFetchSubmitActionData? Deserialize(string json) + public static OpenUrlAction? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **task/fetch**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Action.OpenUrl**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Action.OpenUrl"; + + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The title of the action, as it appears on buttons. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 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. + /// + /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// + [JsonPropertyName("iconUrl")] + public string? IconUrl { get; set; } + + /// + /// Control the style of the action, affecting its visual and spoken representations. + /// + [JsonPropertyName("style")] + public ActionStyle? Style { get; set; } = ActionStyle.Default; + + /// + /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// + [JsonPropertyName("mode")] + public ActionMode? Mode { get; set; } = ActionMode.Primary; + + /// + /// The tooltip text to display when the action is hovered over. + /// + [JsonPropertyName("tooltip")] + public string? Tooltip { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("isEnabled")] + public bool? IsEnabled { get; set; } = true; + + /// + /// The actions to display in the overflow menu of a Split action button. + /// + [JsonPropertyName("menuActions")] + public IList? MenuActions { get; set; } + + /// + /// A set of theme-specific icon URLs. + /// + [JsonPropertyName("themedIconUrls")] + public IList? ThemedIconUrls { get; set; } + + /// + /// The URL to open. + /// + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + public OpenUrlAction() { } + + public OpenUrlAction(string url) + { + this.Url = url; + } + + /// + /// Serializes this OpenUrlAction into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public OpenUrlAction WithKey(string value) + { + this.Key = value; + return this; + } + + public OpenUrlAction WithId(string value) + { + this.Id = value; + return this; + } + + public OpenUrlAction WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public OpenUrlAction WithTitle(string value) + { + this.Title = value; + return this; + } + + public OpenUrlAction WithIconUrl(string value) + { + this.IconUrl = value; + return this; + } + + public OpenUrlAction WithStyle(ActionStyle value) + { + this.Style = value; + return this; + } + + public OpenUrlAction WithMode(ActionMode value) + { + this.Mode = value; + return this; + } + + public OpenUrlAction WithTooltip(string value) + { + this.Tooltip = value; + return this; + } + + public OpenUrlAction WithIsEnabled(bool value) + { + this.IsEnabled = value; + return this; + } + + public OpenUrlAction WithMenuActions(params Action[] value) + { + this.MenuActions = new List(value); + return this; + } + + public OpenUrlAction WithMenuActions(IList value) + { + this.MenuActions = value; + return this; + } + + public OpenUrlAction WithThemedIconUrls(params ThemedUrl[] value) + { + this.ThemedIconUrls = new List(value); + return this; + } + + public OpenUrlAction WithThemedIconUrls(IList value) + { + this.ThemedIconUrls = value; + return this; + } + + public OpenUrlAction WithUrl(string value) + { + this.Url = value; + return this; + } + + public OpenUrlAction WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } +} + +/// +/// Opens a task module in a modal dialog hosting the content at a provided URL. +/// +public class OpenUrlDialogAction : Action +{ + /// + /// Deserializes a JSON string into an object of type OpenUrlDialogAction. + /// + public static OpenUrlDialogAction? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Action.OpenUrlDialog**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Action.OpenUrlDialog"; + + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The title of the action, as it appears on buttons. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 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. + /// + /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// + [JsonPropertyName("iconUrl")] + public string? IconUrl { get; set; } + + /// + /// Control the style of the action, affecting its visual and spoken representations. + /// + [JsonPropertyName("style")] + public ActionStyle? Style { get; set; } = ActionStyle.Default; + + /// + /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// + [JsonPropertyName("mode")] + public ActionMode? Mode { get; set; } = ActionMode.Primary; + + /// + /// The tooltip text to display when the action is hovered over. + /// + [JsonPropertyName("tooltip")] + public string? Tooltip { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("isEnabled")] + public bool? IsEnabled { get; set; } = true; + + /// + /// The actions to display in the overflow menu of a Split action button. + /// + [JsonPropertyName("menuActions")] + public IList? MenuActions { get; set; } + + /// + /// A set of theme-specific icon URLs. + /// + [JsonPropertyName("themedIconUrls")] + public IList? ThemedIconUrls { get; set; } + + /// + /// The title of the dialog to be displayed in the dialog header. + /// + [JsonPropertyName("dialogTitle")] + public string? DialogTitle { get; set; } + + /// + /// The height of the dialog. To define height as a number of pixels, use the px format. + /// + [JsonPropertyName("dialogHeight")] + public string? DialogHeight { get; set; } + + /// + /// The width of the dialog. To define width as a number of pixels, use the px format. + /// + [JsonPropertyName("dialogWidth")] + public string? DialogWidth { get; set; } + + /// + /// The URL to open. + /// + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + /// + /// Serializes this OpenUrlDialogAction into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public OpenUrlDialogAction WithKey(string value) + { + this.Key = value; + return this; + } + + public OpenUrlDialogAction WithId(string value) + { + this.Id = value; + return this; + } + + public OpenUrlDialogAction WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public OpenUrlDialogAction WithTitle(string value) + { + this.Title = value; + return this; + } + + public OpenUrlDialogAction WithIconUrl(string value) + { + this.IconUrl = value; + return this; + } + + public OpenUrlDialogAction WithStyle(ActionStyle value) + { + this.Style = value; + return this; + } + + public OpenUrlDialogAction WithMode(ActionMode value) + { + this.Mode = value; + return this; + } + + public OpenUrlDialogAction WithTooltip(string value) + { + this.Tooltip = value; + return this; + } + + public OpenUrlDialogAction WithIsEnabled(bool value) + { + this.IsEnabled = value; + return this; + } + + public OpenUrlDialogAction WithMenuActions(params Action[] value) + { + this.MenuActions = new List(value); + return this; + } + + public OpenUrlDialogAction WithMenuActions(IList value) + { + this.MenuActions = value; + return this; + } + + public OpenUrlDialogAction WithThemedIconUrls(params ThemedUrl[] value) + { + this.ThemedIconUrls = new List(value); + return this; + } + + public OpenUrlDialogAction WithThemedIconUrls(IList value) + { + this.ThemedIconUrls = value; + return this; + } + + public OpenUrlDialogAction WithDialogTitle(string value) + { + this.DialogTitle = value; + return this; + } + + public OpenUrlDialogAction WithDialogHeight(string value) + { + this.DialogHeight = value; + return this; + } + + public OpenUrlDialogAction WithDialogWidth(string value) + { + this.DialogWidth = value; + return this; + } + + public OpenUrlDialogAction WithUrl(string value) + { + this.Url = value; + return this; + } + + public OpenUrlDialogAction WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } +} + +/// +/// Resets the values of the inputs in the card. +/// +public class ResetInputsAction : Action +{ + /// + /// Deserializes a JSON string into an object of type ResetInputsAction. + /// + public static ResetInputsAction? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Action.ResetInputs**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Action.ResetInputs"; + + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The title of the action, as it appears on buttons. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 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. + /// + /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// + [JsonPropertyName("iconUrl")] + public string? IconUrl { get; set; } + + /// + /// Control the style of the action, affecting its visual and spoken representations. + /// + [JsonPropertyName("style")] + public ActionStyle? Style { get; set; } = ActionStyle.Default; + + /// + /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// + [JsonPropertyName("mode")] + public ActionMode? Mode { get; set; } = ActionMode.Primary; + + /// + /// The tooltip text to display when the action is hovered over. + /// + [JsonPropertyName("tooltip")] + public string? Tooltip { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("isEnabled")] + public bool? IsEnabled { get; set; } = true; + + /// + /// The actions to display in the overflow menu of a Split action button. + /// + [JsonPropertyName("menuActions")] + public IList? MenuActions { get; set; } + + /// + /// A set of theme-specific icon URLs. + /// + [JsonPropertyName("themedIconUrls")] + public IList? ThemedIconUrls { get; set; } + + /// + /// The Ids of the inputs that should be reset. + /// + [JsonPropertyName("targetInputIds")] + public IList? TargetInputIds { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + /// + /// Serializes this ResetInputsAction into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public ResetInputsAction WithKey(string value) + { + this.Key = value; + return this; + } + + public ResetInputsAction WithId(string value) + { + this.Id = value; + return this; + } + + public ResetInputsAction WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public ResetInputsAction WithTitle(string value) + { + this.Title = value; + return this; + } + + public ResetInputsAction WithIconUrl(string value) + { + this.IconUrl = value; + return this; + } + + public ResetInputsAction WithStyle(ActionStyle value) + { + this.Style = value; + return this; + } + + public ResetInputsAction WithMode(ActionMode value) + { + this.Mode = value; + return this; + } + + public ResetInputsAction WithTooltip(string value) + { + this.Tooltip = value; + return this; + } + + public ResetInputsAction WithIsEnabled(bool value) + { + this.IsEnabled = value; + return this; + } + + public ResetInputsAction WithMenuActions(params Action[] value) + { + this.MenuActions = new List(value); + return this; + } + + public ResetInputsAction WithMenuActions(IList value) + { + this.MenuActions = value; + return this; + } + + public ResetInputsAction WithThemedIconUrls(params ThemedUrl[] value) + { + this.ThemedIconUrls = new List(value); + return this; + } + + public ResetInputsAction WithThemedIconUrls(IList value) + { + this.ThemedIconUrls = value; + return this; + } + + public ResetInputsAction WithTargetInputIds(params string[] value) + { + this.TargetInputIds = new List(value); + return this; + } + + public ResetInputsAction WithTargetInputIds(IList value) + { + this.TargetInputIds = value; + return this; + } + + public ResetInputsAction WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } +} + +/// +/// 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. +/// +public class SubmitAction : Action +{ + /// + /// Deserializes a JSON string into an object of type SubmitAction. + /// + public static SubmitAction? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Action.Submit**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Action.Submit"; + + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The title of the action, as it appears on buttons. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 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. + /// + /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// + [JsonPropertyName("iconUrl")] + public string? IconUrl { get; set; } + + /// + /// Control the style of the action, affecting its visual and spoken representations. + /// + [JsonPropertyName("style")] + public ActionStyle? Style { get; set; } = ActionStyle.Default; + + /// + /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// + [JsonPropertyName("mode")] + public ActionMode? Mode { get; set; } = ActionMode.Primary; + + /// + /// The tooltip text to display when the action is hovered over. + /// + [JsonPropertyName("tooltip")] + public string? Tooltip { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("isEnabled")] + public bool? IsEnabled { get; set; } = true; + + /// + /// The actions to display in the overflow menu of a Split action button. + /// + [JsonPropertyName("menuActions")] + public IList? MenuActions { get; set; } + + /// + /// A set of theme-specific icon URLs. + /// + [JsonPropertyName("themedIconUrls")] + public IList? ThemedIconUrls { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("data")] + public IUnion? Data { get; set; } + + /// + /// 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](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// + [JsonPropertyName("associatedInputs")] + public AssociatedInputs? AssociatedInputs { get; set; } + + /// + /// Controls if the action is enabled only if at least one required input has been filled by the user. + /// + [JsonPropertyName("conditionallyEnabled")] + public bool? ConditionallyEnabled { get; set; } = false; + + /// + /// Teams-specific metadata associated with the action. + /// + [JsonPropertyName("msteams")] + public TeamsSubmitActionProperties? Msteams { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + /// + /// Serializes this SubmitAction into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public SubmitAction WithKey(string value) + { + this.Key = value; + return this; + } + + public SubmitAction WithId(string value) + { + this.Id = value; + return this; + } + + public SubmitAction WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public SubmitAction WithTitle(string value) + { + this.Title = value; + return this; + } + + public SubmitAction WithIconUrl(string value) + { + this.IconUrl = value; + return this; + } + + public SubmitAction WithStyle(ActionStyle value) + { + this.Style = value; + return this; + } + + public SubmitAction WithMode(ActionMode value) + { + this.Mode = value; + return this; + } + + public SubmitAction WithTooltip(string value) + { + this.Tooltip = value; + return this; + } + + public SubmitAction WithIsEnabled(bool value) + { + this.IsEnabled = value; + return this; + } + + public SubmitAction WithMenuActions(params Action[] value) + { + this.MenuActions = new List(value); + return this; + } + + public SubmitAction WithMenuActions(IList value) + { + this.MenuActions = value; + return this; + } + + public SubmitAction WithThemedIconUrls(params ThemedUrl[] value) + { + this.ThemedIconUrls = new List(value); + return this; + } + + public SubmitAction WithThemedIconUrls(IList value) + { + this.ThemedIconUrls = value; + return this; + } + + public SubmitAction WithData(IUnion value) + { + this.Data = value; + return this; + } + + public SubmitAction WithAssociatedInputs(AssociatedInputs value) + { + this.AssociatedInputs = value; + return this; + } + + public SubmitAction WithConditionallyEnabled(bool value) + { + this.ConditionallyEnabled = value; + return this; + } + + public SubmitAction WithMsteams(TeamsSubmitActionProperties value) + { + this.Msteams = value; + return this; + } + + public SubmitAction WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } +} + +/// +/// Toggles the visibility of a set of elements. Action.ToggleVisibility is useful for creating "Show more" type UI patterns. +/// +public class ToggleVisibilityAction : Action +{ + /// + /// Deserializes a JSON string into an object of type ToggleVisibilityAction. + /// + public static ToggleVisibilityAction? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Action.ToggleVisibility**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Action.ToggleVisibility"; + + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The title of the action, as it appears on buttons. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 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. + /// + /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// + [JsonPropertyName("iconUrl")] + public string? IconUrl { get; set; } + + /// + /// Control the style of the action, affecting its visual and spoken representations. + /// + [JsonPropertyName("style")] + public ActionStyle? Style { get; set; } = ActionStyle.Default; + + /// + /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// + [JsonPropertyName("mode")] + public ActionMode? Mode { get; set; } = ActionMode.Primary; + + /// + /// The tooltip text to display when the action is hovered over. + /// + [JsonPropertyName("tooltip")] + public string? Tooltip { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("isEnabled")] + public bool? IsEnabled { get; set; } = true; + + /// + /// The actions to display in the overflow menu of a Split action button. + /// + [JsonPropertyName("menuActions")] + public IList? MenuActions { get; set; } + + /// + /// A set of theme-specific icon URLs. + /// + [JsonPropertyName("themedIconUrls")] + public IList? ThemedIconUrls { get; set; } + + /// + /// The Ids of the elements to toggle the visibility of. + /// + [JsonPropertyName("targetElements")] + public IUnion, IList>? TargetElements { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + /// + /// Serializes this ToggleVisibilityAction into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public ToggleVisibilityAction WithKey(string value) + { + this.Key = value; + return this; + } + + public ToggleVisibilityAction WithId(string value) + { + this.Id = value; + return this; + } + + public ToggleVisibilityAction WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public ToggleVisibilityAction WithTitle(string value) + { + this.Title = value; + return this; + } + + public ToggleVisibilityAction WithIconUrl(string value) + { + this.IconUrl = value; + return this; + } + + public ToggleVisibilityAction WithStyle(ActionStyle value) + { + this.Style = value; + return this; + } + + public ToggleVisibilityAction WithMode(ActionMode value) + { + this.Mode = value; + return this; + } + + public ToggleVisibilityAction WithTooltip(string value) + { + this.Tooltip = value; + return this; + } + + public ToggleVisibilityAction WithIsEnabled(bool value) + { + this.IsEnabled = value; + return this; + } + + public ToggleVisibilityAction WithMenuActions(params Action[] value) + { + this.MenuActions = new List(value); + return this; + } + + public ToggleVisibilityAction WithMenuActions(IList value) + { + this.MenuActions = value; + return this; + } + + public ToggleVisibilityAction WithThemedIconUrls(params ThemedUrl[] value) + { + this.ThemedIconUrls = new List(value); + return this; + } + + public ToggleVisibilityAction WithThemedIconUrls(IList value) + { + this.ThemedIconUrls = value; + return this; + } + + public ToggleVisibilityAction WithTargetElements(IUnion, IList> value) + { + this.TargetElements = value; + return this; + } + + public ToggleVisibilityAction WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } +} + +/// +/// Defines a theme-specific URL. +/// +public class ThemedUrl : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type ThemedUrl. + /// + public static ThemedUrl? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The theme this URL applies to. + /// + [JsonPropertyName("theme")] + public ThemeName? Theme { get; set; } = ThemeName.Light; + + /// + /// The URL to use for the associated theme. + /// + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Serializes this ThemedUrl into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public ThemedUrl WithKey(string value) + { + this.Key = value; + return this; + } + + public ThemedUrl WithTheme(ThemeName value) + { + this.Theme = value; + return this; + } + + public ThemedUrl WithUrl(string value) + { + this.Url = value; + return this; + } +} + +/// +/// Defines a target element in an Action.ToggleVisibility. +/// +public class TargetElement : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type TargetElement. + /// + public static TargetElement? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// The Id of the element to change the visibility of. + /// + [JsonPropertyName("elementId")] + public string? ElementId { get; set; } + + /// + /// The new visibility state of the element. + /// + [JsonPropertyName("isVisible")] + public bool? IsVisible { get; set; } + + /// + /// Serializes this TargetElement into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public TargetElement WithElementId(string value) + { + this.ElementId = value; + return this; + } + + public TargetElement WithIsVisible(bool value) + { + this.IsVisible = value; + return this; + } +} + +/// +/// Expands or collapses an embedded card within the main card. +/// +public class ShowCardAction : Action +{ + /// + /// Deserializes a JSON string into an object of type ShowCardAction. + /// + public static ShowCardAction? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Action.ShowCard**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Action.ShowCard"; + + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The title of the action, as it appears on buttons. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 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. + /// + /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// + [JsonPropertyName("iconUrl")] + public string? IconUrl { get; set; } + + /// + /// Control the style of the action, affecting its visual and spoken representations. + /// + [JsonPropertyName("style")] + public ActionStyle? Style { get; set; } = ActionStyle.Default; + + /// + /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// + [JsonPropertyName("mode")] + public ActionMode? Mode { get; set; } = ActionMode.Primary; + + /// + /// The tooltip text to display when the action is hovered over. + /// + [JsonPropertyName("tooltip")] + public string? Tooltip { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("isEnabled")] + public bool? IsEnabled { get; set; } = true; + + /// + /// The actions to display in the overflow menu of a Split action button. + /// + [JsonPropertyName("menuActions")] + public IList? MenuActions { get; set; } + + /// + /// A set of theme-specific icon URLs. + /// + [JsonPropertyName("themedIconUrls")] + public IList? ThemedIconUrls { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + /// + /// The card that should be displayed when the action is executed. + /// + [JsonPropertyName("card")] + public AdaptiveCard? Card { get; set; } + + /// + /// Serializes this ShowCardAction into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public ShowCardAction WithKey(string value) + { + this.Key = value; + return this; + } + + public ShowCardAction WithId(string value) + { + this.Id = value; + return this; + } + + public ShowCardAction WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public ShowCardAction WithTitle(string value) + { + this.Title = value; + return this; + } + + public ShowCardAction WithIconUrl(string value) + { + this.IconUrl = value; + return this; + } + + public ShowCardAction WithStyle(ActionStyle value) + { + this.Style = value; + return this; + } + + public ShowCardAction WithMode(ActionMode value) + { + this.Mode = value; + return this; + } + + public ShowCardAction WithTooltip(string value) + { + this.Tooltip = value; + return this; + } + + public ShowCardAction WithIsEnabled(bool value) + { + this.IsEnabled = value; + return this; + } + + public ShowCardAction WithMenuActions(params Action[] value) + { + this.MenuActions = new List(value); + return this; + } + + public ShowCardAction WithMenuActions(IList value) + { + this.MenuActions = value; + return this; + } + + public ShowCardAction WithThemedIconUrls(params ThemedUrl[] value) + { + this.ThemedIconUrls = new List(value); + return this; + } + + public ShowCardAction WithThemedIconUrls(IList value) + { + this.ThemedIconUrls = value; + return this; + } + + public ShowCardAction WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } + + public ShowCardAction WithCard(AdaptiveCard value) + { + this.Card = value; + return this; + } +} + +/// +/// Shows a popover to display more information to the user. +/// +public class PopoverAction : Action +{ + /// + /// Deserializes a JSON string into an object of type PopoverAction. + /// + public static PopoverAction? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Action.Popover**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Action.Popover"; + + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The title of the action, as it appears on buttons. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 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. + /// + /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// + [JsonPropertyName("iconUrl")] + public string? IconUrl { get; set; } + + /// + /// Control the style of the action, affecting its visual and spoken representations. + /// + [JsonPropertyName("style")] + public ActionStyle? Style { get; set; } = ActionStyle.Default; + + /// + /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// + [JsonPropertyName("mode")] + public ActionMode? Mode { get; set; } = ActionMode.Primary; + + /// + /// The tooltip text to display when the action is hovered over. + /// + [JsonPropertyName("tooltip")] + public string? Tooltip { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("isEnabled")] + public bool? IsEnabled { get; set; } = true; + + /// + /// A set of theme-specific icon URLs. + /// + [JsonPropertyName("themedIconUrls")] + public IList? ThemedIconUrls { get; set; } + + /// + /// The content of the popover, which can be any element. + /// + [JsonPropertyName("content")] + public CardElement? Content { get; set; } + + /// + /// Controls if an arrow should be displayed towards the element that triggered the popover. + /// + [JsonPropertyName("displayArrow")] + public bool? DisplayArrow { get; set; } = true; + + /// + /// Controls where the popover should be displayed with regards to the element that triggered it. + /// + [JsonPropertyName("position")] + public PopoverPosition? Position { get; set; } = PopoverPosition.Above; + + /// + /// The maximum width of the popover in pixels, in the `px` format + /// + [JsonPropertyName("maxPopoverWidth")] + public string? MaxPopoverWidth { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + /// + /// Serializes this PopoverAction into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public PopoverAction WithKey(string value) + { + this.Key = value; + return this; + } + + public PopoverAction WithId(string value) + { + this.Id = value; + return this; + } + + public PopoverAction WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public PopoverAction WithTitle(string value) + { + this.Title = value; + return this; + } + + public PopoverAction WithIconUrl(string value) + { + this.IconUrl = value; + return this; + } + + public PopoverAction WithStyle(ActionStyle value) + { + this.Style = value; + return this; + } + + public PopoverAction WithMode(ActionMode value) + { + this.Mode = value; + return this; + } + + public PopoverAction WithTooltip(string value) + { + this.Tooltip = value; + return this; + } + + public PopoverAction WithIsEnabled(bool value) + { + this.IsEnabled = value; + return this; + } + + public PopoverAction WithThemedIconUrls(params ThemedUrl[] value) + { + this.ThemedIconUrls = new List(value); + return this; + } + + public PopoverAction WithThemedIconUrls(IList value) + { + this.ThemedIconUrls = value; + return this; + } + + public PopoverAction WithContent(CardElement value) + { + this.Content = value; + return this; + } + + public PopoverAction WithDisplayArrow(bool value) + { + this.DisplayArrow = value; + return this; + } + + public PopoverAction WithPosition(PopoverPosition value) + { + this.Position = value; + return this; + } + + public PopoverAction WithMaxPopoverWidth(string value) + { + this.MaxPopoverWidth = value; + return this; + } + + public PopoverAction WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } +} + +/// +/// Displays a set of action, which can be placed anywhere in the card. +/// +public class ActionSet : CardElement +{ + /// + /// Deserializes a JSON string into an object of type ActionSet. + /// + public static ActionSet? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **ActionSet**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "ActionSet"; + + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The locale associated with the element. + /// + [JsonPropertyName("lang")] + public string? Lang { get; set; } + + /// + /// Controls the visibility of the element. + /// + [JsonPropertyName("isVisible")] + public bool? IsVisible { get; set; } = true; + + /// + /// 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. + /// + [JsonPropertyName("separator")] + public bool? Separator { get; set; } = false; + + /// + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; + + /// + /// Controls how the element should be horizontally aligned. + /// + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } + + /// + /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. + /// + [JsonPropertyName("spacing")] + public Spacing? Spacing { get; set; } = Spacing.Default; + + /// + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). + /// + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } + + /// + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; + + /// + /// The area of a Layout.AreaGrid layout in which an element should be displayed. + /// + [JsonPropertyName("grid.area")] + public string? GridArea { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + /// + /// The actions in the set. + /// + [JsonPropertyName("actions")] + public IList? Actions { get; set; } + + public ActionSet() { } + + public ActionSet(params Action[] actions) + { + this.Actions = new List(actions); + } + + public ActionSet(IList actions) + { + this.Actions = actions; + } + + /// + /// Serializes this ActionSet into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public ActionSet WithKey(string value) + { + this.Key = value; + return this; + } + + public ActionSet WithId(string value) + { + this.Id = value; + return this; + } + + public ActionSet WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public ActionSet WithLang(string value) + { + this.Lang = value; + return this; + } + + public ActionSet WithIsVisible(bool value) + { + this.IsVisible = value; + return this; + } + + public ActionSet WithSeparator(bool value) + { + this.Separator = value; + return this; + } + + public ActionSet WithHeight(ElementHeight value) + { + this.Height = value; + return this; + } + + public ActionSet WithHorizontalAlignment(HorizontalAlignment value) + { + this.HorizontalAlignment = value; + return this; + } + + public ActionSet WithSpacing(Spacing value) + { + this.Spacing = value; + return this; + } + + public ActionSet WithTargetWidth(TargetWidth value) + { + this.TargetWidth = value; + return this; + } + + public ActionSet WithIsSortKey(bool value) + { + this.IsSortKey = value; + return this; + } + + public ActionSet WithGridArea(string value) + { + this.GridArea = value; + return this; + } + + public ActionSet WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } + + public ActionSet WithActions(params Action[] value) + { + this.Actions = new List(value); + return this; + } + + public ActionSet WithActions(IList value) + { + this.Actions = value; + return this; + } +} + +/// +/// 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. +/// +public class Container : CardElement +{ + /// + /// Deserializes a JSON string into an object of type Container. + /// + public static Container? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Container**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Container"; + + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The locale associated with the element. + /// + [JsonPropertyName("lang")] + public string? Lang { get; set; } + + /// + /// Controls the visibility of the element. + /// + [JsonPropertyName("isVisible")] + public bool? IsVisible { get; set; } = true; + + /// + /// 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. + /// + [JsonPropertyName("separator")] + public bool? Separator { get; set; } = false; + + /// + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; + + /// + /// Controls how the element should be horizontally aligned. + /// + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } + + /// + /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. + /// + [JsonPropertyName("spacing")] + public Spacing? Spacing { get; set; } = Spacing.Default; + + /// + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). + /// + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } + + /// + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// - [JsonPropertyName("type")] - public string Type { get; } = "task/fetch"; + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; /// - /// Serializes this TaskFetchSubmitActionData into a JSON string. + /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } -} + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } -/// -/// 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. -/// -public class SubmitAction : Action -{ /// - /// Deserializes a JSON string into an object of type SubmitAction. + /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. /// - public static SubmitAction? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } + [JsonPropertyName("style")] + public ContainerStyle? Style { get; set; } /// - /// Must be **Action.Submit**. + /// Controls if a border should be displayed around the container. /// - [JsonPropertyName("type")] - public string Type { get; } = "Action.Submit"; + [JsonPropertyName("showBorder")] + public bool? ShowBorder { get; set; } = false; /// - /// 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. + /// Controls if the container should have rounded corners. /// - [JsonPropertyName("id")] - public string? Id { get; set; } + [JsonPropertyName("roundedCorners")] + public bool? RoundedCorners { get; set; } = false; /// - /// 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). + /// The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See [Container layouts](https://adaptivecards.microsoft.com/?topic=container-layouts) for more details. /// - [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + [JsonPropertyName("layouts")] + public IList? Layouts { get; set; } /// - /// The title of the action, as it appears on buttons. + /// Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. /// - [JsonPropertyName("title")] - public string? Title { get; set; } + [JsonPropertyName("bleed")] + public bool? Bleed { get; set; } = false; /// - /// 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. - /// - /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// The minimum height, in pixels, of the container, in the `px` format. /// - [JsonPropertyName("iconUrl")] - public string? IconUrl { get; set; } + [JsonPropertyName("minHeight")] + public string? MinHeight { get; set; } /// - /// Control the style of the action, affecting its visual and spoken representations. + /// Defines the container's background image. /// - [JsonPropertyName("style")] - public ActionStyle? Style { get; set; } + [JsonPropertyName("backgroundImage")] + public IUnion? BackgroundImage { get; set; } /// - /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// Controls how the container's content should be vertically aligned. /// - [JsonPropertyName("mode")] - public ActionMode? Mode { get; set; } + [JsonPropertyName("verticalContentAlignment")] + public VerticalAlignment? VerticalContentAlignment { get; set; } /// - /// The tooltip text to display when the action is hovered over. + /// Controls if the content of the card is to be rendered left-to-right or right-to-left. /// - [JsonPropertyName("tooltip")] - public string? Tooltip { get; set; } + [JsonPropertyName("rtl")] + public bool? Rtl { get; set; } /// - /// 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. + /// 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. /// - [JsonPropertyName("isEnabled")] - public bool? IsEnabled { get; set; } + [JsonPropertyName("maxHeight")] + public string? MaxHeight { get; set; } /// - /// 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. + /// The area of a Layout.AreaGrid layout in which an element should be displayed. /// - [JsonPropertyName("data")] - public IUnion? Data { get; set; } + [JsonPropertyName("grid.area")] + public string? GridArea { get; set; } /// - /// 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](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// 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. /// - [JsonPropertyName("associatedInputs")] - public AssociatedInputs? AssociatedInputs { get; set; } + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } /// - /// Controls if the action is enabled only if at least one required input has been filled by the user. + /// The elements in the container. /// - [JsonPropertyName("conditionallyEnabled")] - public bool? ConditionallyEnabled { get; set; } + [JsonPropertyName("items")] + public IList? Items { get; set; } - [JsonPropertyName("msteams")] - public TeamsSubmitActionProperties? Msteams { get; set; } + public Container() { } - /// - /// 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. - /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + public Container(params CardElement[] items) + { + this.Items = new List(items); + } + + public Container(IList items) + { + this.Items = items; + } /// - /// Serializes this SubmitAction into a JSON string. + /// Serializes this Container into a JSON string. /// public string Serialize() { @@ -1936,147 +4147,202 @@ public string Serialize() ); } - public SubmitAction WithId(string value) + public Container WithKey(string value) + { + this.Key = value; + return this; + } + + public Container WithId(string value) { this.Id = value; return this; } - public SubmitAction WithRequires(HostCapabilities value) + public Container WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public SubmitAction WithTitle(string value) + public Container WithLang(string value) { - this.Title = value; + this.Lang = value; return this; } - public SubmitAction WithIconUrl(string value) + public Container WithIsVisible(bool value) { - this.IconUrl = value; + this.IsVisible = value; return this; } - public SubmitAction WithStyle(ActionStyle value) + public Container WithSeparator(bool value) + { + this.Separator = value; + return this; + } + + public Container WithHeight(ElementHeight value) + { + this.Height = value; + return this; + } + + public Container WithHorizontalAlignment(HorizontalAlignment value) + { + this.HorizontalAlignment = value; + return this; + } + + public Container WithSpacing(Spacing value) + { + this.Spacing = value; + return this; + } + + public Container WithTargetWidth(TargetWidth value) + { + this.TargetWidth = value; + return this; + } + + public Container WithIsSortKey(bool value) + { + this.IsSortKey = value; + return this; + } + + public Container WithSelectAction(Action value) + { + this.SelectAction = value; + return this; + } + + public Container WithStyle(ContainerStyle value) { this.Style = value; return this; } - public SubmitAction WithMode(ActionMode value) + public Container WithShowBorder(bool value) { - this.Mode = value; + this.ShowBorder = value; return this; } - public SubmitAction WithTooltip(string value) + public Container WithRoundedCorners(bool value) { - this.Tooltip = value; + this.RoundedCorners = value; return this; } - public SubmitAction WithIsEnabled(bool value) + public Container WithLayouts(params ContainerLayout[] value) { - this.IsEnabled = value; + this.Layouts = new List(value); return this; } - public SubmitAction WithData(IUnion value) + public Container WithLayouts(IList value) { - this.Data = value; + this.Layouts = value; return this; } - public SubmitAction WithAssociatedInputs(AssociatedInputs value) + public Container WithBleed(bool value) { - this.AssociatedInputs = value; + this.Bleed = value; return this; } - public SubmitAction WithConditionallyEnabled(bool value) + public Container WithMinHeight(string value) { - this.ConditionallyEnabled = value; + this.MinHeight = value; return this; } - public SubmitAction WithMsteams(TeamsSubmitActionProperties value) + public Container WithBackgroundImage(IUnion value) { - this.Msteams = value; + this.BackgroundImage = value; return this; } - public SubmitAction WithFallback(IUnion value) + public Container WithVerticalContentAlignment(VerticalAlignment value) { - this.Fallback = value; + this.VerticalContentAlignment = value; return this; } -} -/// -/// Teams-specific properties associated with the action. -/// -public class TeamsSubmitActionProperties : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type TeamsSubmitActionProperties. - /// - public static TeamsSubmitActionProperties? Deserialize(string json) + public Container WithRtl(bool value) { - return JsonSerializer.Deserialize(json); + this.Rtl = value; + return this; } - /// - /// Defines how feedback is provided to the end-user when the action is executed. - /// - [JsonPropertyName("feedback")] - public TeamsSubmitActionFeedback? Feedback { get; set; } + public Container WithMaxHeight(string value) + { + this.MaxHeight = value; + return this; + } - /// - /// Serializes this TeamsSubmitActionProperties into a JSON string. - /// - public string Serialize() + public Container WithGridArea(string value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.GridArea = value; + return this; } - public TeamsSubmitActionProperties WithFeedback(TeamsSubmitActionFeedback value) + public Container WithFallback(IUnion value) { - this.Feedback = value; + this.Fallback = value; + return this; + } + + public Container WithItems(params CardElement[] value) + { + this.Items = new List(value); + return this; + } + + public Container WithItems(IList value) + { + this.Items = value; return this; } } /// -/// Represents feedback options for an [Action.Submit](https://adaptivecards.microsoft.com/?topic=Action.Submit). +/// A layout that stacks elements on top of each other. Layout.Stack is the default layout used by AdaptiveCard and all containers. /// -public class TeamsSubmitActionFeedback : SerializableObject +public class StackLayout : ContainerLayout { /// - /// Deserializes a JSON string into an object of type TeamsSubmitActionFeedback. + /// Deserializes a JSON string into an object of type StackLayout. /// - public static TeamsSubmitActionFeedback? Deserialize(string json) + public static StackLayout? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Defines if a feedback message should be displayed after the action is executed. + /// 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. /// - [JsonPropertyName("hide")] - public bool? Hide { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Serializes this TeamsSubmitActionFeedback into a JSON string. + /// Must be **Layout.Stack**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Layout.Stack"; + + /// + /// Controls for which card width the layout should be used. + /// + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } + + /// + /// Serializes this StackLayout into a JSON string. /// public string Serialize() { @@ -2090,101 +4356,100 @@ public string Serialize() ); } - public TeamsSubmitActionFeedback WithHide(bool value) + public StackLayout WithKey(string value) { - this.Hide = value; + this.Key = value; + return this; + } + + public StackLayout WithTargetWidth(TargetWidth value) + { + this.TargetWidth = value; return this; } } /// -/// Opens the provided URL in either a separate browser tab or within the host application. +/// A layout that spreads elements horizontally and wraps them across multiple rows, as needed. /// -public class OpenUrlAction : Action +public class FlowLayout : ContainerLayout { /// - /// Deserializes a JSON string into an object of type OpenUrlAction. + /// Deserializes a JSON string into an object of type FlowLayout. /// - public static OpenUrlAction? Deserialize(string json) + public static FlowLayout? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Action.OpenUrl**. + /// 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. /// - [JsonPropertyName("type")] - public string Type { get; } = "Action.OpenUrl"; + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// 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. + /// Must be **Layout.Flow**. /// - [JsonPropertyName("id")] - public string? Id { get; set; } + [JsonPropertyName("type")] + public string Type { get; } = "Layout.Flow"; /// - /// 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). + /// Controls for which card width the layout should be used. /// - [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } /// - /// The title of the action, as it appears on buttons. + /// Controls how the content of the container should be horizontally aligned. /// - [JsonPropertyName("title")] - public string? Title { get; set; } + [JsonPropertyName("horizontalItemsAlignment")] + public HorizontalAlignment? HorizontalItemsAlignment { get; set; } = HorizontalAlignment.Center; /// - /// 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. - /// - /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// Controls how the content of the container should be vertically aligned. /// - [JsonPropertyName("iconUrl")] - public string? IconUrl { get; set; } + [JsonPropertyName("verticalItemsAlignment")] + public VerticalAlignment? VerticalItemsAlignment { get; set; } = VerticalAlignment.Top; /// - /// Control the style of the action, affecting its visual and spoken representations. + /// Controls how item should fit inside the container. /// - [JsonPropertyName("style")] - public ActionStyle? Style { get; set; } + [JsonPropertyName("itemFit")] + public FlowLayoutItemFit? ItemFit { get; set; } = FlowLayoutItemFit.Fit; /// - /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// The minimum width, in pixels, of each item, in the `px` format. Should not be used if itemWidth is set. /// - [JsonPropertyName("mode")] - public ActionMode? Mode { get; set; } + [JsonPropertyName("minItemWidth")] + public string? MinItemWidth { get; set; } /// - /// The tooltip text to display when the action is hovered over. + /// The maximum width, in pixels, of each item, in the `px` format. Should not be used if itemWidth is set. /// - [JsonPropertyName("tooltip")] - public string? Tooltip { get; set; } + [JsonPropertyName("maxItemWidth")] + public string? MaxItemWidth { get; set; } /// - /// 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. + /// The width, in pixels, of each item, in the `px` format. Should not be used if maxItemWidth and/or minItemWidth are set. /// - [JsonPropertyName("isEnabled")] - public bool? IsEnabled { get; set; } + [JsonPropertyName("itemWidth")] + public string? ItemWidth { get; set; } /// - /// The URL to open. + /// The space between items. /// - [JsonPropertyName("url")] - public string? Url { get; set; } + [JsonPropertyName("columnSpacing")] + public Spacing? ColumnSpacing { get; set; } = Spacing.Default; /// - /// 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. + /// The space between rows of items. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } - - public OpenUrlAction(string url) - { - this.Url = url; - } + [JsonPropertyName("rowSpacing")] + public Spacing? RowSpacing { get; set; } = Spacing.Default; /// - /// Serializes this OpenUrlAction into a JSON string. + /// Serializes this FlowLayout into a JSON string. /// public string Serialize() { @@ -2198,150 +4463,124 @@ public string Serialize() ); } - public OpenUrlAction WithId(string value) + public FlowLayout WithKey(string value) { - this.Id = value; + this.Key = value; return this; } - public OpenUrlAction WithRequires(HostCapabilities value) + public FlowLayout WithTargetWidth(TargetWidth value) { - this.Requires = value; + this.TargetWidth = value; return this; } - public OpenUrlAction WithTitle(string value) + public FlowLayout WithHorizontalItemsAlignment(HorizontalAlignment value) { - this.Title = value; + this.HorizontalItemsAlignment = value; return this; } - public OpenUrlAction WithIconUrl(string value) + public FlowLayout WithVerticalItemsAlignment(VerticalAlignment value) { - this.IconUrl = value; + this.VerticalItemsAlignment = value; return this; } - public OpenUrlAction WithStyle(ActionStyle value) + public FlowLayout WithItemFit(FlowLayoutItemFit value) { - this.Style = value; + this.ItemFit = value; return this; } - public OpenUrlAction WithMode(ActionMode value) + public FlowLayout WithMinItemWidth(string value) { - this.Mode = value; + this.MinItemWidth = value; return this; } - public OpenUrlAction WithTooltip(string value) + public FlowLayout WithMaxItemWidth(string value) { - this.Tooltip = value; + this.MaxItemWidth = value; return this; } - public OpenUrlAction WithIsEnabled(bool value) + public FlowLayout WithItemWidth(string value) { - this.IsEnabled = value; + this.ItemWidth = value; return this; } - public OpenUrlAction WithUrl(string value) + public FlowLayout WithColumnSpacing(Spacing value) { - this.Url = value; + this.ColumnSpacing = value; return this; } - public OpenUrlAction WithFallback(IUnion value) + public FlowLayout WithRowSpacing(Spacing value) { - this.Fallback = value; + this.RowSpacing = value; return this; } } /// -/// Toggles the visibility of a set of elements. Action.ToggleVisibility is useful for creating "Show more" type UI patterns. +/// A layout that divides a container into named areas into which elements can be placed. /// -public class ToggleVisibilityAction : Action +public class AreaGridLayout : ContainerLayout { /// - /// Deserializes a JSON string into an object of type ToggleVisibilityAction. + /// Deserializes a JSON string into an object of type AreaGridLayout. /// - public static ToggleVisibilityAction? Deserialize(string json) + public static AreaGridLayout? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Action.ToggleVisibility**. - /// - [JsonPropertyName("type")] - public string Type { get; } = "Action.ToggleVisibility"; - - /// - /// 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. - /// - [JsonPropertyName("id")] - public string? Id { get; set; } - - /// - /// 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). - /// - [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } - - /// - /// The title of the action, as it appears on buttons. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } - - /// - /// 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. - /// - /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// 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. /// - [JsonPropertyName("iconUrl")] - public string? IconUrl { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Control the style of the action, affecting its visual and spoken representations. + /// Must be **Layout.AreaGrid**. /// - [JsonPropertyName("style")] - public ActionStyle? Style { get; set; } + [JsonPropertyName("type")] + public string Type { get; } = "Layout.AreaGrid"; /// - /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// Controls for which card width the layout should be used. /// - [JsonPropertyName("mode")] - public ActionMode? Mode { get; set; } + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } /// - /// The tooltip text to display when the action is hovered over. + /// The columns in the grid layout, defined as a percentage of the available width or in pixels using the `px` format. /// - [JsonPropertyName("tooltip")] - public string? Tooltip { get; set; } + [JsonPropertyName("columns")] + public IUnion, IList>? Columns { get; set; } /// - /// 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. + /// The areas in the grid layout. /// - [JsonPropertyName("isEnabled")] - public bool? IsEnabled { get; set; } + [JsonPropertyName("areas")] + public IList? Areas { get; set; } /// - /// The Ids of the elements to toggle the visibility of. + /// The space between columns. /// - [JsonPropertyName("targetElements")] - public IUnion, IList>? TargetElements { get; set; } + [JsonPropertyName("columnSpacing")] + public Spacing? ColumnSpacing { get; set; } = Spacing.Default; /// - /// 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. + /// The space between rows. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + [JsonPropertyName("rowSpacing")] + public Spacing? RowSpacing { get; set; } = Spacing.Default; /// - /// Serializes this ToggleVisibilityAction into a JSON string. + /// Serializes this AreaGridLayout into a JSON string. /// public string Serialize() { @@ -2355,94 +4594,100 @@ public string Serialize() ); } - public ToggleVisibilityAction WithId(string value) - { - this.Id = value; - return this; - } - - public ToggleVisibilityAction WithRequires(HostCapabilities value) - { - this.Requires = value; - return this; - } - - public ToggleVisibilityAction WithTitle(string value) - { - this.Title = value; - return this; - } - - public ToggleVisibilityAction WithIconUrl(string value) + public AreaGridLayout WithKey(string value) { - this.IconUrl = value; + this.Key = value; return this; } - public ToggleVisibilityAction WithStyle(ActionStyle value) + public AreaGridLayout WithTargetWidth(TargetWidth value) { - this.Style = value; + this.TargetWidth = value; return this; } - public ToggleVisibilityAction WithMode(ActionMode value) + public AreaGridLayout WithColumns(IUnion, IList> value) { - this.Mode = value; + this.Columns = value; return this; } - public ToggleVisibilityAction WithTooltip(string value) + public AreaGridLayout WithAreas(params GridArea[] value) { - this.Tooltip = value; + this.Areas = new List(value); return this; } - public ToggleVisibilityAction WithIsEnabled(bool value) + public AreaGridLayout WithAreas(IList value) { - this.IsEnabled = value; + this.Areas = value; return this; } - public ToggleVisibilityAction WithTargetElements(IUnion, IList> value) + public AreaGridLayout WithColumnSpacing(Spacing value) { - this.TargetElements = value; + this.ColumnSpacing = value; return this; } - public ToggleVisibilityAction WithFallback(IUnion value) + public AreaGridLayout WithRowSpacing(Spacing value) { - this.Fallback = value; + this.RowSpacing = value; return this; } } /// -/// Defines a target element in an Action.ToggleVisibility. +/// Defines an area in a Layout.AreaGrid layout. /// -public class TargetElement : SerializableObject +public class GridArea : SerializableObject { /// - /// Deserializes a JSON string into an object of type TargetElement. + /// Deserializes a JSON string into an object of type GridArea. /// - public static TargetElement? Deserialize(string json) + public static GridArea? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The Id of the element to change the visibility of. + /// 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. /// - [JsonPropertyName("elementId")] - public string? ElementId { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The new visibility state of the element. + /// The name of the area. To place an element in this area, set its `grid.area` property to match the name of the area. /// - [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + [JsonPropertyName("name")] + public string? Name { get; set; } /// - /// Serializes this TargetElement into a JSON string. + /// The start column index of the area. Column indices start at 1. + /// + [JsonPropertyName("column")] + public float? Column { get; set; } = 1; + + /// + /// Defines how many columns the area should span. + /// + [JsonPropertyName("columnSpan")] + public float? ColumnSpan { get; set; } = 1; + + /// + /// The start row index of the area. Row indices start at 1. + /// + [JsonPropertyName("row")] + public float? Row { get; set; } = 1; + + /// + /// Defines how many rows the area should span. + /// + [JsonPropertyName("rowSpan")] + public float? RowSpan { get; set; } = 1; + + /// + /// Serializes this GridArea into a JSON string. /// public string Serialize() { @@ -2456,102 +4701,94 @@ public string Serialize() ); } - public TargetElement WithElementId(string value) + public GridArea WithKey(string value) { - this.ElementId = value; + this.Key = value; return this; } - public TargetElement WithIsVisible(bool value) + public GridArea WithName(string value) { - this.IsVisible = value; + this.Name = value; return this; } -} -/// -/// Expands or collapses an embedded card within the main card. -/// -public class ShowCardAction : Action -{ - /// - /// Deserializes a JSON string into an object of type ShowCardAction. - /// - public static ShowCardAction? Deserialize(string json) + public GridArea WithColumn(float value) { - return JsonSerializer.Deserialize(json); + this.Column = value; + return this; } - /// - /// Must be **Action.ShowCard**. - /// - [JsonPropertyName("type")] - public string Type { get; } = "Action.ShowCard"; - - /// - /// 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. - /// - [JsonPropertyName("id")] - public string? Id { get; set; } + public GridArea WithColumnSpan(float value) + { + this.ColumnSpan = value; + return this; + } - /// - /// 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). - /// - [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public GridArea WithRow(float value) + { + this.Row = value; + return this; + } - /// - /// The title of the action, as it appears on buttons. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } + public GridArea WithRowSpan(float value) + { + this.RowSpan = value; + return this; + } +} +/// +/// Defines a container's background image and the way it should be rendered. +/// +public class BackgroundImage : SerializableObject +{ /// - /// 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. - /// - /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// Deserializes a JSON string into an object of type BackgroundImage. /// - [JsonPropertyName("iconUrl")] - public string? IconUrl { get; set; } + public static BackgroundImage? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } /// - /// Control the style of the action, affecting its visual and spoken representations. + /// 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. /// - [JsonPropertyName("style")] - public ActionStyle? Style { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// The URL (or Base64-encoded Data URI) of the image. Acceptable formats are PNG, JPEG, GIF and SVG. /// - [JsonPropertyName("mode")] - public ActionMode? Mode { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } /// - /// The tooltip text to display when the action is hovered over. + /// Controls how the image should fill the area. /// - [JsonPropertyName("tooltip")] - public string? Tooltip { get; set; } + [JsonPropertyName("fillMode")] + public FillMode? FillMode { get; set; } = FillMode.Cover; /// - /// 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. + /// Controls how the image should be aligned if it must be cropped or if using repeat fill mode. /// - [JsonPropertyName("isEnabled")] - public bool? IsEnabled { get; set; } + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } = HorizontalAlignment.Left; /// - /// 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. + /// Controls how the image should be aligned if it must be cropped or if using repeat fill mode. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + [JsonPropertyName("verticalAlignment")] + public VerticalAlignment? VerticalAlignment { get; set; } = VerticalAlignment.Top; /// - /// The card that should be displayed when the action is executed. + /// A set of theme-specific image URLs. /// - [JsonPropertyName("card")] - public AdaptiveCard? Card { get; set; } + [JsonPropertyName("themedUrls")] + public IList? ThemedUrls { get; set; } /// - /// Serializes this ShowCardAction into a JSON string. + /// Serializes this BackgroundImage into a JSON string. /// public string Serialize() { @@ -2565,85 +4802,73 @@ public string Serialize() ); } - public ShowCardAction WithId(string value) - { - this.Id = value; - return this; - } - - public ShowCardAction WithRequires(HostCapabilities value) - { - this.Requires = value; - return this; - } - - public ShowCardAction WithTitle(string value) - { - this.Title = value; - return this; - } - - public ShowCardAction WithIconUrl(string value) + public BackgroundImage WithKey(string value) { - this.IconUrl = value; + this.Key = value; return this; } - public ShowCardAction WithStyle(ActionStyle value) + public BackgroundImage WithUrl(string value) { - this.Style = value; + this.Url = value; return this; } - public ShowCardAction WithMode(ActionMode value) + public BackgroundImage WithFillMode(FillMode value) { - this.Mode = value; + this.FillMode = value; return this; } - public ShowCardAction WithTooltip(string value) + public BackgroundImage WithHorizontalAlignment(HorizontalAlignment value) { - this.Tooltip = value; + this.HorizontalAlignment = value; return this; } - public ShowCardAction WithIsEnabled(bool value) + public BackgroundImage WithVerticalAlignment(VerticalAlignment value) { - this.IsEnabled = value; + this.VerticalAlignment = value; return this; } - public ShowCardAction WithFallback(IUnion value) + public BackgroundImage WithThemedUrls(params ThemedUrl[] value) { - this.Fallback = value; + this.ThemedUrls = new List(value); return this; } - public ShowCardAction WithCard(AdaptiveCard value) + public BackgroundImage WithThemedUrls(IList value) { - this.Card = value; + this.ThemedUrls = value; return this; } } /// -/// Resets the values of the inputs in the card. +/// Splits the available horizontal space into separate columns, so elements can be organized in a row. /// -public class ResetInputsAction : Action +public class ColumnSet : CardElement { /// - /// Deserializes a JSON string into an object of type ResetInputsAction. + /// Deserializes a JSON string into an object of type ColumnSet. /// - public static ResetInputsAction? Deserialize(string json) + public static ColumnSet? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Action.ResetInputs**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **ColumnSet**. /// [JsonPropertyName("type")] - public string Type { get; } = "Action.ResetInputs"; + public string Type { get; } = "ColumnSet"; /// /// 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. @@ -2655,60 +4880,118 @@ public class ResetInputsAction : Action /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The locale associated with the element. + /// + [JsonPropertyName("lang")] + public string? Lang { get; set; } + + /// + /// Controls the visibility of the element. + /// + [JsonPropertyName("isVisible")] + public bool? IsVisible { get; set; } = true; + + /// + /// 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. + /// + [JsonPropertyName("separator")] + public bool? Separator { get; set; } = false; + + /// + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; + + /// + /// Controls how the element should be horizontally aligned. + /// + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } + + /// + /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. + /// + [JsonPropertyName("spacing")] + public Spacing? Spacing { get; set; } = Spacing.Default; + + /// + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). + /// + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } + + /// + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; + + /// + /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. + /// + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } + + /// + /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. + /// + [JsonPropertyName("style")] + public ContainerStyle? Style { get; set; } /// - /// The title of the action, as it appears on buttons. + /// Controls if a border should be displayed around the container. /// - [JsonPropertyName("title")] - public string? Title { get; set; } + [JsonPropertyName("showBorder")] + public bool? ShowBorder { get; set; } = false; /// - /// 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. - /// - /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// Controls if the container should have rounded corners. /// - [JsonPropertyName("iconUrl")] - public string? IconUrl { get; set; } + [JsonPropertyName("roundedCorners")] + public bool? RoundedCorners { get; set; } = false; /// - /// Control the style of the action, affecting its visual and spoken representations. + /// Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. /// - [JsonPropertyName("style")] - public ActionStyle? Style { get; set; } + [JsonPropertyName("bleed")] + public bool? Bleed { get; set; } = false; /// - /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// The minimum height, in pixels, of the container, in the `px` format. /// - [JsonPropertyName("mode")] - public ActionMode? Mode { get; set; } + [JsonPropertyName("minHeight")] + public string? MinHeight { get; set; } /// - /// The tooltip text to display when the action is hovered over. + /// 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. /// - [JsonPropertyName("tooltip")] - public string? Tooltip { get; set; } + [JsonPropertyName("minWidth")] + public string? MinWidth { get; set; } /// - /// 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. + /// The area of a Layout.AreaGrid layout in which an element should be displayed. /// - [JsonPropertyName("isEnabled")] - public bool? IsEnabled { get; set; } + [JsonPropertyName("grid.area")] + public string? GridArea { get; set; } /// - /// The Ids of the inputs that should be reset. + /// 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. /// - [JsonPropertyName("targetInputIds")] - public IList? TargetInputIds { get; set; } + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } /// - /// 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. + /// The columns in the set. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + [JsonPropertyName("columns")] + public IList? Columns { get; set; } /// - /// Serializes this ResetInputsAction into a JSON string. + /// Serializes this ColumnSet into a JSON string. /// public string Serialize() { @@ -2722,85 +5005,163 @@ public string Serialize() ); } - public ResetInputsAction WithId(string value) + public ColumnSet WithKey(string value) + { + this.Key = value; + return this; + } + + public ColumnSet WithId(string value) { this.Id = value; return this; } - public ResetInputsAction WithRequires(HostCapabilities value) + public ColumnSet WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ResetInputsAction WithTitle(string value) + public ColumnSet WithLang(string value) { - this.Title = value; + this.Lang = value; return this; } - public ResetInputsAction WithIconUrl(string value) + public ColumnSet WithIsVisible(bool value) { - this.IconUrl = value; + this.IsVisible = value; return this; } - public ResetInputsAction WithStyle(ActionStyle value) + public ColumnSet WithSeparator(bool value) + { + this.Separator = value; + return this; + } + + public ColumnSet WithHeight(ElementHeight value) + { + this.Height = value; + return this; + } + + public ColumnSet WithHorizontalAlignment(HorizontalAlignment value) + { + this.HorizontalAlignment = value; + return this; + } + + public ColumnSet WithSpacing(Spacing value) + { + this.Spacing = value; + return this; + } + + public ColumnSet WithTargetWidth(TargetWidth value) + { + this.TargetWidth = value; + return this; + } + + public ColumnSet WithIsSortKey(bool value) + { + this.IsSortKey = value; + return this; + } + + public ColumnSet WithSelectAction(Action value) + { + this.SelectAction = value; + return this; + } + + public ColumnSet WithStyle(ContainerStyle value) { this.Style = value; return this; } - public ResetInputsAction WithMode(ActionMode value) + public ColumnSet WithShowBorder(bool value) { - this.Mode = value; + this.ShowBorder = value; return this; } - public ResetInputsAction WithTooltip(string value) + public ColumnSet WithRoundedCorners(bool value) { - this.Tooltip = value; + this.RoundedCorners = value; return this; } - public ResetInputsAction WithIsEnabled(bool value) + public ColumnSet WithBleed(bool value) { - this.IsEnabled = value; + this.Bleed = value; return this; } - public ResetInputsAction WithTargetInputIds(params IList value) + public ColumnSet WithMinHeight(string value) { - this.TargetInputIds = value; + this.MinHeight = value; return this; } - public ResetInputsAction WithFallback(IUnion value) + public ColumnSet WithMinWidth(string value) + { + this.MinWidth = value; + return this; + } + + public ColumnSet WithGridArea(string value) + { + this.GridArea = value; + return this; + } + + public ColumnSet WithFallback(IUnion value) { this.Fallback = value; return this; } + + public ColumnSet WithColumns(params Column[] value) + { + this.Columns = new List(value); + return this; + } + + public ColumnSet WithColumns(IList value) + { + this.Columns = value; + return this; + } } /// -/// Inserts an image into the host application's canvas. +/// A media element, that makes it possible to embed videos inside a card. /// -public class InsertImageAction : Action +public class Media : CardElement { /// - /// Deserializes a JSON string into an object of type InsertImageAction. + /// Deserializes a JSON string into an object of type Media. /// - public static InsertImageAction? Deserialize(string json) + public static Media? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Action.InsertImage**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Media**. /// [JsonPropertyName("type")] - public string Type { get; } = "Action.InsertImage"; + public string Type { get; } = "Media"; /// /// 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. @@ -2812,152 +5173,204 @@ public class InsertImageAction : Action /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// - /// The title of the action, as it appears on buttons. + /// The locale associated with the element. /// - [JsonPropertyName("title")] - public string? Title { get; set; } + [JsonPropertyName("lang")] + public string? Lang { get; set; } /// - /// 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. - /// - /// `iconUrl` also accepts the `[,regular|filled]` format to display an icon from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) instead of an image. + /// Controls the visibility of the element. /// - [JsonPropertyName("iconUrl")] - public string? IconUrl { get; set; } + [JsonPropertyName("isVisible")] + public bool? IsVisible { get; set; } = true; /// - /// Control the style of the action, affecting its visual and spoken representations. + /// 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. /// - [JsonPropertyName("style")] - public ActionStyle? Style { get; set; } + [JsonPropertyName("separator")] + public bool? Separator { get; set; } = false; /// - /// Controls if the action is primary or secondary. Secondary actions appear in an overflow menu. + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// - [JsonPropertyName("mode")] - public ActionMode? Mode { get; set; } + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// - /// The tooltip text to display when the action is hovered over. + /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// - [JsonPropertyName("tooltip")] - public string? Tooltip { get; set; } + [JsonPropertyName("spacing")] + public Spacing? Spacing { get; set; } = Spacing.Default; /// - /// 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. + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). /// - [JsonPropertyName("isEnabled")] - public bool? IsEnabled { get; set; } + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } /// - /// The URL of the image to insert. + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// - [JsonPropertyName("url")] - public string? Url { get; set; } + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; /// - /// The alternate text for the image. + /// The sources for the media. For YouTube, Dailymotion and Vimeo, only one source can be specified. + /// + [JsonPropertyName("sources")] + public IList? Sources { get; set; } + + /// + /// The caption sources for the media. Caption sources are not used for YouTube, Dailymotion or Vimeo sources. + /// + [JsonPropertyName("captionSources")] + public IList? CaptionSources { get; set; } + + /// + /// The URL of the poster image to display. + /// + [JsonPropertyName("poster")] + public string? Poster { get; set; } + + /// + /// The alternate text for the media, used for accessibility purposes. /// [JsonPropertyName("altText")] public string? AltText { get; set; } /// - /// The position at which to insert the image. + /// The area of a Layout.AreaGrid layout in which an element should be displayed. /// - [JsonPropertyName("insertPosition")] - public ImageInsertPosition? InsertPosition { get; set; } + [JsonPropertyName("grid.area")] + public string? GridArea { get; set; } /// - /// 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. + /// 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. /// [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + public IUnion? Fallback { get; set; } + + /// + /// Serializes this Media into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public Media WithKey(string value) + { + this.Key = value; + return this; + } + + public Media WithId(string value) + { + this.Id = value; + return this; + } + + public Media WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public Media WithLang(string value) + { + this.Lang = value; + return this; + } - /// - /// Serializes this InsertImageAction into a JSON string. - /// - public string Serialize() + public Media WithIsVisible(bool value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.IsVisible = value; + return this; } - public InsertImageAction WithId(string value) + public Media WithSeparator(bool value) { - this.Id = value; + this.Separator = value; return this; } - public InsertImageAction WithRequires(HostCapabilities value) + public Media WithHeight(ElementHeight value) { - this.Requires = value; + this.Height = value; return this; } - public InsertImageAction WithTitle(string value) + public Media WithSpacing(Spacing value) { - this.Title = value; + this.Spacing = value; return this; } - public InsertImageAction WithIconUrl(string value) + public Media WithTargetWidth(TargetWidth value) { - this.IconUrl = value; + this.TargetWidth = value; return this; } - public InsertImageAction WithStyle(ActionStyle value) + public Media WithIsSortKey(bool value) { - this.Style = value; + this.IsSortKey = value; return this; } - public InsertImageAction WithMode(ActionMode value) + public Media WithSources(params MediaSource[] value) { - this.Mode = value; + this.Sources = new List(value); return this; } - public InsertImageAction WithTooltip(string value) + public Media WithSources(IList value) { - this.Tooltip = value; + this.Sources = value; return this; } - public InsertImageAction WithIsEnabled(bool value) + public Media WithCaptionSources(params CaptionSource[] value) { - this.IsEnabled = value; + this.CaptionSources = new List(value); return this; } - public InsertImageAction WithUrl(string value) + public Media WithCaptionSources(IList value) { - this.Url = value; + this.CaptionSources = value; return this; } - public InsertImageAction WithAltText(string value) + public Media WithPoster(string value) + { + this.Poster = value; + return this; + } + + public Media WithAltText(string value) { this.AltText = value; return this; } - public InsertImageAction WithInsertPosition(ImageInsertPosition value) + public Media WithGridArea(string value) { - this.InsertPosition = value; + this.GridArea = value; return this; } - public InsertImageAction WithFallback(IUnion value) + public Media WithFallback(IUnion value) { this.Fallback = value; return this; @@ -2965,32 +5378,38 @@ public InsertImageAction WithFallback(IUnion value) } /// -/// A layout that stacks elements on top of each other. Layout.Stack is the default layout used by AdaptiveCard and all containers. +/// Defines the source URL of a media stream. YouTube, Dailymotion, Vimeo and Microsoft Stream URLs are supported. /// -public class StackLayout : ContainerLayout +public class MediaSource : SerializableObject { /// - /// Deserializes a JSON string into an object of type StackLayout. + /// Deserializes a JSON string into an object of type MediaSource. /// - public static StackLayout? Deserialize(string json) + public static MediaSource? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Layout.Stack**. + /// 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. /// - [JsonPropertyName("type")] - public string Type { get; } = "Layout.Stack"; + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Controls for which card width the layout should be used. + /// The MIME type of the source. /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } + [JsonPropertyName("mimeType")] + public string? MimeType { get; set; } /// - /// Serializes this StackLayout into a JSON string. + /// The URL of the source. + /// + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Serializes this MediaSource into a JSON string. /// public string Serialize() { @@ -3004,88 +5423,64 @@ public string Serialize() ); } - public StackLayout WithTargetWidth(TargetWidth value) + public MediaSource WithKey(string value) { - this.TargetWidth = value; + this.Key = value; + return this; + } + + public MediaSource WithMimeType(string value) + { + this.MimeType = value; + return this; + } + + public MediaSource WithUrl(string value) + { + this.Url = value; return this; } } /// -/// A layout that spreads elements horizontally and wraps them across multiple rows, as needed. +/// Defines a source URL for a video captions. /// -public class FlowLayout : ContainerLayout +public class CaptionSource : SerializableObject { /// - /// Deserializes a JSON string into an object of type FlowLayout. + /// Deserializes a JSON string into an object of type CaptionSource. /// - public static FlowLayout? Deserialize(string json) + public static CaptionSource? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Layout.Flow**. - /// - [JsonPropertyName("type")] - public string Type { get; } = "Layout.Flow"; - - /// - /// Controls for which card width the layout should be used. - /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } - - /// - /// Controls how the content of the container should be horizontally aligned. - /// - [JsonPropertyName("horizontalItemsAlignment")] - public HorizontalAlignment? HorizontalItemsAlignment { get; set; } - - /// - /// Controls how the content of the container should be vertically aligned. - /// - [JsonPropertyName("verticalItemsAlignment")] - public VerticalAlignment? VerticalItemsAlignment { get; set; } - - /// - /// Controls how item should fit inside the container. - /// - [JsonPropertyName("itemFit")] - public FlowLayoutItemFit? ItemFit { get; set; } - - /// - /// The minimum width, in pixels, of each item, in the `px` format. Should not be used if itemWidth is set. - /// - [JsonPropertyName("minItemWidth")] - public string? MinItemWidth { get; set; } - - /// - /// The maximum width, in pixels, of each item, in the `px` format. Should not be used if itemWidth is set. + /// 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. /// - [JsonPropertyName("maxItemWidth")] - public string? MaxItemWidth { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The width, in pixels, of each item, in the `px` format. Should not be used if maxItemWidth and/or minItemWidth are set. + /// The MIME type of the source. /// - [JsonPropertyName("itemWidth")] - public string? ItemWidth { get; set; } + [JsonPropertyName("mimeType")] + public string? MimeType { get; set; } /// - /// The space between items. + /// The URL of the source. /// - [JsonPropertyName("columnSpacing")] - public Spacing? ColumnSpacing { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } /// - /// The space between rows of items. + /// The label of this caption source. /// - [JsonPropertyName("rowSpacing")] - public Spacing? RowSpacing { get; set; } + [JsonPropertyName("label")] + public string? Label { get; set; } /// - /// Serializes this FlowLayout into a JSON string. + /// Serializes this CaptionSource into a JSON string. /// public string Serialize() { @@ -3099,112 +5494,142 @@ public string Serialize() ); } - public FlowLayout WithTargetWidth(TargetWidth value) + public CaptionSource WithKey(string value) { - this.TargetWidth = value; + this.Key = value; return this; } - public FlowLayout WithHorizontalItemsAlignment(HorizontalAlignment value) + public CaptionSource WithMimeType(string value) { - this.HorizontalItemsAlignment = value; + this.MimeType = value; return this; } - public FlowLayout WithVerticalItemsAlignment(VerticalAlignment value) + public CaptionSource WithUrl(string value) { - this.VerticalItemsAlignment = value; + this.Url = value; return this; } - public FlowLayout WithItemFit(FlowLayoutItemFit value) + public CaptionSource WithLabel(string value) { - this.ItemFit = value; + this.Label = value; return this; } +} - public FlowLayout WithMinItemWidth(string value) +/// +/// A rich text block that displays formatted text. +/// +public class RichTextBlock : CardElement +{ + /// + /// Deserializes a JSON string into an object of type RichTextBlock. + /// + public static RichTextBlock? Deserialize(string json) { - this.MinItemWidth = value; - return this; + return JsonSerializer.Deserialize(json); } - public FlowLayout WithMaxItemWidth(string value) - { - this.MaxItemWidth = value; - return this; - } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } - public FlowLayout WithItemWidth(string value) - { - this.ItemWidth = value; - return this; - } + /// + /// Must be **RichTextBlock**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "RichTextBlock"; - public FlowLayout WithColumnSpacing(Spacing value) - { - this.ColumnSpacing = value; - return this; - } + /// + /// 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. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } - public FlowLayout WithRowSpacing(Spacing value) - { - this.RowSpacing = value; - return this; - } -} + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); + + /// + /// The locale associated with the element. + /// + [JsonPropertyName("lang")] + public string? Lang { get; set; } + + /// + /// Controls the visibility of the element. + /// + [JsonPropertyName("isVisible")] + public bool? IsVisible { get; set; } = true; + + /// + /// 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. + /// + [JsonPropertyName("separator")] + public bool? Separator { get; set; } = false; + + /// + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; -/// -/// A layout that divides a container into named areas into which elements can be placed. -/// -public class AreaGridLayout : ContainerLayout -{ /// - /// Deserializes a JSON string into an object of type AreaGridLayout. + /// Controls how the element should be horizontally aligned. /// - public static AreaGridLayout? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// - /// Must be **Layout.AreaGrid**. + /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// - [JsonPropertyName("type")] - public string Type { get; } = "Layout.AreaGrid"; + [JsonPropertyName("spacing")] + public Spacing? Spacing { get; set; } = Spacing.Default; /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). /// [JsonPropertyName("targetWidth")] public TargetWidth? TargetWidth { get; set; } /// - /// The columns in the grid layout, defined as a percentage of the available width or in pixels using the `px` format. + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// - [JsonPropertyName("columns")] - public IUnion, IList>? Columns { get; set; } + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; /// - /// The areas in the grid layout. + /// The Id of the input the RichTextBlock should act as the label of. /// - [JsonPropertyName("areas")] - public IList? Areas { get; set; } + [JsonPropertyName("labelFor")] + public string? LabelFor { get; set; } /// - /// The space between columns. + /// The area of a Layout.AreaGrid layout in which an element should be displayed. /// - [JsonPropertyName("columnSpacing")] - public Spacing? ColumnSpacing { get; set; } + [JsonPropertyName("grid.area")] + public string? GridArea { get; set; } /// - /// The space between rows. + /// 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. /// - [JsonPropertyName("rowSpacing")] - public Spacing? RowSpacing { get; set; } + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } /// - /// Serializes this AreaGridLayout into a JSON string. + /// The inlines making up the rich text block. + /// + [JsonPropertyName("inlines")] + public IUnion, IList>? Inlines { get; set; } + + /// + /// Serializes this RichTextBlock into a JSON string. /// public string Serialize() { @@ -3218,295 +5643,262 @@ public string Serialize() ); } - public AreaGridLayout WithTargetWidth(TargetWidth value) + public RichTextBlock WithKey(string value) { - this.TargetWidth = value; + this.Key = value; return this; } - public AreaGridLayout WithColumns(IUnion, IList> value) + public RichTextBlock WithId(string value) { - this.Columns = value; + this.Id = value; return this; } - public AreaGridLayout WithAreas(params IList value) + public RichTextBlock WithRequires(HostCapabilities value) { - this.Areas = value; + this.Requires = value; return this; } - public AreaGridLayout WithColumnSpacing(Spacing value) + public RichTextBlock WithLang(string value) { - this.ColumnSpacing = value; + this.Lang = value; return this; } - public AreaGridLayout WithRowSpacing(Spacing value) + public RichTextBlock WithIsVisible(bool value) { - this.RowSpacing = value; + this.IsVisible = value; return this; } -} -/// -/// Defines an area in a Layout.AreaGrid layout. -/// -public class GridArea : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type GridArea. - /// - public static GridArea? Deserialize(string json) + public RichTextBlock WithSeparator(bool value) { - return JsonSerializer.Deserialize(json); + this.Separator = value; + return this; } - /// - /// The name of the area. To place an element in this area, set its `grid.area` property to match the name of the area. - /// - [JsonPropertyName("name")] - public string? Name { get; set; } - - /// - /// The start column index of the area. Column indices start at 1. - /// - [JsonPropertyName("column")] - public float? Column { get; set; } - - /// - /// Defines how many columns the area should span. - /// - [JsonPropertyName("columnSpan")] - public float? ColumnSpan { get; set; } + public RichTextBlock WithHeight(ElementHeight value) + { + this.Height = value; + return this; + } - /// - /// The start row index of the area. Row indices start at 1. - /// - [JsonPropertyName("row")] - public float? Row { get; set; } + public RichTextBlock WithHorizontalAlignment(HorizontalAlignment value) + { + this.HorizontalAlignment = value; + return this; + } - /// - /// Defines how many rows the area should span. - /// - [JsonPropertyName("rowSpan")] - public float? RowSpan { get; set; } + public RichTextBlock WithSpacing(Spacing value) + { + this.Spacing = value; + return this; + } - /// - /// Serializes this GridArea into a JSON string. - /// - public string Serialize() + public RichTextBlock WithTargetWidth(TargetWidth value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.TargetWidth = value; + return this; } - public GridArea WithName(string value) + public RichTextBlock WithIsSortKey(bool value) { - this.Name = value; + this.IsSortKey = value; return this; } - public GridArea WithColumn(float value) + public RichTextBlock WithLabelFor(string value) { - this.Column = value; + this.LabelFor = value; return this; } - public GridArea WithColumnSpan(float value) + public RichTextBlock WithGridArea(string value) { - this.ColumnSpan = value; + this.GridArea = value; return this; } - public GridArea WithRow(float value) + public RichTextBlock WithFallback(IUnion value) { - this.Row = value; + this.Fallback = value; return this; } - public GridArea WithRowSpan(float value) + public RichTextBlock WithInlines(IUnion, IList> value) { - this.RowSpan = value; + this.Inlines = value; return this; } } /// -/// Defines a container's background image and the way it should be rendered. +/// Use tables to display data in a tabular way, with rows, columns and cells. /// -public class BackgroundImage : SerializableObject +public class Table : CardElement { /// - /// Deserializes a JSON string into an object of type BackgroundImage. + /// Deserializes a JSON string into an object of type Table. /// - public static BackgroundImage? Deserialize(string json) + public static Table? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The URL (or Base64-encoded Data URI) of the image. Acceptable formats are PNG, JPEG, GIF and SVG. + /// 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. /// - [JsonPropertyName("url")] - public string? Url { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Controls how the image should fill the area. + /// Must be **Table**. /// - [JsonPropertyName("fillMode")] - public FillMode? FillMode { get; set; } + [JsonPropertyName("type")] + public string Type { get; } = "Table"; /// - /// Controls how the image should be aligned if it must be cropped or if using repeat fill mode. + /// 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. /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + [JsonPropertyName("id")] + public string? Id { get; set; } /// - /// Controls how the image should be aligned if it must be cropped or if using repeat fill mode. + /// 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). /// - [JsonPropertyName("verticalAlignment")] - public VerticalAlignment? VerticalAlignment { get; set; } + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// - /// Serializes this BackgroundImage into a JSON string. + /// The locale associated with the element. /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } + [JsonPropertyName("lang")] + public string? Lang { get; set; } - public BackgroundImage WithUrl(string value) - { - this.Url = value; - return this; - } + /// + /// Controls the visibility of the element. + /// + [JsonPropertyName("isVisible")] + public bool? IsVisible { get; set; } = true; - public BackgroundImage WithFillMode(FillMode value) - { - this.FillMode = value; - return this; - } + /// + /// 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. + /// + [JsonPropertyName("separator")] + public bool? Separator { get; set; } = false; - public BackgroundImage WithHorizontalAlignment(HorizontalAlignment value) - { - this.HorizontalAlignment = value; - return this; - } + /// + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; - public BackgroundImage WithVerticalAlignment(VerticalAlignment value) - { - this.VerticalAlignment = value; - return this; - } -} + /// + /// Controls how the element should be horizontally aligned. + /// + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } + + /// + /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. + /// + [JsonPropertyName("spacing")] + public Spacing? Spacing { get; set; } = Spacing.Default; + + /// + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). + /// + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } + + /// + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; + + /// + /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. + /// + [JsonPropertyName("style")] + public ContainerStyle? Style { get; set; } + + /// + /// Controls if a border should be displayed around the container. + /// + [JsonPropertyName("showBorder")] + public bool? ShowBorder { get; set; } = false; -/// -/// Defines how a card can be refreshed by making a request to the target Bot. -/// -public class RefreshDefinition : SerializableObject -{ /// - /// Deserializes a JSON string into an object of type RefreshDefinition. + /// Controls if the container should have rounded corners. /// - public static RefreshDefinition? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } + [JsonPropertyName("roundedCorners")] + public bool? RoundedCorners { get; set; } = false; /// - /// The Action.Execute action to invoke to refresh the card. + /// The columns in the table. /// - [JsonPropertyName("action")] - public ExecuteAction? Action { get; set; } + [JsonPropertyName("columns")] + public IList? Columns { get; set; } /// - /// 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. + /// 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. /// - [JsonPropertyName("userIds")] - public IList? UserIds { get; set; } + [JsonPropertyName("minWidth")] + public string? MinWidth { get; set; } /// - /// Serializes this RefreshDefinition into a JSON string. + /// Controls whether the first row of the table should be treated as a header. /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } + [JsonPropertyName("firstRowAsHeaders")] + public bool? FirstRowAsHeaders { get; set; } = true; - public RefreshDefinition WithAction(ExecuteAction value) - { - this.Action = value; - return this; - } + /// + /// Controls if grid lines should be displayed. + /// + [JsonPropertyName("showGridLines")] + public bool? ShowGridLines { get; set; } = true; - public RefreshDefinition WithUserIds(params IList value) - { - this.UserIds = value; - return this; - } -} + /// + /// The style of the grid lines between cells. + /// + [JsonPropertyName("gridStyle")] + public ContainerStyle? GridStyle { get; set; } -/// -/// 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) -/// -public class Authentication : SerializableObject -{ /// - /// Deserializes a JSON string into an object of type Authentication. + /// Controls how the content of every cell in the table should be horizontally aligned by default. /// - public static Authentication? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } + [JsonPropertyName("horizontalCellContentAlignment")] + public HorizontalAlignment? HorizontalCellContentAlignment { get; set; } /// - /// The text that can be displayed to the end user when prompting them to authenticate. + /// Controls how the content of every cell in the table should be vertically aligned by default. /// - [JsonPropertyName("text")] - public string? Text { get; set; } + [JsonPropertyName("verticalCellContentAlignment")] + public VerticalAlignment? VerticalCellContentAlignment { get; set; } /// - /// The identifier for registered OAuth connection setting information. + /// The area of a Layout.AreaGrid layout in which an element should be displayed. /// - [JsonPropertyName("connectionName")] - public string? ConnectionName { get; set; } + [JsonPropertyName("grid.area")] + public string? GridArea { get; set; } /// - /// The buttons that should be displayed to the user when prompting for authentication. The array MUST contain one button of type “signin”. Other button types are not currently supported. + /// 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. /// - [JsonPropertyName("buttons")] - public IList? Buttons { get; set; } + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } /// - /// Provides information required to enable on-behalf-of single sign-on user authentication. + /// The rows of the table. /// - [JsonPropertyName("tokenExchangeResource")] - public TokenExchangeResource? TokenExchangeResource { get; set; } + [JsonPropertyName("rows")] + public IList? Rows { get; set; } /// - /// Serializes this Authentication into a JSON string. + /// Serializes this Table into a JSON string. /// public string Serialize() { @@ -3520,320 +5912,202 @@ public string Serialize() ); } - public Authentication WithText(string value) + public Table WithKey(string value) { - this.Text = value; + this.Key = value; return this; } - public Authentication WithConnectionName(string value) + public Table WithId(string value) { - this.ConnectionName = value; + this.Id = value; return this; } - public Authentication WithButtons(params IList value) + public Table WithRequires(HostCapabilities value) { - this.Buttons = value; + this.Requires = value; return this; } - public Authentication WithTokenExchangeResource(TokenExchangeResource value) + public Table WithLang(string value) { - this.TokenExchangeResource = value; + this.Lang = value; return this; } -} -/// -/// 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). -/// -public class AuthCardButton : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type AuthCardButton. - /// - public static AuthCardButton? Deserialize(string json) + public Table WithIsVisible(bool value) { - return JsonSerializer.Deserialize(json); + this.IsVisible = value; + return this; } - /// - /// Must be **signin**. - /// - [JsonPropertyName("type")] - public string? Type { get; set; } - - /// - /// The caption of the button. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } - - /// - /// A URL to an image to display alongside the button’s caption. - /// - [JsonPropertyName("image")] - public string? Image { get; set; } - - /// - /// The value associated with the button. The meaning of value depends on the button’s type. - /// - [JsonPropertyName("value")] - public string? Value { get; set; } - - /// - /// Serializes this AuthCardButton into a JSON string. - /// - public string Serialize() + public Table WithSeparator(bool value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.Separator = value; + return this; } - public AuthCardButton WithType(string value) + public Table WithHeight(ElementHeight value) { - this.Type = value; + this.Height = value; return this; } - public AuthCardButton WithTitle(string value) + public Table WithHorizontalAlignment(HorizontalAlignment value) { - this.Title = value; + this.HorizontalAlignment = value; return this; } - public AuthCardButton WithImage(string value) + public Table WithSpacing(Spacing value) { - this.Image = value; + this.Spacing = value; return this; } - public AuthCardButton WithValue(string value) + public Table WithTargetWidth(TargetWidth value) { - this.Value = value; + this.TargetWidth = value; return this; } -} -/// -/// 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) -/// -public class TokenExchangeResource : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type TokenExchangeResource. - /// - public static TokenExchangeResource? Deserialize(string json) + public Table WithIsSortKey(bool value) { - return JsonSerializer.Deserialize(json); + this.IsSortKey = value; + return this; } - /// - /// The unique identified of this token exchange instance. - /// - [JsonPropertyName("id")] - public string? Id { get; set; } - - /// - /// An application ID or resource identifier with which to exchange a token on behalf of. This property is identity provider- and application-specific. - /// - [JsonPropertyName("uri")] - public string? Uri { get; set; } - - /// - /// An identifier for the identity provider with which to attempt a token exchange. - /// - [JsonPropertyName("providerId")] - public string? ProviderId { get; set; } - - /// - /// Serializes this TokenExchangeResource into a JSON string. - /// - public string Serialize() + public Table WithStyle(ContainerStyle value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.Style = value; + return this; } - public TokenExchangeResource WithId(string value) + public Table WithShowBorder(bool value) { - this.Id = value; + this.ShowBorder = value; return this; } - public TokenExchangeResource WithUri(string value) + public Table WithRoundedCorners(bool value) { - this.Uri = value; + this.RoundedCorners = value; return this; } - public TokenExchangeResource WithProviderId(string value) + public Table WithColumns(params ColumnDefinition[] value) { - this.ProviderId = value; + this.Columns = new List(value); return this; } -} -/// -/// Represents a set of Teams-specific properties on a card. -/// -public class TeamsCardProperties : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type TeamsCardProperties. - /// - public static TeamsCardProperties? Deserialize(string json) + public Table WithColumns(IList value) { - return JsonSerializer.Deserialize(json); - } - - /// - /// Controls the width of the card in a Teams chat. - /// - /// Note that setting `width` to "full" will not actually stretch the card to the "full width" of the chat pane. It will only make the card wider than when the `width` property isn't set. - /// - [JsonPropertyName("width")] - public TeamsCardWidth? Width { get; set; } - - /// - /// The Teams-specific entities associated with the card. - /// - [JsonPropertyName("entities")] - public IList? Entities { get; set; } + this.Columns = value; + return this; + } - /// - /// Serializes this TeamsCardProperties into a JSON string. - /// - public string Serialize() + public Table WithMinWidth(string value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.MinWidth = value; + return this; } - public TeamsCardProperties WithWidth(TeamsCardWidth value) + public Table WithFirstRowAsHeaders(bool value) { - this.Width = value; + this.FirstRowAsHeaders = value; return this; } - public TeamsCardProperties WithEntities(params IList value) + public Table WithShowGridLines(bool value) { - this.Entities = value; + this.ShowGridLines = value; return this; } -} -/// -/// Represents a mention to a person. -/// -public class Mention : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type Mention. - /// - public static Mention? Deserialize(string json) + public Table WithGridStyle(ContainerStyle value) { - return JsonSerializer.Deserialize(json); + this.GridStyle = value; + return this; } - /// - /// Must be **mention**. - /// - [JsonPropertyName("type")] - public string Type { get; } = "mention"; + public Table WithHorizontalCellContentAlignment(HorizontalAlignment value) + { + this.HorizontalCellContentAlignment = value; + return this; + } - /// - /// The text that will be substituted with the mention. - /// - [JsonPropertyName("text")] - public string? Text { get; set; } + public Table WithVerticalCellContentAlignment(VerticalAlignment value) + { + this.VerticalCellContentAlignment = value; + return this; + } - /// - /// Defines the entity being mentioned. - /// - [JsonPropertyName("mentioned")] - public MentionedEntity? Mentioned { get; set; } + public Table WithGridArea(string value) + { + this.GridArea = value; + return this; + } - /// - /// Serializes this Mention into a JSON string. - /// - public string Serialize() + public Table WithFallback(IUnion value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.Fallback = value; + return this; } - public Mention WithText(string value) + public Table WithRows(params TableRow[] value) { - this.Text = value; + this.Rows = new List(value); return this; } - public Mention WithMentioned(MentionedEntity value) + public Table WithRows(IList value) { - this.Mentioned = value; + this.Rows = value; return this; } } /// -/// Represents a mentioned person or tag. +/// Defines a column in a Table element. /// -public class MentionedEntity : SerializableObject +public class ColumnDefinition : SerializableObject { /// - /// Deserializes a JSON string into an object of type MentionedEntity. + /// Deserializes a JSON string into an object of type ColumnDefinition. /// - public static MentionedEntity? Deserialize(string json) + public static ColumnDefinition? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The Id of a person (typically a Microsoft Entra user Id) or tag. + /// 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. /// - [JsonPropertyName("id")] - public string? Id { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The name of the mentioned entity. + /// 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. /// - [JsonPropertyName("name")] - public string? Name { get; set; } + [JsonPropertyName("horizontalCellContentAlignment")] + public HorizontalAlignment? HorizontalCellContentAlignment { get; set; } /// - /// The type of the mentioned entity. + /// 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. /// - [JsonPropertyName("mentionType")] - public MentionType? MentionType { get; set; } + [JsonPropertyName("verticalCellContentAlignment")] + public VerticalAlignment? VerticalCellContentAlignment { get; set; } /// - /// Serializes this MentionedEntity into a JSON string. + /// 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. + /// + [JsonPropertyName("width")] + public IUnion? Width { get; set; } + + /// + /// Serializes this ColumnDefinition into a JSON string. /// public string Serialize() { @@ -3847,84 +6121,55 @@ public string Serialize() ); } - public MentionedEntity WithId(string value) + public ColumnDefinition WithKey(string value) { - this.Id = value; + this.Key = value; return this; } - public MentionedEntity WithName(string value) + public ColumnDefinition WithHorizontalCellContentAlignment(HorizontalAlignment value) { - this.Name = value; + this.HorizontalCellContentAlignment = value; return this; } - public MentionedEntity WithMentionType(MentionType value) + public ColumnDefinition WithVerticalCellContentAlignment(VerticalAlignment value) { - this.MentionType = value; + this.VerticalCellContentAlignment = value; return this; } -} - -/// -/// Card-level metadata. -/// -public class CardMetadata : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type CardMetadata. - /// - public static CardMetadata? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } - - /// - /// 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. - /// - [JsonPropertyName("webUrl")] - public string? WebUrl { get; set; } - - /// - /// Serializes this CardMetadata into a JSON string. - /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } - public CardMetadata WithWebUrl(string value) + public ColumnDefinition WithWidth(IUnion value) { - this.WebUrl = value; + this.Width = value; return this; } } /// -/// 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. +/// A block of text, optionally formatted using Markdown. /// -public class Container : CardElement +public class TextBlock : CardElement { /// - /// Deserializes a JSON string into an object of type Container. + /// Deserializes a JSON string into an object of type TextBlock. /// - public static Container? Deserialize(string json) + public static TextBlock? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Container**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **TextBlock**. /// [JsonPropertyName("type")] - public string Type { get; } = "Container"; + public string Type { get; } = "TextBlock"; /// /// 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. @@ -3936,7 +6181,7 @@ public class Container : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -3948,19 +6193,19 @@ public class Container : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -3972,7 +6217,7 @@ public class Container : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -3984,73 +6229,67 @@ public class Container : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. - /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } - - /// - /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. + /// The text to display. A subset of markdown is supported. /// - [JsonPropertyName("style")] - public ContainerStyle? Style { get; set; } + [JsonPropertyName("text")] + public string? Text { get; set; } /// - /// Controls if a border should be displayed around the container. + /// The size of the text. /// - [JsonPropertyName("showBorder")] - public bool? ShowBorder { get; set; } + [JsonPropertyName("size")] + public TextSize? Size { get; set; } /// - /// Controls if the container should have rounded corners. + /// The weight of the text. /// - [JsonPropertyName("roundedCorners")] - public bool? RoundedCorners { get; set; } + [JsonPropertyName("weight")] + public TextWeight? Weight { get; set; } /// - /// The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See [Container layouts](https://adaptivecards.microsoft.com/?topic=container-layouts) for more details. + /// The color of the text. /// - [JsonPropertyName("layouts")] - public IList? Layouts { get; set; } + [JsonPropertyName("color")] + public TextColor? Color { get; set; } /// - /// Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. + /// Controls whether the text should be renderer using a subtler variant of the select color. /// - [JsonPropertyName("bleed")] - public bool? Bleed { get; set; } + [JsonPropertyName("isSubtle")] + public bool? IsSubtle { get; set; } /// - /// The minimum height, in pixels, of the container, in the `px` format. + /// The type of font to use for rendering. /// - [JsonPropertyName("minHeight")] - public string? MinHeight { get; set; } + [JsonPropertyName("fontType")] + public FontType? FontType { get; set; } /// - /// Defines the container's background image. + /// Controls if the text should wrap. /// - [JsonPropertyName("backgroundImage")] - public IUnion? BackgroundImage { get; set; } + [JsonPropertyName("wrap")] + public bool? Wrap { get; set; } = false; /// - /// Controls how the container's content should be vertically aligned. + /// The maximum number of lines to display. /// - [JsonPropertyName("verticalContentAlignment")] - public VerticalAlignment? VerticalContentAlignment { get; set; } + [JsonPropertyName("maxLines")] + public float? MaxLines { get; set; } /// - /// Controls if the content of the card is to be rendered left-to-right or right-to-left. + /// The style of the text. /// - [JsonPropertyName("rtl")] - public bool? Rtl { get; set; } + [JsonPropertyName("style")] + public TextBlockStyle? Style { get; set; } /// - /// 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. + /// The Id of the input the TextBlock should act as the label of. /// - [JsonPropertyName("maxHeight")] - public string? MaxHeight { get; set; } + [JsonPropertyName("labelFor")] + public string? LabelFor { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -4064,19 +6303,15 @@ public class Container : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - /// - /// The elements in the container. - /// - [JsonPropertyName("items")] - public IList? Items { get; set; } + public TextBlock() { } - public Container(params IList items) + public TextBlock(string text) { - this.Items = items; + this.Text = text; } /// - /// Serializes this Container into a JSON string. + /// Serializes this TextBlock into a JSON string. /// public string Serialize() { @@ -4090,169 +6325,169 @@ public string Serialize() ); } - public Container WithId(string value) + public TextBlock WithKey(string value) + { + this.Key = value; + return this; + } + + public TextBlock WithId(string value) { this.Id = value; return this; } - public Container WithRequires(HostCapabilities value) + public TextBlock WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public Container WithLang(string value) + public TextBlock WithLang(string value) { this.Lang = value; return this; } - public Container WithIsVisible(bool value) + public TextBlock WithIsVisible(bool value) { this.IsVisible = value; return this; } - public Container WithSeparator(bool value) + public TextBlock WithSeparator(bool value) { this.Separator = value; return this; } - public Container WithHeight(ElementHeight value) + public TextBlock WithHeight(ElementHeight value) { this.Height = value; return this; } - public Container WithHorizontalAlignment(HorizontalAlignment value) + public TextBlock WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public Container WithSpacing(Spacing value) + public TextBlock WithSpacing(Spacing value) { this.Spacing = value; return this; } - public Container WithTargetWidth(TargetWidth value) + public TextBlock WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public Container WithIsSortKey(bool value) + public TextBlock WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public Container WithSelectAction(Action value) - { - this.SelectAction = value; - return this; - } - - public Container WithStyle(ContainerStyle value) + public TextBlock WithText(string value) { - this.Style = value; + this.Text = value; return this; } - public Container WithShowBorder(bool value) + public TextBlock WithSize(TextSize value) { - this.ShowBorder = value; + this.Size = value; return this; } - public Container WithRoundedCorners(bool value) + public TextBlock WithWeight(TextWeight value) { - this.RoundedCorners = value; + this.Weight = value; return this; } - public Container WithLayouts(params IList value) + public TextBlock WithColor(TextColor value) { - this.Layouts = value; + this.Color = value; return this; } - public Container WithBleed(bool value) + public TextBlock WithIsSubtle(bool value) { - this.Bleed = value; + this.IsSubtle = value; return this; } - public Container WithMinHeight(string value) + public TextBlock WithFontType(FontType value) { - this.MinHeight = value; + this.FontType = value; return this; } - public Container WithBackgroundImage(IUnion value) + public TextBlock WithWrap(bool value) { - this.BackgroundImage = value; + this.Wrap = value; return this; } - public Container WithVerticalContentAlignment(VerticalAlignment value) + public TextBlock WithMaxLines(float value) { - this.VerticalContentAlignment = value; + this.MaxLines = value; return this; } - public Container WithRtl(bool value) + public TextBlock WithStyle(TextBlockStyle value) { - this.Rtl = value; + this.Style = value; return this; } - public Container WithMaxHeight(string value) + public TextBlock WithLabelFor(string value) { - this.MaxHeight = value; + this.LabelFor = value; return this; } - public Container WithGridArea(string value) + public TextBlock WithGridArea(string value) { this.GridArea = value; return this; } - public Container WithFallback(IUnion value) + public TextBlock WithFallback(IUnion value) { this.Fallback = value; return this; } - - public Container WithItems(params IList value) - { - this.Items = value; - return this; - } } /// -/// Displays a set of action, which can be placed anywhere in the card. +/// A set of facts, displayed as a table or a vertical list when horizontal space is constrained. /// -public class ActionSet : CardElement +public class FactSet : CardElement { /// - /// Deserializes a JSON string into an object of type ActionSet. + /// Deserializes a JSON string into an object of type FactSet. /// - public static ActionSet? Deserialize(string json) + public static FactSet? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **ActionSet**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **FactSet**. /// [JsonPropertyName("type")] - public string Type { get; } = "ActionSet"; + public string Type { get; } = "FactSet"; /// /// 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. @@ -4264,7 +6499,7 @@ public class ActionSet : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -4276,31 +6511,25 @@ public class ActionSet : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// Controls how the element should be horizontally aligned. - /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -4312,7 +6541,13 @@ public class ActionSet : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; + + /// + /// The facts in the set. + /// + [JsonPropertyName("facts")] + public IList? Facts { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -4326,19 +6561,20 @@ public class ActionSet : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - /// - /// The actions in the set. - /// - [JsonPropertyName("actions")] - public IList? Actions { get; set; } + public FactSet() { } - public ActionSet(params IList actions) + public FactSet(params Fact[] facts) { - this.Actions = actions; + this.Facts = new List(facts); + } + + public FactSet(IList facts) + { + this.Facts = facts; } /// - /// Serializes this ActionSet into a JSON string. + /// Serializes this FactSet into a JSON string. /// public string Serialize() { @@ -4352,103 +6588,188 @@ public string Serialize() ); } - public ActionSet WithId(string value) + public FactSet WithKey(string value) + { + this.Key = value; + return this; + } + + public FactSet WithId(string value) { this.Id = value; return this; } - public ActionSet WithRequires(HostCapabilities value) + public FactSet WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ActionSet WithLang(string value) + public FactSet WithLang(string value) { this.Lang = value; return this; } - public ActionSet WithIsVisible(bool value) + public FactSet WithIsVisible(bool value) { this.IsVisible = value; return this; } - public ActionSet WithSeparator(bool value) + public FactSet WithSeparator(bool value) { this.Separator = value; return this; } - public ActionSet WithHeight(ElementHeight value) + public FactSet WithHeight(ElementHeight value) { this.Height = value; return this; } - public ActionSet WithHorizontalAlignment(HorizontalAlignment value) + public FactSet WithSpacing(Spacing value) { - this.HorizontalAlignment = value; + this.Spacing = value; return this; } - public ActionSet WithSpacing(Spacing value) + public FactSet WithTargetWidth(TargetWidth value) { - this.Spacing = value; + this.TargetWidth = value; return this; } - public ActionSet WithTargetWidth(TargetWidth value) + public FactSet WithIsSortKey(bool value) { - this.TargetWidth = value; + this.IsSortKey = value; return this; } - public ActionSet WithIsSortKey(bool value) + public FactSet WithFacts(params Fact[] value) { - this.IsSortKey = value; + this.Facts = new List(value); return this; } - public ActionSet WithGridArea(string value) + public FactSet WithFacts(IList value) + { + this.Facts = value; + return this; + } + + public FactSet WithGridArea(string value) { this.GridArea = value; return this; } - public ActionSet WithFallback(IUnion value) + public FactSet WithFallback(IUnion value) { this.Fallback = value; return this; } +} + +/// +/// A fact in a FactSet element. +/// +public class Fact : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type Fact. + /// + public static Fact? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The fact's title. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// The fact's value. + /// + [JsonPropertyName("value")] + public string? Value { get; set; } + + public Fact() { } - public ActionSet WithActions(params IList value) + public Fact(string title, string value) { - this.Actions = value; + this.Title = title; + this.Value = value; + } + + /// + /// Serializes this Fact into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public Fact WithKey(string value) + { + this.Key = value; + return this; + } + + public Fact WithTitle(string value) + { + this.Title = value; + return this; + } + + public Fact WithValue(string value) + { + this.Value = value; return this; } } /// -/// Splits the available horizontal space into separate columns, so elements can be organized in a row. +/// A set of images, displayed side-by-side and wrapped across multiple rows as needed. /// -public class ColumnSet : CardElement +public class ImageSet : CardElement { /// - /// Deserializes a JSON string into an object of type ColumnSet. + /// Deserializes a JSON string into an object of type ImageSet. /// - public static ColumnSet? Deserialize(string json) + public static ImageSet? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **ColumnSet**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **ImageSet**. /// [JsonPropertyName("type")] - public string Type { get; } = "ColumnSet"; + public string Type { get; } = "ImageSet"; /// /// 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. @@ -4460,7 +6781,7 @@ public class ColumnSet : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -4472,19 +6793,19 @@ public class ColumnSet : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -4496,7 +6817,7 @@ public class ColumnSet : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -4507,44 +6828,20 @@ public class ColumnSet : CardElement /// /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. - /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } - - /// - /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. - /// - [JsonPropertyName("style")] - public ContainerStyle? Style { get; set; } - - /// - /// Controls if a border should be displayed around the container. - /// - [JsonPropertyName("showBorder")] - public bool? ShowBorder { get; set; } - - /// - /// Controls if the container should have rounded corners. - /// - [JsonPropertyName("roundedCorners")] - public bool? RoundedCorners { get; set; } + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; /// - /// Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. + /// The images in the set. /// - [JsonPropertyName("bleed")] - public bool? Bleed { get; set; } + [JsonPropertyName("images")] + public IList? Images { get; set; } /// - /// The minimum height, in pixels, of the container, in the `px` format. + /// The size to use to render all images in the set. /// - [JsonPropertyName("minHeight")] - public string? MinHeight { get; set; } + [JsonPropertyName("imageSize")] + public ImageSize? ImageSize { get; set; } = ImageSize.Medium; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -4558,14 +6855,20 @@ public class ColumnSet : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - /// - /// The columns in the set. - /// - [JsonPropertyName("columns")] - public IList? Columns { get; set; } + public ImageSet() { } + + public ImageSet(params Image[] images) + { + this.Images = new List(images); + } + + public ImageSet(IList images) + { + this.Images = images; + } /// - /// Serializes this ColumnSet into a JSON string. + /// Serializes this ImageSet into a JSON string. /// public string Serialize() { @@ -4579,139 +6882,127 @@ public string Serialize() ); } - public ColumnSet WithId(string value) + public ImageSet WithKey(string value) + { + this.Key = value; + return this; + } + + public ImageSet WithId(string value) { this.Id = value; return this; } - public ColumnSet WithRequires(HostCapabilities value) + public ImageSet WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ColumnSet WithLang(string value) + public ImageSet WithLang(string value) { this.Lang = value; return this; } - public ColumnSet WithIsVisible(bool value) + public ImageSet WithIsVisible(bool value) { this.IsVisible = value; return this; } - public ColumnSet WithSeparator(bool value) + public ImageSet WithSeparator(bool value) { this.Separator = value; return this; } - public ColumnSet WithHeight(ElementHeight value) + public ImageSet WithHeight(ElementHeight value) { this.Height = value; return this; } - public ColumnSet WithHorizontalAlignment(HorizontalAlignment value) + public ImageSet WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public ColumnSet WithSpacing(Spacing value) + public ImageSet WithSpacing(Spacing value) { this.Spacing = value; return this; } - public ColumnSet WithTargetWidth(TargetWidth value) + public ImageSet WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public ColumnSet WithIsSortKey(bool value) + public ImageSet WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public ColumnSet WithSelectAction(Action value) - { - this.SelectAction = value; - return this; - } - - public ColumnSet WithStyle(ContainerStyle value) - { - this.Style = value; - return this; - } - - public ColumnSet WithShowBorder(bool value) - { - this.ShowBorder = value; - return this; - } - - public ColumnSet WithRoundedCorners(bool value) + public ImageSet WithImages(params Image[] value) { - this.RoundedCorners = value; + this.Images = new List(value); return this; } - public ColumnSet WithBleed(bool value) + public ImageSet WithImages(IList value) { - this.Bleed = value; + this.Images = value; return this; } - public ColumnSet WithMinHeight(string value) + public ImageSet WithImageSize(ImageSize value) { - this.MinHeight = value; + this.ImageSize = value; return this; } - public ColumnSet WithGridArea(string value) + public ImageSet WithGridArea(string value) { this.GridArea = value; return this; } - public ColumnSet WithFallback(IUnion value) + public ImageSet WithFallback(IUnion value) { this.Fallback = value; return this; } - - public ColumnSet WithColumns(params IList value) - { - this.Columns = value; - return this; - } } /// -/// A media element, that makes it possible to embed videos inside a card. +/// A standalone image element. /// -public class Media : CardElement +public class Image : CardElement { /// - /// Deserializes a JSON string into an object of type Media. + /// Deserializes a JSON string into an object of type Image. /// - public static Media? Deserialize(string json) + public static Image? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Media**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Image**. /// [JsonPropertyName("type")] - public string Type { get; } = "Media"; + public string Type { get; } = "Image"; /// /// 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. @@ -4723,7 +7014,7 @@ public class Media : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -4735,25 +7026,25 @@ public class Media : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// - /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// Controls how the element should be horizontally aligned. /// - [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -4765,31 +7056,91 @@ public class Media : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The sources for the media. For YouTube, Dailymotion and Vimeo, only one source can be specified. + /// The URL (or Base64-encoded Data URI) of the image. Acceptable formats are PNG, JPEG, GIF and SVG. /// - [JsonPropertyName("sources")] - public IList? Sources { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } /// - /// The caption sources for the media. Caption sources are not used for YouTube, Dailymotion or Vimeo sources. + /// The alternate text for the image, used for accessibility purposes. /// - [JsonPropertyName("captionSources")] - public IList? CaptionSources { get; set; } + [JsonPropertyName("altText")] + public string? AltText { get; set; } /// - /// The URL of the poster image to display. + /// The background color of the image. /// - [JsonPropertyName("poster")] - public string? Poster { get; set; } + [JsonPropertyName("backgroundColor")] + public string? BackgroundColor { get; set; } /// - /// The alternate text for the media, used for accessibility purposes. + /// The style of the image. /// - [JsonPropertyName("altText")] - public string? AltText { get; set; } + [JsonPropertyName("style")] + public ImageStyle? Style { get; set; } = ImageStyle.Default; + + /// + /// The size of the image. + /// + [JsonPropertyName("size")] + public Size? Size { get; set; } = Size.Auto; + + /// + /// The width of the image. + /// + [JsonPropertyName("width")] + public string? Width { get; set; } = "auto"; + + /// + /// An Action that will be invoked when the image is tapped or clicked. Action.ShowCard is not supported. + /// + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } + + /// + /// Controls if the image can be expanded to full screen. + /// + [JsonPropertyName("allowExpand")] + public bool? AllowExpand { get; set; } = false; + + /// + /// Teams-specific metadata associated with the image. + /// + [JsonPropertyName("msteams")] + public TeamsImageProperties? Msteams { get; set; } + + /// + /// A set of theme-specific image URLs. + /// + [JsonPropertyName("themedUrls")] + public IList? ThemedUrls { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fitMode")] + public ImageFitMode? FitMode { get; set; } = ImageFitMode.Fill; + + /// + /// 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. + /// + [JsonPropertyName("horizontalContentAlignment")] + public HorizontalAlignment? HorizontalContentAlignment { get; set; } = HorizontalAlignment.Left; + + /// + /// 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. + /// + [JsonPropertyName("verticalContentAlignment")] + public VerticalAlignment? VerticalContentAlignment { get; set; } = VerticalAlignment.Top; + + /// + /// The height of the image. + /// + [JsonPropertyName("height")] + public string? Height { get; set; } = "auto"; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -4803,8 +7154,15 @@ public class Media : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } + public Image() { } + + public Image(string url) + { + this.Url = url; + } + /// - /// Serializes this Media into a JSON string. + /// Serializes this Image into a JSON string. /// public string Serialize() { @@ -4818,183 +7176,196 @@ public string Serialize() ); } - public Media WithId(string value) + public Image WithKey(string value) + { + this.Key = value; + return this; + } + + public Image WithId(string value) { this.Id = value; return this; } - public Media WithRequires(HostCapabilities value) + public Image WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public Media WithLang(string value) + public Image WithLang(string value) { this.Lang = value; return this; } - public Media WithIsVisible(bool value) + public Image WithIsVisible(bool value) { this.IsVisible = value; return this; } - public Media WithSeparator(bool value) + public Image WithSeparator(bool value) { this.Separator = value; return this; } - public Media WithHeight(ElementHeight value) + public Image WithHorizontalAlignment(HorizontalAlignment value) { - this.Height = value; + this.HorizontalAlignment = value; return this; } - public Media WithSpacing(Spacing value) + public Image WithSpacing(Spacing value) { this.Spacing = value; return this; } - public Media WithTargetWidth(TargetWidth value) + public Image WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public Media WithIsSortKey(bool value) + public Image WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public Media WithSources(params IList value) + public Image WithUrl(string value) { - this.Sources = value; + this.Url = value; + return this; + } + + public Image WithAltText(string value) + { + this.AltText = value; + return this; + } + + public Image WithBackgroundColor(string value) + { + this.BackgroundColor = value; + return this; + } + + public Image WithStyle(ImageStyle value) + { + this.Style = value; + return this; + } + + public Image WithSize(Size value) + { + this.Size = value; + return this; + } + + public Image WithWidth(string value) + { + this.Width = value; + return this; + } + + public Image WithSelectAction(Action value) + { + this.SelectAction = value; + return this; + } + + public Image WithAllowExpand(bool value) + { + this.AllowExpand = value; return this; } - public Media WithCaptionSources(params IList value) + public Image WithMsteams(TeamsImageProperties value) { - this.CaptionSources = value; + this.Msteams = value; return this; } - public Media WithPoster(string value) + public Image WithThemedUrls(params ThemedUrl[] value) { - this.Poster = value; + this.ThemedUrls = new List(value); return this; } - public Media WithAltText(string value) + public Image WithThemedUrls(IList value) { - this.AltText = value; + this.ThemedUrls = value; return this; } - public Media WithGridArea(string value) + public Image WithFitMode(ImageFitMode value) { - this.GridArea = value; + this.FitMode = value; return this; } - public Media WithFallback(IUnion value) + public Image WithHorizontalContentAlignment(HorizontalAlignment value) { - this.Fallback = value; + this.HorizontalContentAlignment = value; return this; } -} -/// -/// Defines the source URL of a media stream. YouTube, Dailymotion, Vimeo and Microsoft Stream URLs are supported. -/// -public class MediaSource : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type MediaSource. - /// - public static MediaSource? Deserialize(string json) + public Image WithVerticalContentAlignment(VerticalAlignment value) { - return JsonSerializer.Deserialize(json); + this.VerticalContentAlignment = value; + return this; } - /// - /// The MIME type of the source. - /// - [JsonPropertyName("mimeType")] - public string? MimeType { get; set; } - - /// - /// The URL of the source. - /// - [JsonPropertyName("url")] - public string? Url { get; set; } - - /// - /// Serializes this MediaSource into a JSON string. - /// - public string Serialize() + public Image WithHeight(string value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.Height = value; + return this; } - public MediaSource WithMimeType(string value) + public Image WithGridArea(string value) { - this.MimeType = value; + this.GridArea = value; return this; } - public MediaSource WithUrl(string value) + public Image WithFallback(IUnion value) { - this.Url = value; + this.Fallback = value; return this; } } /// -/// Defines a source URL for a video captions. +/// Represents a set of Teams-specific properties on an image. /// -public class CaptionSource : SerializableObject +public class TeamsImageProperties : SerializableObject { /// - /// Deserializes a JSON string into an object of type CaptionSource. + /// Deserializes a JSON string into an object of type TeamsImageProperties. /// - public static CaptionSource? Deserialize(string json) + public static TeamsImageProperties? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The MIME type of the source. - /// - [JsonPropertyName("mimeType")] - public string? MimeType { get; set; } - - /// - /// The URL of the source. + /// 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. /// - [JsonPropertyName("url")] - public string? Url { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The label of this caption source. + /// Controls if the image is expandable in Teams. This property is equivalent to the Image.allowExpand property. /// - [JsonPropertyName("label")] - public string? Label { get; set; } + [JsonPropertyName("allowExpand")] + public bool? AllowExpand { get; set; } /// - /// Serializes this CaptionSource into a JSON string. + /// Serializes this TeamsImageProperties into a JSON string. /// public string Serialize() { @@ -5008,43 +7379,43 @@ public string Serialize() ); } - public CaptionSource WithMimeType(string value) - { - this.MimeType = value; - return this; - } - - public CaptionSource WithUrl(string value) + public TeamsImageProperties WithKey(string value) { - this.Url = value; + this.Key = value; return this; } - public CaptionSource WithLabel(string value) + public TeamsImageProperties WithAllowExpand(bool value) { - this.Label = value; + this.AllowExpand = value; return this; } } /// -/// A rich text block that displays formatted text. +/// An input to allow the user to enter text. /// -public class RichTextBlock : CardElement +public class TextInput : CardElement { /// - /// Deserializes a JSON string into an object of type RichTextBlock. + /// Deserializes a JSON string into an object of type TextInput. /// - public static RichTextBlock? Deserialize(string json) + public static TextInput? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **RichTextBlock**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Input.Text**. /// [JsonPropertyName("type")] - public string Type { get; } = "RichTextBlock"; + public string Type { get; } = "Input.Text"; /// /// 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. @@ -5056,7 +7427,7 @@ public class RichTextBlock : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -5068,31 +7439,25 @@ public class RichTextBlock : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// Controls how the element should be horizontally aligned. - /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -5104,7 +7469,75 @@ public class RichTextBlock : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; + + /// + /// The label of the input. + /// + /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. + /// + [JsonPropertyName("label")] + public string? Label { get; set; } + + /// + /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// + [JsonPropertyName("isRequired")] + public bool? IsRequired { get; set; } = false; + + /// + /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// + [JsonPropertyName("errorMessage")] + public string? ErrorMessage { get; set; } + + /// + /// An Action.ResetInputs action that will be executed when the value of the input changes. + /// + [JsonPropertyName("valueChangedAction")] + public Action? ValueChangedAction { get; set; } + + /// + /// The default value of the input. + /// + [JsonPropertyName("value")] + public string? Value { get; set; } + + /// + /// The maximum length of the text in the input. + /// + [JsonPropertyName("maxLength")] + public float? MaxLength { get; set; } + + /// + /// Controls if the input should allow multiple lines of text. + /// + [JsonPropertyName("isMultiline")] + public bool? IsMultiline { get; set; } = false; + + /// + /// The text to display as a placeholder when the user hasn't entered a value. + /// + [JsonPropertyName("placeholder")] + public string? Placeholder { get; set; } + + /// + /// The style of the input. + /// + [JsonPropertyName("style")] + public InputTextStyle? Style { get; set; } = InputTextStyle.Text; + + /// + /// The action that should be displayed as a button alongside the input. Action.ShowCard is not supported. + /// + [JsonPropertyName("inlineAction")] + public Action? InlineAction { get; set; } + + /// + /// The regular expression to validate the input. + /// + [JsonPropertyName("regex")] + public string? Regex { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -5119,123 +7552,183 @@ public class RichTextBlock : CardElement public IUnion? Fallback { get; set; } /// - /// The inlines making up the rich text block. - /// - [JsonPropertyName("inlines")] - public IUnion, IList>? Inlines { get; set; } - - /// - /// Serializes this RichTextBlock into a JSON string. + /// Serializes this TextInput into a JSON string. /// public string Serialize() { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public TextInput WithKey(string value) + { + this.Key = value; + return this; + } + + public TextInput WithId(string value) + { + this.Id = value; + return this; + } + + public TextInput WithRequires(HostCapabilities value) + { + this.Requires = value; + return this; + } + + public TextInput WithLang(string value) + { + this.Lang = value; + return this; + } + + public TextInput WithIsVisible(bool value) + { + this.IsVisible = value; + return this; + } + + public TextInput WithSeparator(bool value) + { + this.Separator = value; + return this; + } + + public TextInput WithHeight(ElementHeight value) + { + this.Height = value; + return this; + } + + public TextInput WithSpacing(Spacing value) + { + this.Spacing = value; + return this; + } + + public TextInput WithTargetWidth(TargetWidth value) + { + this.TargetWidth = value; + return this; + } + + public TextInput WithIsSortKey(bool value) + { + this.IsSortKey = value; + return this; } - public RichTextBlock WithId(string value) + public TextInput WithLabel(string value) { - this.Id = value; + this.Label = value; return this; } - public RichTextBlock WithRequires(HostCapabilities value) + public TextInput WithIsRequired(bool value) { - this.Requires = value; + this.IsRequired = value; return this; } - public RichTextBlock WithLang(string value) + public TextInput WithErrorMessage(string value) { - this.Lang = value; + this.ErrorMessage = value; return this; } - public RichTextBlock WithIsVisible(bool value) + public TextInput WithValueChangedAction(Action value) { - this.IsVisible = value; + this.ValueChangedAction = value; return this; } - public RichTextBlock WithSeparator(bool value) + public TextInput WithValue(string value) { - this.Separator = value; + this.Value = value; return this; } - public RichTextBlock WithHeight(ElementHeight value) + public TextInput WithMaxLength(float value) { - this.Height = value; + this.MaxLength = value; return this; } - public RichTextBlock WithHorizontalAlignment(HorizontalAlignment value) + public TextInput WithIsMultiline(bool value) { - this.HorizontalAlignment = value; + this.IsMultiline = value; return this; } - public RichTextBlock WithSpacing(Spacing value) + public TextInput WithPlaceholder(string value) { - this.Spacing = value; + this.Placeholder = value; return this; } - public RichTextBlock WithTargetWidth(TargetWidth value) + public TextInput WithStyle(InputTextStyle value) { - this.TargetWidth = value; + this.Style = value; return this; } - public RichTextBlock WithIsSortKey(bool value) + public TextInput WithInlineAction(Action value) { - this.IsSortKey = value; + this.InlineAction = value; return this; } - public RichTextBlock WithGridArea(string value) + public TextInput WithRegex(string value) { - this.GridArea = value; + this.Regex = value; return this; } - public RichTextBlock WithFallback(IUnion value) + public TextInput WithGridArea(string value) { - this.Fallback = value; + this.GridArea = value; return this; } - public RichTextBlock WithInlines(IUnion, IList> value) + public TextInput WithFallback(IUnion value) { - this.Inlines = value; + this.Fallback = value; return this; } } /// -/// Use tables to display data in a tabular way, with rows, columns and cells. +/// An input to allow the user to select a date. /// -public class Table : CardElement +public class DateInput : CardElement { /// - /// Deserializes a JSON string into an object of type Table. + /// Deserializes a JSON string into an object of type DateInput. /// - public static Table? Deserialize(string json) + public static DateInput? Deserialize(string json) { - return JsonSerializer.Deserialize
(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Table**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Input.Date**. /// [JsonPropertyName("type")] - public string Type { get; } = "Table"; + public string Type { get; } = "Input.Date"; /// /// 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. @@ -5247,7 +7740,7 @@ public class Table : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -5259,31 +7752,25 @@ public class Table : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// Controls how the element should be horizontally aligned. - /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -5295,61 +7782,57 @@ public class Table : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. - /// - [JsonPropertyName("style")] - public ContainerStyle? Style { get; set; } - - /// - /// Controls if a border should be displayed around the container. + /// The label of the input. + /// + /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. /// - [JsonPropertyName("showBorder")] - public bool? ShowBorder { get; set; } + [JsonPropertyName("label")] + public string? Label { get; set; } /// - /// Controls if the container should have rounded corners. + /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. /// - [JsonPropertyName("roundedCorners")] - public bool? RoundedCorners { get; set; } + [JsonPropertyName("isRequired")] + public bool? IsRequired { get; set; } = false; /// - /// The columns in the table. + /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. /// - [JsonPropertyName("columns")] - public IList? Columns { get; set; } + [JsonPropertyName("errorMessage")] + public string? ErrorMessage { get; set; } /// - /// Controls whether the first row of the table should be treated as a header. + /// An Action.ResetInputs action that will be executed when the value of the input changes. /// - [JsonPropertyName("firstRowAsHeaders")] - public bool? FirstRowAsHeaders { get; set; } + [JsonPropertyName("valueChangedAction")] + public Action? ValueChangedAction { get; set; } /// - /// Controls if grid lines should be displayed. + /// The default value of the input, in the `YYYY-MM-DD` format. /// - [JsonPropertyName("showGridLines")] - public bool? ShowGridLines { get; set; } + [JsonPropertyName("value")] + public string? Value { get; set; } /// - /// The style of the grid lines between cells. + /// The text to display as a placeholder when the user has not selected a date. /// - [JsonPropertyName("gridStyle")] - public ContainerStyle? GridStyle { get; set; } + [JsonPropertyName("placeholder")] + public string? Placeholder { get; set; } /// - /// Controls how the content of every cell in the table should be horizontally aligned by default. + /// The minimum date that can be selected. /// - [JsonPropertyName("horizontalCellContentAlignment")] - public HorizontalAlignment? HorizontalCellContentAlignment { get; set; } + [JsonPropertyName("min")] + public string? Min { get; set; } /// - /// Controls how the content of every cell in the table should be vertically aligned by default. + /// The maximum date that can be selected. /// - [JsonPropertyName("verticalCellContentAlignment")] - public VerticalAlignment? VerticalCellContentAlignment { get; set; } + [JsonPropertyName("max")] + public string? Max { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -5364,13 +7847,7 @@ public class Table : CardElement public IUnion? Fallback { get; set; } /// - /// The rows of the table. - /// - [JsonPropertyName("rows")] - public IList? Rows { get; set; } - - /// - /// Serializes this Table into a JSON string. + /// Serializes this DateInput into a JSON string. /// public string Serialize() { @@ -5384,222 +7861,151 @@ public string Serialize() ); } - public Table WithId(string value) + public DateInput WithKey(string value) + { + this.Key = value; + return this; + } + + public DateInput WithId(string value) { this.Id = value; return this; } - public Table WithRequires(HostCapabilities value) + public DateInput WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public Table WithLang(string value) + public DateInput WithLang(string value) { this.Lang = value; return this; } - public Table WithIsVisible(bool value) + public DateInput WithIsVisible(bool value) { this.IsVisible = value; return this; } - public Table WithSeparator(bool value) + public DateInput WithSeparator(bool value) { this.Separator = value; return this; } - public Table WithHeight(ElementHeight value) + public DateInput WithHeight(ElementHeight value) { this.Height = value; return this; } - public Table WithHorizontalAlignment(HorizontalAlignment value) - { - this.HorizontalAlignment = value; - return this; - } - - public Table WithSpacing(Spacing value) + public DateInput WithSpacing(Spacing value) { this.Spacing = value; return this; } - public Table WithTargetWidth(TargetWidth value) + public DateInput WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public Table WithIsSortKey(bool value) + public DateInput WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public Table WithStyle(ContainerStyle value) - { - this.Style = value; - return this; - } - - public Table WithShowBorder(bool value) - { - this.ShowBorder = value; - return this; - } - - public Table WithRoundedCorners(bool value) - { - this.RoundedCorners = value; - return this; - } - - public Table WithColumns(params IList value) - { - this.Columns = value; - return this; - } - - public Table WithFirstRowAsHeaders(bool value) - { - this.FirstRowAsHeaders = value; - return this; - } - - public Table WithShowGridLines(bool value) - { - this.ShowGridLines = value; - return this; - } - - public Table WithGridStyle(ContainerStyle value) - { - this.GridStyle = value; - return this; - } - - public Table WithHorizontalCellContentAlignment(HorizontalAlignment value) - { - this.HorizontalCellContentAlignment = value; - return this; - } - - public Table WithVerticalCellContentAlignment(VerticalAlignment value) + public DateInput WithLabel(string value) { - this.VerticalCellContentAlignment = value; + this.Label = value; return this; } - public Table WithGridArea(string value) + public DateInput WithIsRequired(bool value) { - this.GridArea = value; + this.IsRequired = value; return this; } - public Table WithFallback(IUnion value) + public DateInput WithErrorMessage(string value) { - this.Fallback = value; + this.ErrorMessage = value; return this; } - public Table WithRows(params IList value) + public DateInput WithValueChangedAction(Action value) { - this.Rows = value; + this.ValueChangedAction = value; return this; - } -} - -/// -/// Defines a column in a Table element. -/// -public class ColumnDefinition : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type ColumnDefinition. - /// - public static ColumnDefinition? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } - - /// - /// 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. - /// - [JsonPropertyName("horizontalCellContentAlignment")] - public HorizontalAlignment? HorizontalCellContentAlignment { get; set; } + } - /// - /// 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. - /// - [JsonPropertyName("verticalCellContentAlignment")] - public VerticalAlignment? VerticalCellContentAlignment { get; set; } + public DateInput WithValue(string value) + { + this.Value = value; + return this; + } - /// - /// The width of the column in the table, expressed as either a percentage of the available width or in pixels, using the `px` format. - /// - [JsonPropertyName("width")] - public IUnion? Width { get; set; } + public DateInput WithPlaceholder(string value) + { + this.Placeholder = value; + return this; + } - /// - /// Serializes this ColumnDefinition into a JSON string. - /// - public string Serialize() + public DateInput WithMin(string value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.Min = value; + return this; } - public ColumnDefinition WithHorizontalCellContentAlignment(HorizontalAlignment value) + public DateInput WithMax(string value) { - this.HorizontalCellContentAlignment = value; + this.Max = value; return this; } - public ColumnDefinition WithVerticalCellContentAlignment(VerticalAlignment value) + public DateInput WithGridArea(string value) { - this.VerticalCellContentAlignment = value; + this.GridArea = value; return this; } - public ColumnDefinition WithWidth(IUnion value) + public DateInput WithFallback(IUnion value) { - this.Width = value; + this.Fallback = value; return this; } } /// -/// A block of text, optionally formatted using Markdown. +/// An input to allow the user to select a time. /// -public class TextBlock : CardElement +public class TimeInput : CardElement { /// - /// Deserializes a JSON string into an object of type TextBlock. + /// Deserializes a JSON string into an object of type TimeInput. /// - public static TextBlock? Deserialize(string json) + public static TimeInput? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **TextBlock**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Input.Time**. /// [JsonPropertyName("type")] - public string Type { get; } = "TextBlock"; + public string Type { get; } = "Input.Time"; /// /// 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. @@ -5611,7 +8017,7 @@ public class TextBlock : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -5623,31 +8029,25 @@ public class TextBlock : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// Controls how the element should be horizontally aligned. - /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -5659,61 +8059,57 @@ public class TextBlock : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The text to display. A subset of markdown is supported. - /// - [JsonPropertyName("text")] - public string? Text { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The size of the text. + /// The label of the input. + /// + /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. /// - [JsonPropertyName("size")] - public TextSize? Size { get; set; } + [JsonPropertyName("label")] + public string? Label { get; set; } /// - /// The weight of the text. + /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. /// - [JsonPropertyName("weight")] - public TextWeight? Weight { get; set; } + [JsonPropertyName("isRequired")] + public bool? IsRequired { get; set; } = false; /// - /// The color of the text. + /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. /// - [JsonPropertyName("color")] - public TextColor? Color { get; set; } + [JsonPropertyName("errorMessage")] + public string? ErrorMessage { get; set; } /// - /// Controls whether the text should be renderer using a subtler variant of the select color. + /// An Action.ResetInputs action that will be executed when the value of the input changes. /// - [JsonPropertyName("isSubtle")] - public bool? IsSubtle { get; set; } + [JsonPropertyName("valueChangedAction")] + public Action? ValueChangedAction { get; set; } /// - /// The type of font to use for rendering. + /// The default value of the input, in the `HH:MM` format. /// - [JsonPropertyName("fontType")] - public FontType? FontType { get; set; } + [JsonPropertyName("value")] + public string? Value { get; set; } /// - /// Controls if the text should wrap. + /// The text to display as a placeholder when the user hasn't entered a value. /// - [JsonPropertyName("wrap")] - public bool? Wrap { get; set; } + [JsonPropertyName("placeholder")] + public string? Placeholder { get; set; } /// - /// The maximum number of lines to display. + /// The minimum time that can be selected, in the `HH:MM` format. /// - [JsonPropertyName("maxLines")] - public float? MaxLines { get; set; } + [JsonPropertyName("min")] + public string? Min { get; set; } /// - /// The style of the text. + /// The maximum time that can be selected, in the `HH:MM` format. /// - [JsonPropertyName("style")] - public StyleEnum? Style { get; set; } + [JsonPropertyName("max")] + public string? Max { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -5727,13 +8123,8 @@ public class TextBlock : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - public TextBlock(string text) - { - this.Text = text; - } - /// - /// Serializes this TextBlock into a JSON string. + /// Serializes this TimeInput into a JSON string. /// public string Serialize() { @@ -5747,127 +8138,121 @@ public string Serialize() ); } - public TextBlock WithId(string value) + public TimeInput WithKey(string value) + { + this.Key = value; + return this; + } + + public TimeInput WithId(string value) { this.Id = value; return this; } - public TextBlock WithRequires(HostCapabilities value) + public TimeInput WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public TextBlock WithLang(string value) + public TimeInput WithLang(string value) { this.Lang = value; return this; } - public TextBlock WithIsVisible(bool value) + public TimeInput WithIsVisible(bool value) { this.IsVisible = value; return this; } - public TextBlock WithSeparator(bool value) + public TimeInput WithSeparator(bool value) { this.Separator = value; return this; } - public TextBlock WithHeight(ElementHeight value) + public TimeInput WithHeight(ElementHeight value) { this.Height = value; return this; } - public TextBlock WithHorizontalAlignment(HorizontalAlignment value) - { - this.HorizontalAlignment = value; - return this; - } - - public TextBlock WithSpacing(Spacing value) + public TimeInput WithSpacing(Spacing value) { this.Spacing = value; return this; } - public TextBlock WithTargetWidth(TargetWidth value) + public TimeInput WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public TextBlock WithIsSortKey(bool value) + public TimeInput WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public TextBlock WithText(string value) - { - this.Text = value; - return this; - } - - public TextBlock WithSize(TextSize value) + public TimeInput WithLabel(string value) { - this.Size = value; + this.Label = value; return this; } - public TextBlock WithWeight(TextWeight value) + public TimeInput WithIsRequired(bool value) { - this.Weight = value; + this.IsRequired = value; return this; } - public TextBlock WithColor(TextColor value) + public TimeInput WithErrorMessage(string value) { - this.Color = value; + this.ErrorMessage = value; return this; } - public TextBlock WithIsSubtle(bool value) + public TimeInput WithValueChangedAction(Action value) { - this.IsSubtle = value; + this.ValueChangedAction = value; return this; } - public TextBlock WithFontType(FontType value) + public TimeInput WithValue(string value) { - this.FontType = value; + this.Value = value; return this; } - public TextBlock WithWrap(bool value) + public TimeInput WithPlaceholder(string value) { - this.Wrap = value; + this.Placeholder = value; return this; } - public TextBlock WithMaxLines(float value) + public TimeInput WithMin(string value) { - this.MaxLines = value; + this.Min = value; return this; } - public TextBlock WithStyle(StyleEnum value) + public TimeInput WithMax(string value) { - this.Style = value; + this.Max = value; return this; } - public TextBlock WithGridArea(string value) + public TimeInput WithGridArea(string value) { this.GridArea = value; return this; } - public TextBlock WithFallback(IUnion value) + public TimeInput WithFallback(IUnion value) { this.Fallback = value; return this; @@ -5875,23 +8260,29 @@ public TextBlock WithFallback(IUnion value) } /// -/// A set of facts, displayed as a table or a vertical list when horizontal space is constrained. +/// An input to allow the user to enter a number. /// -public class FactSet : CardElement +public class NumberInput : CardElement { /// - /// Deserializes a JSON string into an object of type FactSet. + /// Deserializes a JSON string into an object of type NumberInput. /// - public static FactSet? Deserialize(string json) + public static NumberInput? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **FactSet**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Input.Number**. /// [JsonPropertyName("type")] - public string Type { get; } = "FactSet"; + public string Type { get; } = "Input.Number"; /// /// 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. @@ -5903,7 +8294,7 @@ public class FactSet : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -5915,43 +8306,87 @@ public class FactSet : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; + + /// + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). + /// + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } + + /// + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; + + /// + /// The label of the input. + /// + /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. + /// + [JsonPropertyName("label")] + public string? Label { get; set; } + + /// + /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// + [JsonPropertyName("isRequired")] + public bool? IsRequired { get; set; } = false; + + /// + /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// + [JsonPropertyName("errorMessage")] + public string? ErrorMessage { get; set; } + + /// + /// An Action.ResetInputs action that will be executed when the value of the input changes. + /// + [JsonPropertyName("valueChangedAction")] + public Action? ValueChangedAction { get; set; } + + /// + /// The default value of the input. + /// + [JsonPropertyName("value")] + public float? Value { get; set; } /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). + /// The text to display as a placeholder when the user hasn't entered a value. /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } + [JsonPropertyName("placeholder")] + public string? Placeholder { get; set; } /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// The minimum value that can be entered. /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + [JsonPropertyName("min")] + public float? Min { get; set; } /// - /// The facts in the set. + /// The maximum value that can be entered. /// - [JsonPropertyName("facts")] - public IList? Facts { get; set; } + [JsonPropertyName("max")] + public float? Max { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -5965,13 +8400,8 @@ public class FactSet : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - public FactSet(params IList facts) - { - this.Facts = facts; - } - /// - /// Serializes this FactSet into a JSON string. + /// Serializes this NumberInput into a JSON string. /// public string Serialize() { @@ -5985,156 +8415,151 @@ public string Serialize() ); } - public FactSet WithId(string value) + public NumberInput WithKey(string value) + { + this.Key = value; + return this; + } + + public NumberInput WithId(string value) { this.Id = value; return this; } - public FactSet WithRequires(HostCapabilities value) + public NumberInput WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public FactSet WithLang(string value) + public NumberInput WithLang(string value) { this.Lang = value; return this; } - public FactSet WithIsVisible(bool value) + public NumberInput WithIsVisible(bool value) { this.IsVisible = value; return this; } - public FactSet WithSeparator(bool value) + public NumberInput WithSeparator(bool value) { this.Separator = value; return this; } - public FactSet WithHeight(ElementHeight value) + public NumberInput WithHeight(ElementHeight value) { this.Height = value; return this; } - public FactSet WithSpacing(Spacing value) + public NumberInput WithSpacing(Spacing value) { this.Spacing = value; return this; } - public FactSet WithTargetWidth(TargetWidth value) + public NumberInput WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public FactSet WithIsSortKey(bool value) + public NumberInput WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public FactSet WithFacts(params IList value) + public NumberInput WithLabel(string value) { - this.Facts = value; + this.Label = value; return this; } - public FactSet WithGridArea(string value) + public NumberInput WithIsRequired(bool value) { - this.GridArea = value; + this.IsRequired = value; return this; } - public FactSet WithFallback(IUnion value) + public NumberInput WithErrorMessage(string value) { - this.Fallback = value; + this.ErrorMessage = value; return this; } -} -/// -/// A fact in a FactSet element. -/// -public class Fact : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type Fact. - /// - public static Fact? Deserialize(string json) + public NumberInput WithValueChangedAction(Action value) { - return JsonSerializer.Deserialize(json); + this.ValueChangedAction = value; + return this; } - /// - /// The fact's title. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } + public NumberInput WithValue(float value) + { + this.Value = value; + return this; + } - /// - /// The fact's value. - /// - [JsonPropertyName("value")] - public string? Value { get; set; } + public NumberInput WithPlaceholder(string value) + { + this.Placeholder = value; + return this; + } - public Fact(string title, string value) + public NumberInput WithMin(float value) { - this.Title = title; - this.Value = value; + this.Min = value; + return this; } - /// - /// Serializes this Fact into a JSON string. - /// - public string Serialize() + public NumberInput WithMax(float value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.Max = value; + return this; } - public Fact WithTitle(string value) + public NumberInput WithGridArea(string value) { - this.Title = value; + this.GridArea = value; return this; } - public Fact WithValue(string value) + public NumberInput WithFallback(IUnion value) { - this.Value = value; + this.Fallback = value; return this; } } /// -/// A set of images, displayed side-by-side and wrapped across multiple rows as needed. +/// An input to allow the user to select between on/off states. /// -public class ImageSet : CardElement +public class ToggleInput : CardElement { /// - /// Deserializes a JSON string into an object of type ImageSet. + /// Deserializes a JSON string into an object of type ToggleInput. /// - public static ImageSet? Deserialize(string json) + public static ToggleInput? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **ImageSet**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Input.Toggle**. /// [JsonPropertyName("type")] - public string Type { get; } = "ImageSet"; + public string Type { get; } = "Input.Toggle"; /// /// 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. @@ -6146,7 +8571,7 @@ public class ImageSet : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -6158,31 +8583,25 @@ public class ImageSet : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// Controls how the element should be horizontally aligned. - /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -6194,19 +8613,69 @@ public class ImageSet : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The images in the set. + /// The label of the input. + /// + /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. /// - [JsonPropertyName("images")] - public IList? Images { get; set; } + [JsonPropertyName("label")] + public string? Label { get; set; } /// - /// The size to use to render all images in the set. + /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. /// - [JsonPropertyName("imageSize")] - public ImageSize? ImageSize { get; set; } + [JsonPropertyName("isRequired")] + public bool? IsRequired { get; set; } = false; + + /// + /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// + [JsonPropertyName("errorMessage")] + public string? ErrorMessage { get; set; } + + /// + /// An Action.ResetInputs action that will be executed when the value of the input changes. + /// + [JsonPropertyName("valueChangedAction")] + public Action? ValueChangedAction { get; set; } + + /// + /// The default value of the input. + /// + [JsonPropertyName("value")] + public string? Value { get; set; } = "false"; + + /// + /// The title (caption) to display next to the toggle. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// The value to send to the Bot when the toggle is on. + /// + [JsonPropertyName("valueOn")] + public string? ValueOn { get; set; } = "true"; + + /// + /// The value to send to the Bot when the toggle is off. + /// + [JsonPropertyName("valueOff")] + public string? ValueOff { get; set; } = "false"; + + /// + /// Controls if the title should wrap. + /// + [JsonPropertyName("wrap")] + public bool? Wrap { get; set; } = 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. + /// + [JsonPropertyName("showTitle")] + public bool? ShowTitle { get; set; } = true; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -6220,13 +8689,15 @@ public class ImageSet : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - public ImageSet(params IList images) + public ToggleInput() { } + + public ToggleInput(string title) { - this.Images = images; + this.Title = title; } /// - /// Serializes this ImageSet into a JSON string. + /// Serializes this ToggleInput into a JSON string. /// public string Serialize() { @@ -6240,85 +8711,133 @@ public string Serialize() ); } - public ImageSet WithId(string value) + public ToggleInput WithKey(string value) + { + this.Key = value; + return this; + } + + public ToggleInput WithId(string value) { this.Id = value; return this; } - public ImageSet WithRequires(HostCapabilities value) + public ToggleInput WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ImageSet WithLang(string value) + public ToggleInput WithLang(string value) { this.Lang = value; return this; } - public ImageSet WithIsVisible(bool value) + public ToggleInput WithIsVisible(bool value) { this.IsVisible = value; return this; } - public ImageSet WithSeparator(bool value) + public ToggleInput WithSeparator(bool value) + { + this.Separator = value; + return this; + } + + public ToggleInput WithHeight(ElementHeight value) + { + this.Height = value; + return this; + } + + public ToggleInput WithSpacing(Spacing value) + { + this.Spacing = value; + return this; + } + + public ToggleInput WithTargetWidth(TargetWidth value) + { + this.TargetWidth = value; + return this; + } + + public ToggleInput WithIsSortKey(bool value) + { + this.IsSortKey = value; + return this; + } + + public ToggleInput WithLabel(string value) + { + this.Label = value; + return this; + } + + public ToggleInput WithIsRequired(bool value) + { + this.IsRequired = value; + return this; + } + + public ToggleInput WithErrorMessage(string value) { - this.Separator = value; + this.ErrorMessage = value; return this; } - public ImageSet WithHeight(ElementHeight value) + public ToggleInput WithValueChangedAction(Action value) { - this.Height = value; + this.ValueChangedAction = value; return this; } - public ImageSet WithHorizontalAlignment(HorizontalAlignment value) + public ToggleInput WithValue(string value) { - this.HorizontalAlignment = value; + this.Value = value; return this; } - public ImageSet WithSpacing(Spacing value) + public ToggleInput WithTitle(string value) { - this.Spacing = value; + this.Title = value; return this; } - public ImageSet WithTargetWidth(TargetWidth value) + public ToggleInput WithValueOn(string value) { - this.TargetWidth = value; + this.ValueOn = value; return this; } - public ImageSet WithIsSortKey(bool value) + public ToggleInput WithValueOff(string value) { - this.IsSortKey = value; + this.ValueOff = value; return this; } - public ImageSet WithImages(params IList value) + public ToggleInput WithWrap(bool value) { - this.Images = value; + this.Wrap = value; return this; } - public ImageSet WithImageSize(ImageSize value) + public ToggleInput WithShowTitle(bool value) { - this.ImageSize = value; + this.ShowTitle = value; return this; } - public ImageSet WithGridArea(string value) + public ToggleInput WithGridArea(string value) { this.GridArea = value; return this; } - public ImageSet WithFallback(IUnion value) + public ToggleInput WithFallback(IUnion value) { this.Fallback = value; return this; @@ -6326,23 +8845,29 @@ public ImageSet WithFallback(IUnion value) } /// -/// A standalone image element. +/// An input to allow the user to select one or more values. /// -public class Image : CardElement +public class ChoiceSetInput : CardElement { /// - /// Deserializes a JSON string into an object of type Image. + /// Deserializes a JSON string into an object of type ChoiceSetInput. /// - public static Image? Deserialize(string json) + public static ChoiceSetInput? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Image**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Input.ChoiceSet**. /// [JsonPropertyName("type")] - public string Type { get; } = "Image"; + public string Type { get; } = "Input.ChoiceSet"; /// /// 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. @@ -6354,7 +8879,7 @@ public class Image : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -6366,25 +8891,25 @@ public class Image : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// - /// Controls how the element should be horizontally aligned. + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -6396,64 +8921,87 @@ public class Image : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The URL (or Base64-encoded Data URI) of the image. Acceptable formats are PNG, JPEG, GIF and SVG. + /// The label of the input. + /// + /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. /// - [JsonPropertyName("url")] - public string? Url { get; set; } + [JsonPropertyName("label")] + public string? Label { get; set; } /// - /// The alternate text for the image, used for accessibility purposes. + /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. /// - [JsonPropertyName("altText")] - public string? AltText { get; set; } + [JsonPropertyName("isRequired")] + public bool? IsRequired { get; set; } = false; /// - /// The background color of the image. + /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. /// - [JsonPropertyName("backgroundColor")] - public string? BackgroundColor { get; set; } + [JsonPropertyName("errorMessage")] + public string? ErrorMessage { get; set; } /// - /// The style of the image. + /// An Action.ResetInputs action that will be executed when the value of the input changes. /// - [JsonPropertyName("style")] - public ImageStyle? Style { get; set; } + [JsonPropertyName("valueChangedAction")] + public Action? ValueChangedAction { get; set; } /// - /// The size of the image. + /// The default value of the input. /// - [JsonPropertyName("size")] - public Size? Size { get; set; } + [JsonPropertyName("value")] + public string? Value { get; set; } /// - /// The width of the image. + /// The choices associated with the input. /// - [JsonPropertyName("width")] - public string? Width { get; set; } + [JsonPropertyName("choices")] + public IList? Choices { get; set; } /// - /// An Action that will be invoked when the image is tapped or clicked. Action.ShowCard is not supported. + /// A Data.Query object that defines the dataset from which to dynamically fetch the choices for the input. /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } + [JsonPropertyName("choices.data")] + public QueryData? ChoicesData { get; set; } /// - /// Controls if the image can be expanded to full screen. + /// Controls whether the input should be displayed as a dropdown (compact) or a list of radio buttons or checkboxes (expanded). /// - [JsonPropertyName("allowExpand")] - public bool? AllowExpand { get; set; } + [JsonPropertyName("style")] + public ChoiceSetInputStyle? Style { get; set; } = ChoiceSetInputStyle.Compact; - [JsonPropertyName("msteams")] - public TeamsImageProperties? Msteams { get; set; } + /// + /// Controls whether multiple choices can be selected. + /// + [JsonPropertyName("isMultiSelect")] + public bool? IsMultiSelect { get; set; } = false; /// - /// The height of the image. + /// The text to display as a placeholder when the user has not entered any value. /// - [JsonPropertyName("height")] - public string? Height { get; set; } + [JsonPropertyName("placeholder")] + public string? Placeholder { get; set; } + + /// + /// Controls if choice titles should wrap. + /// + [JsonPropertyName("wrap")] + public bool? Wrap { get; set; } = true; + + /// + /// Controls whether choice items are arranged in multiple columns in expanded mode, or in a single column. Default is false. + /// + [JsonPropertyName("useMultipleColumns")] + public bool? UseMultipleColumns { get; set; } = false; + + /// + /// 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. + /// + [JsonPropertyName("minColumnWidth")] + public string? MinColumnWidth { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -6467,13 +9015,20 @@ public class Image : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - public Image(string url) + public ChoiceSetInput() { } + + public ChoiceSetInput(params Choice[] choices) { - this.Url = url; + this.Choices = new List(choices); + } + + public ChoiceSetInput(IList choices) + { + this.Choices = choices; } /// - /// Serializes this Image into a JSON string. + /// Serializes this ChoiceSetInput into a JSON string. /// public string Serialize() { @@ -6487,154 +9042,279 @@ public string Serialize() ); } - public Image WithId(string value) + public ChoiceSetInput WithKey(string value) + { + this.Key = value; + return this; + } + + public ChoiceSetInput WithId(string value) { this.Id = value; return this; } - public Image WithRequires(HostCapabilities value) + public ChoiceSetInput WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public Image WithLang(string value) + public ChoiceSetInput WithLang(string value) { this.Lang = value; return this; } - public Image WithIsVisible(bool value) + public ChoiceSetInput WithIsVisible(bool value) { this.IsVisible = value; return this; } - public Image WithSeparator(bool value) + public ChoiceSetInput WithSeparator(bool value) { this.Separator = value; return this; } - public Image WithHorizontalAlignment(HorizontalAlignment value) + public ChoiceSetInput WithHeight(ElementHeight value) { - this.HorizontalAlignment = value; + this.Height = value; return this; } - public Image WithSpacing(Spacing value) + public ChoiceSetInput WithSpacing(Spacing value) { this.Spacing = value; return this; } - public Image WithTargetWidth(TargetWidth value) + public ChoiceSetInput WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public Image WithIsSortKey(bool value) + public ChoiceSetInput WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public Image WithUrl(string value) + public ChoiceSetInput WithLabel(string value) { - this.Url = value; + this.Label = value; return this; } - public Image WithAltText(string value) + public ChoiceSetInput WithIsRequired(bool value) { - this.AltText = value; + this.IsRequired = value; return this; } - public Image WithBackgroundColor(string value) + public ChoiceSetInput WithErrorMessage(string value) { - this.BackgroundColor = value; + this.ErrorMessage = value; return this; } - public Image WithStyle(ImageStyle value) + public ChoiceSetInput WithValueChangedAction(Action value) + { + this.ValueChangedAction = value; + return this; + } + + public ChoiceSetInput WithValue(string value) + { + this.Value = value; + return this; + } + + public ChoiceSetInput WithChoices(params Choice[] value) + { + this.Choices = new List(value); + return this; + } + + public ChoiceSetInput WithChoices(IList value) + { + this.Choices = value; + return this; + } + + public ChoiceSetInput WithChoicesData(QueryData value) + { + this.ChoicesData = value; + return this; + } + + public ChoiceSetInput WithStyle(ChoiceSetInputStyle value) { this.Style = value; return this; } - public Image WithSize(Size value) + public ChoiceSetInput WithIsMultiSelect(bool value) { - this.Size = value; + this.IsMultiSelect = value; return this; } - public Image WithWidth(string value) + public ChoiceSetInput WithPlaceholder(string value) { - this.Width = value; + this.Placeholder = value; return this; } - public Image WithSelectAction(Action value) + public ChoiceSetInput WithWrap(bool value) { - this.SelectAction = value; + this.Wrap = value; return this; } - public Image WithAllowExpand(bool value) + public ChoiceSetInput WithUseMultipleColumns(bool value) { - this.AllowExpand = value; + this.UseMultipleColumns = value; + return this; + } + + public ChoiceSetInput WithMinColumnWidth(string value) + { + this.MinColumnWidth = value; + return this; + } + + public ChoiceSetInput WithGridArea(string value) + { + this.GridArea = value; + return this; + } + + public ChoiceSetInput WithFallback(IUnion value) + { + this.Fallback = value; return this; } +} + +/// +/// A choice as used by the Input.ChoiceSet input. +/// +public class Choice : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type Choice. + /// + public static Choice? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The text to display for the choice. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// The value associated with the choice, as sent to the Bot when an Action.Submit or Action.Execute is invoked + /// + [JsonPropertyName("value")] + public string? Value { get; set; } - public Image WithMsteams(TeamsImageProperties value) + /// + /// Serializes this Choice into a JSON string. + /// + public string Serialize() { - this.Msteams = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public Image WithHeight(string value) + public Choice WithKey(string value) { - this.Height = value; + this.Key = value; return this; } - public Image WithGridArea(string value) + public Choice WithTitle(string value) { - this.GridArea = value; + this.Title = value; return this; } - public Image WithFallback(IUnion value) + public Choice WithValue(string value) { - this.Fallback = value; + this.Value = value; return this; } } /// -/// Represents a set of Teams-specific properties on an image. +/// Defines a query to dynamically fetch data from a Bot. /// -public class TeamsImageProperties : SerializableObject +public class QueryData : SerializableObject { /// - /// Deserializes a JSON string into an object of type TeamsImageProperties. + /// Deserializes a JSON string into an object of type QueryData. /// - public static TeamsImageProperties? Deserialize(string json) + public static QueryData? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Controls if the image is expandable in Teams. This property is equivalent to the Image.allowExpand property. + /// 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. /// - [JsonPropertyName("allowExpand")] - public bool? AllowExpand { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Serializes this TeamsImageProperties into a JSON string. + /// Must be **Data.Query**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "Data.Query"; + + /// + /// The dataset from which to fetch the data. + /// + [JsonPropertyName("dataset")] + public string? Dataset { get; set; } + + /// + /// Controls which inputs are associated with the Data.Query. When a Data.Query is executed, the values of the associated inputs are sent to the Bot, allowing it to perform filtering operations based on the user's input. + /// + [JsonPropertyName("associatedInputs")] + public AssociatedInputs? AssociatedInputs { get; set; } + + /// + /// The maximum number of data items that should be returned 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. + /// + [JsonPropertyName("count")] + public float? Count { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("skip")] + public float? Skip { get; set; } + + /// + /// Serializes this QueryData into a JSON string. /// public string Serialize() { @@ -6648,31 +9328,61 @@ public string Serialize() ); } - public TeamsImageProperties WithAllowExpand(bool value) + public QueryData WithKey(string value) { - this.AllowExpand = value; + this.Key = value; + return this; + } + + public QueryData WithDataset(string value) + { + this.Dataset = value; + return this; + } + + public QueryData WithAssociatedInputs(AssociatedInputs value) + { + this.AssociatedInputs = value; + return this; + } + + public QueryData WithCount(float value) + { + this.Count = value; + return this; + } + + public QueryData WithSkip(float value) + { + this.Skip = value; return this; } } /// -/// An input to allow the user to enter text. +/// An input to allow the user to rate something using stars. /// -public class TextInput : CardElement +public class RatingInput : CardElement { /// - /// Deserializes a JSON string into an object of type TextInput. + /// Deserializes a JSON string into an object of type RatingInput. /// - public static TextInput? Deserialize(string json) + public static RatingInput? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Input.Text**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Input.Rating**. /// [JsonPropertyName("type")] - public string Type { get; } = "Input.Text"; + public string Type { get; } = "Input.Rating"; /// /// 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. @@ -6684,7 +9394,7 @@ public class TextInput : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -6696,25 +9406,25 @@ public class TextInput : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -6726,7 +9436,7 @@ public class TextInput : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// /// The label of the input. @@ -6740,7 +9450,7 @@ public class TextInput : CardElement /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. /// [JsonPropertyName("isRequired")] - public bool? IsRequired { get; set; } + public bool? IsRequired { get; set; } = false; /// /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. @@ -6752,49 +9462,37 @@ public class TextInput : CardElement /// An Action.ResetInputs action that will be executed when the value of the input changes. /// [JsonPropertyName("valueChangedAction")] - public ResetInputsAction? ValueChangedAction { get; set; } + public Action? ValueChangedAction { get; set; } /// /// The default value of the input. /// [JsonPropertyName("value")] - public string? Value { get; set; } - - /// - /// The maximum length of the text in the input. - /// - [JsonPropertyName("maxLength")] - public float? MaxLength { get; set; } - - /// - /// Controls if the input should allow multiple lines of text. - /// - [JsonPropertyName("isMultiline")] - public bool? IsMultiline { get; set; } + public float? Value { get; set; } /// - /// The text to display as a placeholder when the user hasn't entered a value. + /// The number of stars to display. /// - [JsonPropertyName("placeholder")] - public string? Placeholder { get; set; } + [JsonPropertyName("max")] + public float? Max { get; set; } = 5; /// - /// The style of the input. + /// Controls if the user can select half stars. /// - [JsonPropertyName("style")] - public InputTextStyle? Style { get; set; } + [JsonPropertyName("allowHalfSteps")] + public bool? AllowHalfSteps { get; set; } = false; /// - /// The action that should be displayed as a button alongside the input. Action.ShowCard is not supported. + /// The size of the stars. /// - [JsonPropertyName("inlineAction")] - public Action? InlineAction { get; set; } + [JsonPropertyName("size")] + public RatingSize? Size { get; set; } = RatingSize.Large; /// - /// The regular expression to validate the input. + /// The color of the stars. /// - [JsonPropertyName("regex")] - public string? Regex { get; set; } + [JsonPropertyName("color")] + public RatingColor? Color { get; set; } = RatingColor.Neutral; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -6809,7 +9507,7 @@ public class TextInput : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this TextInput into a JSON string. + /// Serializes this RatingInput into a JSON string. /// public string Serialize() { @@ -6823,133 +9521,127 @@ public string Serialize() ); } - public TextInput WithId(string value) + public RatingInput WithKey(string value) + { + this.Key = value; + return this; + } + + public RatingInput WithId(string value) { this.Id = value; return this; } - public TextInput WithRequires(HostCapabilities value) + public RatingInput WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public TextInput WithLang(string value) + public RatingInput WithLang(string value) { this.Lang = value; return this; } - public TextInput WithIsVisible(bool value) + public RatingInput WithIsVisible(bool value) { this.IsVisible = value; return this; } - public TextInput WithSeparator(bool value) + public RatingInput WithSeparator(bool value) { this.Separator = value; return this; } - public TextInput WithHeight(ElementHeight value) + public RatingInput WithHeight(ElementHeight value) { this.Height = value; return this; } - public TextInput WithSpacing(Spacing value) + public RatingInput WithSpacing(Spacing value) { this.Spacing = value; return this; } - public TextInput WithTargetWidth(TargetWidth value) + public RatingInput WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public TextInput WithIsSortKey(bool value) + public RatingInput WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public TextInput WithLabel(string value) + public RatingInput WithLabel(string value) { this.Label = value; return this; } - public TextInput WithIsRequired(bool value) + public RatingInput WithIsRequired(bool value) { this.IsRequired = value; return this; } - public TextInput WithErrorMessage(string value) + public RatingInput WithErrorMessage(string value) { this.ErrorMessage = value; return this; } - public TextInput WithValueChangedAction(ResetInputsAction value) + public RatingInput WithValueChangedAction(Action value) { this.ValueChangedAction = value; return this; } - public TextInput WithValue(string value) + public RatingInput WithValue(float value) { this.Value = value; return this; } - public TextInput WithMaxLength(float value) - { - this.MaxLength = value; - return this; - } - - public TextInput WithIsMultiline(bool value) - { - this.IsMultiline = value; - return this; - } - - public TextInput WithPlaceholder(string value) + public RatingInput WithMax(float value) { - this.Placeholder = value; + this.Max = value; return this; } - public TextInput WithStyle(InputTextStyle value) + public RatingInput WithAllowHalfSteps(bool value) { - this.Style = value; + this.AllowHalfSteps = value; return this; } - public TextInput WithInlineAction(Action value) + public RatingInput WithSize(RatingSize value) { - this.InlineAction = value; + this.Size = value; return this; } - public TextInput WithRegex(string value) + public RatingInput WithColor(RatingColor value) { - this.Regex = value; + this.Color = value; return this; } - public TextInput WithGridArea(string value) + public RatingInput WithGridArea(string value) { this.GridArea = value; return this; } - public TextInput WithFallback(IUnion value) + public RatingInput WithFallback(IUnion value) { this.Fallback = value; return this; @@ -6957,23 +9649,29 @@ public TextInput WithFallback(IUnion value) } /// -/// An input to allow the user to select a date. +/// A read-only star rating element, to display the rating of something. /// -public class DateInput : CardElement +public class Rating : CardElement { /// - /// Deserializes a JSON string into an object of type DateInput. + /// Deserializes a JSON string into an object of type Rating. /// - public static DateInput? Deserialize(string json) + public static Rating? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Input.Date**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Rating**. /// [JsonPropertyName("type")] - public string Type { get; } = "Input.Date"; + public string Type { get; } = "Rating"; /// /// 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. @@ -6985,7 +9683,7 @@ public class DateInput : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -6997,25 +9695,31 @@ public class DateInput : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; + + /// + /// Controls how the element should be horizontally aligned. + /// + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -7027,57 +9731,43 @@ public class DateInput : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The label of the input. - /// - /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. - /// - [JsonPropertyName("label")] - public string? Label { get; set; } - - /// - /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. - /// - [JsonPropertyName("isRequired")] - public bool? IsRequired { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. - /// - [JsonPropertyName("errorMessage")] - public string? ErrorMessage { get; set; } + /// The value of the rating. Must be between 0 and max. + /// + [JsonPropertyName("value")] + public float? Value { get; set; } /// - /// An Action.ResetInputs action that will be executed when the value of the input changes. + /// The number of "votes" associated with the rating. /// - [JsonPropertyName("valueChangedAction")] - public ResetInputsAction? ValueChangedAction { get; set; } + [JsonPropertyName("count")] + public float? Count { get; set; } /// - /// The default value of the input, in the `YYYY-MM-DD` format. + /// The number of stars to display. /// - [JsonPropertyName("value")] - public string? Value { get; set; } + [JsonPropertyName("max")] + public float? Max { get; set; } = 5; /// - /// The text to display as a placeholder when the user has not selected a date. + /// The size of the stars. /// - [JsonPropertyName("placeholder")] - public string? Placeholder { get; set; } + [JsonPropertyName("size")] + public RatingSize? Size { get; set; } = RatingSize.Large; /// - /// The minimum date that can be selected. + /// The color of the stars. /// - [JsonPropertyName("min")] - public string? Min { get; set; } + [JsonPropertyName("color")] + public RatingColor? Color { get; set; } = RatingColor.Neutral; /// - /// The maximum date that can be selected. + /// The style of the stars. /// - [JsonPropertyName("max")] - public string? Max { get; set; } + [JsonPropertyName("style")] + public RatingStyle? Style { get; set; } = RatingStyle.Default; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -7092,7 +9782,7 @@ public class DateInput : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this DateInput into a JSON string. + /// Serializes this Rating into a JSON string. /// public string Serialize() { @@ -7106,115 +9796,115 @@ public string Serialize() ); } - public DateInput WithId(string value) + public Rating WithKey(string value) + { + this.Key = value; + return this; + } + + public Rating WithId(string value) { this.Id = value; return this; } - public DateInput WithRequires(HostCapabilities value) + public Rating WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public DateInput WithLang(string value) + public Rating WithLang(string value) { this.Lang = value; return this; } - public DateInput WithIsVisible(bool value) + public Rating WithIsVisible(bool value) { this.IsVisible = value; return this; } - public DateInput WithSeparator(bool value) + public Rating WithSeparator(bool value) { this.Separator = value; return this; } - public DateInput WithHeight(ElementHeight value) + public Rating WithHeight(ElementHeight value) { this.Height = value; return this; } - public DateInput WithSpacing(Spacing value) - { - this.Spacing = value; - return this; - } - - public DateInput WithTargetWidth(TargetWidth value) + public Rating WithHorizontalAlignment(HorizontalAlignment value) { - this.TargetWidth = value; + this.HorizontalAlignment = value; return this; } - public DateInput WithIsSortKey(bool value) + public Rating WithSpacing(Spacing value) { - this.IsSortKey = value; + this.Spacing = value; return this; } - public DateInput WithLabel(string value) + public Rating WithTargetWidth(TargetWidth value) { - this.Label = value; + this.TargetWidth = value; return this; } - public DateInput WithIsRequired(bool value) + public Rating WithIsSortKey(bool value) { - this.IsRequired = value; + this.IsSortKey = value; return this; } - public DateInput WithErrorMessage(string value) + public Rating WithValue(float value) { - this.ErrorMessage = value; + this.Value = value; return this; } - public DateInput WithValueChangedAction(ResetInputsAction value) + public Rating WithCount(float value) { - this.ValueChangedAction = value; + this.Count = value; return this; } - public DateInput WithValue(string value) + public Rating WithMax(float value) { - this.Value = value; + this.Max = value; return this; } - public DateInput WithPlaceholder(string value) + public Rating WithSize(RatingSize value) { - this.Placeholder = value; + this.Size = value; return this; } - public DateInput WithMin(string value) + public Rating WithColor(RatingColor value) { - this.Min = value; + this.Color = value; return this; } - public DateInput WithMax(string value) + public Rating WithStyle(RatingStyle value) { - this.Max = value; + this.Style = value; return this; } - public DateInput WithGridArea(string value) + public Rating WithGridArea(string value) { this.GridArea = value; return this; } - public DateInput WithFallback(IUnion value) + public Rating WithFallback(IUnion value) { this.Fallback = value; return this; @@ -7222,23 +9912,29 @@ public DateInput WithFallback(IUnion value) } /// -/// An input to allow the user to select a time. +/// A special type of button with an icon, title and description. /// -public class TimeInput : CardElement +public class CompoundButton : CardElement { /// - /// Deserializes a JSON string into an object of type TimeInput. + /// Deserializes a JSON string into an object of type CompoundButton. /// - public static TimeInput? Deserialize(string json) + public static CompoundButton? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Input.Time**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **CompoundButton**. /// [JsonPropertyName("type")] - public string Type { get; } = "Input.Time"; + public string Type { get; } = "CompoundButton"; /// /// 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. @@ -7250,7 +9946,7 @@ public class TimeInput : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -7262,25 +9958,31 @@ public class TimeInput : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; + + /// + /// Controls how the element should be horizontally aligned. + /// + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -7292,57 +9994,37 @@ public class TimeInput : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The label of the input. - /// - /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. - /// - [JsonPropertyName("label")] - public string? Label { get; set; } - - /// - /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. - /// - [JsonPropertyName("isRequired")] - public bool? IsRequired { get; set; } - - /// - /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. - /// - [JsonPropertyName("errorMessage")] - public string? ErrorMessage { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// An Action.ResetInputs action that will be executed when the value of the input changes. + /// The icon to show on the button. /// - [JsonPropertyName("valueChangedAction")] - public ResetInputsAction? ValueChangedAction { get; set; } + [JsonPropertyName("icon")] + public IconInfo? Icon { get; set; } /// - /// The default value of the input, in the `HH:MM` format. + /// The badge to show on the button. /// - [JsonPropertyName("value")] - public string? Value { get; set; } + [JsonPropertyName("badge")] + public string? Badge { get; set; } /// - /// The text to display as a placeholder when the user hasn't entered a value. + /// The title of the button. /// - [JsonPropertyName("placeholder")] - public string? Placeholder { get; set; } + [JsonPropertyName("title")] + public string? Title { get; set; } /// - /// The minimum time that can be selected, in the `HH:MM` format. + /// The description text of the button. /// - [JsonPropertyName("min")] - public string? Min { get; set; } + [JsonPropertyName("description")] + public string? Description { get; set; } /// - /// The maximum time that can be selected, in the `HH:MM` format. + /// An Action that will be invoked when the button is tapped or clicked. Action.ShowCard is not supported. /// - [JsonPropertyName("max")] - public string? Max { get; set; } + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -7357,7 +10039,7 @@ public class TimeInput : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this TimeInput into a JSON string. + /// Serializes this CompoundButton into a JSON string. /// public string Serialize() { @@ -7371,139 +10053,228 @@ public string Serialize() ); } - public TimeInput WithId(string value) + public CompoundButton WithKey(string value) + { + this.Key = value; + return this; + } + + public CompoundButton WithId(string value) { this.Id = value; return this; } - public TimeInput WithRequires(HostCapabilities value) + public CompoundButton WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public TimeInput WithLang(string value) + public CompoundButton WithLang(string value) { this.Lang = value; return this; } - public TimeInput WithIsVisible(bool value) + public CompoundButton WithIsVisible(bool value) { this.IsVisible = value; return this; } - public TimeInput WithSeparator(bool value) + public CompoundButton WithSeparator(bool value) { this.Separator = value; return this; } - public TimeInput WithHeight(ElementHeight value) + public CompoundButton WithHeight(ElementHeight value) { this.Height = value; return this; } - public TimeInput WithSpacing(Spacing value) + public CompoundButton WithHorizontalAlignment(HorizontalAlignment value) + { + this.HorizontalAlignment = value; + return this; + } + + public CompoundButton WithSpacing(Spacing value) { this.Spacing = value; return this; } - public TimeInput WithTargetWidth(TargetWidth value) + public CompoundButton WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public TimeInput WithIsSortKey(bool value) + public CompoundButton WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public TimeInput WithLabel(string value) + public CompoundButton WithIcon(IconInfo value) { - this.Label = value; + this.Icon = value; return this; } - public TimeInput WithIsRequired(bool value) + public CompoundButton WithBadge(string value) { - this.IsRequired = value; + this.Badge = value; + return this; + } + + public CompoundButton WithTitle(string value) + { + this.Title = value; + return this; + } + + public CompoundButton WithDescription(string value) + { + this.Description = value; + return this; + } + + public CompoundButton WithSelectAction(Action value) + { + this.SelectAction = value; + return this; + } + + public CompoundButton WithGridArea(string value) + { + this.GridArea = value; + return this; + } + + public CompoundButton WithFallback(IUnion value) + { + this.Fallback = value; return this; } +} + +/// +/// Defines information about a Fluent icon and how it should be rendered. +/// +public class IconInfo : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type IconInfo. + /// + public static IconInfo? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The name of the icon to display. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } - public TimeInput WithErrorMessage(string value) - { - this.ErrorMessage = value; - return this; - } + /// + /// The size of the icon. + /// + [JsonPropertyName("size")] + public IconSize? Size { get; set; } = IconSize.XSmall; - public TimeInput WithValueChangedAction(ResetInputsAction value) - { - this.ValueChangedAction = value; - return this; - } + /// + /// The style of the icon. + /// + [JsonPropertyName("style")] + public IconStyle? Style { get; set; } = IconStyle.Regular; - public TimeInput WithValue(string value) + /// + /// The color of the icon. + /// + [JsonPropertyName("color")] + public TextColor? Color { get; set; } = TextColor.Default; + + /// + /// Serializes this IconInfo into a JSON string. + /// + public string Serialize() { - this.Value = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public TimeInput WithPlaceholder(string value) + public IconInfo WithKey(string value) { - this.Placeholder = value; + this.Key = value; return this; } - public TimeInput WithMin(string value) + public IconInfo WithName(string value) { - this.Min = value; + this.Name = value; return this; } - public TimeInput WithMax(string value) + public IconInfo WithSize(IconSize value) { - this.Max = value; + this.Size = value; return this; } - public TimeInput WithGridArea(string value) + public IconInfo WithStyle(IconStyle value) { - this.GridArea = value; + this.Style = value; return this; } - public TimeInput WithFallback(IUnion value) + public IconInfo WithColor(TextColor value) { - this.Fallback = value; + this.Color = value; return this; } } /// -/// An input to allow the user to enter a number. +/// A standalone icon element. Icons can be picked from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog). /// -public class NumberInput : CardElement +public class Icon : CardElement { /// - /// Deserializes a JSON string into an object of type NumberInput. + /// Deserializes a JSON string into an object of type Icon. /// - public static NumberInput? Deserialize(string json) + public static Icon? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Input.Number**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Icon**. /// [JsonPropertyName("type")] - public string Type { get; } = "Input.Number"; + public string Type { get; } = "Icon"; /// /// 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. @@ -7515,7 +10286,7 @@ public class NumberInput : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -7527,25 +10298,25 @@ public class NumberInput : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// - /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// Controls how the element should be horizontally aligned. /// - [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -7557,57 +10328,37 @@ public class NumberInput : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The label of the input. - /// - /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. - /// - [JsonPropertyName("label")] - public string? Label { get; set; } - - /// - /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. - /// - [JsonPropertyName("isRequired")] - public bool? IsRequired { get; set; } - - /// - /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. - /// - [JsonPropertyName("errorMessage")] - public string? ErrorMessage { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// An Action.ResetInputs action that will be executed when the value of the input changes. + /// The name of the icon to display. /// - [JsonPropertyName("valueChangedAction")] - public ResetInputsAction? ValueChangedAction { get; set; } + [JsonPropertyName("name")] + public string? Name { get; set; } /// - /// The default value of the input. + /// The size of the icon. /// - [JsonPropertyName("value")] - public float? Value { get; set; } + [JsonPropertyName("size")] + public IconSize? Size { get; set; } = IconSize.Standard; /// - /// The text to display as a placeholder when the user hasn't entered a value. + /// The style of the icon. /// - [JsonPropertyName("placeholder")] - public string? Placeholder { get; set; } + [JsonPropertyName("style")] + public IconStyle? Style { get; set; } = IconStyle.Regular; /// - /// The minimum value that can be entered. + /// The color of the icon. /// - [JsonPropertyName("min")] - public float? Min { get; set; } + [JsonPropertyName("color")] + public TextColor? Color { get; set; } = TextColor.Default; /// - /// The maximum value that can be entered. + /// An Action that will be invoked when the icon is tapped or clicked. Action.ShowCard is not supported. /// - [JsonPropertyName("max")] - public float? Max { get; set; } + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -7621,8 +10372,15 @@ public class NumberInput : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } + public Icon() { } + + public Icon(string name) + { + this.Name = name; + } + /// - /// Serializes this NumberInput into a JSON string. + /// Serializes this Icon into a JSON string. /// public string Serialize() { @@ -7636,115 +10394,103 @@ public string Serialize() ); } - public NumberInput WithId(string value) + public Icon WithKey(string value) + { + this.Key = value; + return this; + } + + public Icon WithId(string value) { this.Id = value; return this; } - public NumberInput WithRequires(HostCapabilities value) + public Icon WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public NumberInput WithLang(string value) + public Icon WithLang(string value) { this.Lang = value; return this; } - public NumberInput WithIsVisible(bool value) + public Icon WithIsVisible(bool value) { this.IsVisible = value; return this; } - public NumberInput WithSeparator(bool value) + public Icon WithSeparator(bool value) { this.Separator = value; return this; } - public NumberInput WithHeight(ElementHeight value) + public Icon WithHorizontalAlignment(HorizontalAlignment value) { - this.Height = value; + this.HorizontalAlignment = value; return this; } - public NumberInput WithSpacing(Spacing value) + public Icon WithSpacing(Spacing value) { this.Spacing = value; return this; } - public NumberInput WithTargetWidth(TargetWidth value) + public Icon WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public NumberInput WithIsSortKey(bool value) + public Icon WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public NumberInput WithLabel(string value) - { - this.Label = value; - return this; - } - - public NumberInput WithIsRequired(bool value) - { - this.IsRequired = value; - return this; - } - - public NumberInput WithErrorMessage(string value) - { - this.ErrorMessage = value; - return this; - } - - public NumberInput WithValueChangedAction(ResetInputsAction value) + public Icon WithName(string value) { - this.ValueChangedAction = value; + this.Name = value; return this; } - public NumberInput WithValue(float value) + public Icon WithSize(IconSize value) { - this.Value = value; + this.Size = value; return this; } - public NumberInput WithPlaceholder(string value) + public Icon WithStyle(IconStyle value) { - this.Placeholder = value; + this.Style = value; return this; } - public NumberInput WithMin(float value) + public Icon WithColor(TextColor value) { - this.Min = value; + this.Color = value; return this; } - public NumberInput WithMax(float value) + public Icon WithSelectAction(Action value) { - this.Max = value; + this.SelectAction = value; return this; } - public NumberInput WithGridArea(string value) + public Icon WithGridArea(string value) { this.GridArea = value; return this; } - public NumberInput WithFallback(IUnion value) + public Icon WithFallback(IUnion value) { this.Fallback = value; return this; @@ -7752,23 +10498,29 @@ public NumberInput WithFallback(IUnion value) } /// -/// An input to allow the user to select between on/off states. +/// A carousel with sliding pages. /// -public class ToggleInput : CardElement +public class Carousel : CardElement { /// - /// Deserializes a JSON string into an object of type ToggleInput. + /// Deserializes a JSON string into an object of type Carousel. /// - public static ToggleInput? Deserialize(string json) + public static Carousel? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Input.Toggle**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Carousel**. /// [JsonPropertyName("type")] - public string Type { get; } = "Input.Toggle"; + public string Type { get; } = "Carousel"; /// /// 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. @@ -7780,7 +10532,7 @@ public class ToggleInput : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -7792,25 +10544,25 @@ public class ToggleInput : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -7822,63 +10574,25 @@ public class ToggleInput : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The label of the input. - /// - /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. - /// - [JsonPropertyName("label")] - public string? Label { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. - /// - [JsonPropertyName("isRequired")] - public bool? IsRequired { get; set; } - - /// - /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. - /// - [JsonPropertyName("errorMessage")] - public string? ErrorMessage { get; set; } - - /// - /// An Action.ResetInputs action that will be executed when the value of the input changes. - /// - [JsonPropertyName("valueChangedAction")] - public ResetInputsAction? ValueChangedAction { get; set; } - - /// - /// The default value of the input. - /// - [JsonPropertyName("value")] - public string? Value { get; set; } - - /// - /// The title (caption) to display next to the toggle. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } - - /// - /// The value to send to the Bot when the toggle is on. + /// Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. /// - [JsonPropertyName("valueOn")] - public string? ValueOn { get; set; } + [JsonPropertyName("bleed")] + public bool? Bleed { get; set; } = false; /// - /// The value to send to the Bot when the toggle is off. + /// The minimum height, in pixels, of the container, in the `px` format. /// - [JsonPropertyName("valueOff")] - public string? ValueOff { get; set; } + [JsonPropertyName("minHeight")] + public string? MinHeight { get; set; } /// - /// Controls if the title should wrap. + /// Controls the type of animation to use to navigate between pages. /// - [JsonPropertyName("wrap")] - public bool? Wrap { get; set; } + [JsonPropertyName("pageAnimation")] + public CarouselPageAnimation? PageAnimation { get; set; } = CarouselPageAnimation.Slide; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -7892,13 +10606,14 @@ public class ToggleInput : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - public ToggleInput(string title) - { - this.Title = title; - } + /// + /// The pages in the carousel. + /// + [JsonPropertyName("pages")] + public IList? Pages { get; set; } /// - /// Serializes this ToggleInput into a JSON string. + /// Serializes this Carousel into a JSON string. /// public string Serialize() { @@ -7912,145 +10627,133 @@ public string Serialize() ); } - public ToggleInput WithId(string value) + public Carousel WithKey(string value) + { + this.Key = value; + return this; + } + + public Carousel WithId(string value) { this.Id = value; return this; } - public ToggleInput WithRequires(HostCapabilities value) + public Carousel WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ToggleInput WithLang(string value) + public Carousel WithLang(string value) { this.Lang = value; return this; } - public ToggleInput WithIsVisible(bool value) + public Carousel WithIsVisible(bool value) { this.IsVisible = value; return this; } - public ToggleInput WithSeparator(bool value) + public Carousel WithSeparator(bool value) { this.Separator = value; return this; } - public ToggleInput WithHeight(ElementHeight value) + public Carousel WithHeight(ElementHeight value) { this.Height = value; return this; } - public ToggleInput WithSpacing(Spacing value) + public Carousel WithSpacing(Spacing value) { this.Spacing = value; return this; } - public ToggleInput WithTargetWidth(TargetWidth value) + public Carousel WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public ToggleInput WithIsSortKey(bool value) + public Carousel WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public ToggleInput WithLabel(string value) - { - this.Label = value; - return this; - } - - public ToggleInput WithIsRequired(bool value) - { - this.IsRequired = value; - return this; - } - - public ToggleInput WithErrorMessage(string value) - { - this.ErrorMessage = value; - return this; - } - - public ToggleInput WithValueChangedAction(ResetInputsAction value) - { - this.ValueChangedAction = value; - return this; - } - - public ToggleInput WithValue(string value) + public Carousel WithBleed(bool value) { - this.Value = value; + this.Bleed = value; return this; } - public ToggleInput WithTitle(string value) + public Carousel WithMinHeight(string value) { - this.Title = value; + this.MinHeight = value; return this; } - public ToggleInput WithValueOn(string value) + public Carousel WithPageAnimation(CarouselPageAnimation value) { - this.ValueOn = value; + this.PageAnimation = value; return this; } - public ToggleInput WithValueOff(string value) + public Carousel WithGridArea(string value) { - this.ValueOff = value; + this.GridArea = value; return this; } - public ToggleInput WithWrap(bool value) + public Carousel WithFallback(IUnion value) { - this.Wrap = value; + this.Fallback = value; return this; } - public ToggleInput WithGridArea(string value) + public Carousel WithPages(params CarouselPage[] value) { - this.GridArea = value; + this.Pages = new List(value); return this; } - public ToggleInput WithFallback(IUnion value) + public Carousel WithPages(IList value) { - this.Fallback = value; + this.Pages = value; return this; } } /// -/// An input to allow the user to select one or more values. +/// A badge element to show an icon and/or text in a compact form over a colored background. /// -public class ChoiceSetInput : CardElement +public class Badge : CardElement { /// - /// Deserializes a JSON string into an object of type ChoiceSetInput. + /// Deserializes a JSON string into an object of type Badge. /// - public static ChoiceSetInput? Deserialize(string json) + public static Badge? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Input.ChoiceSet**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Badge**. /// [JsonPropertyName("type")] - public string Type { get; } = "Input.ChoiceSet"; + public string Type { get; } = "Badge"; /// /// 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. @@ -8062,7 +10765,7 @@ public class ChoiceSetInput : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -8074,25 +10777,31 @@ public class ChoiceSetInput : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; + + /// + /// Controls how the element should be horizontally aligned. + /// + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -8104,87 +10813,55 @@ public class ChoiceSetInput : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The label of the input. - /// - /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. - /// - [JsonPropertyName("label")] - public string? Label { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// The text to display. /// - [JsonPropertyName("isRequired")] - public bool? IsRequired { get; set; } + [JsonPropertyName("text")] + public string? Text { get; set; } /// - /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// The name of an icon from the [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) to display, in the `[,regular|filled]` format. If the style is not specified, the regular style is used. /// - [JsonPropertyName("errorMessage")] - public string? ErrorMessage { get; set; } + [JsonPropertyName("icon")] + public string? Icon { get; set; } /// - /// An Action.ResetInputs action that will be executed when the value of the input changes. + /// Controls the position of the icon. /// - [JsonPropertyName("valueChangedAction")] - public ResetInputsAction? ValueChangedAction { get; set; } + [JsonPropertyName("iconPosition")] + public BadgeIconPosition? IconPosition { get; set; } = BadgeIconPosition.Before; /// - /// The default value of the input. + /// Controls the strength of the background color. /// - [JsonPropertyName("value")] - public string? Value { get; set; } + [JsonPropertyName("appearance")] + public BadgeAppearance? Appearance { get; set; } = BadgeAppearance.Filled; /// - /// The choices associated with the input. + /// The size of the badge. /// - [JsonPropertyName("choices")] - public IList? Choices { get; set; } + [JsonPropertyName("size")] + public BadgeSize? Size { get; set; } = BadgeSize.Medium; /// - /// A Data.Query object that defines the dataset from which to dynamically fetch the choices for the input. + /// Controls the shape of the badge. /// - [JsonPropertyName("choices.data")] - public QueryData? ChoicesData { get; set; } + [JsonPropertyName("shape")] + public BadgeShape? Shape { get; set; } = BadgeShape.Circular; /// - /// Controls whether the input should be displayed as a dropdown (compact) or a list of radio buttons or checkboxes (expanded). + /// The style of the badge. /// [JsonPropertyName("style")] - public StyleEnum? Style { get; set; } - - /// - /// Controls whether multiple choices can be selected. - /// - [JsonPropertyName("isMultiSelect")] - public bool? IsMultiSelect { get; set; } - - /// - /// The text to display as a placeholder when the user has not entered any value. - /// - [JsonPropertyName("placeholder")] - public string? Placeholder { get; set; } - - /// - /// Controls if choice titles should wrap. - /// - [JsonPropertyName("wrap")] - public bool? Wrap { get; set; } - - /// - /// Controls whether choice items are arranged in multiple columns in expanded mode, or in a single column. Default is false. - /// - [JsonPropertyName("useMultipleColumns")] - public bool? UseMultipleColumns { get; set; } + public BadgeStyle? Style { get; set; } = BadgeStyle.Default; /// - /// 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. + /// Controls the tooltip text to display when the badge is hovered over. /// - [JsonPropertyName("minColumnWidth")] - public string? MinColumnWidth { get; set; } + [JsonPropertyName("tooltip")] + public string? Tooltip { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -8198,13 +10875,8 @@ public class ChoiceSetInput : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - public ChoiceSetInput(params IList choices) - { - this.Choices = choices; - } - /// - /// Serializes this ChoiceSetInput into a JSON string. + /// Serializes this Badge into a JSON string. /// public string Serialize() { @@ -8218,145 +10890,127 @@ public string Serialize() ); } - public ChoiceSetInput WithId(string value) + public Badge WithKey(string value) + { + this.Key = value; + return this; + } + + public Badge WithId(string value) { this.Id = value; return this; } - public ChoiceSetInput WithRequires(HostCapabilities value) + public Badge WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ChoiceSetInput WithLang(string value) + public Badge WithLang(string value) { this.Lang = value; return this; } - public ChoiceSetInput WithIsVisible(bool value) + public Badge WithIsVisible(bool value) { this.IsVisible = value; return this; } - public ChoiceSetInput WithSeparator(bool value) + public Badge WithSeparator(bool value) { this.Separator = value; return this; } - public ChoiceSetInput WithHeight(ElementHeight value) + public Badge WithHeight(ElementHeight value) { this.Height = value; return this; } - public ChoiceSetInput WithSpacing(Spacing value) - { - this.Spacing = value; - return this; - } - - public ChoiceSetInput WithTargetWidth(TargetWidth value) - { - this.TargetWidth = value; - return this; - } - - public ChoiceSetInput WithIsSortKey(bool value) - { - this.IsSortKey = value; - return this; - } - - public ChoiceSetInput WithLabel(string value) - { - this.Label = value; - return this; - } - - public ChoiceSetInput WithIsRequired(bool value) + public Badge WithHorizontalAlignment(HorizontalAlignment value) { - this.IsRequired = value; + this.HorizontalAlignment = value; return this; } - public ChoiceSetInput WithErrorMessage(string value) + public Badge WithSpacing(Spacing value) { - this.ErrorMessage = value; + this.Spacing = value; return this; } - public ChoiceSetInput WithValueChangedAction(ResetInputsAction value) + public Badge WithTargetWidth(TargetWidth value) { - this.ValueChangedAction = value; + this.TargetWidth = value; return this; } - public ChoiceSetInput WithValue(string value) + public Badge WithIsSortKey(bool value) { - this.Value = value; + this.IsSortKey = value; return this; } - public ChoiceSetInput WithChoices(params IList value) + public Badge WithText(string value) { - this.Choices = value; + this.Text = value; return this; } - public ChoiceSetInput WithChoicesData(QueryData value) + public Badge WithIcon(string value) { - this.ChoicesData = value; + this.Icon = value; return this; } - public ChoiceSetInput WithStyle(StyleEnum value) + public Badge WithIconPosition(BadgeIconPosition value) { - this.Style = value; + this.IconPosition = value; return this; } - public ChoiceSetInput WithIsMultiSelect(bool value) + public Badge WithAppearance(BadgeAppearance value) { - this.IsMultiSelect = value; + this.Appearance = value; return this; } - public ChoiceSetInput WithPlaceholder(string value) + public Badge WithSize(BadgeSize value) { - this.Placeholder = value; + this.Size = value; return this; } - public ChoiceSetInput WithWrap(bool value) + public Badge WithShape(BadgeShape value) { - this.Wrap = value; + this.Shape = value; return this; } - public ChoiceSetInput WithUseMultipleColumns(bool value) + public Badge WithStyle(BadgeStyle value) { - this.UseMultipleColumns = value; + this.Style = value; return this; } - public ChoiceSetInput WithMinColumnWidth(string value) + public Badge WithTooltip(string value) { - this.MinColumnWidth = value; + this.Tooltip = value; return this; } - public ChoiceSetInput WithGridArea(string value) + public Badge WithGridArea(string value) { this.GridArea = value; return this; } - public ChoiceSetInput WithFallback(IUnion value) + public Badge WithFallback(IUnion value) { this.Fallback = value; return this; @@ -8364,103 +11018,122 @@ public ChoiceSetInput WithFallback(IUnion value) } /// -/// A choice as used by the Input.ChoiceSet input. +/// A spinning ring element, to indicate progress. /// -public class Choice : SerializableObject +public class ProgressRing : CardElement { /// - /// Deserializes a JSON string into an object of type Choice. + /// Deserializes a JSON string into an object of type ProgressRing. /// - public static Choice? Deserialize(string json) + public static ProgressRing? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The text to display for the choice. + /// 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. /// - [JsonPropertyName("title")] - public string? Title { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The value associated with the choice, as sent to the Bot when an Action.Submit or Action.Execute is invoked + /// Must be **ProgressRing**. /// - [JsonPropertyName("value")] - public string? Value { get; set; } + [JsonPropertyName("type")] + public string Type { get; } = "ProgressRing"; /// - /// Serializes this Choice into a JSON string. + /// 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. /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } + [JsonPropertyName("id")] + public string? Id { get; set; } - public Choice WithTitle(string value) - { - this.Title = value; - return this; - } + /// + /// 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). + /// + [JsonPropertyName("requires")] + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); - public Choice WithValue(string value) - { - this.Value = value; - return this; - } -} + /// + /// The locale associated with the element. + /// + [JsonPropertyName("lang")] + public string? Lang { get; set; } -/// -/// Defines a query to dynamically fetch data from a Bot. -/// -public class QueryData : SerializableObject -{ /// - /// Deserializes a JSON string into an object of type QueryData. + /// Controls the visibility of the element. /// - public static QueryData? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } + [JsonPropertyName("isVisible")] + public bool? IsVisible { get; set; } = true; /// - /// Must be **Data.Query**. + /// 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. /// - [JsonPropertyName("type")] - public string Type { get; } = "Data.Query"; + [JsonPropertyName("separator")] + public bool? Separator { get; set; } = false; /// - /// The dataset from which to fetch the data. + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// - [JsonPropertyName("dataset")] - public string? Dataset { get; set; } + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// - /// Controls which inputs are associated with the Data.Query. When a Data.Query is executed, the values of the associated inputs are sent to the Bot, allowing it to perform filtering operations based on the user's input. + /// Controls how the element should be horizontally aligned. /// - [JsonPropertyName("associatedInputs")] - public AssociatedInputs? AssociatedInputs { get; set; } + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// - /// The maximum number of data items that should be returned 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. + /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// - [JsonPropertyName("count")] - public float? Count { get; set; } + [JsonPropertyName("spacing")] + public Spacing? Spacing { get; set; } = Spacing.Default; /// - /// 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. + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). /// - [JsonPropertyName("skip")] - public float? Skip { get; set; } + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } /// - /// Serializes this QueryData into a JSON string. + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; + + /// + /// The label of the progress ring. + /// + [JsonPropertyName("label")] + public string? Label { get; set; } + + /// + /// Controls the relative position of the label to the progress ring. + /// + [JsonPropertyName("labelPosition")] + public ProgressRingLabelPosition? LabelPosition { get; set; } = ProgressRingLabelPosition.Below; + + /// + /// The size of the progress ring. + /// + [JsonPropertyName("size")] + public ProgressRingSize? Size { get; set; } = ProgressRingSize.Medium; + + /// + /// The area of a Layout.AreaGrid layout in which an element should be displayed. + /// + [JsonPropertyName("grid.area")] + public string? GridArea { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + /// + /// Serializes this ProgressRing into a JSON string. /// public string Serialize() { @@ -8474,49 +11147,127 @@ public string Serialize() ); } - public QueryData WithDataset(string value) + public ProgressRing WithKey(string value) { - this.Dataset = value; + this.Key = value; return this; } - public QueryData WithAssociatedInputs(AssociatedInputs value) + public ProgressRing WithId(string value) { - this.AssociatedInputs = value; + this.Id = value; return this; } - public QueryData WithCount(float value) + public ProgressRing WithRequires(HostCapabilities value) { - this.Count = value; + this.Requires = value; return this; } - public QueryData WithSkip(float value) + public ProgressRing WithLang(string value) { - this.Skip = value; + this.Lang = value; + return this; + } + + public ProgressRing WithIsVisible(bool value) + { + this.IsVisible = value; + return this; + } + + public ProgressRing WithSeparator(bool value) + { + this.Separator = value; + return this; + } + + public ProgressRing WithHeight(ElementHeight value) + { + this.Height = value; + return this; + } + + public ProgressRing WithHorizontalAlignment(HorizontalAlignment value) + { + this.HorizontalAlignment = value; + return this; + } + + public ProgressRing WithSpacing(Spacing value) + { + this.Spacing = value; + return this; + } + + public ProgressRing WithTargetWidth(TargetWidth value) + { + this.TargetWidth = value; + return this; + } + + public ProgressRing WithIsSortKey(bool value) + { + this.IsSortKey = value; + return this; + } + + public ProgressRing WithLabel(string value) + { + this.Label = value; + return this; + } + + public ProgressRing WithLabelPosition(ProgressRingLabelPosition value) + { + this.LabelPosition = value; + return this; + } + + public ProgressRing WithSize(ProgressRingSize value) + { + this.Size = value; + return this; + } + + public ProgressRing WithGridArea(string value) + { + this.GridArea = value; + return this; + } + + public ProgressRing WithFallback(IUnion value) + { + this.Fallback = value; return this; } } /// -/// An input to allow the user to rate something using stars. +/// A progress bar element, to represent a value within a range. /// -public class RatingInput : CardElement +public class ProgressBar : CardElement { /// - /// Deserializes a JSON string into an object of type RatingInput. + /// Deserializes a JSON string into an object of type ProgressBar. /// - public static RatingInput? Deserialize(string json) + public static ProgressBar? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Input.Rating**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **ProgressBar**. /// [JsonPropertyName("type")] - public string Type { get; } = "Input.Rating"; + public string Type { get; } = "ProgressBar"; /// /// 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. @@ -8528,7 +11279,7 @@ public class RatingInput : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -8540,93 +11291,61 @@ public class RatingInput : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. - /// - [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } - - /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). - /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } - - /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. - /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The label of the input. - /// - /// A label should **always** be provided to ensure the best user experience especially for users of assistive technology. - /// - [JsonPropertyName("label")] - public string? Label { get; set; } - - /// - /// Controls whether the input is required. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. - /// - [JsonPropertyName("isRequired")] - public bool? IsRequired { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// - /// The error message to display when the input fails validation. See [Input validation](https://adaptivecards.microsoft.com/?topic=input-validation) for more details. + /// Controls how the element should be horizontally aligned. /// - [JsonPropertyName("errorMessage")] - public string? ErrorMessage { get; set; } + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// - /// An Action.ResetInputs action that will be executed when the value of the input changes. + /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// - [JsonPropertyName("valueChangedAction")] - public ResetInputsAction? ValueChangedAction { get; set; } + [JsonPropertyName("spacing")] + public Spacing? Spacing { get; set; } = Spacing.Default; /// - /// The default value of the input. + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). /// - [JsonPropertyName("value")] - public float? Value { get; set; } + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } /// - /// The number of stars to display. + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// - [JsonPropertyName("max")] - public float? Max { get; set; } + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; /// - /// Controls if the user can select half stars. + /// The value of the progress bar. Must be between 0 and max. /// - [JsonPropertyName("allowHalfSteps")] - public bool? AllowHalfSteps { get; set; } + [JsonPropertyName("value")] + public float? Value { get; set; } /// - /// The size of the stars. + /// The maximum value of the progress bar. /// - [JsonPropertyName("size")] - public RatingSize? Size { get; set; } + [JsonPropertyName("max")] + public float? Max { get; set; } = 100; /// - /// The color of the stars. + /// 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. /// [JsonPropertyName("color")] - public RatingColor? Color { get; set; } + public ProgressBarColor? Color { get; set; } = ProgressBarColor.Accent; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -8641,7 +11360,7 @@ public class RatingInput : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this RatingInput into a JSON string. + /// Serializes this ProgressBar into a JSON string. /// public string Serialize() { @@ -8655,121 +11374,97 @@ public string Serialize() ); } - public RatingInput WithId(string value) + public ProgressBar WithKey(string value) + { + this.Key = value; + return this; + } + + public ProgressBar WithId(string value) { this.Id = value; return this; } - public RatingInput WithRequires(HostCapabilities value) + public ProgressBar WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public RatingInput WithLang(string value) + public ProgressBar WithLang(string value) { this.Lang = value; return this; } - public RatingInput WithIsVisible(bool value) + public ProgressBar WithIsVisible(bool value) { this.IsVisible = value; return this; } - public RatingInput WithSeparator(bool value) + public ProgressBar WithSeparator(bool value) { this.Separator = value; return this; } - public RatingInput WithHeight(ElementHeight value) + public ProgressBar WithHeight(ElementHeight value) { this.Height = value; return this; } - public RatingInput WithSpacing(Spacing value) - { - this.Spacing = value; - return this; - } - - public RatingInput WithTargetWidth(TargetWidth value) - { - this.TargetWidth = value; - return this; - } - - public RatingInput WithIsSortKey(bool value) - { - this.IsSortKey = value; - return this; - } - - public RatingInput WithLabel(string value) + public ProgressBar WithHorizontalAlignment(HorizontalAlignment value) { - this.Label = value; + this.HorizontalAlignment = value; return this; } - public RatingInput WithIsRequired(bool value) + public ProgressBar WithSpacing(Spacing value) { - this.IsRequired = value; + this.Spacing = value; return this; } - public RatingInput WithErrorMessage(string value) + public ProgressBar WithTargetWidth(TargetWidth value) { - this.ErrorMessage = value; + this.TargetWidth = value; return this; } - public RatingInput WithValueChangedAction(ResetInputsAction value) + public ProgressBar WithIsSortKey(bool value) { - this.ValueChangedAction = value; + this.IsSortKey = value; return this; } - public RatingInput WithValue(float value) + public ProgressBar WithValue(float value) { this.Value = value; return this; } - public RatingInput WithMax(float value) + public ProgressBar WithMax(float value) { this.Max = value; return this; } - public RatingInput WithAllowHalfSteps(bool value) - { - this.AllowHalfSteps = value; - return this; - } - - public RatingInput WithSize(RatingSize value) - { - this.Size = value; - return this; - } - - public RatingInput WithColor(RatingColor value) + public ProgressBar WithColor(ProgressBarColor value) { this.Color = value; return this; } - public RatingInput WithGridArea(string value) + public ProgressBar WithGridArea(string value) { this.GridArea = value; return this; } - public RatingInput WithFallback(IUnion value) + public ProgressBar WithFallback(IUnion value) { this.Fallback = value; return this; @@ -8777,23 +11472,29 @@ public RatingInput WithFallback(IUnion value) } /// -/// A read-only star rating element, to display the rating of something. +/// A donut chart. /// -public class Rating : CardElement +public class DonutChart : CardElement { /// - /// Deserializes a JSON string into an object of type Rating. + /// Deserializes a JSON string into an object of type DonutChart. /// - public static Rating? Deserialize(string json) + public static DonutChart? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Rating**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Chart.Donut**. /// [JsonPropertyName("type")] - public string Type { get; } = "Rating"; + public string Type { get; } = "Chart.Donut"; /// /// 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. @@ -8805,7 +11506,7 @@ public class Rating : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -8817,19 +11518,19 @@ public class Rating : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -8841,7 +11542,7 @@ public class Rating : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -8853,43 +11554,67 @@ public class Rating : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The value of the rating. Must be between 0 and max. + /// The title of the chart. /// - [JsonPropertyName("value")] - public float? Value { get; set; } + [JsonPropertyName("title")] + public string? Title { get; set; } /// - /// The number of "votes" associated with the rating. + /// Controls whether the chart's title should be displayed. Defaults to `false`. /// - [JsonPropertyName("count")] - public float? Count { get; set; } + [JsonPropertyName("showTitle")] + public bool? ShowTitle { get; set; } = false; /// - /// The number of stars to display. + /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// - [JsonPropertyName("max")] - public float? Max { get; set; } + [JsonPropertyName("colorSet")] + public ChartColorSet? ColorSet { get; set; } /// - /// The size of the stars. + /// The maximum width, in pixels, of the chart, in the `px` format. /// - [JsonPropertyName("size")] - public RatingSize? Size { get; set; } + [JsonPropertyName("maxWidth")] + public string? MaxWidth { get; set; } /// - /// The color of the stars. + /// Controls whether the chart's legend should be displayed. /// - [JsonPropertyName("color")] - public RatingColor? Color { get; set; } + [JsonPropertyName("showLegend")] + public bool? ShowLegend { get; set; } = true; /// - /// The style of the stars. + /// The data to display in the chart. /// - [JsonPropertyName("style")] - public RatingStyle? Style { get; set; } + [JsonPropertyName("data")] + public IList? Data { get; set; } + + /// + /// The value that should be displayed in the center of a Donut chart. `value` is ignored for Pie charts. + /// + [JsonPropertyName("value")] + public string? Value { get; set; } + + /// + /// Controls the color of the value displayed in the center of a Donut chart. + /// + [JsonPropertyName("valueColor")] + public ChartColor? ValueColor { get; set; } + + /// + /// Controls the thickness of the donut segments. Default is **Thick**. + /// + [JsonPropertyName("thickness")] + public DonutThickness? Thickness { get; set; } + + /// + /// Controls whether the outlines of the donut segments are displayed. + /// + [JsonPropertyName("showOutlines")] + public bool? ShowOutlines { get; set; } = true; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -8904,7 +11629,7 @@ public class Rating : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this Rating into a JSON string. + /// Serializes this DonutChart into a JSON string. /// public string Serialize() { @@ -8918,133 +11643,252 @@ public string Serialize() ); } - public Rating WithId(string value) + public DonutChart WithKey(string value) + { + this.Key = value; + return this; + } + + public DonutChart WithId(string value) { this.Id = value; return this; } - public Rating WithRequires(HostCapabilities value) + public DonutChart WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public Rating WithLang(string value) + public DonutChart WithLang(string value) { this.Lang = value; return this; } - public Rating WithIsVisible(bool value) + public DonutChart WithIsVisible(bool value) { this.IsVisible = value; return this; } - public Rating WithSeparator(bool value) + public DonutChart WithSeparator(bool value) { this.Separator = value; return this; } - public Rating WithHeight(ElementHeight value) + public DonutChart WithHeight(ElementHeight value) { this.Height = value; return this; } - public Rating WithHorizontalAlignment(HorizontalAlignment value) + public DonutChart WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public Rating WithSpacing(Spacing value) + public DonutChart WithSpacing(Spacing value) { this.Spacing = value; return this; } - public Rating WithTargetWidth(TargetWidth value) + public DonutChart WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public Rating WithIsSortKey(bool value) + public DonutChart WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public Rating WithValue(float value) + public DonutChart WithTitle(string value) + { + this.Title = value; + return this; + } + + public DonutChart WithShowTitle(bool value) + { + this.ShowTitle = value; + return this; + } + + public DonutChart WithColorSet(ChartColorSet value) + { + this.ColorSet = value; + return this; + } + + public DonutChart WithMaxWidth(string value) + { + this.MaxWidth = value; + return this; + } + + public DonutChart WithShowLegend(bool value) + { + this.ShowLegend = value; + return this; + } + + public DonutChart WithData(params DonutChartData[] value) + { + this.Data = new List(value); + return this; + } + + public DonutChart WithData(IList value) + { + this.Data = value; + return this; + } + + public DonutChart WithValue(string value) { this.Value = value; return this; } - public Rating WithCount(float value) + public DonutChart WithValueColor(ChartColor value) { - this.Count = value; + this.ValueColor = value; return this; } - public Rating WithMax(float value) + public DonutChart WithThickness(DonutThickness value) { - this.Max = value; + this.Thickness = value; return this; } - public Rating WithSize(RatingSize value) + public DonutChart WithShowOutlines(bool value) { - this.Size = value; + this.ShowOutlines = value; + return this; + } + + public DonutChart WithGridArea(string value) + { + this.GridArea = value; + return this; + } + + public DonutChart WithFallback(IUnion value) + { + this.Fallback = value; return this; } +} + +/// +/// A data point in a Donut chart. +/// +public class DonutChartData : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type DonutChartData. + /// + public static DonutChartData? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The legend of the chart. + /// + [JsonPropertyName("legend")] + public string? Legend { get; set; } + + /// + /// The value associated with the data point. + /// + [JsonPropertyName("value")] + public float? Value { get; set; } = 0; + + /// + /// The color to use for the data point. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// + [JsonPropertyName("color")] + public ChartColor? Color { get; set; } + + /// + /// Serializes this DonutChartData into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } - public Rating WithColor(RatingColor value) + public DonutChartData WithKey(string value) { - this.Color = value; + this.Key = value; return this; } - public Rating WithStyle(RatingStyle value) + public DonutChartData WithLegend(string value) { - this.Style = value; + this.Legend = value; return this; } - public Rating WithGridArea(string value) + public DonutChartData WithValue(float value) { - this.GridArea = value; + this.Value = value; return this; } - public Rating WithFallback(IUnion value) + public DonutChartData WithColor(ChartColor value) { - this.Fallback = value; + this.Color = value; return this; } } /// -/// A special type of button with an icon, title and description. +/// A pie chart. /// -public class CompoundButton : CardElement +public class PieChart : CardElement { /// - /// Deserializes a JSON string into an object of type CompoundButton. + /// Deserializes a JSON string into an object of type PieChart. /// - public static CompoundButton? Deserialize(string json) + public static PieChart? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **CompoundButton**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Chart.Pie**. /// [JsonPropertyName("type")] - public string Type { get; } = "CompoundButton"; + public string Type { get; } = "Chart.Pie"; /// /// 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. @@ -9056,7 +11900,7 @@ public class CompoundButton : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -9068,19 +11912,19 @@ public class CompoundButton : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -9092,7 +11936,7 @@ public class CompoundButton : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -9104,37 +11948,67 @@ public class CompoundButton : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The icon to show on the button. + /// The title of the chart. /// - [JsonPropertyName("icon")] - public IconInfo? Icon { get; set; } + [JsonPropertyName("title")] + public string? Title { get; set; } /// - /// The badge to show on the button. + /// Controls whether the chart's title should be displayed. Defaults to `false`. /// - [JsonPropertyName("badge")] - public string? Badge { get; set; } + [JsonPropertyName("showTitle")] + public bool? ShowTitle { get; set; } = false; /// - /// The title of the button. + /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// - [JsonPropertyName("title")] - public string? Title { get; set; } + [JsonPropertyName("colorSet")] + public ChartColorSet? ColorSet { get; set; } /// - /// The description text of the button. + /// The maximum width, in pixels, of the chart, in the `px` format. /// - [JsonPropertyName("description")] - public string? Description { get; set; } + [JsonPropertyName("maxWidth")] + public string? MaxWidth { get; set; } /// - /// An Action that will be invoked when the button is tapped or clicked. Action.ShowCard is not supported. + /// Controls whether the chart's legend should be displayed. /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } + [JsonPropertyName("showLegend")] + public bool? ShowLegend { get; set; } = true; + + /// + /// The data to display in the chart. + /// + [JsonPropertyName("data")] + public IList? Data { get; set; } + + /// + /// The value that should be displayed in the center of a Donut chart. `value` is ignored for Pie charts. + /// + [JsonPropertyName("value")] + public string? Value { get; set; } + + /// + /// Controls the color of the value displayed in the center of a Donut chart. + /// + [JsonPropertyName("valueColor")] + public ChartColor? ValueColor { get; set; } + + /// + /// Controls the thickness of the donut segments. Default is **Thick**. + /// + [JsonPropertyName("thickness")] + public DonutThickness? Thickness { get; set; } + + /// + /// Controls whether the outlines of the donut segments are displayed. + /// + [JsonPropertyName("showOutlines")] + public bool? ShowOutlines { get; set; } = true; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -9149,7 +12023,7 @@ public class CompoundButton : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this CompoundButton into a JSON string. + /// Serializes this PieChart into a JSON string. /// public string Serialize() { @@ -9163,204 +12037,175 @@ public string Serialize() ); } - public CompoundButton WithId(string value) + public PieChart WithKey(string value) + { + this.Key = value; + return this; + } + + public PieChart WithId(string value) { this.Id = value; return this; } - public CompoundButton WithRequires(HostCapabilities value) + public PieChart WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public CompoundButton WithLang(string value) + public PieChart WithLang(string value) { this.Lang = value; return this; } - public CompoundButton WithIsVisible(bool value) + public PieChart WithIsVisible(bool value) { this.IsVisible = value; return this; } - public CompoundButton WithSeparator(bool value) + public PieChart WithSeparator(bool value) { this.Separator = value; return this; } - public CompoundButton WithHeight(ElementHeight value) + public PieChart WithHeight(ElementHeight value) { this.Height = value; return this; } - public CompoundButton WithHorizontalAlignment(HorizontalAlignment value) + public PieChart WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public CompoundButton WithSpacing(Spacing value) + public PieChart WithSpacing(Spacing value) { this.Spacing = value; return this; } - public CompoundButton WithTargetWidth(TargetWidth value) + public PieChart WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public CompoundButton WithIsSortKey(bool value) + public PieChart WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public CompoundButton WithIcon(IconInfo value) + public PieChart WithTitle(string value) { - this.Icon = value; + this.Title = value; return this; } - public CompoundButton WithBadge(string value) + public PieChart WithShowTitle(bool value) { - this.Badge = value; + this.ShowTitle = value; return this; } - public CompoundButton WithTitle(string value) + public PieChart WithColorSet(ChartColorSet value) { - this.Title = value; + this.ColorSet = value; return this; } - public CompoundButton WithDescription(string value) + public PieChart WithMaxWidth(string value) { - this.Description = value; + this.MaxWidth = value; return this; } - public CompoundButton WithSelectAction(Action value) + public PieChart WithShowLegend(bool value) { - this.SelectAction = value; + this.ShowLegend = value; return this; } - public CompoundButton WithGridArea(string value) + public PieChart WithData(params DonutChartData[] value) { - this.GridArea = value; + this.Data = new List(value); return this; } - public CompoundButton WithFallback(IUnion value) + public PieChart WithData(IList value) { - this.Fallback = value; + this.Data = value; return this; } -} -/// -/// Defines information about a Fluent icon and how it should be rendered. -/// -public class IconInfo : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type IconInfo. - /// - public static IconInfo? Deserialize(string json) + public PieChart WithValue(string value) { - return JsonSerializer.Deserialize(json); + this.Value = value; + return this; } - /// - /// The name of the icon to display. - /// - [JsonPropertyName("name")] - public string? Name { get; set; } - - /// - /// The size of the icon. - /// - [JsonPropertyName("size")] - public IconSize? Size { get; set; } - - /// - /// The style of the icon. - /// - [JsonPropertyName("style")] - public IconStyle? Style { get; set; } - - /// - /// The color of the icon. - /// - [JsonPropertyName("color")] - public TextColor? Color { get; set; } - - /// - /// Serializes this IconInfo into a JSON string. - /// - public string Serialize() + public PieChart WithValueColor(ChartColor value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.ValueColor = value; + return this; } - public IconInfo WithName(string value) + public PieChart WithThickness(DonutThickness value) { - this.Name = value; + this.Thickness = value; return this; } - public IconInfo WithSize(IconSize value) + public PieChart WithShowOutlines(bool value) { - this.Size = value; + this.ShowOutlines = value; return this; } - public IconInfo WithStyle(IconStyle value) + public PieChart WithGridArea(string value) { - this.Style = value; + this.GridArea = value; return this; } - public IconInfo WithColor(TextColor value) + public PieChart WithFallback(IUnion value) { - this.Color = value; + this.Fallback = value; return this; } } /// -/// A standalone icon element. Icons can be picked from the vast [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog). +/// A grouped vertical bar chart. /// -public class Icon : CardElement +public class GroupedVerticalBarChart : CardElement { /// - /// Deserializes a JSON string into an object of type Icon. + /// Deserializes a JSON string into an object of type GroupedVerticalBarChart. /// - public static Icon? Deserialize(string json) + public static GroupedVerticalBarChart? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Icon**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Chart.VerticalBar.Grouped**. /// [JsonPropertyName("type")] - public string Type { get; } = "Icon"; + public string Type { get; } = "Chart.VerticalBar.Grouped"; /// /// 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. @@ -9372,7 +12217,7 @@ public class Icon : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -9384,13 +12229,19 @@ public class Icon : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; + + /// + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -9402,7 +12253,7 @@ public class Icon : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -9414,37 +12265,91 @@ public class Icon : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The name of the icon to display. + /// The title of the chart. /// - [JsonPropertyName("name")] - public string? Name { get; set; } + [JsonPropertyName("title")] + public string? Title { get; set; } /// - /// The size of the icon. + /// Controls whether the chart's title should be displayed. Defaults to `false`. /// - [JsonPropertyName("size")] - public IconSize? Size { get; set; } + [JsonPropertyName("showTitle")] + public bool? ShowTitle { get; set; } = false; /// - /// The style of the icon. + /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// + [JsonPropertyName("colorSet")] + public ChartColorSet? ColorSet { get; set; } + + /// + /// The maximum width, in pixels, of the chart, in the `px` format. + /// + [JsonPropertyName("maxWidth")] + public string? MaxWidth { get; set; } + + /// + /// Controls whether the chart's legend should be displayed. + /// + [JsonPropertyName("showLegend")] + public bool? ShowLegend { get; set; } = true; + + /// + /// The title of the x axis. + /// + [JsonPropertyName("xAxisTitle")] + public string? XAxisTitle { get; set; } + + /// + /// The title of the y axis. + /// + [JsonPropertyName("yAxisTitle")] + public string? YAxisTitle { get; set; } + + /// + /// The color to use for all data points. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// + [JsonPropertyName("color")] + public ChartColor? Color { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("stacked")] + public bool? Stacked { get; set; } = false; + + /// + /// The data points in a series. + /// + [JsonPropertyName("data")] + public IList? Data { get; set; } + + /// + /// Controls if values should be displayed on each bar. /// - [JsonPropertyName("style")] - public IconStyle? Style { get; set; } + [JsonPropertyName("showBarValues")] + public bool? ShowBarValues { get; set; } = false; /// - /// The color of the icon. + /// 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`. /// - [JsonPropertyName("color")] - public TextColor? Color { get; set; } + [JsonPropertyName("yMin")] + public float? YMin { get; set; } /// - /// An Action that will be invoked when the icon is tapped or clicked. Action.ShowCard is not supported. + /// 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`. /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } + [JsonPropertyName("yMax")] + public float? YMax { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -9458,13 +12363,8 @@ public class Icon : CardElement [JsonPropertyName("fallback")] public IUnion? Fallback { get; set; } - public Icon(string name) - { - this.Name = name; - } - /// - /// Serializes this Icon into a JSON string. + /// Serializes this GroupedVerticalBarChart into a JSON string. /// public string Serialize() { @@ -9478,214 +12378,208 @@ public string Serialize() ); } - public Icon WithId(string value) + public GroupedVerticalBarChart WithKey(string value) + { + this.Key = value; + return this; + } + + public GroupedVerticalBarChart WithId(string value) { this.Id = value; return this; } - public Icon WithRequires(HostCapabilities value) + public GroupedVerticalBarChart WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public Icon WithLang(string value) + public GroupedVerticalBarChart WithLang(string value) { this.Lang = value; return this; } - public Icon WithIsVisible(bool value) + public GroupedVerticalBarChart WithIsVisible(bool value) { this.IsVisible = value; return this; } - public Icon WithSeparator(bool value) + public GroupedVerticalBarChart WithSeparator(bool value) { this.Separator = value; return this; } - public Icon WithHorizontalAlignment(HorizontalAlignment value) + public GroupedVerticalBarChart WithHeight(ElementHeight value) + { + this.Height = value; + return this; + } + + public GroupedVerticalBarChart WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public Icon WithSpacing(Spacing value) + public GroupedVerticalBarChart WithSpacing(Spacing value) { this.Spacing = value; return this; } - public Icon WithTargetWidth(TargetWidth value) + public GroupedVerticalBarChart WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public Icon WithIsSortKey(bool value) + public GroupedVerticalBarChart WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public Icon WithName(string value) + public GroupedVerticalBarChart WithTitle(string value) { - this.Name = value; + this.Title = value; return this; } - public Icon WithSize(IconSize value) + public GroupedVerticalBarChart WithShowTitle(bool value) { - this.Size = value; + this.ShowTitle = value; return this; } - public Icon WithStyle(IconStyle value) + public GroupedVerticalBarChart WithColorSet(ChartColorSet value) { - this.Style = value; + this.ColorSet = value; return this; } - public Icon WithColor(TextColor value) + public GroupedVerticalBarChart WithMaxWidth(string value) { - this.Color = value; + this.MaxWidth = value; return this; } - public Icon WithSelectAction(Action value) + public GroupedVerticalBarChart WithShowLegend(bool value) { - this.SelectAction = value; + this.ShowLegend = value; return this; } - public Icon WithGridArea(string value) + public GroupedVerticalBarChart WithXAxisTitle(string value) { - this.GridArea = value; + this.XAxisTitle = value; return this; } - public Icon WithFallback(IUnion value) + public GroupedVerticalBarChart WithYAxisTitle(string value) { - this.Fallback = value; + this.YAxisTitle = value; return this; } -} -/// -/// A carousel with sliding pages. -/// -public class Carousel : CardElement -{ - /// - /// Deserializes a JSON string into an object of type Carousel. - /// - public static Carousel? Deserialize(string json) + public GroupedVerticalBarChart WithColor(ChartColor value) { - return JsonSerializer.Deserialize(json); + this.Color = value; + return this; } - /// - /// Must be **Carousel**. - /// - [JsonPropertyName("type")] - public string Type { get; } = "Carousel"; - - /// - /// 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. - /// - [JsonPropertyName("id")] - public string? Id { get; set; } - - /// - /// 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). - /// - [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } - - /// - /// The locale associated with the element. - /// - [JsonPropertyName("lang")] - public string? Lang { get; set; } + public GroupedVerticalBarChart WithStacked(bool value) + { + this.Stacked = value; + return this; + } - /// - /// Controls the visibility of the element. - /// - [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public GroupedVerticalBarChart WithData(params GroupedVerticalBarChartData[] value) + { + this.Data = new List(value); + return this; + } - /// - /// 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. - /// - [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public GroupedVerticalBarChart WithData(IList value) + { + this.Data = value; + return this; + } - /// - /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. - /// - [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public GroupedVerticalBarChart WithShowBarValues(bool value) + { + this.ShowBarValues = value; + return this; + } - /// - /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. - /// - [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public GroupedVerticalBarChart WithYMin(float value) + { + this.YMin = value; + return this; + } - /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). - /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } + public GroupedVerticalBarChart WithYMax(float value) + { + this.YMax = value; + return this; + } - /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. - /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public GroupedVerticalBarChart WithGridArea(string value) + { + this.GridArea = value; + return this; + } - /// - /// Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. - /// - [JsonPropertyName("bleed")] - public bool? Bleed { get; set; } + public GroupedVerticalBarChart WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } +} +/// +/// Represents a series of data points. +/// +public class GroupedVerticalBarChartData : SerializableObject +{ /// - /// The minimum height, in pixels, of the container, in the `px` format. + /// Deserializes a JSON string into an object of type GroupedVerticalBarChartData. /// - [JsonPropertyName("minHeight")] - public string? MinHeight { get; set; } + public static GroupedVerticalBarChartData? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } /// - /// Controls the type of animation to use to navigate between pages. + /// 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. /// - [JsonPropertyName("pageAnimation")] - public CarouselPageAnimation? PageAnimation { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The area of a Layout.AreaGrid layout in which an element should be displayed. + /// The legend of the chart. /// - [JsonPropertyName("grid.area")] - public string? GridArea { get; set; } + [JsonPropertyName("legend")] + public string? Legend { get; set; } /// - /// 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. + /// The data points in the series. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + [JsonPropertyName("values")] + public IList? Values { get; set; } /// - /// The pages in the carousel. + /// The color to use for all data points in the series. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// - [JsonPropertyName("pages")] - public IList? Pages { get; set; } + [JsonPropertyName("color")] + public ChartColor? Color { get; set; } /// - /// Serializes this Carousel into a JSON string. + /// Serializes this GroupedVerticalBarChartData into a JSON string. /// public string Serialize() { @@ -9699,115 +12593,126 @@ public string Serialize() ); } - public Carousel WithId(string value) - { - this.Id = value; - return this; - } - - public Carousel WithRequires(HostCapabilities value) - { - this.Requires = value; - return this; - } - - public Carousel WithLang(string value) - { - this.Lang = value; - return this; - } - - public Carousel WithIsVisible(bool value) - { - this.IsVisible = value; - return this; - } - - public Carousel WithSeparator(bool value) - { - this.Separator = value; - return this; - } - - public Carousel WithHeight(ElementHeight value) + public GroupedVerticalBarChartData WithKey(string value) { - this.Height = value; + this.Key = value; return this; } - public Carousel WithSpacing(Spacing value) + public GroupedVerticalBarChartData WithLegend(string value) { - this.Spacing = value; + this.Legend = value; return this; } - public Carousel WithTargetWidth(TargetWidth value) + public GroupedVerticalBarChartData WithValues(params BarChartDataValue[] value) { - this.TargetWidth = value; + this.Values = new List(value); return this; } - public Carousel WithIsSortKey(bool value) + public GroupedVerticalBarChartData WithValues(IList value) { - this.IsSortKey = value; + this.Values = value; return this; } - public Carousel WithBleed(bool value) + public GroupedVerticalBarChartData WithColor(ChartColor value) { - this.Bleed = value; + this.Color = value; return this; } +} - public Carousel WithMinHeight(string value) +/// +/// A single data point in a bar chart. +/// +public class BarChartDataValue : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type BarChartDataValue. + /// + public static BarChartDataValue? Deserialize(string json) { - this.MinHeight = value; - return this; + return JsonSerializer.Deserialize(json); } - public Carousel WithPageAnimation(CarouselPageAnimation value) + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The x axis value of the data point. + /// + [JsonPropertyName("x")] + public string? X { get; set; } + + /// + /// The y axis value of the data point. + /// + [JsonPropertyName("y")] + public float? Y { get; set; } = 0; + + /// + /// Serializes this BarChartDataValue into a JSON string. + /// + public string Serialize() { - this.PageAnimation = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public Carousel WithGridArea(string value) + public BarChartDataValue WithKey(string value) { - this.GridArea = value; + this.Key = value; return this; } - public Carousel WithFallback(IUnion value) + public BarChartDataValue WithX(string value) { - this.Fallback = value; + this.X = value; return this; } - public Carousel WithPages(params IList value) + public BarChartDataValue WithY(float value) { - this.Pages = value; + this.Y = value; return this; } } /// -/// A badge element to show an icon and/or text in a compact form over a colored background. +/// A vertical bar chart. /// -public class Badge : CardElement +public class VerticalBarChart : CardElement { /// - /// Deserializes a JSON string into an object of type Badge. + /// Deserializes a JSON string into an object of type VerticalBarChart. /// - public static Badge? Deserialize(string json) + public static VerticalBarChart? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Badge**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Chart.VerticalBar**. /// [JsonPropertyName("type")] - public string Type { get; } = "Badge"; + public string Type { get; } = "Chart.VerticalBar"; /// /// 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. @@ -9819,7 +12724,7 @@ public class Badge : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -9831,19 +12736,19 @@ public class Badge : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -9855,7 +12760,7 @@ public class Badge : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -9867,55 +12772,79 @@ public class Badge : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The text to display. + /// The title of the chart. /// - [JsonPropertyName("text")] - public string? Text { get; set; } + [JsonPropertyName("title")] + public string? Title { get; set; } /// - /// The name of an icon from the [Adaptive Card icon catalog](https://adaptivecards.microsoft.com/?topic=icon-catalog) to display, in the `[,regular|filled]` format. If the style is not specified, the regular style is used. + /// Controls whether the chart's title should be displayed. Defaults to `false`. /// - [JsonPropertyName("icon")] - public string? Icon { get; set; } + [JsonPropertyName("showTitle")] + public bool? ShowTitle { get; set; } = false; /// - /// Controls the position of the icon. + /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// - [JsonPropertyName("iconPosition")] - public BadgeIconPosition? IconPosition { get; set; } + [JsonPropertyName("colorSet")] + public ChartColorSet? ColorSet { get; set; } /// - /// Controls the strength of the background color. + /// The maximum width, in pixels, of the chart, in the `px` format. /// - [JsonPropertyName("appearance")] - public BadgeAppearance? Appearance { get; set; } + [JsonPropertyName("maxWidth")] + public string? MaxWidth { get; set; } /// - /// The size of the badge. + /// Controls whether the chart's legend should be displayed. /// - [JsonPropertyName("size")] - public BadgeSize? Size { get; set; } + [JsonPropertyName("showLegend")] + public bool? ShowLegend { get; set; } = true; /// - /// Controls the shape of the badge. + /// The title of the x axis. /// - [JsonPropertyName("shape")] - public BadgeShape? Shape { get; set; } + [JsonPropertyName("xAxisTitle")] + public string? XAxisTitle { get; set; } /// - /// The style of the badge. + /// The title of the y axis. /// - [JsonPropertyName("style")] - public BadgeStyle? Style { get; set; } + [JsonPropertyName("yAxisTitle")] + public string? YAxisTitle { get; set; } /// - /// Controls the tooltip text to display when the badge is hovered over. + /// The data to display in the chart. /// - [JsonPropertyName("tooltip")] - public string? Tooltip { get; set; } + [JsonPropertyName("data")] + public IList? Data { get; set; } + + /// + /// The color to use for all data points. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// + [JsonPropertyName("color")] + public ChartColor? Color { get; set; } + + /// + /// Controls if the bar values should be displayed. + /// + [JsonPropertyName("showBarValues")] + public bool? ShowBarValues { get; set; } = false; + + /// + /// The requested minimum for the Y axis range. The value used at runtime may be different to optimize visual presentation. + /// + [JsonPropertyName("yMin")] + public float? YMin { get; set; } + + /// + /// The requested maximum for the Y axis range. The value used at runtime may be different to optimize visual presentation. + /// + [JsonPropertyName("yMax")] + public float? YMax { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -9930,7 +12859,7 @@ public class Badge : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this Badge into a JSON string. + /// Serializes this VerticalBarChart into a JSON string. /// public string Serialize() { @@ -9944,145 +12873,264 @@ public string Serialize() ); } - public Badge WithId(string value) + public VerticalBarChart WithKey(string value) + { + this.Key = value; + return this; + } + + public VerticalBarChart WithId(string value) { this.Id = value; return this; } - public Badge WithRequires(HostCapabilities value) + public VerticalBarChart WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public Badge WithLang(string value) + public VerticalBarChart WithLang(string value) { this.Lang = value; return this; } - public Badge WithIsVisible(bool value) + public VerticalBarChart WithIsVisible(bool value) { this.IsVisible = value; return this; } - public Badge WithSeparator(bool value) + public VerticalBarChart WithSeparator(bool value) { this.Separator = value; return this; } - public Badge WithHeight(ElementHeight value) + public VerticalBarChart WithHeight(ElementHeight value) { this.Height = value; return this; } - public Badge WithHorizontalAlignment(HorizontalAlignment value) + public VerticalBarChart WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public Badge WithSpacing(Spacing value) + public VerticalBarChart WithSpacing(Spacing value) { this.Spacing = value; return this; } - public Badge WithTargetWidth(TargetWidth value) + public VerticalBarChart WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public Badge WithIsSortKey(bool value) + public VerticalBarChart WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public Badge WithText(string value) + public VerticalBarChart WithTitle(string value) { - this.Text = value; + this.Title = value; return this; } - public Badge WithIcon(string value) + public VerticalBarChart WithShowTitle(bool value) { - this.Icon = value; + this.ShowTitle = value; return this; } - public Badge WithIconPosition(BadgeIconPosition value) + public VerticalBarChart WithColorSet(ChartColorSet value) { - this.IconPosition = value; + this.ColorSet = value; return this; } - public Badge WithAppearance(BadgeAppearance value) + public VerticalBarChart WithMaxWidth(string value) { - this.Appearance = value; + this.MaxWidth = value; + return this; + } + + public VerticalBarChart WithShowLegend(bool value) + { + this.ShowLegend = value; + return this; + } + + public VerticalBarChart WithXAxisTitle(string value) + { + this.XAxisTitle = value; + return this; + } + + public VerticalBarChart WithYAxisTitle(string value) + { + this.YAxisTitle = value; + return this; + } + + public VerticalBarChart WithData(params VerticalBarChartDataValue[] value) + { + this.Data = new List(value); + return this; + } + + public VerticalBarChart WithData(IList value) + { + this.Data = value; + return this; + } + + public VerticalBarChart WithColor(ChartColor value) + { + this.Color = value; + return this; + } + + public VerticalBarChart WithShowBarValues(bool value) + { + this.ShowBarValues = value; + return this; + } + + public VerticalBarChart WithYMin(float value) + { + this.YMin = value; + return this; + } + + public VerticalBarChart WithYMax(float value) + { + this.YMax = value; + return this; + } + + public VerticalBarChart WithGridArea(string value) + { + this.GridArea = value; return this; } - public Badge WithSize(BadgeSize value) - { - this.Size = value; - return this; - } + public VerticalBarChart WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } +} + +/// +/// Represents a data point in a vertical bar chart. +/// +public class VerticalBarChartDataValue : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type VerticalBarChartDataValue. + /// + public static VerticalBarChartDataValue? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The x axis value of the data point. + /// + [JsonPropertyName("x")] + public IUnion? X { get; set; } + + /// + /// The y axis value of the data point. + /// + [JsonPropertyName("y")] + public float? Y { get; set; } = 0; + + /// + /// The color to use for the bar associated with the data point. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// + [JsonPropertyName("color")] + public ChartColor? Color { get; set; } - public Badge WithShape(BadgeShape value) + /// + /// Serializes this VerticalBarChartDataValue into a JSON string. + /// + public string Serialize() { - this.Shape = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public Badge WithStyle(BadgeStyle value) + public VerticalBarChartDataValue WithKey(string value) { - this.Style = value; + this.Key = value; return this; } - public Badge WithTooltip(string value) + public VerticalBarChartDataValue WithX(IUnion value) { - this.Tooltip = value; + this.X = value; return this; } - public Badge WithGridArea(string value) + public VerticalBarChartDataValue WithY(float value) { - this.GridArea = value; + this.Y = value; return this; } - public Badge WithFallback(IUnion value) + public VerticalBarChartDataValue WithColor(ChartColor value) { - this.Fallback = value; + this.Color = value; return this; } } /// -/// A donut chart. +/// A horizontal bar chart. /// -public class DonutChart : CardElement +public class HorizontalBarChart : CardElement { /// - /// Deserializes a JSON string into an object of type DonutChart. + /// Deserializes a JSON string into an object of type HorizontalBarChart. /// - public static DonutChart? Deserialize(string json) + public static HorizontalBarChart? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Chart.Donut**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Chart.HorizontalBar**. /// [JsonPropertyName("type")] - public string Type { get; } = "Chart.Donut"; + public string Type { get; } = "Chart.HorizontalBar"; /// /// 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. @@ -10094,7 +13142,7 @@ public class DonutChart : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -10106,19 +13154,19 @@ public class DonutChart : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -10130,7 +13178,7 @@ public class DonutChart : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -10142,7 +13190,7 @@ public class DonutChart : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// /// The title of the chart. @@ -10150,6 +13198,12 @@ public class DonutChart : CardElement [JsonPropertyName("title")] public string? Title { get; set; } + /// + /// Controls whether the chart's title should be displayed. Defaults to `false`. + /// + [JsonPropertyName("showTitle")] + public bool? ShowTitle { get; set; } = false; + /// /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// @@ -10157,10 +13211,46 @@ public class DonutChart : CardElement public ChartColorSet? ColorSet { get; set; } /// - /// The data to display in the chart. + /// The maximum width, in pixels, of the chart, in the `px` format. + /// + [JsonPropertyName("maxWidth")] + public string? MaxWidth { get; set; } + + /// + /// Controls whether the chart's legend should be displayed. + /// + [JsonPropertyName("showLegend")] + public bool? ShowLegend { get; set; } = true; + + /// + /// The title of the x axis. + /// + [JsonPropertyName("xAxisTitle")] + public string? XAxisTitle { get; set; } + + /// + /// The title of the y axis. + /// + [JsonPropertyName("yAxisTitle")] + public string? YAxisTitle { get; set; } + + /// + /// The color to use for all data points. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// + [JsonPropertyName("color")] + public ChartColor? Color { get; set; } + + /// + /// The data points in the chart. /// [JsonPropertyName("data")] - public IList? Data { get; set; } + public IList? Data { get; set; } + + /// + /// Controls how the chart should be visually laid out. + /// + [JsonPropertyName("displayMode")] + public HorizontalBarChartDisplayMode? DisplayMode { get; set; } = HorizontalBarChartDisplayMode.AbsoluteWithAxis; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -10175,7 +13265,7 @@ public class DonutChart : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this DonutChart into a JSON string. + /// Serializes this HorizontalBarChart into a JSON string. /// public string Serialize() { @@ -10189,91 +13279,145 @@ public string Serialize() ); } - public DonutChart WithId(string value) + public HorizontalBarChart WithKey(string value) + { + this.Key = value; + return this; + } + + public HorizontalBarChart WithId(string value) { this.Id = value; return this; } - public DonutChart WithRequires(HostCapabilities value) + public HorizontalBarChart WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public DonutChart WithLang(string value) + public HorizontalBarChart WithLang(string value) { this.Lang = value; return this; } - public DonutChart WithIsVisible(bool value) + public HorizontalBarChart WithIsVisible(bool value) { this.IsVisible = value; return this; } - public DonutChart WithSeparator(bool value) + public HorizontalBarChart WithSeparator(bool value) { this.Separator = value; return this; } - public DonutChart WithHeight(ElementHeight value) + public HorizontalBarChart WithHeight(ElementHeight value) { this.Height = value; return this; } - public DonutChart WithHorizontalAlignment(HorizontalAlignment value) + public HorizontalBarChart WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public DonutChart WithSpacing(Spacing value) + public HorizontalBarChart WithSpacing(Spacing value) { this.Spacing = value; return this; } - public DonutChart WithTargetWidth(TargetWidth value) + public HorizontalBarChart WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public DonutChart WithIsSortKey(bool value) + public HorizontalBarChart WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public DonutChart WithTitle(string value) + public HorizontalBarChart WithTitle(string value) { this.Title = value; return this; } - public DonutChart WithColorSet(ChartColorSet value) + public HorizontalBarChart WithShowTitle(bool value) + { + this.ShowTitle = value; + return this; + } + + public HorizontalBarChart WithColorSet(ChartColorSet value) { this.ColorSet = value; return this; } - public DonutChart WithData(params IList value) + public HorizontalBarChart WithMaxWidth(string value) + { + this.MaxWidth = value; + return this; + } + + public HorizontalBarChart WithShowLegend(bool value) + { + this.ShowLegend = value; + return this; + } + + public HorizontalBarChart WithXAxisTitle(string value) + { + this.XAxisTitle = value; + return this; + } + + public HorizontalBarChart WithYAxisTitle(string value) + { + this.YAxisTitle = value; + return this; + } + + public HorizontalBarChart WithColor(ChartColor value) + { + this.Color = value; + return this; + } + + public HorizontalBarChart WithData(params HorizontalBarChartDataValue[] value) + { + this.Data = new List(value); + return this; + } + + public HorizontalBarChart WithData(IList value) { this.Data = value; return this; } - public DonutChart WithGridArea(string value) + public HorizontalBarChart WithDisplayMode(HorizontalBarChartDisplayMode value) + { + this.DisplayMode = value; + return this; + } + + public HorizontalBarChart WithGridArea(string value) { this.GridArea = value; return this; } - public DonutChart WithFallback(IUnion value) + public HorizontalBarChart WithFallback(IUnion value) { this.Fallback = value; return this; @@ -10281,38 +13425,44 @@ public DonutChart WithFallback(IUnion value) } /// -/// A data point in a Donut chart. +/// Represents a single data point in a horizontal bar chart. /// -public class DonutChartData : SerializableObject +public class HorizontalBarChartDataValue : SerializableObject { /// - /// Deserializes a JSON string into an object of type DonutChartData. + /// Deserializes a JSON string into an object of type HorizontalBarChartDataValue. /// - public static DonutChartData? Deserialize(string json) + public static HorizontalBarChartDataValue? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The legend of the chart. + /// 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. /// - [JsonPropertyName("legend")] - public string? Legend { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The value associated with the data point. + /// The x axis value of the data point. /// - [JsonPropertyName("value")] - public float? Value { get; set; } + [JsonPropertyName("x")] + public string? X { get; set; } /// - /// The color to use for the data point. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// The y axis value of the data point. + /// + [JsonPropertyName("y")] + public float? Y { get; set; } = 0; + + /// + /// The color of the bar associated with the data point. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// [JsonPropertyName("color")] public ChartColor? Color { get; set; } /// - /// Serializes this DonutChartData into a JSON string. + /// Serializes this HorizontalBarChartDataValue into a JSON string. /// public string Serialize() { @@ -10326,19 +13476,25 @@ public string Serialize() ); } - public DonutChartData WithLegend(string value) + public HorizontalBarChartDataValue WithKey(string value) { - this.Legend = value; + this.Key = value; return this; } - public DonutChartData WithValue(float value) + public HorizontalBarChartDataValue WithX(string value) { - this.Value = value; + this.X = value; return this; } - public DonutChartData WithColor(ChartColor value) + public HorizontalBarChartDataValue WithY(float value) + { + this.Y = value; + return this; + } + + public HorizontalBarChartDataValue WithColor(ChartColor value) { this.Color = value; return this; @@ -10346,23 +13502,29 @@ public DonutChartData WithColor(ChartColor value) } /// -/// A pie chart. +/// A stacked horizontal bar chart. /// -public class PieChart : CardElement +public class StackedHorizontalBarChart : CardElement { /// - /// Deserializes a JSON string into an object of type PieChart. + /// Deserializes a JSON string into an object of type StackedHorizontalBarChart. /// - public static PieChart? Deserialize(string json) + public static StackedHorizontalBarChart? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Chart.Pie**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Chart.HorizontalBar.Stacked**. /// [JsonPropertyName("type")] - public string Type { get; } = "Chart.Pie"; + public string Type { get; } = "Chart.HorizontalBar.Stacked"; /// /// 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. @@ -10374,7 +13536,7 @@ public class PieChart : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -10386,19 +13548,19 @@ public class PieChart : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -10410,7 +13572,7 @@ public class PieChart : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -10422,7 +13584,7 @@ public class PieChart : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// /// The title of the chart. @@ -10430,17 +13592,53 @@ public class PieChart : CardElement [JsonPropertyName("title")] public string? Title { get; set; } + /// + /// Controls whether the chart's title should be displayed. Defaults to `false`. + /// + [JsonPropertyName("showTitle")] + public bool? ShowTitle { get; set; } = false; + /// /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// [JsonPropertyName("colorSet")] public ChartColorSet? ColorSet { get; set; } + /// + /// The maximum width, in pixels, of the chart, in the `px` format. + /// + [JsonPropertyName("maxWidth")] + public string? MaxWidth { get; set; } + + /// + /// Controls whether the chart's legend should be displayed. + /// + [JsonPropertyName("showLegend")] + public bool? ShowLegend { get; set; } = true; + + /// + /// The title of the x axis. + /// + [JsonPropertyName("xAxisTitle")] + public string? XAxisTitle { get; set; } + + /// + /// The title of the y axis. + /// + [JsonPropertyName("yAxisTitle")] + public string? YAxisTitle { get; set; } + + /// + /// The color to use for all data points. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// + [JsonPropertyName("color")] + public ChartColor? Color { get; set; } + /// /// The data to display in the chart. /// [JsonPropertyName("data")] - public IList? Data { get; set; } + public IList? Data { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -10455,7 +13653,7 @@ public class PieChart : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this PieChart into a JSON string. + /// Serializes this StackedHorizontalBarChart into a JSON string. /// public string Serialize() { @@ -10469,91 +13667,139 @@ public string Serialize() ); } - public PieChart WithId(string value) + public StackedHorizontalBarChart WithKey(string value) + { + this.Key = value; + return this; + } + + public StackedHorizontalBarChart WithId(string value) { this.Id = value; return this; } - public PieChart WithRequires(HostCapabilities value) + public StackedHorizontalBarChart WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public PieChart WithLang(string value) + public StackedHorizontalBarChart WithLang(string value) { this.Lang = value; return this; } - public PieChart WithIsVisible(bool value) + public StackedHorizontalBarChart WithIsVisible(bool value) { this.IsVisible = value; return this; } - public PieChart WithSeparator(bool value) + public StackedHorizontalBarChart WithSeparator(bool value) { this.Separator = value; return this; } - public PieChart WithHeight(ElementHeight value) + public StackedHorizontalBarChart WithHeight(ElementHeight value) { this.Height = value; return this; } - public PieChart WithHorizontalAlignment(HorizontalAlignment value) + public StackedHorizontalBarChart WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public PieChart WithSpacing(Spacing value) + public StackedHorizontalBarChart WithSpacing(Spacing value) { this.Spacing = value; return this; } - public PieChart WithTargetWidth(TargetWidth value) + public StackedHorizontalBarChart WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public PieChart WithIsSortKey(bool value) + public StackedHorizontalBarChart WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public PieChart WithTitle(string value) + public StackedHorizontalBarChart WithTitle(string value) { this.Title = value; return this; } - public PieChart WithColorSet(ChartColorSet value) + public StackedHorizontalBarChart WithShowTitle(bool value) + { + this.ShowTitle = value; + return this; + } + + public StackedHorizontalBarChart WithColorSet(ChartColorSet value) { this.ColorSet = value; return this; } - public PieChart WithData(params IList value) + public StackedHorizontalBarChart WithMaxWidth(string value) + { + this.MaxWidth = value; + return this; + } + + public StackedHorizontalBarChart WithShowLegend(bool value) + { + this.ShowLegend = value; + return this; + } + + public StackedHorizontalBarChart WithXAxisTitle(string value) + { + this.XAxisTitle = value; + return this; + } + + public StackedHorizontalBarChart WithYAxisTitle(string value) + { + this.YAxisTitle = value; + return this; + } + + public StackedHorizontalBarChart WithColor(ChartColor value) + { + this.Color = value; + return this; + } + + public StackedHorizontalBarChart WithData(params StackedHorizontalBarChartData[] value) + { + this.Data = new List(value); + return this; + } + + public StackedHorizontalBarChart WithData(IList value) { this.Data = value; return this; } - public PieChart WithGridArea(string value) + public StackedHorizontalBarChart WithGridArea(string value) { this.GridArea = value; return this; } - public PieChart WithFallback(IUnion value) + public StackedHorizontalBarChart WithFallback(IUnion value) { this.Fallback = value; return this; @@ -10561,23 +13807,177 @@ public PieChart WithFallback(IUnion value) } /// -/// A grouped vertical bar chart. +/// Defines the collection of data series to display in as a stacked horizontal bar chart. /// -public class GroupedVerticalBarChart : CardElement +public class StackedHorizontalBarChartData : SerializableObject { /// - /// Deserializes a JSON string into an object of type GroupedVerticalBarChart. + /// Deserializes a JSON string into an object of type StackedHorizontalBarChartData. /// - public static GroupedVerticalBarChart? Deserialize(string json) + public static StackedHorizontalBarChartData? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Chart.VerticalBar.Grouped**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The title of the series. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// The data points in the series. + /// + [JsonPropertyName("data")] + public IList? Data { get; set; } + + /// + /// Serializes this StackedHorizontalBarChartData into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public StackedHorizontalBarChartData WithKey(string value) + { + this.Key = value; + return this; + } + + public StackedHorizontalBarChartData WithTitle(string value) + { + this.Title = value; + return this; + } + + public StackedHorizontalBarChartData WithData(params StackedHorizontalBarChartDataPoint[] value) + { + this.Data = new List(value); + return this; + } + + public StackedHorizontalBarChartData WithData(IList value) + { + this.Data = value; + return this; + } +} + +/// +/// A data point in a series. +/// +public class StackedHorizontalBarChartDataPoint : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type StackedHorizontalBarChartDataPoint. + /// + public static StackedHorizontalBarChartDataPoint? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The legend associated with the data point. + /// + [JsonPropertyName("legend")] + public string? Legend { get; set; } + + /// + /// The value of the data point. + /// + [JsonPropertyName("value")] + public float? Value { get; set; } = 0; + + /// + /// The color to use to render the bar associated with the data point. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// + [JsonPropertyName("color")] + public ChartColor? Color { get; set; } + + /// + /// Serializes this StackedHorizontalBarChartDataPoint into a JSON string. + /// + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } + + public StackedHorizontalBarChartDataPoint WithKey(string value) + { + this.Key = value; + return this; + } + + public StackedHorizontalBarChartDataPoint WithLegend(string value) + { + this.Legend = value; + return this; + } + + public StackedHorizontalBarChartDataPoint WithValue(float value) + { + this.Value = value; + return this; + } + + public StackedHorizontalBarChartDataPoint WithColor(ChartColor value) + { + this.Color = value; + return this; + } +} + +/// +/// A line chart. +/// +public class LineChart : CardElement +{ + /// + /// Deserializes a JSON string into an object of type LineChart. + /// + public static LineChart? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Chart.Line**. /// [JsonPropertyName("type")] - public string Type { get; } = "Chart.VerticalBar.Grouped"; + public string Type { get; } = "Chart.Line"; /// /// 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. @@ -10589,7 +13989,7 @@ public class GroupedVerticalBarChart : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -10601,19 +14001,19 @@ public class GroupedVerticalBarChart : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -10625,7 +14025,7 @@ public class GroupedVerticalBarChart : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -10637,7 +14037,7 @@ public class GroupedVerticalBarChart : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// /// The title of the chart. @@ -10645,12 +14045,30 @@ public class GroupedVerticalBarChart : CardElement [JsonPropertyName("title")] public string? Title { get; set; } + /// + /// Controls whether the chart's title should be displayed. Defaults to `false`. + /// + [JsonPropertyName("showTitle")] + public bool? ShowTitle { get; set; } = false; + /// /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// [JsonPropertyName("colorSet")] public ChartColorSet? ColorSet { get; set; } + /// + /// The maximum width, in pixels, of the chart, in the `px` format. + /// + [JsonPropertyName("maxWidth")] + public string? MaxWidth { get; set; } + + /// + /// Controls whether the chart's legend should be displayed. + /// + [JsonPropertyName("showLegend")] + public bool? ShowLegend { get; set; } = true; + /// /// The title of the x axis. /// @@ -10670,37 +14088,19 @@ public class GroupedVerticalBarChart : CardElement public ChartColor? Color { get; set; } /// - /// 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. - /// - [JsonPropertyName("stacked")] - public bool? Stacked { get; set; } - - /// - /// The data points in a series. + /// The data point series in the line chart. /// [JsonPropertyName("data")] - public IList? Data { get; set; } - - /// - /// Controls if values should be displayed on each bar. - /// - [JsonPropertyName("showBarValues")] - public bool? ShowBarValues { get; set; } + public IList? Data { get; set; } /// - /// 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`. + /// The maximum y range. /// [JsonPropertyName("yMin")] public float? YMin { get; set; } /// - /// 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`. + /// The minimum y range. /// [JsonPropertyName("yMax")] public float? YMax { get; set; } @@ -10718,7 +14118,7 @@ public class GroupedVerticalBarChart : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this GroupedVerticalBarChart into a JSON string. + /// Serializes this LineChart into a JSON string. /// public string Serialize() { @@ -10732,133 +14132,151 @@ public string Serialize() ); } - public GroupedVerticalBarChart WithId(string value) + public LineChart WithKey(string value) + { + this.Key = value; + return this; + } + + public LineChart WithId(string value) { this.Id = value; return this; } - public GroupedVerticalBarChart WithRequires(HostCapabilities value) + public LineChart WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public GroupedVerticalBarChart WithLang(string value) + public LineChart WithLang(string value) { this.Lang = value; return this; } - public GroupedVerticalBarChart WithIsVisible(bool value) + public LineChart WithIsVisible(bool value) { this.IsVisible = value; return this; } - public GroupedVerticalBarChart WithSeparator(bool value) + public LineChart WithSeparator(bool value) { this.Separator = value; return this; } - public GroupedVerticalBarChart WithHeight(ElementHeight value) + public LineChart WithHeight(ElementHeight value) { this.Height = value; return this; } - public GroupedVerticalBarChart WithHorizontalAlignment(HorizontalAlignment value) + public LineChart WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public GroupedVerticalBarChart WithSpacing(Spacing value) + public LineChart WithSpacing(Spacing value) { this.Spacing = value; return this; } - public GroupedVerticalBarChart WithTargetWidth(TargetWidth value) + public LineChart WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public GroupedVerticalBarChart WithIsSortKey(bool value) + public LineChart WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public GroupedVerticalBarChart WithTitle(string value) + public LineChart WithTitle(string value) { this.Title = value; return this; } - public GroupedVerticalBarChart WithColorSet(ChartColorSet value) + public LineChart WithShowTitle(bool value) + { + this.ShowTitle = value; + return this; + } + + public LineChart WithColorSet(ChartColorSet value) { this.ColorSet = value; return this; } - public GroupedVerticalBarChart WithXAxisTitle(string value) + public LineChart WithMaxWidth(string value) { - this.XAxisTitle = value; + this.MaxWidth = value; return this; } - public GroupedVerticalBarChart WithYAxisTitle(string value) + public LineChart WithShowLegend(bool value) { - this.YAxisTitle = value; + this.ShowLegend = value; return this; } - public GroupedVerticalBarChart WithColor(ChartColor value) + public LineChart WithXAxisTitle(string value) { - this.Color = value; + this.XAxisTitle = value; return this; } - public GroupedVerticalBarChart WithStacked(bool value) + public LineChart WithYAxisTitle(string value) { - this.Stacked = value; + this.YAxisTitle = value; return this; } - public GroupedVerticalBarChart WithData(params IList value) + public LineChart WithColor(ChartColor value) { - this.Data = value; + this.Color = value; return this; } - public GroupedVerticalBarChart WithShowBarValues(bool value) + public LineChart WithData(params LineChartData[] value) { - this.ShowBarValues = value; + this.Data = new List(value); return this; } - public GroupedVerticalBarChart WithYMin(float value) + public LineChart WithData(IList value) + { + this.Data = value; + return this; + } + + public LineChart WithYMin(float value) { this.YMin = value; return this; } - public GroupedVerticalBarChart WithYMax(float value) + public LineChart WithYMax(float value) { this.YMax = value; return this; } - public GroupedVerticalBarChart WithGridArea(string value) + public LineChart WithGridArea(string value) { this.GridArea = value; return this; } - public GroupedVerticalBarChart WithFallback(IUnion value) + public LineChart WithFallback(IUnion value) { this.Fallback = value; return this; @@ -10866,18 +14284,24 @@ public GroupedVerticalBarChart WithFallback(IUnion } /// -/// Represents a series of data points. +/// Represents a collection of data points series in a line chart. /// -public class GroupedVerticalBarChartData : SerializableObject +public class LineChartData : SerializableObject { /// - /// Deserializes a JSON string into an object of type GroupedVerticalBarChartData. + /// Deserializes a JSON string into an object of type LineChartData. /// - public static GroupedVerticalBarChartData? Deserialize(string json) + public static LineChartData? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + /// /// The legend of the chart. /// @@ -10888,16 +14312,16 @@ public class GroupedVerticalBarChartData : SerializableObject /// The data points in the series. /// [JsonPropertyName("values")] - public IList? Values { get; set; } + public IList? Values { get; set; } /// - /// The color to use for all data points in the series. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// The color all data points in the series. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// [JsonPropertyName("color")] public ChartColor? Color { get; set; } /// - /// Serializes this GroupedVerticalBarChartData into a JSON string. + /// Serializes this LineChartData into a JSON string. /// public string Serialize() { @@ -10911,19 +14335,31 @@ public string Serialize() ); } - public GroupedVerticalBarChartData WithLegend(string value) + public LineChartData WithKey(string value) + { + this.Key = value; + return this; + } + + public LineChartData WithLegend(string value) { this.Legend = value; return this; } - public GroupedVerticalBarChartData WithValues(params IList value) + public LineChartData WithValues(params LineChartValue[] value) + { + this.Values = new List(value); + return this; + } + + public LineChartData WithValues(IList value) { this.Values = value; return this; } - public GroupedVerticalBarChartData WithColor(ChartColor value) + public LineChartData WithColor(ChartColor value) { this.Color = value; return this; @@ -10931,32 +14367,42 @@ public GroupedVerticalBarChartData WithColor(ChartColor value) } /// -/// A single data point in a bar chart. +/// Represents a single data point in a line chart. /// -public class BarChartDataValue : SerializableObject +public class LineChartValue : SerializableObject { /// - /// Deserializes a JSON string into an object of type BarChartDataValue. + /// Deserializes a JSON string into an object of type LineChartValue. /// - public static BarChartDataValue? Deserialize(string json) + public static LineChartValue? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + /// /// The x axis value of the data point. + /// + /// If all x values of the x [Chart.Line](https://adaptivecards.microsoft.com/?topic=Chart.Line) are expressed as a number, or if all x values are expressed as a date string in the `YYYY-MM-DD` format, the chart will be rendered as a time series chart, i.e. x axis values will span across the minimum x value to maximum x value range. + /// + /// Otherwise, if x values are represented as a mix of numbers and strings or if at least one x value isn't in the `YYYY-MM-DD` format, the chart will be rendered as a categorical chart, i.e. x axis values will be displayed as categories. /// [JsonPropertyName("x")] - public string? X { get; set; } + public IUnion? X { get; set; } /// /// The y axis value of the data point. /// [JsonPropertyName("y")] - public float? Y { get; set; } + public float? Y { get; set; } = 0; /// - /// Serializes this BarChartDataValue into a JSON string. + /// Serializes this LineChartValue into a JSON string. /// public string Serialize() { @@ -10970,13 +14416,19 @@ public string Serialize() ); } - public BarChartDataValue WithX(string value) + public LineChartValue WithKey(string value) + { + this.Key = value; + return this; + } + + public LineChartValue WithX(IUnion value) { this.X = value; return this; } - public BarChartDataValue WithY(float value) + public LineChartValue WithY(float value) { this.Y = value; return this; @@ -10984,23 +14436,29 @@ public BarChartDataValue WithY(float value) } /// -/// A vertical bar chart. +/// A gauge chart. /// -public class VerticalBarChart : CardElement +public class GaugeChart : CardElement { /// - /// Deserializes a JSON string into an object of type VerticalBarChart. + /// Deserializes a JSON string into an object of type GaugeChart. /// - public static VerticalBarChart? Deserialize(string json) + public static GaugeChart? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Chart.VerticalBar**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Chart.Gauge**. /// [JsonPropertyName("type")] - public string Type { get; } = "Chart.VerticalBar"; + public string Type { get; } = "Chart.Gauge"; /// /// 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. @@ -11012,7 +14470,7 @@ public class VerticalBarChart : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -11024,19 +14482,19 @@ public class VerticalBarChart : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -11048,7 +14506,7 @@ public class VerticalBarChart : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -11060,7 +14518,7 @@ public class VerticalBarChart : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// /// The title of the chart. @@ -11068,6 +14526,12 @@ public class VerticalBarChart : CardElement [JsonPropertyName("title")] public string? Title { get; set; } + /// + /// Controls whether the chart's title should be displayed. Defaults to `false`. + /// + [JsonPropertyName("showTitle")] + public bool? ShowTitle { get; set; } = false; + /// /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// @@ -11075,46 +14539,70 @@ public class VerticalBarChart : CardElement public ChartColorSet? ColorSet { get; set; } /// - /// The title of the x axis. + /// The maximum width, in pixels, of the chart, in the `px` format. /// - [JsonPropertyName("xAxisTitle")] - public string? XAxisTitle { get; set; } + [JsonPropertyName("maxWidth")] + public string? MaxWidth { get; set; } /// - /// The title of the y axis. + /// Controls whether the chart's legend should be displayed. /// - [JsonPropertyName("yAxisTitle")] - public string? YAxisTitle { get; set; } + [JsonPropertyName("showLegend")] + public bool? ShowLegend { get; set; } = true; /// - /// The data to display in the chart. + /// The minimum value of the gauge. /// - [JsonPropertyName("data")] - public IList? Data { get; set; } + [JsonPropertyName("min")] + public float? Min { get; set; } = 0; /// - /// The color to use for all data points. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// The maximum value of the gauge. /// - [JsonPropertyName("color")] - public ChartColor? Color { get; set; } + [JsonPropertyName("max")] + public float? Max { get; set; } /// - /// Controls if the bar values should be displayed. + /// The sub-label of the gauge. /// - [JsonPropertyName("showBarValues")] - public bool? ShowBarValues { get; set; } + [JsonPropertyName("subLabel")] + public string? SubLabel { get; set; } /// - /// The requested minimum for the Y axis range. The value used at runtime may be different to optimize visual presentation. + /// Controls whether the min/max values should be displayed. /// - [JsonPropertyName("yMin")] - public float? YMin { get; set; } + [JsonPropertyName("showMinMax")] + public bool? ShowMinMax { get; set; } = true; /// - /// The requested maximum for the Y axis range. The value used at runtime may be different to optimize visual presentation. + /// Controls whether the gauge's needle is displayed. Default is **true**. /// - [JsonPropertyName("yMax")] - public float? YMax { get; set; } + [JsonPropertyName("showNeedle")] + public bool? ShowNeedle { get; set; } = true; + + /// + /// Controls whether the outlines of the gauge segments are displayed. + /// + [JsonPropertyName("showOutlines")] + public bool? ShowOutlines { get; set; } = true; + + /// + /// The segments to display in the gauge. + /// + [JsonPropertyName("segments")] + public IList? Segments { get; set; } + + /// + /// The value of the gauge. + /// + [JsonPropertyName("value")] + public float? Value { get; set; } = 0; + + /// + /// The format used to display the gauge's value. + /// + [JsonPropertyName("valueFormat")] + public GaugeChartValueFormat? ValueFormat { get; set; } = GaugeChartValueFormat.Percentage; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -11129,7 +14617,7 @@ public class VerticalBarChart : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this VerticalBarChart into a JSON string. + /// Serializes this GaugeChart into a JSON string. /// public string Serialize() { @@ -11143,127 +14631,169 @@ public string Serialize() ); } - public VerticalBarChart WithId(string value) + public GaugeChart WithKey(string value) + { + this.Key = value; + return this; + } + + public GaugeChart WithId(string value) { this.Id = value; return this; } - public VerticalBarChart WithRequires(HostCapabilities value) + public GaugeChart WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public VerticalBarChart WithLang(string value) + public GaugeChart WithLang(string value) { this.Lang = value; return this; } - public VerticalBarChart WithIsVisible(bool value) + public GaugeChart WithIsVisible(bool value) { this.IsVisible = value; return this; } - public VerticalBarChart WithSeparator(bool value) + public GaugeChart WithSeparator(bool value) { this.Separator = value; return this; } - public VerticalBarChart WithHeight(ElementHeight value) + public GaugeChart WithHeight(ElementHeight value) { this.Height = value; return this; } - public VerticalBarChart WithHorizontalAlignment(HorizontalAlignment value) + public GaugeChart WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public VerticalBarChart WithSpacing(Spacing value) + public GaugeChart WithSpacing(Spacing value) { this.Spacing = value; return this; } - public VerticalBarChart WithTargetWidth(TargetWidth value) + public GaugeChart WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public VerticalBarChart WithIsSortKey(bool value) + public GaugeChart WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public VerticalBarChart WithTitle(string value) + public GaugeChart WithTitle(string value) { this.Title = value; return this; } - public VerticalBarChart WithColorSet(ChartColorSet value) + public GaugeChart WithShowTitle(bool value) + { + this.ShowTitle = value; + return this; + } + + public GaugeChart WithColorSet(ChartColorSet value) { this.ColorSet = value; return this; } - public VerticalBarChart WithXAxisTitle(string value) + public GaugeChart WithMaxWidth(string value) { - this.XAxisTitle = value; + this.MaxWidth = value; + return this; + } + + public GaugeChart WithShowLegend(bool value) + { + this.ShowLegend = value; + return this; + } + + public GaugeChart WithMin(float value) + { + this.Min = value; + return this; + } + + public GaugeChart WithMax(float value) + { + this.Max = value; + return this; + } + + public GaugeChart WithSubLabel(string value) + { + this.SubLabel = value; + return this; + } + + public GaugeChart WithShowMinMax(bool value) + { + this.ShowMinMax = value; return this; } - public VerticalBarChart WithYAxisTitle(string value) + public GaugeChart WithShowNeedle(bool value) { - this.YAxisTitle = value; + this.ShowNeedle = value; return this; } - public VerticalBarChart WithData(params IList value) + public GaugeChart WithShowOutlines(bool value) { - this.Data = value; + this.ShowOutlines = value; return this; } - public VerticalBarChart WithColor(ChartColor value) + public GaugeChart WithSegments(params GaugeChartLegend[] value) { - this.Color = value; + this.Segments = new List(value); return this; } - public VerticalBarChart WithShowBarValues(bool value) + public GaugeChart WithSegments(IList value) { - this.ShowBarValues = value; + this.Segments = value; return this; } - public VerticalBarChart WithYMin(float value) + public GaugeChart WithValue(float value) { - this.YMin = value; + this.Value = value; return this; } - public VerticalBarChart WithYMax(float value) + public GaugeChart WithValueFormat(GaugeChartValueFormat value) { - this.YMax = value; + this.ValueFormat = value; return this; } - public VerticalBarChart WithGridArea(string value) + public GaugeChart WithGridArea(string value) { this.GridArea = value; return this; } - public VerticalBarChart WithFallback(IUnion value) + public GaugeChart WithFallback(IUnion value) { this.Fallback = value; return this; @@ -11271,38 +14801,44 @@ public VerticalBarChart WithFallback(IUnion value) } /// -/// Represents a data point in a vertical bar chart. +/// The legend of the chart. /// -public class VerticalBarChartDataValue : SerializableObject +public class GaugeChartLegend : SerializableObject { /// - /// Deserializes a JSON string into an object of type VerticalBarChartDataValue. + /// Deserializes a JSON string into an object of type GaugeChartLegend. /// - public static VerticalBarChartDataValue? Deserialize(string json) + public static GaugeChartLegend? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The x axis value of the data point. + /// 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. /// - [JsonPropertyName("x")] - public IUnion? X { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The y axis value of the data point. + /// The size of the segment. /// - [JsonPropertyName("y")] - public float? Y { get; set; } + [JsonPropertyName("size")] + public float? Size { get; set; } = 0; /// - /// The color to use for the bar associated with the data point. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// The legend text associated with the segment. + /// + [JsonPropertyName("legend")] + public string? Legend { get; set; } + + /// + /// The color to use for the segment. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). /// [JsonPropertyName("color")] public ChartColor? Color { get; set; } /// - /// Serializes this VerticalBarChartDataValue into a JSON string. + /// Serializes this GaugeChartLegend into a JSON string. /// public string Serialize() { @@ -11316,19 +14852,25 @@ public string Serialize() ); } - public VerticalBarChartDataValue WithX(IUnion value) + public GaugeChartLegend WithKey(string value) { - this.X = value; + this.Key = value; return this; } - public VerticalBarChartDataValue WithY(float value) + public GaugeChartLegend WithSize(float value) { - this.Y = value; + this.Size = value; return this; } - public VerticalBarChartDataValue WithColor(ChartColor value) + public GaugeChartLegend WithLegend(string value) + { + this.Legend = value; + return this; + } + + public GaugeChartLegend WithColor(ChartColor value) { this.Color = value; return this; @@ -11336,23 +14878,29 @@ public VerticalBarChartDataValue WithColor(ChartColor value) } /// -/// A horizontal bar chart. +/// A formatted and syntax-colored code block. /// -public class HorizontalBarChart : CardElement +public class CodeBlock : CardElement { /// - /// Deserializes a JSON string into an object of type HorizontalBarChart. + /// Deserializes a JSON string into an object of type CodeBlock. /// - public static HorizontalBarChart? Deserialize(string json) + public static CodeBlock? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Chart.HorizontalBar**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **CodeBlock**. /// [JsonPropertyName("type")] - public string Type { get; } = "Chart.HorizontalBar"; + public string Type { get; } = "CodeBlock"; /// /// 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. @@ -11364,7 +14912,7 @@ public class HorizontalBarChart : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -11376,19 +14924,19 @@ public class HorizontalBarChart : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -11400,7 +14948,7 @@ public class HorizontalBarChart : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -11412,49 +14960,25 @@ public class HorizontalBarChart : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The title of the chart. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } - - /// - /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). - /// - [JsonPropertyName("colorSet")] - public ChartColorSet? ColorSet { get; set; } - - /// - /// The title of the x axis. - /// - [JsonPropertyName("xAxisTitle")] - public string? XAxisTitle { get; set; } - - /// - /// The title of the y axis. - /// - [JsonPropertyName("yAxisTitle")] - public string? YAxisTitle { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The color to use for all data points. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// The code snippet to display. /// - [JsonPropertyName("color")] - public ChartColor? Color { get; set; } + [JsonPropertyName("codeSnippet")] + public string? CodeSnippet { get; set; } /// - /// The data points in the chart. + /// The language the code snippet is expressed in. /// - [JsonPropertyName("data")] - public IList? Data { get; set; } + [JsonPropertyName("language")] + public CodeLanguage? Language { get; set; } = CodeLanguage.PlainText; /// - /// Controls how the chart should be visually laid out. + /// A number that represents the line in the file from where the code snippet was extracted. /// - [JsonPropertyName("displayMode")] - public HorizontalBarChartDisplayMode? DisplayMode { get; set; } + [JsonPropertyName("startLineNumber")] + public float? StartLineNumber { get; set; } = 1; /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -11469,7 +14993,7 @@ public class HorizontalBarChart : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this HorizontalBarChart into a JSON string. + /// Serializes this CodeBlock into a JSON string. /// public string Serialize() { @@ -11483,115 +15007,97 @@ public string Serialize() ); } - public HorizontalBarChart WithId(string value) + public CodeBlock WithKey(string value) + { + this.Key = value; + return this; + } + + public CodeBlock WithId(string value) { this.Id = value; return this; } - public HorizontalBarChart WithRequires(HostCapabilities value) + public CodeBlock WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public HorizontalBarChart WithLang(string value) + public CodeBlock WithLang(string value) { this.Lang = value; return this; } - public HorizontalBarChart WithIsVisible(bool value) + public CodeBlock WithIsVisible(bool value) { this.IsVisible = value; return this; } - public HorizontalBarChart WithSeparator(bool value) + public CodeBlock WithSeparator(bool value) { this.Separator = value; return this; } - public HorizontalBarChart WithHeight(ElementHeight value) + public CodeBlock WithHeight(ElementHeight value) { this.Height = value; return this; } - public HorizontalBarChart WithHorizontalAlignment(HorizontalAlignment value) + public CodeBlock WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public HorizontalBarChart WithSpacing(Spacing value) + public CodeBlock WithSpacing(Spacing value) { this.Spacing = value; return this; } - public HorizontalBarChart WithTargetWidth(TargetWidth value) + public CodeBlock WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public HorizontalBarChart WithIsSortKey(bool value) + public CodeBlock WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public HorizontalBarChart WithTitle(string value) - { - this.Title = value; - return this; - } - - public HorizontalBarChart WithColorSet(ChartColorSet value) - { - this.ColorSet = value; - return this; - } - - public HorizontalBarChart WithXAxisTitle(string value) - { - this.XAxisTitle = value; - return this; - } - - public HorizontalBarChart WithYAxisTitle(string value) - { - this.YAxisTitle = value; - return this; - } - - public HorizontalBarChart WithColor(ChartColor value) + public CodeBlock WithCodeSnippet(string value) { - this.Color = value; + this.CodeSnippet = value; return this; } - public HorizontalBarChart WithData(params IList value) + public CodeBlock WithLanguage(CodeLanguage value) { - this.Data = value; + this.Language = value; return this; } - public HorizontalBarChart WithDisplayMode(HorizontalBarChartDisplayMode value) + public CodeBlock WithStartLineNumber(float value) { - this.DisplayMode = value; + this.StartLineNumber = value; return this; } - public HorizontalBarChart WithGridArea(string value) + public CodeBlock WithGridArea(string value) { this.GridArea = value; return this; } - public HorizontalBarChart WithFallback(IUnion value) + public CodeBlock WithFallback(IUnion value) { this.Fallback = value; return this; @@ -11599,88 +15105,29 @@ public HorizontalBarChart WithFallback(IUnion valu } /// -/// Represents a single data point in a horizontal bar chart. -/// -public class HorizontalBarChartDataValue : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type HorizontalBarChartDataValue. - /// - public static HorizontalBarChartDataValue? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } - - /// - /// The x axis value of the data point. - /// - [JsonPropertyName("x")] - public string? X { get; set; } - - /// - /// The y axis value of the data point. - /// - [JsonPropertyName("y")] - public float? Y { get; set; } - - /// - /// The color of the bar associated with the data point. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). - /// - [JsonPropertyName("color")] - public ChartColor? Color { get; set; } - - /// - /// Serializes this HorizontalBarChartDataValue into a JSON string. - /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } - - public HorizontalBarChartDataValue WithX(string value) - { - this.X = value; - return this; - } - - public HorizontalBarChartDataValue WithY(float value) - { - this.Y = value; - return this; - } - - public HorizontalBarChartDataValue WithColor(ChartColor value) - { - this.Color = value; - return this; - } -} - -/// -/// A stacked horizontal bar chart. +/// Displays a user's information, including their profile picture. /// -public class StackedHorizontalBarChart : CardElement +public class ComUserMicrosoftGraphComponent : CardElement { /// - /// Deserializes a JSON string into an object of type StackedHorizontalBarChart. + /// Deserializes a JSON string into an object of type ComUserMicrosoftGraphComponent. /// - public static StackedHorizontalBarChart? Deserialize(string json) + public static ComUserMicrosoftGraphComponent? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Chart.HorizontalBar.Stacked**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Component**. /// [JsonPropertyName("type")] - public string Type { get; } = "Chart.HorizontalBar.Stacked"; + public string Type { get; } = "Component"; /// /// 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. @@ -11692,7 +15139,7 @@ public class StackedHorizontalBarChart : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -11704,19 +15151,19 @@ public class StackedHorizontalBarChart : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -11728,7 +15175,7 @@ public class StackedHorizontalBarChart : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -11740,43 +15187,19 @@ public class StackedHorizontalBarChart : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The title of the chart. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } - - /// - /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). - /// - [JsonPropertyName("colorSet")] - public ChartColorSet? ColorSet { get; set; } - - /// - /// The title of the x axis. - /// - [JsonPropertyName("xAxisTitle")] - public string? XAxisTitle { get; set; } - - /// - /// The title of the y axis. - /// - [JsonPropertyName("yAxisTitle")] - public string? YAxisTitle { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The color to use for all data points. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// Must be **graph.microsoft.com/user**. /// - [JsonPropertyName("color")] - public ChartColor? Color { get; set; } + [JsonPropertyName("name")] + public string Name { get; } = "graph.microsoft.com/user"; /// - /// The data to display in the chart. + /// The properties of the Persona component. /// - [JsonPropertyName("data")] - public IList? Data { get; set; } + [JsonPropertyName("properties")] + public PersonaProperties? Properties { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -11791,7 +15214,7 @@ public class StackedHorizontalBarChart : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this StackedHorizontalBarChart into a JSON string. + /// Serializes this ComUserMicrosoftGraphComponent into a JSON string. /// public string Serialize() { @@ -11805,109 +15228,85 @@ public string Serialize() ); } - public StackedHorizontalBarChart WithId(string value) + public ComUserMicrosoftGraphComponent WithKey(string value) + { + this.Key = value; + return this; + } + + public ComUserMicrosoftGraphComponent WithId(string value) { this.Id = value; return this; } - public StackedHorizontalBarChart WithRequires(HostCapabilities value) + public ComUserMicrosoftGraphComponent WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public StackedHorizontalBarChart WithLang(string value) + public ComUserMicrosoftGraphComponent WithLang(string value) { this.Lang = value; return this; } - public StackedHorizontalBarChart WithIsVisible(bool value) + public ComUserMicrosoftGraphComponent WithIsVisible(bool value) { this.IsVisible = value; return this; } - public StackedHorizontalBarChart WithSeparator(bool value) + public ComUserMicrosoftGraphComponent WithSeparator(bool value) { this.Separator = value; return this; } - public StackedHorizontalBarChart WithHeight(ElementHeight value) + public ComUserMicrosoftGraphComponent WithHeight(ElementHeight value) { this.Height = value; return this; } - public StackedHorizontalBarChart WithHorizontalAlignment(HorizontalAlignment value) + public ComUserMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public StackedHorizontalBarChart WithSpacing(Spacing value) + public ComUserMicrosoftGraphComponent WithSpacing(Spacing value) { this.Spacing = value; return this; } - public StackedHorizontalBarChart WithTargetWidth(TargetWidth value) + public ComUserMicrosoftGraphComponent WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public StackedHorizontalBarChart WithIsSortKey(bool value) + public ComUserMicrosoftGraphComponent WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public StackedHorizontalBarChart WithTitle(string value) - { - this.Title = value; - return this; - } - - public StackedHorizontalBarChart WithColorSet(ChartColorSet value) - { - this.ColorSet = value; - return this; - } - - public StackedHorizontalBarChart WithXAxisTitle(string value) - { - this.XAxisTitle = value; - return this; - } - - public StackedHorizontalBarChart WithYAxisTitle(string value) - { - this.YAxisTitle = value; - return this; - } - - public StackedHorizontalBarChart WithColor(ChartColor value) - { - this.Color = value; - return this; - } - - public StackedHorizontalBarChart WithData(params IList value) + public ComUserMicrosoftGraphComponent WithProperties(PersonaProperties value) { - this.Data = value; + this.Properties = value; return this; } - public StackedHorizontalBarChart WithGridArea(string value) + public ComUserMicrosoftGraphComponent WithGridArea(string value) { this.GridArea = value; return this; } - public StackedHorizontalBarChart WithFallback(IUnion value) + public ComUserMicrosoftGraphComponent WithFallback(IUnion value) { this.Fallback = value; return this; @@ -11915,91 +15314,56 @@ public StackedHorizontalBarChart WithFallback(IUnion -/// Defines the collection of data series to display in as a stacked horizontal bar chart. +/// Represents the properties of a Persona component. /// -public class StackedHorizontalBarChartData : SerializableObject +public class PersonaProperties : SerializableObject { /// - /// Deserializes a JSON string into an object of type StackedHorizontalBarChartData. + /// Deserializes a JSON string into an object of type PersonaProperties. /// - public static StackedHorizontalBarChartData? Deserialize(string json) + public static PersonaProperties? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The title of the series. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } - - /// - /// The data points in the series. + /// 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. /// - [JsonPropertyName("data")] - public IList? Data { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Serializes this StackedHorizontalBarChartData into a JSON string. + /// The Id of the persona. /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } - - public StackedHorizontalBarChartData WithTitle(string value) - { - this.Title = value; - return this; - } - - public StackedHorizontalBarChartData WithData(params IList value) - { - this.Data = value; - return this; - } -} + [JsonPropertyName("id")] + public string? Id { get; set; } -/// -/// A data point in a series. -/// -public class StackedHorizontalBarChartDataPoint : SerializableObject -{ /// - /// Deserializes a JSON string into an object of type StackedHorizontalBarChartDataPoint. + /// The UPN of the persona. /// - public static StackedHorizontalBarChartDataPoint? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } + [JsonPropertyName("userPrincipalName")] + public string? UserPrincipalName { get; set; } /// - /// The legend associated with the data point. + /// The display name of the persona. /// - [JsonPropertyName("legend")] - public string? Legend { get; set; } + [JsonPropertyName("displayName")] + public string? DisplayName { get; set; } /// - /// The value of the data point. + /// Defines the style of the icon for the persona. /// - [JsonPropertyName("value")] - public float? Value { get; set; } + [JsonPropertyName("iconStyle")] + public PersonaIconStyle? IconStyle { get; set; } /// - /// The color to use to render the bar associated with the data point. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// Defines how the persona should be displayed. /// - [JsonPropertyName("color")] - public ChartColor? Color { get; set; } + [JsonPropertyName("style")] + public PersonaDisplayStyle? Style { get; set; } /// - /// Serializes this StackedHorizontalBarChartDataPoint into a JSON string. + /// Serializes this PersonaProperties into a JSON string. /// public string Serialize() { @@ -12013,43 +15377,67 @@ public string Serialize() ); } - public StackedHorizontalBarChartDataPoint WithLegend(string value) + public PersonaProperties WithKey(string value) { - this.Legend = value; + this.Key = value; return this; } - public StackedHorizontalBarChartDataPoint WithValue(float value) + public PersonaProperties WithId(string value) { - this.Value = value; + this.Id = value; return this; } - public StackedHorizontalBarChartDataPoint WithColor(ChartColor value) + public PersonaProperties WithUserPrincipalName(string value) { - this.Color = value; + this.UserPrincipalName = value; + return this; + } + + public PersonaProperties WithDisplayName(string value) + { + this.DisplayName = value; + return this; + } + + public PersonaProperties WithIconStyle(PersonaIconStyle value) + { + this.IconStyle = value; + return this; + } + + public PersonaProperties WithStyle(PersonaDisplayStyle value) + { + this.Style = value; return this; } } /// -/// A line chart. +/// Displays multiple users' information, including their profile pictures. /// -public class LineChart : CardElement +public class ComUsersMicrosoftGraphComponent : CardElement { /// - /// Deserializes a JSON string into an object of type LineChart. + /// Deserializes a JSON string into an object of type ComUsersMicrosoftGraphComponent. /// - public static LineChart? Deserialize(string json) + public static ComUsersMicrosoftGraphComponent? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Chart.Line**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Component**. /// [JsonPropertyName("type")] - public string Type { get; } = "Chart.Line"; + public string Type { get; } = "Component"; /// /// 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. @@ -12061,7 +15449,7 @@ public class LineChart : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -12073,91 +15461,55 @@ public class LineChart : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } - - /// - /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. - /// - [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// Controls how the element should be horizontally aligned. - /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } - - /// - /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. - /// - [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } - - /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). - /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } - - /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. - /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The title of the chart. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } + public bool? Separator { get; set; } = false; /// - /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// - [JsonPropertyName("colorSet")] - public ChartColorSet? ColorSet { get; set; } + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// - /// The title of the x axis. + /// Controls how the element should be horizontally aligned. /// - [JsonPropertyName("xAxisTitle")] - public string? XAxisTitle { get; set; } + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// - /// The title of the y axis. + /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// - [JsonPropertyName("yAxisTitle")] - public string? YAxisTitle { get; set; } + [JsonPropertyName("spacing")] + public Spacing? Spacing { get; set; } = Spacing.Default; /// - /// The color to use for all data points. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). /// - [JsonPropertyName("color")] - public ChartColor? Color { get; set; } + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } /// - /// The data point series in the line chart. + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// - [JsonPropertyName("data")] - public IList? Data { get; set; } + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; /// - /// The maximum y range. + /// Must be **graph.microsoft.com/users**. /// - [JsonPropertyName("yMin")] - public float? YMin { get; set; } + [JsonPropertyName("name")] + public string Name { get; } = "graph.microsoft.com/users"; /// - /// The minimum y range. + /// The properties of the PersonaSet component. /// - [JsonPropertyName("yMax")] - public float? YMax { get; set; } + [JsonPropertyName("properties")] + public PersonaSetProperties? Properties { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -12172,7 +15524,7 @@ public class LineChart : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this LineChart into a JSON string. + /// Serializes this ComUsersMicrosoftGraphComponent into a JSON string. /// public string Serialize() { @@ -12186,121 +15538,85 @@ public string Serialize() ); } - public LineChart WithId(string value) + public ComUsersMicrosoftGraphComponent WithKey(string value) + { + this.Key = value; + return this; + } + + public ComUsersMicrosoftGraphComponent WithId(string value) { this.Id = value; return this; } - public LineChart WithRequires(HostCapabilities value) + public ComUsersMicrosoftGraphComponent WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public LineChart WithLang(string value) + public ComUsersMicrosoftGraphComponent WithLang(string value) { this.Lang = value; return this; } - public LineChart WithIsVisible(bool value) + public ComUsersMicrosoftGraphComponent WithIsVisible(bool value) { this.IsVisible = value; return this; } - public LineChart WithSeparator(bool value) + public ComUsersMicrosoftGraphComponent WithSeparator(bool value) { this.Separator = value; return this; } - public LineChart WithHeight(ElementHeight value) + public ComUsersMicrosoftGraphComponent WithHeight(ElementHeight value) { this.Height = value; return this; } - public LineChart WithHorizontalAlignment(HorizontalAlignment value) + public ComUsersMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public LineChart WithSpacing(Spacing value) + public ComUsersMicrosoftGraphComponent WithSpacing(Spacing value) { this.Spacing = value; return this; } - public LineChart WithTargetWidth(TargetWidth value) + public ComUsersMicrosoftGraphComponent WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public LineChart WithIsSortKey(bool value) + public ComUsersMicrosoftGraphComponent WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public LineChart WithTitle(string value) - { - this.Title = value; - return this; - } - - public LineChart WithColorSet(ChartColorSet value) - { - this.ColorSet = value; - return this; - } - - public LineChart WithXAxisTitle(string value) - { - this.XAxisTitle = value; - return this; - } - - public LineChart WithYAxisTitle(string value) - { - this.YAxisTitle = value; - return this; - } - - public LineChart WithColor(ChartColor value) - { - this.Color = value; - return this; - } - - public LineChart WithData(params IList value) - { - this.Data = value; - return this; - } - - public LineChart WithYMin(float value) - { - this.YMin = value; - return this; - } - - public LineChart WithYMax(float value) + public ComUsersMicrosoftGraphComponent WithProperties(PersonaSetProperties value) { - this.YMax = value; + this.Properties = value; return this; } - public LineChart WithGridArea(string value) + public ComUsersMicrosoftGraphComponent WithGridArea(string value) { this.GridArea = value; return this; } - public LineChart WithFallback(IUnion value) + public ComUsersMicrosoftGraphComponent WithFallback(IUnion value) { this.Fallback = value; return this; @@ -12308,38 +15624,44 @@ public LineChart WithFallback(IUnion value) } /// -/// Represents a collection of data points series in a line chart. +/// Represents the properties of a PersonaSet component. /// -public class LineChartData : SerializableObject +public class PersonaSetProperties : SerializableObject { /// - /// Deserializes a JSON string into an object of type LineChartData. + /// Deserializes a JSON string into an object of type PersonaSetProperties. /// - public static LineChartData? Deserialize(string json) + public static PersonaSetProperties? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The legend of the chart. + /// 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. /// - [JsonPropertyName("legend")] - public string? Legend { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The data points in the series. + /// The users a PersonaSet component should display. /// - [JsonPropertyName("values")] - public IList? Values { get; set; } + [JsonPropertyName("users")] + public IList? Users { get; set; } /// - /// The color all data points in the series. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// Defines the style of the icon for the personas in the set. /// - [JsonPropertyName("color")] - public ChartColor? Color { get; set; } + [JsonPropertyName("iconStyle")] + public PersonaIconStyle? IconStyle { get; set; } /// - /// Serializes this LineChartData into a JSON string. + /// Defines how each persona in the set should be displayed. + /// + [JsonPropertyName("style")] + public PersonaDisplayStyle? Style { get; set; } + + /// + /// Serializes this PersonaSetProperties into a JSON string. /// public string Serialize() { @@ -12353,100 +15675,61 @@ public string Serialize() ); } - public LineChartData WithLegend(string value) + public PersonaSetProperties WithKey(string value) { - this.Legend = value; + this.Key = value; return this; } - public LineChartData WithValues(params IList value) + public PersonaSetProperties WithUsers(params PersonaProperties[] value) { - this.Values = value; + this.Users = new List(value); return this; } - public LineChartData WithColor(ChartColor value) + public PersonaSetProperties WithUsers(IList value) { - this.Color = value; + this.Users = value; return this; } -} - -/// -/// Represents a single data point in a line chart. -/// -public class LineChartValue : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type LineChartValue. - /// - public static LineChartValue? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } - - /// - /// The x axis value of the data point. - /// - /// If all x values of the x [Chart.Line](https://adaptivecards.microsoft.com/?topic=Chart.Line) are expressed as a number, or if all x values are expressed as a date string in the `YYYY-MM-DD` format, the chart will be rendered as a time series chart, i.e. x axis values will span across the minimum x value to maximum x value range. - /// - /// Otherwise, if x values are represented as a mix of numbers and strings or if at least one x value isn't in the `YYYY-MM-DD` format, the chart will be rendered as a categorical chart, i.e. x axis values will be displayed as categories. - /// - [JsonPropertyName("x")] - public IUnion? X { get; set; } - - /// - /// The y axis value of the data point. - /// - [JsonPropertyName("y")] - public float? Y { get; set; } - - /// - /// Serializes this LineChartValue into a JSON string. - /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } - public LineChartValue WithX(IUnion value) + public PersonaSetProperties WithIconStyle(PersonaIconStyle value) { - this.X = value; + this.IconStyle = value; return this; } - public LineChartValue WithY(float value) + public PersonaSetProperties WithStyle(PersonaDisplayStyle value) { - this.Y = value; + this.Style = value; return this; } } /// -/// A gauge chart. +/// Displays information about a generic graph resource. /// -public class GaugeChart : CardElement +public class ComResourceMicrosoftGraphComponent : CardElement { /// - /// Deserializes a JSON string into an object of type GaugeChart. + /// Deserializes a JSON string into an object of type ComResourceMicrosoftGraphComponent. /// - public static GaugeChart? Deserialize(string json) + public static ComResourceMicrosoftGraphComponent? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Chart.Gauge**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Component**. /// [JsonPropertyName("type")] - public string Type { get; } = "Chart.Gauge"; + public string Type { get; } = "Component"; /// /// 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. @@ -12458,7 +15741,7 @@ public class GaugeChart : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -12470,19 +15753,19 @@ public class GaugeChart : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -12494,7 +15777,7 @@ public class GaugeChart : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -12505,62 +15788,20 @@ public class GaugeChart : CardElement /// /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The title of the chart. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } - - /// - /// The name of the set of colors to use to render the chart. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). - /// - [JsonPropertyName("colorSet")] - public ChartColorSet? ColorSet { get; set; } - - /// - /// The minimum value of the gauge. - /// - [JsonPropertyName("min")] - public float? Min { get; set; } - - /// - /// The maximum value of the gauge. - /// - [JsonPropertyName("max")] - public float? Max { get; set; } - - /// - /// The sub-label of the gauge. - /// - [JsonPropertyName("subLabel")] - public string? SubLabel { get; set; } - - /// - /// Controls whether the min/max values should be displayed. - /// - [JsonPropertyName("showMinMax")] - public bool? ShowMinMax { get; set; } - - /// - /// The segments to display in the gauge. - /// - [JsonPropertyName("segments")] - public IList? Segments { get; set; } + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; /// - /// The value of the gauge. + /// Must be **graph.microsoft.com/resource**. /// - [JsonPropertyName("value")] - public float? Value { get; set; } + [JsonPropertyName("name")] + public string Name { get; } = "graph.microsoft.com/resource"; /// - /// The format used to display the gauge's value. + /// The properties of the resource. /// - [JsonPropertyName("valueFormat")] - public GaugeChartValueFormat? ValueFormat { get; set; } + [JsonPropertyName("properties")] + public ResourceProperties? Properties { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -12575,7 +15816,7 @@ public class GaugeChart : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this GaugeChart into a JSON string. + /// Serializes this ComResourceMicrosoftGraphComponent into a JSON string. /// public string Serialize() { @@ -12589,166 +15830,195 @@ public string Serialize() ); } - public GaugeChart WithId(string value) + public ComResourceMicrosoftGraphComponent WithKey(string value) + { + this.Key = value; + return this; + } + + public ComResourceMicrosoftGraphComponent WithId(string value) { this.Id = value; return this; } - public GaugeChart WithRequires(HostCapabilities value) + public ComResourceMicrosoftGraphComponent WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public GaugeChart WithLang(string value) + public ComResourceMicrosoftGraphComponent WithLang(string value) { this.Lang = value; return this; } - public GaugeChart WithIsVisible(bool value) + public ComResourceMicrosoftGraphComponent WithIsVisible(bool value) { this.IsVisible = value; return this; } - public GaugeChart WithSeparator(bool value) + public ComResourceMicrosoftGraphComponent WithSeparator(bool value) { this.Separator = value; return this; } - public GaugeChart WithHeight(ElementHeight value) + public ComResourceMicrosoftGraphComponent WithHeight(ElementHeight value) { this.Height = value; return this; } - public GaugeChart WithHorizontalAlignment(HorizontalAlignment value) + public ComResourceMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public GaugeChart WithSpacing(Spacing value) + public ComResourceMicrosoftGraphComponent WithSpacing(Spacing value) { this.Spacing = value; return this; } - public GaugeChart WithTargetWidth(TargetWidth value) + public ComResourceMicrosoftGraphComponent WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public GaugeChart WithIsSortKey(bool value) + public ComResourceMicrosoftGraphComponent WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public GaugeChart WithTitle(string value) + public ComResourceMicrosoftGraphComponent WithProperties(ResourceProperties value) { - this.Title = value; + this.Properties = value; return this; } - public GaugeChart WithColorSet(ChartColorSet value) + public ComResourceMicrosoftGraphComponent WithGridArea(string value) { - this.ColorSet = value; + this.GridArea = value; return this; } - public GaugeChart WithMin(float value) + public ComResourceMicrosoftGraphComponent WithFallback(IUnion value) { - this.Min = value; + this.Fallback = value; return this; } +} - public GaugeChart WithMax(float value) +/// +/// Represents the properties of a resource component. +/// +public class ResourceProperties : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type ResourceProperties. + /// + public static ResourceProperties? Deserialize(string json) { - this.Max = value; - return this; + return JsonSerializer.Deserialize(json); } - public GaugeChart WithSubLabel(string value) - { - this.SubLabel = value; - return this; - } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } - public GaugeChart WithShowMinMax(bool value) - { - this.ShowMinMax = value; - return this; - } + /// + /// The Id of the resource. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// The reference to the resource. + /// + [JsonPropertyName("resourceReference")] + public IDictionary? ResourceReference { get; set; } + + /// + /// The visualization of the resource. + /// + [JsonPropertyName("resourceVisualization")] + public ResourceVisualization? ResourceVisualization { get; set; } - public GaugeChart WithSegments(params IList value) + /// + /// Serializes this ResourceProperties into a JSON string. + /// + public string Serialize() { - this.Segments = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public GaugeChart WithValue(float value) + public ResourceProperties WithKey(string value) { - this.Value = value; + this.Key = value; return this; } - public GaugeChart WithValueFormat(GaugeChartValueFormat value) + public ResourceProperties WithId(string value) { - this.ValueFormat = value; + this.Id = value; return this; } - public GaugeChart WithGridArea(string value) + public ResourceProperties WithResourceReference(IDictionary value) { - this.GridArea = value; + this.ResourceReference = value; return this; } - public GaugeChart WithFallback(IUnion value) + public ResourceProperties WithResourceVisualization(ResourceVisualization value) { - this.Fallback = value; + this.ResourceVisualization = value; return this; } } /// -/// The legend of the chart. +/// Represents a visualization of a resource. /// -public class GaugeChartLegend : SerializableObject +public class ResourceVisualization : SerializableObject { /// - /// Deserializes a JSON string into an object of type GaugeChartLegend. + /// Deserializes a JSON string into an object of type ResourceVisualization. /// - public static GaugeChartLegend? Deserialize(string json) + public static ResourceVisualization? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The size of the segment. - /// - [JsonPropertyName("size")] - public float? Size { get; set; } - - /// - /// The legend text associated with the segment. + /// 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. /// - [JsonPropertyName("legend")] - public string? Legend { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The color to use for the segment. See [Chart colors reference](https://adaptivecards.microsoft.com/?topic=chart-colors-reference). + /// The media associated with the resource. /// - [JsonPropertyName("color")] - public ChartColor? Color { get; set; } + [JsonPropertyName("media")] + public string? Media { get; set; } /// - /// Serializes this GaugeChartLegend into a JSON string. + /// Serializes this ResourceVisualization into a JSON string. /// public string Serialize() { @@ -12762,43 +16032,43 @@ public string Serialize() ); } - public GaugeChartLegend WithSize(float value) - { - this.Size = value; - return this; - } - - public GaugeChartLegend WithLegend(string value) + public ResourceVisualization WithKey(string value) { - this.Legend = value; + this.Key = value; return this; } - public GaugeChartLegend WithColor(ChartColor value) + public ResourceVisualization WithMedia(string value) { - this.Color = value; + this.Media = value; return this; } } /// -/// A formatted and syntax-colored code block. +/// Displays information about a file resource. /// -public class CodeBlock : CardElement +public class ComFileMicrosoftGraphComponent : CardElement { /// - /// Deserializes a JSON string into an object of type CodeBlock. + /// Deserializes a JSON string into an object of type ComFileMicrosoftGraphComponent. /// - public static CodeBlock? Deserialize(string json) + public static ComFileMicrosoftGraphComponent? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **CodeBlock**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **Component**. /// [JsonPropertyName("type")] - public string Type { get; } = "CodeBlock"; + public string Type { get; } = "Component"; /// /// 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. @@ -12810,7 +16080,7 @@ public class CodeBlock : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -12822,19 +16092,19 @@ public class CodeBlock : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -12846,7 +16116,7 @@ public class CodeBlock : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -12858,25 +16128,19 @@ public class CodeBlock : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The code snippet to display. - /// - [JsonPropertyName("codeSnippet")] - public string? CodeSnippet { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// The language the code snippet is expressed in. + /// Must be **graph.microsoft.com/file**. /// - [JsonPropertyName("language")] - public CodeLanguage? Language { get; set; } + [JsonPropertyName("name")] + public string Name { get; } = "graph.microsoft.com/file"; /// - /// A number that represents the line in the file from where the code snippet was extracted. + /// The properties of the file. /// - [JsonPropertyName("startLineNumber")] - public float? StartLineNumber { get; set; } + [JsonPropertyName("properties")] + public FileProperties? Properties { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -12891,7 +16155,7 @@ public class CodeBlock : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this CodeBlock into a JSON string. + /// Serializes this ComFileMicrosoftGraphComponent into a JSON string. /// public string Serialize() { @@ -12905,110 +16169,187 @@ public string Serialize() ); } - public CodeBlock WithId(string value) + public ComFileMicrosoftGraphComponent WithKey(string value) + { + this.Key = value; + return this; + } + + public ComFileMicrosoftGraphComponent WithId(string value) { this.Id = value; return this; } - public CodeBlock WithRequires(HostCapabilities value) + public ComFileMicrosoftGraphComponent WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public CodeBlock WithLang(string value) + public ComFileMicrosoftGraphComponent WithLang(string value) { this.Lang = value; return this; } - public CodeBlock WithIsVisible(bool value) + public ComFileMicrosoftGraphComponent WithIsVisible(bool value) { this.IsVisible = value; return this; } - public CodeBlock WithSeparator(bool value) + public ComFileMicrosoftGraphComponent WithSeparator(bool value) { this.Separator = value; return this; } - public CodeBlock WithHeight(ElementHeight value) + public ComFileMicrosoftGraphComponent WithHeight(ElementHeight value) { this.Height = value; return this; } - public CodeBlock WithHorizontalAlignment(HorizontalAlignment value) + public ComFileMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public CodeBlock WithSpacing(Spacing value) + public ComFileMicrosoftGraphComponent WithSpacing(Spacing value) { this.Spacing = value; return this; } - public CodeBlock WithTargetWidth(TargetWidth value) + public ComFileMicrosoftGraphComponent WithTargetWidth(TargetWidth value) + { + this.TargetWidth = value; + return this; + } + + public ComFileMicrosoftGraphComponent WithIsSortKey(bool value) + { + this.IsSortKey = value; + return this; + } + + public ComFileMicrosoftGraphComponent WithProperties(FileProperties value) + { + this.Properties = value; + return this; + } + + public ComFileMicrosoftGraphComponent WithGridArea(string value) + { + this.GridArea = value; + return this; + } + + public ComFileMicrosoftGraphComponent WithFallback(IUnion value) + { + this.Fallback = value; + return this; + } +} + +/// +/// Represents the properties of a file component. +/// +public class FileProperties : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type FileProperties. + /// + public static FileProperties? Deserialize(string json) { - this.TargetWidth = value; - return this; + return JsonSerializer.Deserialize(json); } - public CodeBlock WithIsSortKey(bool value) - { - this.IsSortKey = value; - return this; - } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } - public CodeBlock WithCodeSnippet(string value) + /// + /// The name of the file. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The file extension. + /// + [JsonPropertyName("extension")] + public string? Extension { get; set; } + + /// + /// The URL of the file. + /// + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Serializes this FileProperties into a JSON string. + /// + public string Serialize() { - this.CodeSnippet = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public CodeBlock WithLanguage(CodeLanguage value) + public FileProperties WithKey(string value) { - this.Language = value; + this.Key = value; return this; } - public CodeBlock WithStartLineNumber(float value) + public FileProperties WithName(string value) { - this.StartLineNumber = value; + this.Name = value; return this; } - public CodeBlock WithGridArea(string value) + public FileProperties WithExtension(string value) { - this.GridArea = value; + this.Extension = value; return this; } - public CodeBlock WithFallback(IUnion value) + public FileProperties WithUrl(string value) { - this.Fallback = value; + this.Url = value; return this; } } /// -/// Displays a user's information, including their profile picture. +/// Displays information about a calendar event. /// -public class ComUserMicrosoftGraphComponent : CardElement +public class ComEventMicrosoftGraphComponent : CardElement { /// - /// Deserializes a JSON string into an object of type ComUserMicrosoftGraphComponent. + /// Deserializes a JSON string into an object of type ComEventMicrosoftGraphComponent. /// - public static ComUserMicrosoftGraphComponent? Deserialize(string json) + public static ComEventMicrosoftGraphComponent? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + /// /// Must be **Component**. /// @@ -13025,7 +16366,7 @@ public class ComUserMicrosoftGraphComponent : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -13037,19 +16378,19 @@ public class ComUserMicrosoftGraphComponent : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -13061,7 +16402,7 @@ public class ComUserMicrosoftGraphComponent : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -13073,19 +16414,19 @@ public class ComUserMicrosoftGraphComponent : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// Must be **graph.microsoft.com/user**. + /// Must be **graph.microsoft.com/event**. /// [JsonPropertyName("name")] - public string Name { get; } = "graph.microsoft.com/user"; + public string Name { get; } = "graph.microsoft.com/event"; /// - /// The properties of the user. + /// The properties of the event. /// [JsonPropertyName("properties")] - public PersonaProperties? Properties { get; set; } + public CalendarEventProperties? Properties { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -13100,7 +16441,7 @@ public class ComUserMicrosoftGraphComponent : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this ComUserMicrosoftGraphComponent into a JSON string. + /// Serializes this ComEventMicrosoftGraphComponent into a JSON string. /// public string Serialize() { @@ -13114,79 +16455,85 @@ public string Serialize() ); } - public ComUserMicrosoftGraphComponent WithId(string value) + public ComEventMicrosoftGraphComponent WithKey(string value) + { + this.Key = value; + return this; + } + + public ComEventMicrosoftGraphComponent WithId(string value) { this.Id = value; return this; } - public ComUserMicrosoftGraphComponent WithRequires(HostCapabilities value) + public ComEventMicrosoftGraphComponent WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ComUserMicrosoftGraphComponent WithLang(string value) + public ComEventMicrosoftGraphComponent WithLang(string value) { this.Lang = value; return this; } - public ComUserMicrosoftGraphComponent WithIsVisible(bool value) + public ComEventMicrosoftGraphComponent WithIsVisible(bool value) { this.IsVisible = value; return this; } - public ComUserMicrosoftGraphComponent WithSeparator(bool value) + public ComEventMicrosoftGraphComponent WithSeparator(bool value) { this.Separator = value; return this; } - public ComUserMicrosoftGraphComponent WithHeight(ElementHeight value) + public ComEventMicrosoftGraphComponent WithHeight(ElementHeight value) { this.Height = value; return this; } - public ComUserMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) + public ComEventMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public ComUserMicrosoftGraphComponent WithSpacing(Spacing value) + public ComEventMicrosoftGraphComponent WithSpacing(Spacing value) { this.Spacing = value; return this; } - public ComUserMicrosoftGraphComponent WithTargetWidth(TargetWidth value) + public ComEventMicrosoftGraphComponent WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public ComUserMicrosoftGraphComponent WithIsSortKey(bool value) + public ComEventMicrosoftGraphComponent WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public ComUserMicrosoftGraphComponent WithProperties(PersonaProperties value) + public ComEventMicrosoftGraphComponent WithProperties(CalendarEventProperties value) { this.Properties = value; return this; } - public ComUserMicrosoftGraphComponent WithGridArea(string value) + public ComEventMicrosoftGraphComponent WithGridArea(string value) { this.GridArea = value; return this; } - public ComUserMicrosoftGraphComponent WithFallback(IUnion value) + public ComEventMicrosoftGraphComponent WithFallback(IUnion value) { this.Fallback = value; return this; @@ -13194,163 +16541,98 @@ public ComUserMicrosoftGraphComponent WithFallback(IUnion -/// Represents the properties of a Persona component. -/// -public class PersonaProperties : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type PersonaProperties. - /// - public static PersonaProperties? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } - - /// - /// The UPN of the persona. - /// - [JsonPropertyName("userPrincipalName")] - public string? UserPrincipalName { get; set; } - - /// - /// The display name of the persona. - /// - [JsonPropertyName("displayName")] - public string? DisplayName { get; set; } - - /// - /// Serializes this PersonaProperties into a JSON string. - /// - public string Serialize() - { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); - } - - public PersonaProperties WithUserPrincipalName(string value) - { - this.UserPrincipalName = value; - return this; - } - - public PersonaProperties WithDisplayName(string value) - { - this.DisplayName = value; - return this; - } -} - -/// -/// Displays multiple users' information, including their profile pictures. +/// The properties of a calendar event. /// -public class ComUsersMicrosoftGraphComponent : CardElement +public class CalendarEventProperties : SerializableObject { /// - /// Deserializes a JSON string into an object of type ComUsersMicrosoftGraphComponent. + /// Deserializes a JSON string into an object of type CalendarEventProperties. /// - public static ComUsersMicrosoftGraphComponent? Deserialize(string json) + public static CalendarEventProperties? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Component**. + /// 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. /// - [JsonPropertyName("type")] - public string Type { get; } = "Component"; + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// 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. + /// The ID of the event. /// [JsonPropertyName("id")] public string? Id { get; set; } /// - /// 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). - /// - [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } - - /// - /// The locale associated with the element. - /// - [JsonPropertyName("lang")] - public string? Lang { get; set; } - - /// - /// Controls the visibility of the element. + /// The title of the event. /// - [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + [JsonPropertyName("title")] + public string? Title { get; set; } /// - /// 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. + /// The start date and time of the event. /// - [JsonPropertyName("separator")] - public bool? Separator { get; set; } + [JsonPropertyName("start")] + public string? Start { get; set; } /// - /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// The end date and time of the event. /// - [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + [JsonPropertyName("end")] + public string? End { get; set; } /// - /// Controls how the element should be horizontally aligned. + /// The status of the event. /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + [JsonPropertyName("status")] + public string? Status { get; set; } /// - /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. + /// The locations of the event. /// - [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + [JsonPropertyName("locations")] + public IList? Locations { get; set; } /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). + /// The URL of the online meeting. /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } + [JsonPropertyName("onlineMeetingUrl")] + public string? OnlineMeetingUrl { get; set; } /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// Indicates if the event is all day. /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + [JsonPropertyName("isAllDay")] + public bool? IsAllDay { get; set; } /// - /// Must be **graph.microsoft.com/users**. + /// The extension of the event. /// - [JsonPropertyName("name")] - public string Name { get; } = "graph.microsoft.com/users"; + [JsonPropertyName("extension")] + public string? Extension { get; set; } /// - /// The properties of the set. + /// The URL of the event. /// - [JsonPropertyName("properties")] - public PersonaSetProperties? Properties { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } /// - /// The area of a Layout.AreaGrid layout in which an element should be displayed. + /// The attendees of the event. /// - [JsonPropertyName("grid.area")] - public string? GridArea { get; set; } + [JsonPropertyName("attendees")] + public IList? Attendees { get; set; } /// - /// 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. + /// The organizer of the event. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + [JsonPropertyName("organizer")] + public CalendarEventAttendee? Organizer { get; set; } /// - /// Serializes this ComUsersMicrosoftGraphComponent into a JSON string. + /// Serializes this CalendarEventProperties into a JSON string. /// public string Serialize() { @@ -13364,106 +16646,148 @@ public string Serialize() ); } - public ComUsersMicrosoftGraphComponent WithId(string value) + public CalendarEventProperties WithKey(string value) + { + this.Key = value; + return this; + } + + public CalendarEventProperties WithId(string value) { this.Id = value; return this; } - public ComUsersMicrosoftGraphComponent WithRequires(HostCapabilities value) + public CalendarEventProperties WithTitle(string value) { - this.Requires = value; + this.Title = value; return this; } - public ComUsersMicrosoftGraphComponent WithLang(string value) + public CalendarEventProperties WithStart(string value) { - this.Lang = value; + this.Start = value; return this; } - public ComUsersMicrosoftGraphComponent WithIsVisible(bool value) + public CalendarEventProperties WithEnd(string value) { - this.IsVisible = value; + this.End = value; return this; } - public ComUsersMicrosoftGraphComponent WithSeparator(bool value) + public CalendarEventProperties WithStatus(string value) { - this.Separator = value; + this.Status = value; return this; } - public ComUsersMicrosoftGraphComponent WithHeight(ElementHeight value) + public CalendarEventProperties WithLocations(params string[] value) { - this.Height = value; + this.Locations = new List(value); return this; } - public ComUsersMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) + public CalendarEventProperties WithLocations(IList value) { - this.HorizontalAlignment = value; + this.Locations = value; return this; } - public ComUsersMicrosoftGraphComponent WithSpacing(Spacing value) + public CalendarEventProperties WithOnlineMeetingUrl(string value) { - this.Spacing = value; + this.OnlineMeetingUrl = value; return this; } - public ComUsersMicrosoftGraphComponent WithTargetWidth(TargetWidth value) + public CalendarEventProperties WithIsAllDay(bool value) { - this.TargetWidth = value; + this.IsAllDay = value; return this; } - public ComUsersMicrosoftGraphComponent WithIsSortKey(bool value) + public CalendarEventProperties WithExtension(string value) { - this.IsSortKey = value; + this.Extension = value; return this; } - public ComUsersMicrosoftGraphComponent WithProperties(PersonaSetProperties value) + public CalendarEventProperties WithUrl(string value) { - this.Properties = value; + this.Url = value; return this; } - public ComUsersMicrosoftGraphComponent WithGridArea(string value) + public CalendarEventProperties WithAttendees(params CalendarEventAttendee[] value) { - this.GridArea = value; + this.Attendees = new List(value); return this; } - public ComUsersMicrosoftGraphComponent WithFallback(IUnion value) + public CalendarEventProperties WithAttendees(IList value) { - this.Fallback = value; + this.Attendees = value; + return this; + } + + public CalendarEventProperties WithOrganizer(CalendarEventAttendee value) + { + this.Organizer = value; return this; } } /// -/// Represents the properties of a PersonaSet component. +/// Represents a calendar event attendee. /// -public class PersonaSetProperties : SerializableObject +public class CalendarEventAttendee : SerializableObject { /// - /// Deserializes a JSON string into an object of type PersonaSetProperties. + /// Deserializes a JSON string into an object of type CalendarEventAttendee. /// - public static PersonaSetProperties? Deserialize(string json) + public static CalendarEventAttendee? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The users a PersonaSet component should display. + /// 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. /// - [JsonPropertyName("users")] - public IList? Users { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Serializes this PersonaSetProperties into a JSON string. + /// The name of the attendee. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The email address of the attendee. + /// + [JsonPropertyName("email")] + public string? Email { get; set; } + + /// + /// The title of the attendee. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// The type of the attendee. + /// + [JsonPropertyName("type")] + public string? Type { get; set; } + + /// + /// The status of the attendee. + /// + [JsonPropertyName("status")] + public string? Status { get; set; } + + /// + /// Serializes this CalendarEventAttendee into a JSON string. /// public string Serialize() { @@ -13477,31 +16801,67 @@ public string Serialize() ); } - public PersonaSetProperties WithUsers(params IList value) + public CalendarEventAttendee WithKey(string value) { - this.Users = value; + this.Key = value; + return this; + } + + public CalendarEventAttendee WithName(string value) + { + this.Name = value; + return this; + } + + public CalendarEventAttendee WithEmail(string value) + { + this.Email = value; + return this; + } + + public CalendarEventAttendee WithTitle(string value) + { + this.Title = value; + return this; + } + + public CalendarEventAttendee WithType(string value) + { + this.Type = value; + return this; + } + + public CalendarEventAttendee WithStatus(string value) + { + this.Status = value; return this; } } /// -/// Displays information about a generic graph resource. +/// A page inside a Carousel element. /// -public class ComResourceMicrosoftGraphComponent : CardElement +public class CarouselPage : CardElement { /// - /// Deserializes a JSON string into an object of type ComResourceMicrosoftGraphComponent. + /// Deserializes a JSON string into an object of type CarouselPage. /// - public static ComResourceMicrosoftGraphComponent? Deserialize(string json) + public static CarouselPage? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Component**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **CarouselPage**. /// [JsonPropertyName("type")] - public string Type { get; } = "Component"; + public string Type { get; } = "CarouselPage"; /// /// 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. @@ -13513,7 +16873,7 @@ public class ComResourceMicrosoftGraphComponent : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -13525,55 +16885,85 @@ public class ComResourceMicrosoftGraphComponent : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// - /// 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. + /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// - [JsonPropertyName("separator")] - public bool? Separator { get; set; } + [JsonPropertyName("height")] + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// - /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). /// - [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + [JsonPropertyName("targetWidth")] + public TargetWidth? TargetWidth { get; set; } /// - /// Controls how the element should be horizontally aligned. + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; /// - /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. + /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. /// - [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). + /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } + [JsonPropertyName("style")] + public ContainerStyle? Style { get; set; } /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// Controls if a border should be displayed around the container. /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + [JsonPropertyName("showBorder")] + public bool? ShowBorder { get; set; } = false; /// - /// Must be **graph.microsoft.com/resource**. + /// Controls if the container should have rounded corners. /// - [JsonPropertyName("name")] - public string Name { get; } = "graph.microsoft.com/resource"; + [JsonPropertyName("roundedCorners")] + public bool? RoundedCorners { get; set; } = false; /// - /// The properties of the resource. + /// The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See [Container layouts](https://adaptivecards.microsoft.com/?topic=container-layouts) for more details. /// - [JsonPropertyName("properties")] - public ResourceProperties? Properties { get; set; } + [JsonPropertyName("layouts")] + public IList? Layouts { get; set; } + + /// + /// The minimum height, in pixels, of the container, in the `px` format. + /// + [JsonPropertyName("minHeight")] + public string? MinHeight { get; set; } + + /// + /// Defines the container's background image. + /// + [JsonPropertyName("backgroundImage")] + public IUnion? BackgroundImage { get; set; } + + /// + /// Controls how the container's content should be vertically aligned. + /// + [JsonPropertyName("verticalContentAlignment")] + public VerticalAlignment? VerticalContentAlignment { get; set; } + + /// + /// Controls if the content of the card is to be rendered left-to-right or right-to-left. + /// + [JsonPropertyName("rtl")] + public bool? Rtl { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("maxHeight")] + public string? MaxHeight { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -13588,7 +16978,25 @@ public class ComResourceMicrosoftGraphComponent : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this ComResourceMicrosoftGraphComponent into a JSON string. + /// The elements in the page. + /// + [JsonPropertyName("items")] + public IList? Items { get; set; } + + public CarouselPage() { } + + public CarouselPage(params CardElement[] items) + { + this.Items = new List(items); + } + + public CarouselPage(IList items) + { + this.Items = items; + } + + /// + /// Serializes this CarouselPage into a JSON string. /// public string Serialize() { @@ -13602,209 +17010,169 @@ public string Serialize() ); } - public ComResourceMicrosoftGraphComponent WithId(string value) + public CarouselPage WithKey(string value) + { + this.Key = value; + return this; + } + + public CarouselPage WithId(string value) { this.Id = value; return this; } - public ComResourceMicrosoftGraphComponent WithRequires(HostCapabilities value) + public CarouselPage WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ComResourceMicrosoftGraphComponent WithLang(string value) + public CarouselPage WithLang(string value) { this.Lang = value; return this; } - public ComResourceMicrosoftGraphComponent WithIsVisible(bool value) + public CarouselPage WithIsVisible(bool value) { this.IsVisible = value; return this; } - public ComResourceMicrosoftGraphComponent WithSeparator(bool value) + public CarouselPage WithHeight(ElementHeight value) { - this.Separator = value; + this.Height = value; return this; } - public ComResourceMicrosoftGraphComponent WithHeight(ElementHeight value) + public CarouselPage WithTargetWidth(TargetWidth value) { - this.Height = value; + this.TargetWidth = value; + return this; + } + + public CarouselPage WithIsSortKey(bool value) + { + this.IsSortKey = value; return this; } - public ComResourceMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) + public CarouselPage WithSelectAction(Action value) { - this.HorizontalAlignment = value; + this.SelectAction = value; return this; } - public ComResourceMicrosoftGraphComponent WithSpacing(Spacing value) + public CarouselPage WithStyle(ContainerStyle value) { - this.Spacing = value; + this.Style = value; return this; } - public ComResourceMicrosoftGraphComponent WithTargetWidth(TargetWidth value) + public CarouselPage WithShowBorder(bool value) { - this.TargetWidth = value; + this.ShowBorder = value; return this; } - public ComResourceMicrosoftGraphComponent WithIsSortKey(bool value) + public CarouselPage WithRoundedCorners(bool value) { - this.IsSortKey = value; + this.RoundedCorners = value; return this; } - public ComResourceMicrosoftGraphComponent WithProperties(ResourceProperties value) + public CarouselPage WithLayouts(params ContainerLayout[] value) { - this.Properties = value; + this.Layouts = new List(value); return this; } - public ComResourceMicrosoftGraphComponent WithGridArea(string value) + public CarouselPage WithLayouts(IList value) { - this.GridArea = value; + this.Layouts = value; return this; } - public ComResourceMicrosoftGraphComponent WithFallback(IUnion value) + public CarouselPage WithMinHeight(string value) { - this.Fallback = value; + this.MinHeight = value; return this; } -} -/// -/// Represents the properties of a resource component. -/// -public class ResourceProperties : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type ResourceProperties. - /// - public static ResourceProperties? Deserialize(string json) + public CarouselPage WithBackgroundImage(IUnion value) { - return JsonSerializer.Deserialize(json); + this.BackgroundImage = value; + return this; } - /// - /// The Id of the resource. - /// - [JsonPropertyName("id")] - public string? Id { get; set; } - - /// - /// The reference to the resource. - /// - [JsonPropertyName("resourceReference")] - public IDictionary? ResourceReference { get; set; } - - /// - /// The visualization of the resource. - /// - [JsonPropertyName("resourceVisualization")] - public ResourceVisualization? ResourceVisualization { get; set; } - - /// - /// Serializes this ResourceProperties into a JSON string. - /// - public string Serialize() + public CarouselPage WithVerticalContentAlignment(VerticalAlignment value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.VerticalContentAlignment = value; + return this; } - public ResourceProperties WithId(string value) + public CarouselPage WithRtl(bool value) { - this.Id = value; + this.Rtl = value; return this; } - public ResourceProperties WithResourceReference(IDictionary value) + public CarouselPage WithMaxHeight(string value) { - this.ResourceReference = value; + this.MaxHeight = value; return this; } - public ResourceProperties WithResourceVisualization(ResourceVisualization value) + public CarouselPage WithGridArea(string value) { - this.ResourceVisualization = value; + this.GridArea = value; return this; } -} -/// -/// Represents a visualization of a resource. -/// -public class ResourceVisualization : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type ResourceVisualization. - /// - public static ResourceVisualization? Deserialize(string json) + public CarouselPage WithFallback(IUnion value) { - return JsonSerializer.Deserialize(json); + this.Fallback = value; + return this; } - /// - /// The media associated with the resource. - /// - [JsonPropertyName("media")] - public string? Media { get; set; } - - /// - /// Serializes this ResourceVisualization into a JSON string. - /// - public string Serialize() + public CarouselPage WithItems(params CardElement[] value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.Items = new List(value); + return this; } - public ResourceVisualization WithMedia(string value) + public CarouselPage WithItems(IList value) { - this.Media = value; + this.Items = value; return this; } } /// -/// Displays information about a file resource. +/// Represents a row of cells in a table. /// -public class ComFileMicrosoftGraphComponent : CardElement +public class TableRow : CardElement { /// - /// Deserializes a JSON string into an object of type ComFileMicrosoftGraphComponent. + /// Deserializes a JSON string into an object of type TableRow. /// - public static ComFileMicrosoftGraphComponent? Deserialize(string json) + public static TableRow? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Component**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **TableRow**. /// [JsonPropertyName("type")] - public string Type { get; } = "Component"; + public string Type { get; } = "TableRow"; /// /// 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. @@ -13816,7 +17184,7 @@ public class ComFileMicrosoftGraphComponent : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -13828,19 +17196,19 @@ public class ComFileMicrosoftGraphComponent : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls how the element should be horizontally aligned. @@ -13852,7 +17220,7 @@ public class ComFileMicrosoftGraphComponent : CardElement /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -13864,19 +17232,37 @@ public class ComFileMicrosoftGraphComponent : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// Must be **graph.microsoft.com/file**. + /// Controls if a border should be displayed around the container. /// - [JsonPropertyName("name")] - public string Name { get; } = "graph.microsoft.com/file"; + [JsonPropertyName("showBorder")] + public bool? ShowBorder { get; set; } = false; /// - /// The properties of the file. + /// Controls if the container should have rounded corners. /// - [JsonPropertyName("properties")] - public FileProperties? Properties { get; set; } + [JsonPropertyName("roundedCorners")] + public bool? RoundedCorners { get; set; } = false; + + /// + /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. + /// + [JsonPropertyName("style")] + public ContainerStyle? Style { get; set; } + + /// + /// Controls how the content of every cell in the row should be horizontally aligned by default. This property overrides the horizontalCellContentAlignment property of the table and columns. + /// + [JsonPropertyName("horizontalCellContentAlignment")] + public HorizontalAlignment? HorizontalCellContentAlignment { get; set; } + + /// + /// Controls how the content of every cell in the row should be vertically aligned by default. This property overrides the verticalCellContentAlignment property of the table and columns. + /// + [JsonPropertyName("verticalCellContentAlignment")] + public VerticalAlignment? VerticalCellContentAlignment { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -13891,7 +17277,13 @@ public class ComFileMicrosoftGraphComponent : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this ComFileMicrosoftGraphComponent into a JSON string. + /// The cells in the row. + /// + [JsonPropertyName("cells")] + public IList? Cells { get; set; } + + /// + /// Serializes this TableRow into a JSON string. /// public string Serialize() { @@ -13905,168 +17297,151 @@ public string Serialize() ); } - public ComFileMicrosoftGraphComponent WithId(string value) + public TableRow WithKey(string value) + { + this.Key = value; + return this; + } + + public TableRow WithId(string value) { this.Id = value; return this; } - public ComFileMicrosoftGraphComponent WithRequires(HostCapabilities value) + public TableRow WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ComFileMicrosoftGraphComponent WithLang(string value) + public TableRow WithLang(string value) { this.Lang = value; return this; } - public ComFileMicrosoftGraphComponent WithIsVisible(bool value) + public TableRow WithIsVisible(bool value) { this.IsVisible = value; return this; } - public ComFileMicrosoftGraphComponent WithSeparator(bool value) + public TableRow WithSeparator(bool value) { this.Separator = value; return this; } - public ComFileMicrosoftGraphComponent WithHeight(ElementHeight value) + public TableRow WithHeight(ElementHeight value) { this.Height = value; return this; } - public ComFileMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) + public TableRow WithHorizontalAlignment(HorizontalAlignment value) { this.HorizontalAlignment = value; return this; } - public ComFileMicrosoftGraphComponent WithSpacing(Spacing value) + public TableRow WithSpacing(Spacing value) { this.Spacing = value; return this; } - public ComFileMicrosoftGraphComponent WithTargetWidth(TargetWidth value) + public TableRow WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public ComFileMicrosoftGraphComponent WithIsSortKey(bool value) + public TableRow WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public ComFileMicrosoftGraphComponent WithProperties(FileProperties value) + public TableRow WithShowBorder(bool value) { - this.Properties = value; + this.ShowBorder = value; return this; } - public ComFileMicrosoftGraphComponent WithGridArea(string value) + public TableRow WithRoundedCorners(bool value) { - this.GridArea = value; + this.RoundedCorners = value; return this; } - public ComFileMicrosoftGraphComponent WithFallback(IUnion value) + public TableRow WithStyle(ContainerStyle value) { - this.Fallback = value; + this.Style = value; return this; } -} -/// -/// Represents the properties of a file component. -/// -public class FileProperties : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type FileProperties. - /// - public static FileProperties? Deserialize(string json) + public TableRow WithHorizontalCellContentAlignment(HorizontalAlignment value) { - return JsonSerializer.Deserialize(json); + this.HorizontalCellContentAlignment = value; + return this; } - /// - /// The name of the file. - /// - [JsonPropertyName("name")] - public string? Name { get; set; } - - /// - /// The file extension. - /// - [JsonPropertyName("extension")] - public string? Extension { get; set; } - - /// - /// The URL of the file. - /// - [JsonPropertyName("url")] - public string? Url { get; set; } - - /// - /// Serializes this FileProperties into a JSON string. - /// - public string Serialize() + public TableRow WithVerticalCellContentAlignment(VerticalAlignment value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.VerticalCellContentAlignment = value; + return this; } - public FileProperties WithName(string value) + public TableRow WithGridArea(string value) { - this.Name = value; + this.GridArea = value; return this; } - public FileProperties WithExtension(string value) + public TableRow WithFallback(IUnion value) { - this.Extension = value; + this.Fallback = value; return this; } - public FileProperties WithUrl(string value) + public TableRow WithCells(params TableCell[] value) { - this.Url = value; + this.Cells = new List(value); + return this; + } + + public TableRow WithCells(IList value) + { + this.Cells = value; return this; } } /// -/// Displays information about a calendar event. +/// Represents a cell in a table row. /// -public class ComEventMicrosoftGraphComponent : CardElement +public class TableCell : CardElement { /// - /// Deserializes a JSON string into an object of type ComEventMicrosoftGraphComponent. + /// Deserializes a JSON string into an object of type TableCell. /// - public static ComEventMicrosoftGraphComponent? Deserialize(string json) + public static TableCell? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **Component**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **TableCell**. /// [JsonPropertyName("type")] - public string Type { get; } = "Component"; + public string Type { get; } = "TableCell"; /// /// 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. @@ -14078,7 +17453,7 @@ public class ComEventMicrosoftGraphComponent : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -14090,31 +17465,25 @@ public class ComEventMicrosoftGraphComponent : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// Controls how the element should be horizontally aligned. - /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -14126,19 +17495,61 @@ public class ComEventMicrosoftGraphComponent : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// Must be **graph.microsoft.com/event**. + /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. /// - [JsonPropertyName("name")] - public string Name { get; } = "graph.microsoft.com/event"; + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } /// - /// The properties of the event. + /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. /// - [JsonPropertyName("properties")] - public CalendarEventProperties? Properties { get; set; } + [JsonPropertyName("style")] + public ContainerStyle? Style { get; set; } + + /// + /// The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See [Container layouts](https://adaptivecards.microsoft.com/?topic=container-layouts) for more details. + /// + [JsonPropertyName("layouts")] + public IList? Layouts { get; set; } + + /// + /// Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. + /// + [JsonPropertyName("bleed")] + public bool? Bleed { get; set; } = false; + + /// + /// The minimum height, in pixels, of the container, in the `px` format. + /// + [JsonPropertyName("minHeight")] + public string? MinHeight { get; set; } + + /// + /// Defines the container's background image. + /// + [JsonPropertyName("backgroundImage")] + public IUnion? BackgroundImage { get; set; } + + /// + /// Controls how the container's content should be vertically aligned. + /// + [JsonPropertyName("verticalContentAlignment")] + public VerticalAlignment? VerticalContentAlignment { get; set; } + + /// + /// Controls if the content of the card is to be rendered left-to-right or right-to-left. + /// + [JsonPropertyName("rtl")] + public bool? Rtl { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("maxHeight")] + public string? MaxHeight { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -14153,7 +17564,25 @@ public class ComEventMicrosoftGraphComponent : CardElement public IUnion? Fallback { get; set; } /// - /// Serializes this ComEventMicrosoftGraphComponent into a JSON string. + /// The items (elements) in the cell. + /// + [JsonPropertyName("items")] + public IList? Items { get; set; } + + public TableCell() { } + + public TableCell(params CardElement[] items) + { + this.Items = new List(items); + } + + public TableCell(IList items) + { + this.Items = items; + } + + /// + /// Serializes this TableCell into a JSON string. /// public string Serialize() { @@ -14167,172 +17596,287 @@ public string Serialize() ); } - public ComEventMicrosoftGraphComponent WithId(string value) + public TableCell WithKey(string value) + { + this.Key = value; + return this; + } + + public TableCell WithId(string value) { this.Id = value; return this; } - public ComEventMicrosoftGraphComponent WithRequires(HostCapabilities value) + public TableCell WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public ComEventMicrosoftGraphComponent WithLang(string value) + public TableCell WithLang(string value) { this.Lang = value; return this; } - public ComEventMicrosoftGraphComponent WithIsVisible(bool value) + public TableCell WithIsVisible(bool value) { this.IsVisible = value; return this; } - public ComEventMicrosoftGraphComponent WithSeparator(bool value) + public TableCell WithSeparator(bool value) { this.Separator = value; return this; } - public ComEventMicrosoftGraphComponent WithHeight(ElementHeight value) + public TableCell WithHeight(ElementHeight value) { this.Height = value; return this; } - public ComEventMicrosoftGraphComponent WithHorizontalAlignment(HorizontalAlignment value) + public TableCell WithSpacing(Spacing value) { - this.HorizontalAlignment = value; + this.Spacing = value; return this; } - public ComEventMicrosoftGraphComponent WithSpacing(Spacing value) + public TableCell WithTargetWidth(TargetWidth value) { - this.Spacing = value; + this.TargetWidth = value; return this; } - public ComEventMicrosoftGraphComponent WithTargetWidth(TargetWidth value) + public TableCell WithIsSortKey(bool value) { - this.TargetWidth = value; + this.IsSortKey = value; return this; } - public ComEventMicrosoftGraphComponent WithIsSortKey(bool value) + public TableCell WithSelectAction(Action value) { - this.IsSortKey = value; + this.SelectAction = value; return this; } - public ComEventMicrosoftGraphComponent WithProperties(CalendarEventProperties value) + public TableCell WithStyle(ContainerStyle value) { - this.Properties = value; + this.Style = value; return this; } - public ComEventMicrosoftGraphComponent WithGridArea(string value) + public TableCell WithLayouts(params ContainerLayout[] value) + { + this.Layouts = new List(value); + return this; + } + + public TableCell WithLayouts(IList value) + { + this.Layouts = value; + return this; + } + + public TableCell WithBleed(bool value) + { + this.Bleed = value; + return this; + } + + public TableCell WithMinHeight(string value) + { + this.MinHeight = value; + return this; + } + + public TableCell WithBackgroundImage(IUnion value) + { + this.BackgroundImage = value; + return this; + } + + public TableCell WithVerticalContentAlignment(VerticalAlignment value) + { + this.VerticalContentAlignment = value; + return this; + } + + public TableCell WithRtl(bool value) + { + this.Rtl = value; + return this; + } + + public TableCell WithMaxHeight(string value) + { + this.MaxHeight = value; + return this; + } + + public TableCell WithGridArea(string value) { this.GridArea = value; return this; } - public ComEventMicrosoftGraphComponent WithFallback(IUnion value) + public TableCell WithFallback(IUnion value) { this.Fallback = value; return this; } + + public TableCell WithItems(params CardElement[] value) + { + this.Items = new List(value); + return this; + } + + public TableCell WithItems(IList value) + { + this.Items = value; + return this; + } } /// -/// The properties of a calendar event. +/// A block of text inside a RichTextBlock element. /// -public class CalendarEventProperties : SerializableObject +public class TextRun : CardElement { /// - /// Deserializes a JSON string into an object of type CalendarEventProperties. + /// Deserializes a JSON string into an object of type TextRun. /// - public static CalendarEventProperties? Deserialize(string json) + public static TextRun? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The ID of the event. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **TextRun**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "TextRun"; + + /// + /// 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. /// [JsonPropertyName("id")] public string? Id { get; set; } /// - /// The title of the event. + /// The locale associated with the element. /// - [JsonPropertyName("title")] - public string? Title { get; set; } + [JsonPropertyName("lang")] + public string? Lang { get; set; } + + /// + /// Controls the visibility of the element. + /// + [JsonPropertyName("isVisible")] + public bool? IsVisible { get; set; } = true; + + /// + /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// + [JsonPropertyName("isSortKey")] + public bool? IsSortKey { get; set; } = false; + + /// + /// The text to display. A subset of markdown is supported. + /// + [JsonPropertyName("text")] + public string? Text { get; set; } + + /// + /// The size of the text. + /// + [JsonPropertyName("size")] + public TextSize? Size { get; set; } + + /// + /// The weight of the text. + /// + [JsonPropertyName("weight")] + public TextWeight? Weight { get; set; } /// - /// The start date and time of the event. + /// The color of the text. /// - [JsonPropertyName("start")] - public string? Start { get; set; } + [JsonPropertyName("color")] + public TextColor? Color { get; set; } /// - /// The end date and time of the event. + /// Controls whether the text should be renderer using a subtler variant of the select color. /// - [JsonPropertyName("end")] - public string? End { get; set; } + [JsonPropertyName("isSubtle")] + public bool? IsSubtle { get; set; } /// - /// The status of the event. + /// The type of font to use for rendering. /// - [JsonPropertyName("status")] - public string? Status { get; set; } + [JsonPropertyName("fontType")] + public FontType? FontType { get; set; } /// - /// The locations of the event. + /// Controls if the text should be italicized. /// - [JsonPropertyName("locations")] - public IList? Locations { get; set; } + [JsonPropertyName("italic")] + public bool? Italic { get; set; } = false; /// - /// The URL of the online meeting. + /// Controls if the text should be struck through. /// - [JsonPropertyName("onlineMeetingUrl")] - public string? OnlineMeetingUrl { get; set; } + [JsonPropertyName("strikethrough")] + public bool? Strikethrough { get; set; } = false; /// - /// Indicates if the event is all day. + /// Controls if the text should be highlighted. /// - [JsonPropertyName("isAllDay")] - public bool? IsAllDay { get; set; } + [JsonPropertyName("highlight")] + public bool? Highlight { get; set; } = false; /// - /// The extension of the event. + /// Controls if the text should be underlined. /// - [JsonPropertyName("extension")] - public string? Extension { get; set; } + [JsonPropertyName("underline")] + public bool? Underline { get; set; } = false; /// - /// The URL of the event. + /// An Action that will be invoked when the text is tapped or clicked. Action.ShowCard is not supported. /// - [JsonPropertyName("url")] - public string? Url { get; set; } + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } /// - /// The attendees of the event. + /// The area of a Layout.AreaGrid layout in which an element should be displayed. /// - [JsonPropertyName("attendees")] - public IList? Attendees { get; set; } + [JsonPropertyName("grid.area")] + public string? GridArea { get; set; } /// - /// The organizer of the event. + /// 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. /// - [JsonPropertyName("organizer")] - public CalendarEventAttendee? Organizer { get; set; } + [JsonPropertyName("fallback")] + public IUnion? Fallback { get; set; } + + public TextRun() { } + + public TextRun(string text) + { + this.Text = text; + } /// - /// Serializes this CalendarEventProperties into a JSON string. + /// Serializes this TextRun into a JSON string. /// public string Serialize() { @@ -14346,186 +17890,139 @@ public string Serialize() ); } - public CalendarEventProperties WithId(string value) + public TextRun WithKey(string value) { - this.Id = value; + this.Key = value; return this; } - public CalendarEventProperties WithTitle(string value) + public TextRun WithId(string value) { - this.Title = value; + this.Id = value; return this; } - public CalendarEventProperties WithStart(string value) + public TextRun WithLang(string value) { - this.Start = value; + this.Lang = value; return this; } - public CalendarEventProperties WithEnd(string value) + public TextRun WithIsVisible(bool value) { - this.End = value; + this.IsVisible = value; return this; } - public CalendarEventProperties WithStatus(string value) + public TextRun WithIsSortKey(bool value) { - this.Status = value; + this.IsSortKey = value; return this; } - public CalendarEventProperties WithLocations(params IList value) + public TextRun WithText(string value) { - this.Locations = value; + this.Text = value; return this; } - public CalendarEventProperties WithOnlineMeetingUrl(string value) + public TextRun WithSize(TextSize value) { - this.OnlineMeetingUrl = value; + this.Size = value; return this; } - public CalendarEventProperties WithIsAllDay(bool value) + public TextRun WithWeight(TextWeight value) { - this.IsAllDay = value; + this.Weight = value; return this; } - public CalendarEventProperties WithExtension(string value) + public TextRun WithColor(TextColor value) { - this.Extension = value; + this.Color = value; return this; } - public CalendarEventProperties WithUrl(string value) + public TextRun WithIsSubtle(bool value) { - this.Url = value; + this.IsSubtle = value; return this; } - public CalendarEventProperties WithAttendees(params IList value) + public TextRun WithFontType(FontType value) { - this.Attendees = value; + this.FontType = value; return this; } - public CalendarEventProperties WithOrganizer(CalendarEventAttendee value) + public TextRun WithItalic(bool value) { - this.Organizer = value; + this.Italic = value; return this; } -} - -/// -/// Represents a calendar event attendee. -/// -public class CalendarEventAttendee : SerializableObject -{ - /// - /// Deserializes a JSON string into an object of type CalendarEventAttendee. - /// - public static CalendarEventAttendee? Deserialize(string json) - { - return JsonSerializer.Deserialize(json); - } - - /// - /// The name of the attendee. - /// - [JsonPropertyName("name")] - public string? Name { get; set; } - - /// - /// The email address of the attendee. - /// - [JsonPropertyName("email")] - public string? Email { get; set; } - - /// - /// The title of the attendee. - /// - [JsonPropertyName("title")] - public string? Title { get; set; } - - /// - /// The type of the attendee. - /// - [JsonPropertyName("type")] - public string? Type { get; set; } - - /// - /// The status of the attendee. - /// - [JsonPropertyName("status")] - public string? Status { get; set; } - /// - /// Serializes this CalendarEventAttendee into a JSON string. - /// - public string Serialize() + public TextRun WithStrikethrough(bool value) { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - } - ); + this.Strikethrough = value; + return this; } - public CalendarEventAttendee WithName(string value) + public TextRun WithHighlight(bool value) { - this.Name = value; + this.Highlight = value; return this; } - public CalendarEventAttendee WithEmail(string value) + public TextRun WithUnderline(bool value) { - this.Email = value; + this.Underline = value; return this; } - public CalendarEventAttendee WithTitle(string value) + public TextRun WithSelectAction(Action value) { - this.Title = value; + this.SelectAction = value; return this; } - public CalendarEventAttendee WithType(string value) + public TextRun WithGridArea(string value) { - this.Type = value; + this.GridArea = value; return this; } - public CalendarEventAttendee WithStatus(string value) + public TextRun WithFallback(IUnion value) { - this.Status = value; + this.Fallback = value; return this; } } /// -/// A page inside a Carousel element. +/// An inline icon inside a RichTextBlock element. /// -public class CarouselPage : CardElement +public class IconRun : CardElement { /// - /// Deserializes a JSON string into an object of type CarouselPage. + /// Deserializes a JSON string into an object of type IconRun. /// - public static CarouselPage? Deserialize(string json) + public static IconRun? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **CarouselPage**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **IconRun**. /// [JsonPropertyName("type")] - public string Type { get; } = "CarouselPage"; + public string Type { get; } = "IconRun"; /// /// 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. @@ -14533,12 +18030,6 @@ public class CarouselPage : CardElement [JsonPropertyName("id")] public string? Id { get; set; } - /// - /// 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). - /// - [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } - /// /// The locale associated with the element. /// @@ -14549,85 +18040,43 @@ public class CarouselPage : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } - - /// - /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. - /// - [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). - /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } + public bool? IsVisible { get; set; } = true; /// /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. - /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } - - /// - /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. - /// - [JsonPropertyName("style")] - public ContainerStyle? Style { get; set; } - - /// - /// Controls if a border should be displayed around the container. - /// - [JsonPropertyName("showBorder")] - public bool? ShowBorder { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// Controls if the container should have rounded corners. - /// - [JsonPropertyName("roundedCorners")] - public bool? RoundedCorners { get; set; } - - /// - /// The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See [Container layouts](https://adaptivecards.microsoft.com/?topic=container-layouts) for more details. - /// - [JsonPropertyName("layouts")] - public IList? Layouts { get; set; } - - /// - /// The minimum height, in pixels, of the container, in the `px` format. + /// The name of the inline icon to display. /// - [JsonPropertyName("minHeight")] - public string? MinHeight { get; set; } + [JsonPropertyName("name")] + public string? Name { get; set; } /// - /// Defines the container's background image. + /// The size of the inline icon. /// - [JsonPropertyName("backgroundImage")] - public IUnion? BackgroundImage { get; set; } + [JsonPropertyName("size")] + public SizeEnum? Size { get; set; } = SizeEnum.Default; /// - /// Controls how the container's content should be vertically aligned. + /// The style of the inline icon. /// - [JsonPropertyName("verticalContentAlignment")] - public VerticalAlignment? VerticalContentAlignment { get; set; } + [JsonPropertyName("style")] + public IconStyle? Style { get; set; } = IconStyle.Regular; /// - /// Controls if the content of the card is to be rendered left-to-right or right-to-left. + /// The color of the inline icon. /// - [JsonPropertyName("rtl")] - public bool? Rtl { get; set; } + [JsonPropertyName("color")] + public TextColor? Color { get; set; } = TextColor.Default; /// - /// 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. + /// An Action that will be invoked when the inline icon is tapped or clicked. Action.ShowCard is not supported. /// - [JsonPropertyName("maxHeight")] - public string? MaxHeight { get; set; } + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -14642,18 +18091,7 @@ public class CarouselPage : CardElement public IUnion? Fallback { get; set; } /// - /// The elements in the page. - /// - [JsonPropertyName("items")] - public IList? Items { get; set; } - - public CarouselPage(params IList items) - { - this.Items = items; - } - - /// - /// Serializes this CarouselPage into a JSON string. + /// Serializes this IconRun into a JSON string. /// public string Serialize() { @@ -14667,145 +18105,103 @@ public string Serialize() ); } - public CarouselPage WithId(string value) + public IconRun WithKey(string value) { - this.Id = value; + this.Key = value; return this; } - public CarouselPage WithRequires(HostCapabilities value) + public IconRun WithId(string value) { - this.Requires = value; + this.Id = value; return this; } - public CarouselPage WithLang(string value) + public IconRun WithLang(string value) { this.Lang = value; return this; } - public CarouselPage WithIsVisible(bool value) + public IconRun WithIsVisible(bool value) { this.IsVisible = value; return this; } - public CarouselPage WithHeight(ElementHeight value) - { - this.Height = value; - return this; - } - - public CarouselPage WithTargetWidth(TargetWidth value) - { - this.TargetWidth = value; - return this; - } - - public CarouselPage WithIsSortKey(bool value) + public IconRun WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public CarouselPage WithSelectAction(Action value) - { - this.SelectAction = value; - return this; - } - - public CarouselPage WithStyle(ContainerStyle value) - { - this.Style = value; - return this; - } - - public CarouselPage WithShowBorder(bool value) - { - this.ShowBorder = value; - return this; - } - - public CarouselPage WithRoundedCorners(bool value) - { - this.RoundedCorners = value; - return this; - } - - public CarouselPage WithLayouts(params IList value) - { - this.Layouts = value; - return this; - } - - public CarouselPage WithMinHeight(string value) + public IconRun WithName(string value) { - this.MinHeight = value; + this.Name = value; return this; } - public CarouselPage WithBackgroundImage(IUnion value) + public IconRun WithSize(SizeEnum value) { - this.BackgroundImage = value; + this.Size = value; return this; } - public CarouselPage WithVerticalContentAlignment(VerticalAlignment value) + public IconRun WithStyle(IconStyle value) { - this.VerticalContentAlignment = value; + this.Style = value; return this; } - public CarouselPage WithRtl(bool value) + public IconRun WithColor(TextColor value) { - this.Rtl = value; + this.Color = value; return this; } - public CarouselPage WithMaxHeight(string value) + public IconRun WithSelectAction(Action value) { - this.MaxHeight = value; + this.SelectAction = value; return this; } - public CarouselPage WithGridArea(string value) + public IconRun WithGridArea(string value) { this.GridArea = value; return this; } - public CarouselPage WithFallback(IUnion value) + public IconRun WithFallback(IUnion value) { this.Fallback = value; return this; } - - public CarouselPage WithItems(params IList value) - { - this.Items = value; - return this; - } } /// -/// Represents a row of cells in a table. +/// An inline image inside a RichTextBlock element. /// -public class TableRow : CardElement +public class ImageRun : CardElement { /// - /// Deserializes a JSON string into an object of type TableRow. + /// Deserializes a JSON string into an object of type ImageRun. /// - public static TableRow? Deserialize(string json) + public static ImageRun? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **TableRow**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Must be **ImageRun**. /// [JsonPropertyName("type")] - public string Type { get; } = "TableRow"; + public string Type { get; } = "ImageRun"; /// /// 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. @@ -14813,12 +18209,6 @@ public class TableRow : CardElement [JsonPropertyName("id")] public string? Id { get; set; } - /// - /// 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). - /// - [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } - /// /// The locale associated with the element. /// @@ -14829,73 +18219,43 @@ public class TableRow : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } - - /// - /// 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. - /// - [JsonPropertyName("separator")] - public bool? Separator { get; set; } - - /// - /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. - /// - [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } - - /// - /// Controls how the element should be horizontally aligned. - /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } - - /// - /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. - /// - [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } - - /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). - /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } + public bool? IsVisible { get; set; } = true; /// /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// - /// Controls if a border should be displayed around the container. + /// The URL (or Base64-encoded Data URI) of the image. Acceptable formats are PNG, JPEG, GIF and SVG. /// - [JsonPropertyName("showBorder")] - public bool? ShowBorder { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } /// - /// Controls if the container should have rounded corners. + /// The size of the inline image. /// - [JsonPropertyName("roundedCorners")] - public bool? RoundedCorners { get; set; } + [JsonPropertyName("size")] + public SizeEnum? Size { get; set; } = SizeEnum.Default; /// - /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. + /// The style of the inline image. /// [JsonPropertyName("style")] - public ContainerStyle? Style { get; set; } + public ImageStyle? Style { get; set; } = ImageStyle.Default; /// - /// Controls how the content of every cell in the row should be horizontally aligned by default. This property overrides the horizontalCellContentAlignment property of the table and columns. + /// An Action that will be invoked when the image is tapped or clicked. Action.ShowCard is not supported. /// - [JsonPropertyName("horizontalCellContentAlignment")] - public HorizontalAlignment? HorizontalCellContentAlignment { get; set; } + [JsonPropertyName("selectAction")] + public Action? SelectAction { get; set; } /// - /// Controls how the content of every cell in the row should be vertically aligned by default. This property overrides the verticalCellContentAlignment property of the table and columns. + /// A set of theme-specific image URLs. /// - [JsonPropertyName("verticalCellContentAlignment")] - public VerticalAlignment? VerticalCellContentAlignment { get; set; } + [JsonPropertyName("themedUrls")] + public IList? ThemedUrls { get; set; } /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. @@ -14910,13 +18270,7 @@ public class TableRow : CardElement public IUnion? Fallback { get; set; } /// - /// The cells in the row. - /// - [JsonPropertyName("cells")] - public IList? Cells { get; set; } - - /// - /// Serializes this TableRow into a JSON string. + /// Serializes this ImageRun into a JSON string. /// public string Serialize() { @@ -14930,133 +18284,109 @@ public string Serialize() ); } - public TableRow WithId(string value) + public ImageRun WithKey(string value) { - this.Id = value; + this.Key = value; return this; } - public TableRow WithRequires(HostCapabilities value) + public ImageRun WithId(string value) { - this.Requires = value; + this.Id = value; return this; } - public TableRow WithLang(string value) + public ImageRun WithLang(string value) { this.Lang = value; return this; } - public TableRow WithIsVisible(bool value) + public ImageRun WithIsVisible(bool value) { this.IsVisible = value; return this; } - public TableRow WithSeparator(bool value) - { - this.Separator = value; - return this; - } - - public TableRow WithHeight(ElementHeight value) - { - this.Height = value; - return this; - } - - public TableRow WithHorizontalAlignment(HorizontalAlignment value) - { - this.HorizontalAlignment = value; - return this; - } - - public TableRow WithSpacing(Spacing value) - { - this.Spacing = value; - return this; - } - - public TableRow WithTargetWidth(TargetWidth value) - { - this.TargetWidth = value; - return this; - } - - public TableRow WithIsSortKey(bool value) + public ImageRun WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public TableRow WithShowBorder(bool value) + public ImageRun WithUrl(string value) { - this.ShowBorder = value; + this.Url = value; return this; } - public TableRow WithRoundedCorners(bool value) + public ImageRun WithSize(SizeEnum value) { - this.RoundedCorners = value; + this.Size = value; return this; } - public TableRow WithStyle(ContainerStyle value) + public ImageRun WithStyle(ImageStyle value) { this.Style = value; return this; } - public TableRow WithHorizontalCellContentAlignment(HorizontalAlignment value) + public ImageRun WithSelectAction(Action value) { - this.HorizontalCellContentAlignment = value; + this.SelectAction = value; return this; } - public TableRow WithVerticalCellContentAlignment(VerticalAlignment value) + public ImageRun WithThemedUrls(params ThemedUrl[] value) { - this.VerticalCellContentAlignment = value; + this.ThemedUrls = new List(value); return this; } - public TableRow WithGridArea(string value) + public ImageRun WithThemedUrls(IList value) { - this.GridArea = value; + this.ThemedUrls = value; return this; } - public TableRow WithFallback(IUnion value) + public ImageRun WithGridArea(string value) { - this.Fallback = value; + this.GridArea = value; return this; } - public TableRow WithCells(params IList value) + public ImageRun WithFallback(IUnion value) { - this.Cells = value; + this.Fallback = value; return this; } } /// -/// Represents a cell in a table row. +/// A column in a ColumnSet element. /// -public class TableCell : CardElement +public class Column : CardElement { /// - /// Deserializes a JSON string into an object of type TableCell. + /// Deserializes a JSON string into an object of type Column. /// - public static TableCell? Deserialize(string json) + public static Column? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **TableCell**. + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Optional. If specified, must be **Column**. /// [JsonPropertyName("type")] - public string Type { get; } = "TableCell"; + public string Type { get; } = "Column"; /// /// 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. @@ -15068,7 +18398,7 @@ public class TableCell : CardElement /// 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). /// [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } + public HostCapabilities? Requires { get; set; } = new HostCapabilities(); /// /// The locale associated with the element. @@ -15080,25 +18410,31 @@ public class TableCell : CardElement /// Controls the visibility of the element. /// [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + public bool? IsVisible { get; set; } = true; /// /// 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. /// [JsonPropertyName("separator")] - public bool? Separator { get; set; } + public bool? Separator { get; set; } = false; /// /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. /// [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + public ElementHeight? Height { get; set; } = ElementHeight.Auto; + + /// + /// Controls how the element should be horizontally aligned. + /// + [JsonPropertyName("horizontalAlignment")] + public HorizontalAlignment? HorizontalAlignment { get; set; } /// /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. /// [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public Spacing? Spacing { get; set; } = Spacing.Default; /// /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). @@ -15110,7 +18446,7 @@ public class TableCell : CardElement /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. /// [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public bool? IsSortKey { get; set; } = false; /// /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. @@ -15124,6 +18460,18 @@ public class TableCell : CardElement [JsonPropertyName("style")] public ContainerStyle? Style { get; set; } + /// + /// Controls if a border should be displayed around the container. + /// + [JsonPropertyName("showBorder")] + public bool? ShowBorder { get; set; } = false; + + /// + /// Controls if the container should have rounded corners. + /// + [JsonPropertyName("roundedCorners")] + public bool? RoundedCorners { get; set; } = false; + /// /// The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See [Container layouts](https://adaptivecards.microsoft.com/?topic=container-layouts) for more details. /// @@ -15134,7 +18482,7 @@ public class TableCell : CardElement /// Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. /// [JsonPropertyName("bleed")] - public bool? Bleed { get; set; } + public bool? Bleed { get; set; } = false; /// /// The minimum height, in pixels, of the container, in the `px` format. @@ -15166,6 +18514,12 @@ public class TableCell : CardElement [JsonPropertyName("maxHeight")] public string? MaxHeight { get; set; } + /// + /// 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. + /// + [JsonPropertyName("width")] + public IUnion? Width { get; set; } + /// /// The area of a Layout.AreaGrid layout in which an element should be displayed. /// @@ -15179,18 +18533,25 @@ public class TableCell : CardElement public IUnion? Fallback { get; set; } /// - /// The items (elements) in the cell. + /// The elements in the column. /// [JsonPropertyName("items")] public IList? Items { get; set; } - public TableCell(params IList items) + public Column() { } + + public Column(params CardElement[] items) + { + this.Items = new List(items); + } + + public Column(IList items) { this.Items = items; } /// - /// Serializes this TableCell into a JSON string. + /// Serializes this Column into a JSON string. /// public string Serialize() { @@ -15204,127 +18565,169 @@ public string Serialize() ); } - public TableCell WithId(string value) + public Column WithKey(string value) + { + this.Key = value; + return this; + } + + public Column WithId(string value) { this.Id = value; return this; } - public TableCell WithRequires(HostCapabilities value) + public Column WithRequires(HostCapabilities value) { this.Requires = value; return this; } - public TableCell WithLang(string value) + public Column WithLang(string value) { this.Lang = value; return this; } - public TableCell WithIsVisible(bool value) + public Column WithIsVisible(bool value) { this.IsVisible = value; return this; } - public TableCell WithSeparator(bool value) + public Column WithSeparator(bool value) { this.Separator = value; return this; } - public TableCell WithHeight(ElementHeight value) + public Column WithHeight(ElementHeight value) { this.Height = value; return this; } - public TableCell WithSpacing(Spacing value) + public Column WithHorizontalAlignment(HorizontalAlignment value) + { + this.HorizontalAlignment = value; + return this; + } + + public Column WithSpacing(Spacing value) { this.Spacing = value; return this; } - public TableCell WithTargetWidth(TargetWidth value) + public Column WithTargetWidth(TargetWidth value) { this.TargetWidth = value; return this; } - public TableCell WithIsSortKey(bool value) + public Column WithIsSortKey(bool value) { this.IsSortKey = value; return this; } - public TableCell WithSelectAction(Action value) + public Column WithSelectAction(Action value) { this.SelectAction = value; return this; } - public TableCell WithStyle(ContainerStyle value) + public Column WithStyle(ContainerStyle value) { this.Style = value; return this; } - public TableCell WithLayouts(params IList value) + public Column WithShowBorder(bool value) + { + this.ShowBorder = value; + return this; + } + + public Column WithRoundedCorners(bool value) + { + this.RoundedCorners = value; + return this; + } + + public Column WithLayouts(params ContainerLayout[] value) + { + this.Layouts = new List(value); + return this; + } + + public Column WithLayouts(IList value) { this.Layouts = value; return this; } - public TableCell WithBleed(bool value) + public Column WithBleed(bool value) { this.Bleed = value; return this; } - public TableCell WithMinHeight(string value) + public Column WithMinHeight(string value) { this.MinHeight = value; return this; } - public TableCell WithBackgroundImage(IUnion value) + public Column WithBackgroundImage(IUnion value) { this.BackgroundImage = value; return this; } - public TableCell WithVerticalContentAlignment(VerticalAlignment value) + public Column WithVerticalContentAlignment(VerticalAlignment value) { this.VerticalContentAlignment = value; return this; } - public TableCell WithRtl(bool value) + public Column WithRtl(bool value) { this.Rtl = value; return this; } - public TableCell WithMaxHeight(string value) + public Column WithMaxHeight(string value) { this.MaxHeight = value; return this; } - public TableCell WithGridArea(string value) + public Column WithWidth(IUnion value) + { + this.Width = value; + return this; + } + + public Column WithGridArea(string value) { this.GridArea = value; return this; } - public TableCell WithFallback(IUnion value) + public Column WithFallback(IUnion value) { this.Fallback = value; return this; } - public TableCell WithItems(params IList value) + public Column WithItems(params CardElement[] value) + { + this.Items = new List(value); + return this; + } + + public Column WithItems(IList value) { this.Items = value; return this; @@ -15332,133 +18735,100 @@ public TableCell WithItems(params IList value) } /// -/// A block of text inside a RichTextBlock element. +/// Represents the data of an Action.Submit. /// -public class TextRun : CardElement +public class SubmitActionData : SerializableObject { /// - /// Deserializes a JSON string into an object of type TextRun. + /// Deserializes a JSON string into an object of type SubmitActionData. /// - public static TextRun? Deserialize(string json) + public static SubmitActionData? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **TextRun**. - /// - [JsonPropertyName("type")] - public string Type { get; } = "TextRun"; - - /// - /// 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. - /// - [JsonPropertyName("id")] - public string? Id { get; set; } - - /// - /// The locale associated with the element. - /// - [JsonPropertyName("lang")] - public string? Lang { get; set; } - - /// - /// Controls the visibility of the element. - /// - [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } - - /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. - /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } - - /// - /// The text to display. A subset of markdown is supported. - /// - [JsonPropertyName("text")] - public string? Text { get; set; } - - /// - /// The size of the text. - /// - [JsonPropertyName("size")] - public TextSize? Size { get; set; } - - /// - /// The weight of the text. - /// - [JsonPropertyName("weight")] - public TextWeight? Weight { get; set; } - - /// - /// The color of the text. - /// - [JsonPropertyName("color")] - public TextColor? Color { get; set; } - - /// - /// Controls whether the text should be renderer using a subtler variant of the select color. + /// 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. /// - [JsonPropertyName("isSubtle")] - public bool? IsSubtle { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The type of font to use for rendering. + /// Defines the optional Teams-specific portion of the action's data. /// - [JsonPropertyName("fontType")] - public FontType? FontType { get; set; } + [JsonPropertyName("msteams")] + public object? Msteams { get; set; } /// - /// Controls if the text should be italicized. + /// Serializes this SubmitActionData into a JSON string. /// - [JsonPropertyName("italic")] - public bool? Italic { get; set; } + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } - /// - /// Controls if the text should be struck through. - /// - [JsonPropertyName("strikethrough")] - public bool? Strikethrough { get; set; } + public SubmitActionData WithKey(string value) + { + this.Key = value; + return this; + } - /// - /// Controls if the text should be highlighted. - /// - [JsonPropertyName("highlight")] - public bool? Highlight { get; set; } + public SubmitActionData WithMsteams(object value) + { + this.Msteams = value; + return this; + } + [JsonExtensionData] + public IDictionary NonSchemaProperties { get; set; } = new Dictionary(); +} +/// +/// Represents Teams-specific data in an Action.Submit to send an Instant Message back to the Bot. +/// +public class ImBackSubmitActionData : SerializableObject +{ /// - /// Controls if the text should be underlined. + /// Deserializes a JSON string into an object of type ImBackSubmitActionData. /// - [JsonPropertyName("underline")] - public bool? Underline { get; set; } + public static ImBackSubmitActionData? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } /// - /// An Action that will be invoked when the text is tapped or clicked. Action.ShowCard is not supported. + /// 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. /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The area of a Layout.AreaGrid layout in which an element should be displayed. - /// - [JsonPropertyName("grid.area")] - public string? GridArea { get; set; } + /// Must be **imBack**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "imBack"; /// - /// 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. + /// The value that will be sent to the Bot. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + [JsonPropertyName("value")] + public string? Value { get; set; } - public TextRun(string text) + public ImBackSubmitActionData() { } + + public ImBackSubmitActionData(string value) { - this.Text = text; + this.Value = value; } /// - /// Serializes this TextRun into a JSON string. + /// Serializes this ImBackSubmitActionData into a JSON string. /// public string Serialize() { @@ -15472,196 +18842,332 @@ public string Serialize() ); } - public TextRun WithId(string value) + public ImBackSubmitActionData WithKey(string value) { - this.Id = value; + this.Key = value; return this; } - public TextRun WithLang(string value) + public ImBackSubmitActionData WithValue(string value) { - this.Lang = value; + this.Value = value; return this; } +} - public TextRun WithIsVisible(bool value) +/// +/// Represents Teams-specific data in an Action.Submit to make an Invoke request to the Bot. +/// +public class InvokeSubmitActionData : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type InvokeSubmitActionData. + /// + public static InvokeSubmitActionData? Deserialize(string json) { - this.IsVisible = value; - return this; + return JsonSerializer.Deserialize(json); } - public TextRun WithIsSortKey(bool value) - { - this.IsSortKey = value; - return this; - } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } - public TextRun WithText(string value) + /// + /// Must be **invoke**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "invoke"; + + /// + /// 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. + /// + [JsonPropertyName("value")] + public IUnion? Value { get; set; } + + public InvokeSubmitActionData() { } + + public InvokeSubmitActionData(IUnion value) { - this.Text = value; - return this; + this.Value = value; } - public TextRun WithSize(TextSize value) + /// + /// Serializes this InvokeSubmitActionData into a JSON string. + /// + public string Serialize() { - this.Size = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public TextRun WithWeight(TextWeight value) + public InvokeSubmitActionData WithKey(string value) { - this.Weight = value; + this.Key = value; return this; } - public TextRun WithColor(TextColor value) + public InvokeSubmitActionData WithValue(IUnion value) { - this.Color = value; + this.Value = value; return this; } +} - public TextRun WithIsSubtle(bool value) +/// +/// Data for invoking a collaboration stage action. +/// +public class CollabStageInvokeDataValue : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type CollabStageInvokeDataValue. + /// + public static CollabStageInvokeDataValue? Deserialize(string json) { - this.IsSubtle = value; - return this; + return JsonSerializer.Deserialize(json); } - public TextRun WithFontType(FontType value) + /// + /// Must be **tab/tabInfoAction**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "tab/tabInfoAction"; + + /// + /// Provides information about the iFrame content, rendered in the collab stage popout window. + /// + [JsonPropertyName("tabInfo")] + public TabInfo? TabInfo { get; set; } + + /// + /// Serializes this CollabStageInvokeDataValue into a JSON string. + /// + public string Serialize() { - this.FontType = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public TextRun WithItalic(bool value) + public CollabStageInvokeDataValue WithTabInfo(TabInfo value) { - this.Italic = value; + this.TabInfo = value; return this; } +} - public TextRun WithStrikethrough(bool value) +/// +/// Represents information about the iFrame content, rendered in the collab stage popout window. +/// +public class TabInfo : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type TabInfo. + /// + public static TabInfo? Deserialize(string json) { - this.Strikethrough = value; - return this; + return JsonSerializer.Deserialize(json); } - public TextRun WithHighlight(bool value) + /// + /// The name for the content. This will be displayed as the title of the window hosting the iFrame. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The URL to open in an iFrame. + /// + [JsonPropertyName("contentUrl")] + public string? ContentUrl { get; set; } + + /// + /// The unique entity id for this content (e.g., random UUID). + /// + [JsonPropertyName("entityId")] + public string? EntityId { get; set; } + + /// + /// An optional website URL to the content, allowing users to open this content in the browser (if they prefer). + /// + [JsonPropertyName("websiteUrl")] + public string? WebsiteUrl { get; set; } + + /// + /// Serializes this TabInfo into a JSON string. + /// + public string Serialize() { - this.Highlight = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public TextRun WithUnderline(bool value) + public TabInfo WithName(string value) { - this.Underline = value; + this.Name = value; return this; } - public TextRun WithSelectAction(Action value) + public TabInfo WithContentUrl(string value) { - this.SelectAction = value; + this.ContentUrl = value; return this; } - public TextRun WithGridArea(string value) + public TabInfo WithEntityId(string value) { - this.GridArea = value; + this.EntityId = value; return this; } - public TextRun WithFallback(IUnion value) + public TabInfo WithWebsiteUrl(string value) { - this.Fallback = value; + this.WebsiteUrl = value; return this; } } /// -/// An inline icon inside a RichTextBlock element. +/// Represents Teams-specific data in an Action.Submit to send a message back to the Bot. /// -public class IconRun : CardElement +public class MessageBackSubmitActionData : SerializableObject { /// - /// Deserializes a JSON string into an object of type IconRun. + /// Deserializes a JSON string into an object of type MessageBackSubmitActionData. /// - public static IconRun? Deserialize(string json) + public static MessageBackSubmitActionData? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **IconRun**. + /// 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. /// - [JsonPropertyName("type")] - public string Type { get; } = "IconRun"; + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// 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. + /// Must be **messageBack**. /// - [JsonPropertyName("id")] - public string? Id { get; set; } + [JsonPropertyName("type")] + public string Type { get; } = "messageBack"; /// - /// The locale associated with the element. + /// The text that will be sent to the Bot. /// - [JsonPropertyName("lang")] - public string? Lang { get; set; } + [JsonPropertyName("text")] + public string? Text { get; set; } /// - /// Controls the visibility of the element. + /// 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. /// - [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + [JsonPropertyName("displayText")] + public string? DisplayText { get; set; } /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// 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. /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + [JsonPropertyName("value")] + public object? Value { get; set; } /// - /// The name of the inline icon to display. + /// Serializes this MessageBackSubmitActionData into a JSON string. /// - [JsonPropertyName("name")] - public string? Name { get; set; } + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } - /// - /// The size of the inline icon. - /// - [JsonPropertyName("size")] - public SizeEnum? Size { get; set; } + public MessageBackSubmitActionData WithKey(string value) + { + this.Key = value; + return this; + } - /// - /// The style of the inline icon. - /// - [JsonPropertyName("style")] - public IconStyle? Style { get; set; } + public MessageBackSubmitActionData WithText(string value) + { + this.Text = value; + return this; + } + + public MessageBackSubmitActionData WithDisplayText(string value) + { + this.DisplayText = value; + return this; + } + + public MessageBackSubmitActionData WithValue(object value) + { + this.Value = value; + return this; + } +} +/// +/// Represents Teams-specific data in an Action.Submit to sign in a user. +/// +public class SigninSubmitActionData : SerializableObject +{ /// - /// The color of the inline icon. + /// Deserializes a JSON string into an object of type SigninSubmitActionData. /// - [JsonPropertyName("color")] - public TextColor? Color { get; set; } + public static SigninSubmitActionData? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } /// - /// An Action that will be invoked when the inline icon is tapped or clicked. Action.ShowCard is not supported. + /// 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. /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The area of a Layout.AreaGrid layout in which an element should be displayed. + /// Must be **signin**. /// - [JsonPropertyName("grid.area")] - public string? GridArea { get; set; } + [JsonPropertyName("type")] + public string Type { get; } = "signin"; /// - /// 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. + /// The URL to redirect the end-user for signing in. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + [JsonPropertyName("value")] + public string? Value { get; set; } + + public SigninSubmitActionData() { } + + public SigninSubmitActionData(string value) + { + this.Value = value; + } /// - /// Serializes this IconRun into a JSON string. + /// Serializes this SigninSubmitActionData into a JSON string. /// public string Serialize() { @@ -15675,160 +19181,205 @@ public string Serialize() ); } - public IconRun WithId(string value) + public SigninSubmitActionData WithKey(string value) { - this.Id = value; + this.Key = value; return this; } - public IconRun WithLang(string value) + public SigninSubmitActionData WithValue(string value) { - this.Lang = value; + this.Value = value; return this; } +} - public IconRun WithIsVisible(bool value) +/// +/// Represents Teams-specific data in an Action.Submit to open a task module. +/// +public class TaskFetchSubmitActionData : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type TaskFetchSubmitActionData. + /// + public static TaskFetchSubmitActionData? Deserialize(string json) { - this.IsVisible = value; - return this; + return JsonSerializer.Deserialize(json); } - public IconRun WithIsSortKey(bool value) - { - this.IsSortKey = value; - return this; - } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } - public IconRun WithName(string value) - { - this.Name = value; - return this; - } + /// + /// Must be **task/fetch**. + /// + [JsonPropertyName("type")] + public string Type { get; } = "task/fetch"; - public IconRun WithSize(SizeEnum value) + /// + /// Serializes this TaskFetchSubmitActionData into a JSON string. + /// + public string Serialize() { - this.Size = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public IconRun WithStyle(IconStyle value) + public TaskFetchSubmitActionData WithKey(string value) { - this.Style = value; + this.Key = value; return this; } +} - public IconRun WithColor(TextColor value) +/// +/// Teams-specific properties associated with the action. +/// +public class TeamsSubmitActionProperties : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type TeamsSubmitActionProperties. + /// + public static TeamsSubmitActionProperties? Deserialize(string json) { - this.Color = value; - return this; + return JsonSerializer.Deserialize(json); } - public IconRun WithSelectAction(Action value) + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Defines how feedback is provided to the end-user when the action is executed. + /// + [JsonPropertyName("feedback")] + public TeamsSubmitActionFeedback? Feedback { get; set; } + + /// + /// Serializes this TeamsSubmitActionProperties into a JSON string. + /// + public string Serialize() { - this.SelectAction = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public IconRun WithGridArea(string value) + public TeamsSubmitActionProperties WithKey(string value) { - this.GridArea = value; + this.Key = value; return this; } - public IconRun WithFallback(IUnion value) + public TeamsSubmitActionProperties WithFeedback(TeamsSubmitActionFeedback value) { - this.Fallback = value; + this.Feedback = value; return this; } } /// -/// An inline image inside a RichTextBlock element. +/// Represents feedback options for an [Action.Submit](https://adaptivecards.microsoft.com/?topic=Action.Submit). /// -public class ImageRun : CardElement +public class TeamsSubmitActionFeedback : SerializableObject { /// - /// Deserializes a JSON string into an object of type ImageRun. + /// Deserializes a JSON string into an object of type TeamsSubmitActionFeedback. /// - public static ImageRun? Deserialize(string json) + public static TeamsSubmitActionFeedback? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Must be **ImageRun**. - /// - [JsonPropertyName("type")] - public string Type { get; } = "ImageRun"; - - /// - /// 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. - /// - [JsonPropertyName("id")] - public string? Id { get; set; } - - /// - /// The locale associated with the element. - /// - [JsonPropertyName("lang")] - public string? Lang { get; set; } - - /// - /// Controls the visibility of the element. + /// 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. /// - [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. + /// Defines if a feedback message should be displayed after the action is executed. /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + [JsonPropertyName("hide")] + public bool? Hide { get; set; } /// - /// The URL (or Base64-encoded Data URI) of the image. Acceptable formats are PNG, JPEG, GIF and SVG. + /// Serializes this TeamsSubmitActionFeedback into a JSON string. /// - [JsonPropertyName("url")] - public string? Url { get; set; } + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } - /// - /// The size of the inline image. - /// - [JsonPropertyName("size")] - public SizeEnum? Size { get; set; } + public TeamsSubmitActionFeedback WithKey(string value) + { + this.Key = value; + return this; + } - /// - /// The style of the inline image. - /// - [JsonPropertyName("style")] - public ImageStyle? Style { get; set; } + public TeamsSubmitActionFeedback WithHide(bool value) + { + this.Hide = value; + return this; + } +} +/// +/// Defines how a card can be refreshed by making a request to the target Bot. +/// +public class RefreshDefinition : SerializableObject +{ /// - /// An Action that will be invoked when the image is tapped or clicked. Action.ShowCard is not supported. + /// Deserializes a JSON string into an object of type RefreshDefinition. /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } + public static RefreshDefinition? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } /// - /// A set of theme-specific image URLs. + /// 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. /// - [JsonPropertyName("themedUrls")] - public IList? ThemedUrls { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The area of a Layout.AreaGrid layout in which an element should be displayed. + /// The Action.Execute action to invoke to refresh the card. /// - [JsonPropertyName("grid.area")] - public string? GridArea { get; set; } + [JsonPropertyName("action")] + public ExecuteAction? Action { get; set; } /// - /// 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. + /// 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. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + [JsonPropertyName("userIds")] + public IList? UserIds { get; set; } /// - /// Serializes this ImageRun into a JSON string. + /// Serializes this RefreshDefinition into a JSON string. /// public string Serialize() { @@ -15842,100 +19393,171 @@ public string Serialize() ); } - public ImageRun WithId(string value) + public RefreshDefinition WithKey(string value) { - this.Id = value; + this.Key = value; return this; } - public ImageRun WithLang(string value) + public RefreshDefinition WithAction(ExecuteAction value) { - this.Lang = value; + this.Action = value; return this; } - public ImageRun WithIsVisible(bool value) + public RefreshDefinition WithUserIds(params string[] value) { - this.IsVisible = value; + this.UserIds = new List(value); return this; } - public ImageRun WithIsSortKey(bool value) + public RefreshDefinition WithUserIds(IList value) { - this.IsSortKey = value; + this.UserIds = value; return this; } +} + +/// +/// 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) +/// +public class Authentication : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type Authentication. + /// + public static Authentication? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } + + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The text that can be displayed to the end user when prompting them to authenticate. + /// + [JsonPropertyName("text")] + public string? Text { get; set; } + + /// + /// The identifier for registered OAuth connection setting information. + /// + [JsonPropertyName("connectionName")] + public string? ConnectionName { get; set; } + + /// + /// The buttons that should be displayed to the user when prompting for authentication. The array MUST contain one button of type “signin”. Other button types are not currently supported. + /// + [JsonPropertyName("buttons")] + public IList? Buttons { get; set; } - public ImageRun WithUrl(string value) + /// + /// Provides information required to enable on-behalf-of single sign-on user authentication. + /// + [JsonPropertyName("tokenExchangeResource")] + public TokenExchangeResource? TokenExchangeResource { get; set; } + + /// + /// Serializes this Authentication into a JSON string. + /// + public string Serialize() { - this.Url = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public ImageRun WithSize(SizeEnum value) + public Authentication WithKey(string value) { - this.Size = value; + this.Key = value; return this; } - public ImageRun WithStyle(ImageStyle value) + public Authentication WithText(string value) { - this.Style = value; + this.Text = value; return this; } - public ImageRun WithSelectAction(Action value) + public Authentication WithConnectionName(string value) { - this.SelectAction = value; + this.ConnectionName = value; return this; } - public ImageRun WithThemedUrls(params IList value) + public Authentication WithButtons(params AuthCardButton[] value) { - this.ThemedUrls = value; + this.Buttons = new List(value); return this; } - public ImageRun WithGridArea(string value) + public Authentication WithButtons(IList value) { - this.GridArea = value; + this.Buttons = value; return this; } - public ImageRun WithFallback(IUnion value) + public Authentication WithTokenExchangeResource(TokenExchangeResource value) { - this.Fallback = value; + this.TokenExchangeResource = value; return this; } } /// -/// Defines a theme-specific URL. +/// 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). /// -public class ThemedUrl : SerializableObject +public class AuthCardButton : SerializableObject { /// - /// Deserializes a JSON string into an object of type ThemedUrl. + /// Deserializes a JSON string into an object of type AuthCardButton. /// - public static ThemedUrl? Deserialize(string json) + public static AuthCardButton? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// The theme this URL applies to. + /// 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. /// - [JsonPropertyName("theme")] - public ThemeName? Theme { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The URL to use for the associated theme. + /// Must be **signin**. /// - [JsonPropertyName("url")] - public string? Url { get; set; } + [JsonPropertyName("type")] + public string? Type { get; set; } /// - /// Serializes this ThemedUrl into a JSON string. + /// The caption of the button. + /// + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// A URL to an image to display alongside the button’s caption. + /// + [JsonPropertyName("image")] + public string? Image { get; set; } + + /// + /// The value associated with the button. The meaning of value depends on the button’s type. + /// + [JsonPropertyName("value")] + public string? Value { get; set; } + + /// + /// Serializes this AuthCardButton into a JSON string. /// public string Serialize() { @@ -15949,195 +19571,226 @@ public string Serialize() ); } - public ThemedUrl WithTheme(ThemeName value) + public AuthCardButton WithKey(string value) { - this.Theme = value; + this.Key = value; return this; } - public ThemedUrl WithUrl(string value) + public AuthCardButton WithType(string value) { - this.Url = value; + this.Type = value; + return this; + } + + public AuthCardButton WithTitle(string value) + { + this.Title = value; + return this; + } + + public AuthCardButton WithImage(string value) + { + this.Image = value; + return this; + } + + public AuthCardButton WithValue(string value) + { + this.Value = value; return this; } } /// -/// A column in a ColumnSet element. +/// 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) /// -public class Column : CardElement +public class TokenExchangeResource : SerializableObject { /// - /// Deserializes a JSON string into an object of type Column. + /// Deserializes a JSON string into an object of type TokenExchangeResource. /// - public static Column? Deserialize(string json) + public static TokenExchangeResource? Deserialize(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } /// - /// Optional. If specified, must be **Column**. + /// 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. /// - [JsonPropertyName("type")] - public string Type { get; } = "Column"; + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// 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. + /// The unique identified of this token exchange instance. /// [JsonPropertyName("id")] public string? Id { get; set; } /// - /// 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). - /// - [JsonPropertyName("requires")] - public HostCapabilities? Requires { get; set; } - - /// - /// The locale associated with the element. - /// - [JsonPropertyName("lang")] - public string? Lang { get; set; } - - /// - /// Controls the visibility of the element. - /// - [JsonPropertyName("isVisible")] - public bool? IsVisible { get; set; } - - /// - /// 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. + /// An application ID or resource identifier with which to exchange a token on behalf of. This property is identity provider- and application-specific. /// - [JsonPropertyName("separator")] - public bool? Separator { get; set; } + [JsonPropertyName("uri")] + public string? Uri { get; set; } /// - /// The height of the element. When set to stretch, the element will use the remaining vertical space in its container. + /// An identifier for the identity provider with which to attempt a token exchange. /// - [JsonPropertyName("height")] - public ElementHeight? Height { get; set; } + [JsonPropertyName("providerId")] + public string? ProviderId { get; set; } /// - /// Controls how the element should be horizontally aligned. + /// Serializes this TokenExchangeResource into a JSON string. /// - [JsonPropertyName("horizontalAlignment")] - public HorizontalAlignment? HorizontalAlignment { get; set; } + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } - /// - /// Controls the amount of space between this element and the previous one. No space will be added for the first element in a container. - /// - [JsonPropertyName("spacing")] - public Spacing? Spacing { get; set; } + public TokenExchangeResource WithKey(string value) + { + this.Key = value; + return this; + } - /// - /// 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](https://adaptivecards.microsoft.com/?topic=responsive-layout). - /// - [JsonPropertyName("targetWidth")] - public TargetWidth? TargetWidth { get; set; } + public TokenExchangeResource WithId(string value) + { + this.Id = value; + return this; + } - /// - /// Controls whether the element should be used as a sort key by elements that allow sorting across a collection of elements. - /// - [JsonPropertyName("isSortKey")] - public bool? IsSortKey { get; set; } + public TokenExchangeResource WithUri(string value) + { + this.Uri = value; + return this; + } - /// - /// An Action that will be invoked when the element is tapped or clicked. Action.ShowCard is not supported. - /// - [JsonPropertyName("selectAction")] - public Action? SelectAction { get; set; } + public TokenExchangeResource WithProviderId(string value) + { + this.ProviderId = value; + return this; + } +} +/// +/// Represents a set of Teams-specific properties on a card. +/// +public class TeamsCardProperties : SerializableObject +{ /// - /// The style of the container. Container styles control the colors of the background, border and text inside the container, in such a way that contrast requirements are always met. + /// Deserializes a JSON string into an object of type TeamsCardProperties. /// - [JsonPropertyName("style")] - public ContainerStyle? Style { get; set; } + public static TeamsCardProperties? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } /// - /// Controls if a border should be displayed around the container. + /// 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. /// - [JsonPropertyName("showBorder")] - public bool? ShowBorder { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// Controls if the container should have rounded corners. + /// Controls the width of the card in a Teams chat. + /// + /// Note that setting `width` to "full" will not actually stretch the card to the "full width" of the chat pane. It will only make the card wider than when the `width` property isn't set. /// - [JsonPropertyName("roundedCorners")] - public bool? RoundedCorners { get; set; } + [JsonPropertyName("width")] + public TeamsCardWidth? Width { get; set; } /// - /// The layouts associated with the container. The container can dynamically switch from one layout to another as the card's width changes. See [Container layouts](https://adaptivecards.microsoft.com/?topic=container-layouts) for more details. + /// The Teams-specific entities associated with the card. /// - [JsonPropertyName("layouts")] - public IList? Layouts { get; set; } + [JsonPropertyName("entities")] + public IList? Entities { get; set; } /// - /// Controls if the container should bleed into its parent. A bleeding container extends into its parent's padding. + /// Serializes this TeamsCardProperties into a JSON string. /// - [JsonPropertyName("bleed")] - public bool? Bleed { get; set; } + public string Serialize() + { + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); + } - /// - /// The minimum height, in pixels, of the container, in the `px` format. - /// - [JsonPropertyName("minHeight")] - public string? MinHeight { get; set; } + public TeamsCardProperties WithKey(string value) + { + this.Key = value; + return this; + } - /// - /// Defines the container's background image. - /// - [JsonPropertyName("backgroundImage")] - public IUnion? BackgroundImage { get; set; } + public TeamsCardProperties WithWidth(TeamsCardWidth value) + { + this.Width = value; + return this; + } - /// - /// Controls how the container's content should be vertically aligned. - /// - [JsonPropertyName("verticalContentAlignment")] - public VerticalAlignment? VerticalContentAlignment { get; set; } + public TeamsCardProperties WithEntities(params Mention[] value) + { + this.Entities = new List(value); + return this; + } - /// - /// Controls if the content of the card is to be rendered left-to-right or right-to-left. - /// - [JsonPropertyName("rtl")] - public bool? Rtl { get; set; } + public TeamsCardProperties WithEntities(IList value) + { + this.Entities = value; + return this; + } +} +/// +/// Represents a mention to a person. +/// +public class Mention : SerializableObject +{ /// - /// 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. + /// Deserializes a JSON string into an object of type Mention. /// - [JsonPropertyName("maxHeight")] - public string? MaxHeight { get; set; } + public static Mention? Deserialize(string json) + { + return JsonSerializer.Deserialize(json); + } /// - /// 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. + /// 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. /// - [JsonPropertyName("width")] - public IUnion? Width { get; set; } + [JsonPropertyName("key")] + public string? Key { get; set; } /// - /// The area of a Layout.AreaGrid layout in which an element should be displayed. + /// Must be **mention**. /// - [JsonPropertyName("grid.area")] - public string? GridArea { get; set; } + [JsonPropertyName("type")] + public string Type { get; } = "mention"; /// - /// 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. + /// The text that will be substituted with the mention. /// - [JsonPropertyName("fallback")] - public IUnion? Fallback { get; set; } + [JsonPropertyName("text")] + public string? Text { get; set; } /// - /// The elements in the column. + /// Defines the entity being mentioned. /// - [JsonPropertyName("items")] - public IList? Items { get; set; } - - public Column(params IList items) - { - this.Items = items; - } + [JsonPropertyName("mentioned")] + public MentionedEntity? Mentioned { get; set; } /// - /// Serializes this Column into a JSON string. + /// Serializes this Mention into a JSON string. /// public string Serialize() { @@ -16151,153 +19804,269 @@ public string Serialize() ); } - public Column WithId(string value) + public Mention WithKey(string value) { - this.Id = value; + this.Key = value; return this; } - public Column WithRequires(HostCapabilities value) + public Mention WithText(string value) { - this.Requires = value; + this.Text = value; return this; } - public Column WithLang(string value) + public Mention WithMentioned(MentionedEntity value) { - this.Lang = value; + this.Mentioned = value; return this; } +} - public Column WithIsVisible(bool value) +/// +/// Represents a mentioned person or tag. +/// +public class MentionedEntity : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type MentionedEntity. + /// + public static MentionedEntity? Deserialize(string json) { - this.IsVisible = value; - return this; + return JsonSerializer.Deserialize(json); } - public Column WithSeparator(bool value) - { - this.Separator = value; - return this; - } + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } - public Column WithHeight(ElementHeight value) - { - this.Height = value; - return this; - } + /// + /// The Id of a person (typically a Microsoft Entra user Id) or tag. + /// + [JsonPropertyName("id")] + public string? Id { get; set; } - public Column WithHorizontalAlignment(HorizontalAlignment value) - { - this.HorizontalAlignment = value; - return this; - } + /// + /// The name of the mentioned entity. + /// + [JsonPropertyName("name")] + public string? Name { get; set; } - public Column WithSpacing(Spacing value) + /// + /// The type of the mentioned entity. + /// + [JsonPropertyName("mentionType")] + public MentionType? MentionType { get; set; } = MentionType.Person; + + /// + /// Serializes this MentionedEntity into a JSON string. + /// + public string Serialize() { - this.Spacing = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public Column WithTargetWidth(TargetWidth value) + public MentionedEntity WithKey(string value) { - this.TargetWidth = value; + this.Key = value; return this; } - public Column WithIsSortKey(bool value) + public MentionedEntity WithId(string value) { - this.IsSortKey = value; + this.Id = value; return this; } - public Column WithSelectAction(Action value) + public MentionedEntity WithName(string value) { - this.SelectAction = value; + this.Name = value; return this; } - public Column WithStyle(ContainerStyle value) + public MentionedEntity WithMentionType(MentionType value) { - this.Style = value; + this.MentionType = value; return this; } +} - public Column WithShowBorder(bool value) +/// +/// Card-level metadata. +/// +public class CardMetadata : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type CardMetadata. + /// + public static CardMetadata? Deserialize(string json) { - this.ShowBorder = value; - return this; + return JsonSerializer.Deserialize(json); } - public Column WithRoundedCorners(bool value) + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("webUrl")] + public string? WebUrl { get; set; } + + /// + /// Serializes this CardMetadata into a JSON string. + /// + public string Serialize() { - this.RoundedCorners = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public Column WithLayouts(params IList value) + public CardMetadata WithKey(string value) { - this.Layouts = value; + this.Key = value; return this; } - public Column WithBleed(bool value) + public CardMetadata WithWebUrl(string value) { - this.Bleed = value; + this.WebUrl = value; return this; } +} - public Column WithMinHeight(string value) +/// +/// The resources that can be used in the body of the card. +/// +public class Resources : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type Resources. + /// + public static Resources? Deserialize(string json) { - this.MinHeight = value; - return this; + return JsonSerializer.Deserialize(json); } - public Column WithBackgroundImage(IUnion value) + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("strings")] + public IDictionary? Strings { get; set; } + + /// + /// Serializes this Resources into a JSON string. + /// + public string Serialize() { - this.BackgroundImage = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public Column WithVerticalContentAlignment(VerticalAlignment value) + public Resources WithKey(string value) { - this.VerticalContentAlignment = value; + this.Key = value; return this; } - public Column WithRtl(bool value) + public Resources WithStrings(IDictionary value) { - this.Rtl = value; + this.Strings = value; return this; } +} - public Column WithMaxHeight(string value) +/// +/// Defines the replacement string values. +/// +public class StringResource : SerializableObject +{ + /// + /// Deserializes a JSON string into an object of type StringResource. + /// + public static StringResource? Deserialize(string json) { - this.MaxHeight = value; - return this; + return JsonSerializer.Deserialize(json); } - public Column WithWidth(IUnion value) + /// + /// 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. + /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// The default value of the string, which is used when no matching localized value is found. + /// + [JsonPropertyName("defaultValue")] + public string? DefaultValue { get; set; } + + /// + /// 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. + /// + [JsonPropertyName("localizedValues")] + public IDictionary? LocalizedValues { get; set; } + + /// + /// Serializes this StringResource into a JSON string. + /// + public string Serialize() { - this.Width = value; - return this; + return JsonSerializer.Serialize( + this, + new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + } + ); } - public Column WithGridArea(string value) + public StringResource WithKey(string value) { - this.GridArea = value; + this.Key = value; return this; } - public Column WithFallback(IUnion value) + public StringResource WithDefaultValue(string value) { - this.Fallback = value; + this.DefaultValue = value; return this; } - public Column WithItems(params IList value) + public StringResource WithLocalizedValues(IDictionary value) { - this.Items = value; + this.LocalizedValues = value; return this; } } \ No newline at end of file diff --git a/Libraries/Microsoft.Teams.Cards/Utilities/OpenDialogData.cs b/Libraries/Microsoft.Teams.Cards/Utilities/OpenDialogData.cs new file mode 100644 index 00000000..958c980e --- /dev/null +++ b/Libraries/Microsoft.Teams.Cards/Utilities/OpenDialogData.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Teams.Cards; + +/// +/// Convenience class for creating the data payload to open a dialog +/// from an Action.Submit. +/// +/// Abstracts away the msteams: { type: "task/fetch" } protocol detail +/// and sets a reserved dialog_id field for handler routing. +/// +/// +/// +/// new SubmitAction { Data = new Union<string, SubmitActionData>(new OpenDialogData("simple_form")) } +/// +/// +public class OpenDialogData : SubmitActionData +{ + private const string ReservedKeyword = "dialog_id"; + + public OpenDialogData(string dialogId, IDictionary? extraData = null) + { + Msteams = new TaskFetchSubmitActionData(); + if (extraData != null) + { + foreach (var kvp in extraData) + { + NonSchemaProperties[kvp.Key] = kvp.Value; + } + } + NonSchemaProperties[ReservedKeyword] = dialogId; + } +} \ No newline at end of file diff --git a/Libraries/Microsoft.Teams.Cards/Utilities/SubmitData.cs b/Libraries/Microsoft.Teams.Cards/Utilities/SubmitData.cs new file mode 100644 index 00000000..8d30f480 --- /dev/null +++ b/Libraries/Microsoft.Teams.Cards/Utilities/SubmitData.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Teams.Cards; + +/// +/// Utility class for creating submit data with action-based routing. +/// +/// Extends the generated with a convenience constructor +/// that accepts an action identifier for handler routing. +/// +/// +/// +/// new ExecuteAction { Data = new Union<string, SubmitActionData>(new SubmitData("save_profile", new() { ["entity_id"] = "12345" })) } +/// +/// +public class SubmitData : SubmitActionData +{ + private const string ReservedKeyword = "action"; + + public SubmitData(string action, IDictionary? extraData = null) + { + if (extraData != null) + { + foreach (var kvp in extraData) + { + NonSchemaProperties[kvp.Key] = kvp.Value; + } + } + NonSchemaProperties[ReservedKeyword] = action; + } +} \ No newline at end of file diff --git a/Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Configuration/Microsoft.Teams.Apps.Extensions/TeamsSettings.cs b/Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Configuration/Microsoft.Teams.Apps.Extensions/TeamsSettings.cs index 11a4e532..6889601f 100644 --- a/Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Configuration/Microsoft.Teams.Apps.Extensions/TeamsSettings.cs +++ b/Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Configuration/Microsoft.Teams.Apps.Extensions/TeamsSettings.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using Microsoft.Teams.Api.Auth; @@ -10,21 +10,82 @@ public class TeamsSettings public string? ClientId { get; set; } public string? ClientSecret { get; set; } public string? TenantId { get; set; } + public string? Cloud { get; set; } + public string[]? AdditionalAllowedDomains { get; set; } + + /// Override the Azure AD login endpoint. + public string? LoginEndpoint { get; set; } + + /// Override the default login tenant. + public string? LoginTenant { get; set; } + + /// Override the Bot Framework OAuth scope. + public string? BotScope { get; set; } + + /// Override the Bot Framework token service URL. + public string? TokenServiceUrl { get; set; } + + /// Override the OpenID metadata URL for token validation. + public string? OpenIdMetadataUrl { get; set; } + + /// Override the token issuer for Bot Framework tokens. + public string? TokenIssuer { get; set; } + + /// Override the Microsoft Graph token scope. + public string? GraphScope { get; set; } public bool Empty { get { return ClientId == "" || ClientSecret == ""; } } + /// + /// Resolves the by starting from + /// (or the setting, or ), then applying + /// any per-endpoint overrides from settings. + /// + public CloudEnvironment ResolveCloud(CloudEnvironment? programmaticCloud = null) + { + var baseCloud = programmaticCloud + ?? (!string.IsNullOrWhiteSpace(Cloud) ? CloudEnvironment.FromName(Cloud) : null) + ?? CloudEnvironment.Public; + + return baseCloud.WithOverrides( + loginEndpoint: LoginEndpoint, + loginTenant: LoginTenant, + botScope: BotScope, + tokenServiceUrl: TokenServiceUrl, + openIdMetadataUrl: OpenIdMetadataUrl, + tokenIssuer: TokenIssuer, + graphScope: GraphScope + ); + } + public AppOptions Apply(AppOptions? options = null) { options ??= new AppOptions(); + var cloud = ResolveCloud(options.Cloud); + options.Cloud = cloud; + if (ClientId is not null && ClientSecret is not null && !Empty) { - options.Credentials = new ClientCredentials(ClientId, ClientSecret, TenantId); + var credentials = new ClientCredentials(ClientId, ClientSecret, TenantId) + { + Cloud = cloud + }; + options.Credentials = credentials; + } + else if (options.Credentials is ClientCredentials existingCredentials) + { + existingCredentials.Cloud = cloud; + } + + if (AdditionalAllowedDomains is { Length: > 0 }) + { + options.AdditionalAllowedDomains = AdditionalAllowedDomains; } return options; } -} \ No newline at end of file +} diff --git a/Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Hosting/Microsoft.Teams.Apps.Extensions/HostApplicationBuilder.cs b/Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Hosting/Microsoft.Teams.Apps.Extensions/HostApplicationBuilder.cs index 01f28920..507dfb43 100644 --- a/Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Hosting/Microsoft.Teams.Apps.Extensions/HostApplicationBuilder.cs +++ b/Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Hosting/Microsoft.Teams.Apps.Extensions/HostApplicationBuilder.cs @@ -31,6 +31,10 @@ public static IHostApplicationBuilder AddTeamsCore(this IHostApplicationBuilder var settings = builder.Configuration.GetTeams(); var loggingSettings = builder.Configuration.GetTeamsLogging(); + // cloud environment (base preset + per-endpoint overrides) + var cloud = settings.ResolveCloud(options.Cloud); + options.Cloud = cloud; + // client credentials if (options.Credentials is null && settings.ClientId is not null && settings.ClientSecret is not null && !settings.Empty) { @@ -38,7 +42,12 @@ public static IHostApplicationBuilder AddTeamsCore(this IHostApplicationBuilder settings.ClientId, settings.ClientSecret, settings.TenantId - ); + ) + { Cloud = cloud }; + } + else if (options.Credentials is ClientCredentials existingCredentials) + { + existingCredentials.Cloud = cloud; } options.Logger ??= new ConsoleLogger(loggingSettings); @@ -56,14 +65,21 @@ public static IHostApplicationBuilder AddTeamsCore(this IHostApplicationBuilder var settings = builder.Configuration.GetTeams(); var loggingSettings = builder.Configuration.GetTeamsLogging(); + // cloud environment (base preset + per-endpoint overrides) + var cloud = settings.ResolveCloud(); + appBuilder = appBuilder.AddCloud(cloud); + // client credentials if (settings.ClientId is not null && settings.ClientSecret is not null && !settings.Empty) { - appBuilder = appBuilder.AddCredentials(new ClientCredentials( + var credentials = new ClientCredentials( settings.ClientId, settings.ClientSecret, settings.TenantId - )); + ) + { Cloud = cloud }; + + appBuilder = appBuilder.AddCredentials(credentials); } var app = appBuilder.Build(); diff --git a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore.DevTools/DevToolsPlugin.cs b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore.DevTools/DevToolsPlugin.cs index 309340fe..91557da4 100644 --- a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore.DevTools/DevToolsPlugin.cs +++ b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore.DevTools/DevToolsPlugin.cs @@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.Hosting; using Microsoft.Teams.Apps; using Microsoft.Teams.Apps.Events; using Microsoft.Teams.Apps.Plugins; @@ -90,6 +91,16 @@ public DevToolsPlugin AddPage(Page page) public Task OnInit(App app, CancellationToken cancellationToken = default) { + var hostEnvironment = _services.GetService(); + var isProduction = hostEnvironment?.IsProduction() + ?? string.Equals(Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"), "Production", StringComparison.OrdinalIgnoreCase); + if (isProduction) + { + throw new InvalidOperationException( + "Devtools plugin cannot be used in production environments. " + + "Remove the devtools plugin from your app configuration."); + } + foreach (var page in _settings.Pages) { AddPage(page); diff --git a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/HostApplicationBuilder.cs b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/HostApplicationBuilder.cs index 760d94da..1d814979 100644 --- a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/HostApplicationBuilder.cs +++ b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/HostApplicationBuilder.cs @@ -119,8 +119,9 @@ public static class EntraTokenAuthConstants public static IHostApplicationBuilder AddTeamsTokenAuthentication(this IHostApplicationBuilder builder, bool skipAuth = false) { var settings = builder.Configuration.GetTeams(); + var cloud = settings.ResolveCloud(); - var teamsValidationSettings = new TeamsValidationSettings(); + var teamsValidationSettings = new TeamsValidationSettings(cloud); if (!string.IsNullOrEmpty(settings.ClientId)) { teamsValidationSettings.AddDefaultAudiences(settings.ClientId); diff --git a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/TeamsValidationSettings.cs b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/TeamsValidationSettings.cs index 5443c928..324346be 100644 --- a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/TeamsValidationSettings.cs +++ b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/TeamsValidationSettings.cs @@ -1,11 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.Teams.Api.Auth; + namespace Microsoft.Teams.Plugins.AspNetCore.Extensions; public class TeamsValidationSettings { - public string OpenIdMetadataUrl = "https://login.botframework.com/v1/.well-known/openidconfiguration"; + public string OpenIdMetadataUrl; public List Audiences = []; - public List Issuers = [ - "https://api.botframework.com", + public List Issuers; + public string LoginEndpoint; + + public TeamsValidationSettings() : this(CloudEnvironment.Public) + { + } + + public TeamsValidationSettings(CloudEnvironment cloud) + { + LoginEndpoint = cloud.LoginEndpoint; + OpenIdMetadataUrl = cloud.OpenIdMetadataUrl; + Issuers = [ + cloud.TokenIssuer, "https://sts.windows.net/d6d49420-f39b-4df7-a1dc-d59a935871db/", // Emulator Auth v3.1, 1.0 token "https://login.microsoftonline.com/d6d49420-f39b-4df7-a1dc-d59a935871db/v2.0", // Emulator Auth v3.1, 2.0 token "https://sts.windows.net/f8cdef31-a31e-4b4a-93e4-5f571e91255a/", // Emulator Auth v3.2, 1.0 token @@ -13,6 +29,7 @@ public class TeamsValidationSettings "https://sts.windows.net/69e9b82d-4842-4902-8d1e-abc5b98a55e8/", // Copilot Auth v1.0 token "https://login.microsoftonline.com/69e9b82d-4842-4902-8d1e-abc5b98a55e8/v2.0", // Copilot Auth v2.0 token ]; + } public void AddDefaultAudiences(string ClientId) { @@ -29,13 +46,21 @@ public IEnumerable GetValidIssuersForTenant(string? tenantId) var validIssuers = new List(); if (!string.IsNullOrEmpty(tenantId)) { - validIssuers.Add($"https://login.microsoftonline.com/{tenantId}/"); + validIssuers.Add($"{LoginEndpoint}/{tenantId}/"); + } + else + { + // When no tenant ID is configured, issuer validation will be skipped. + // This accepts tokens from any Azure AD tenant. + System.Diagnostics.Trace.TraceWarning( + "No tenant ID provided for Entra token validation. " + + "Issuer validation will be skipped, accepting tokens from any tenant."); } return validIssuers; } public string GetTenantSpecificOpenIdMetadataUrl(string? tenantId) { - return $"https://login.microsoftonline.com/{tenantId ?? "common"}/v2.0/.well-known/openid-configuration"; + return $"{LoginEndpoint}/{tenantId ?? "common"}/v2.0/.well-known/openid-configuration"; } } \ No newline at end of file diff --git a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.External/Microsoft.Teams.Plugins.External.Mcp/version.json b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.External/Microsoft.Teams.Plugins.External.Mcp/version.json index 2d95ee2d..6f241820 100644 --- a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.External/Microsoft.Teams.Plugins.External.Mcp/version.json +++ b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.External/Microsoft.Teams.Plugins.External.Mcp/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.0.6-preview.{height}", + "version": "2.0.7-preview.{height}", "publicReleaseRefSpec": [ "^refs/heads/main$", "^refs/heads/v\\d+(?:\\.\\d+)?$", diff --git a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.External/Microsoft.Teams.Plugins.External.McpClient/version.json b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.External/Microsoft.Teams.Plugins.External.McpClient/version.json index 2d95ee2d..6f241820 100644 --- a/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.External/Microsoft.Teams.Plugins.External.McpClient/version.json +++ b/Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.External/Microsoft.Teams.Plugins.External.McpClient/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.0.6-preview.{height}", + "version": "2.0.7-preview.{height}", "publicReleaseRefSpec": [ "^refs/heads/main$", "^refs/heads/v\\d+(?:\\.\\d+)?$", diff --git a/RELEASE.md b/RELEASE.md index e463fd24..55072d86 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -6,9 +6,8 @@ This document describes how to release packages for the Teams SDK for .NET. It a | Pipeline | File | Trigger | Signing | Destination | Approval | |----------|------|---------|---------|-------------|----------| -| **teams.net-pr** | ci.yaml | PR to `main`/`release/*` | No | Pipeline artifacts only | None | -| **teams.net-preview** | publish-preview.yaml | Manual (`Internal`/`Public`) | Public only | Internal feed or nuget.org | Public only | -| **teams.net** | publish.yml | Manual | Yes | nuget.org | Required | +| **Teams.NET-PR** | ci.yaml | PR to `main`/`release/*` | No | Pipeline artifacts only | None | +| **Teams.NET-ESRP** | publish.yaml | Manual (`Internal`/`Public`) | Public only | Internal feed or nuget.org | Public only | | **BotCore-CD** | cd-core.yaml | PR/push to `next/*` (`core/**`) | No | Internal feed (`next/core` branch) | Auto | Note: Public packages are available on nuget.org. Internal feed packages are for Microsoft internal use. @@ -38,24 +37,33 @@ Versions are managed by **Nerdbank.GitVersioning** via [version.json](version.js ### Producing a Stable Release Version -To produce a non-preview release (e.g., `0.0.0`, without suffix), you must **edit version.json before running publish.yml**: +To produce a non-preview release (e.g., `2.0.7`), you must work from the `releases/v2` branch: -1. Create a PR to change version.json: +1. Merge `main` into `releases/v2`: + ```bash + git checkout releases/v2 + git merge main + ``` +2. Edit `version.json` to remove the preview suffix: ```json { - "version": "0.0.0" + "version": "2.0.7" } ``` -2. Merge the PR -3. Run the **teams.net** (`publish.yml`) pipeline manually -4. Approve the push to nuget.org -5. Create another PR to bump the version for the next preview cycle: +3. Commit and push the version change to `releases/v2` +4. Run the **Teams.NET-ESRP** (`publish.yaml`) pipeline manually from the `releases/v2` branch with **Public** publish type +5. Approve the push to nuget.org +6. After the release, bump the version for the next cycle: ```json { - "version": "0.0.0+1-preview.{height}" + "version": "2.0.8-preview.{height}" } ``` +### Producing Preview Releases + +Preview releases can be published directly from the `main` branch since `version.json` on `main` includes the preview suffix. + ### Note on publicReleaseRefSpec The `publicReleaseRefSpec` in version.json controls metadata (e.g., whether a build is considered "public" for telemetry), but it does **not** affect the version number itself. The version string is determined entirely by the `"version"` field. @@ -69,64 +77,67 @@ The `teams-net-publish` environment in Azure DevOps controls who can approve rel 3. Click **Approvals and checks** 4. Add/remove approvers as needed -## Publishing Preview Packages (publish-preview pipeline) +## Publishing Packages (Teams.NET-ESRP pipeline) + +The `Teams.NET-ESRP` pipeline is triggered manually and requires selecting a **Publish Type**: `Internal` or `Public`. The version of the packages is determined by Nerdbank.GitVersioning from `version.json`, so the same pipeline can publish both preview and stable releases. -The `publish-preview` pipeline is triggered manually and requires selecting a **Publish Type**: `Internal` or `Public`. +**Branch Strategy:** +- **Preview releases**: Publish from `main` branch (version.json contains preview suffix) +- **Stable releases**: Publish from `releases/v2` branch (version.json has no suffix) -### Internal Previews +### Internal Packages -Pushes unsigned packages to the internal ADO `TeamsSDKPreviews` feed. +Pushes unsigned packages to the internal ADO `TeamsSDKPreviews` feed (useful for testing before public release). -1. Go to **Pipelines** > **publish-preview** +1. Go to **Pipelines** > **Teams.NET-ESRP** 2. Click **Run pipeline** -3. Select the branch to build from +3. Select the branch to build from (`main` for previews, `releases/v2` for stable) 4. Choose **Internal** as the Publish Type 5. Pipeline runs: Build > Test > Pack > Push to internal feed No approval is required. Packages are available immediately in the internal feed. -### Public Previews +### Public Packages -Signs packages (Authenticode + NuGet) and pushes to nuget.org. +Signs packages (Authenticode + NuGet) and pushes to nuget.org. The package version (preview or stable) is determined by `version.json` on the selected branch. -1. Go to **Pipelines** > **publish-preview** +1. Go to **Pipelines** > **Teams.NET-ESRP** 2. Click **Run pipeline** -3. Select the branch to build from +3. Select the branch to build from: + - `main` for preview releases + - `releases/v2` for stable releases 4. Choose **Public** as the Publish Type 5. Pipeline runs: Build > Test > Sign > Pack 6. **PushToNuGet stage** waits for approval 7. Approver reviews in ADO and clicks **Approve** 8. Packages are pushed to nuget.org -#### Installing Published Preview Packages +#### Installing Published Packages -Preview packages, once published, work identically to stable releases and are available on the same profile: +Once published, packages are available on the [teams-sdk nuget.org profile](https://www.nuget.org/profiles/teams-sdk). +For stable releases: ```bash -dotnet add package Microsoft.Teams.Apps --version 0.0.0-preview.N +dotnet add package Microsoft.Teams.Apps --version 0.0.0 ``` -Available preview versions can be found on the [teams-sdk nuget.org profile](https://www.nuget.org/profiles/teams-sdk) or by using: - +For preview releases: ```bash -dotnet package search Microsoft.Teams.Apps --prerelease +dotnet add package Microsoft.Teams.Apps --version 0.0.0-preview.N ``` -## Production Releases (teams.net pipeline) - -Production releases are triggered manually via `publish.yml`. +You can search for available versions using: +```bash +# Stable only +dotnet package search Microsoft.Teams.Apps -1. Go to **Pipelines** > **teams.net** -2. Click **Run pipeline** -3. Select the branch/tag to release -4. Pipeline runs: Build > Test > Sign > Pack -5. **PushToNuGet stage** waits for approval -6. Approver reviews in ADO and clicks **Approve** -7. Packages are pushed to nuget.org +# Include prereleases +dotnet package search Microsoft.Teams.Apps --prerelease +``` -## CI Validation (teams.net-pr pipeline) +## CI Validation (Teams.NET-PR pipeline) -The `teams.net-pr` pipeline runs automatically on PRs targeting `main` or `release/*` branches (excluding `core/**` paths). It does not publish packages. +The `Teams.NET-PR` pipeline runs automatically on PRs targeting `main` or `release/*` branches (excluding `core/**` paths). It does not publish packages. 1. Open or update a PR targeting `main` or `release/*` 2. Pipeline runs: Build > Test > Pack diff --git a/Samples/Samples.Cards/Program.cs b/Samples/Samples.Cards/Program.cs index 7c789dba..1e8a652b 100644 --- a/Samples/Samples.Cards/Program.cs +++ b/Samples/Samples.Cards/Program.cs @@ -184,7 +184,7 @@ static Microsoft.Teams.Cards.AdaptiveCard CreateBasicAdaptiveCard() new ExecuteAction { Title = "Submit", - Data = new Union(new SubmitActionData { NonSchemaProperties = new Dictionary { { "action", "submit_basic" } } }), + Data = new Union(new SubmitData("submit_basic")), AssociatedInputs = AssociatedInputs.Auto } } @@ -208,7 +208,7 @@ static Microsoft.Teams.Cards.AdaptiveCard CreateProfileCard() new ExecuteAction { Title = "Save", - Data = new Union(new SubmitActionData { NonSchemaProperties = new Dictionary { { "action", "save_profile" }, { "entity_id", "12345" } } }), + Data = new Union(new SubmitData("save_profile", new Dictionary { ["entity_id"] = "12345" })), AssociatedInputs = AssociatedInputs.Auto }, new OpenUrlAction("https://adaptivecards.microsoft.com") { Title = "Learn More" } @@ -233,7 +233,7 @@ static Microsoft.Teams.Cards.AdaptiveCard CreateProfileCardWithValidation() new ExecuteAction { Title = "Save", - Data = new Union(new SubmitActionData { NonSchemaProperties = new Dictionary { { "action", "save_profile" } } }), + Data = new Union(new SubmitData("save_profile")), AssociatedInputs = AssociatedInputs.Auto } } @@ -255,7 +255,7 @@ static Microsoft.Teams.Cards.AdaptiveCard CreateFeedbackCard() new ExecuteAction { Title = "Submit Feedback", - Data = new Union(new SubmitActionData { NonSchemaProperties = new Dictionary { { "action", "submit_feedback" } } }), + Data = new Union(new SubmitData("submit_feedback")), AssociatedInputs = AssociatedInputs.Auto } } @@ -291,7 +291,7 @@ static Microsoft.Teams.Cards.AdaptiveCard CreateTaskFormCard() new ExecuteAction { Title = "Create Task", - Data = new Union(new SubmitActionData { NonSchemaProperties = new Dictionary { { "action", "create_task" } } }), + Data = new Union(new SubmitData("create_task")), AssociatedInputs = AssociatedInputs.Auto, Style = ActionStyle.Positive } diff --git a/Samples/Samples.Dialogs/Program.cs b/Samples/Samples.Dialogs/Program.cs index d78603af..1f2f8496 100644 --- a/Samples/Samples.Dialogs/Program.cs +++ b/Samples/Samples.Dialogs/Program.cs @@ -45,7 +45,7 @@ return Task.FromResult(new Microsoft.Teams.Api.TaskModules.Response(new Microsoft.Teams.Api.TaskModules.MessageTask("No data found in the activity value"))); } - var dialogType = data.Value.TryGetProperty("opendialogtype", out var dialogTypeElement) && dialogTypeElement.ValueKind == JsonValueKind.String + var dialogType = data.Value.TryGetProperty("dialog_id", out var dialogTypeElement) && dialogTypeElement.ValueKind == JsonValueKind.String ? dialogTypeElement.GetString() : null; @@ -151,6 +151,16 @@ static string SanitizeForLog(string? input) return input.Replace("\r", "").Replace("\n", ""); } +static Microsoft.Teams.Cards.SubmitAction CreateTaskFetchSubmitAction(string title, string dialogId) +{ + return new Microsoft.Teams.Cards.SubmitAction + { + Title = title, + Data = new Microsoft.Teams.Common.Union( + new Microsoft.Teams.Cards.OpenDialogData(dialogId)) + }; +} + static Microsoft.Teams.Cards.AdaptiveCard CreateDialogLauncherCard() { var card = new Microsoft.Teams.Cards.AdaptiveCard @@ -165,26 +175,10 @@ static Microsoft.Teams.Cards.AdaptiveCard CreateDialogLauncherCard() }, Actions = new List { - new Microsoft.Teams.Cards.TaskFetchAction( - Microsoft.Teams.Cards.TaskFetchAction.FromObject(new { opendialogtype = "simple_form" })) - { - Title = "Simple form test" - }, - new Microsoft.Teams.Cards.TaskFetchAction( - Microsoft.Teams.Cards.TaskFetchAction.FromObject(new { opendialogtype = "webpage_dialog" })) - { - Title = "Webpage Dialog" - }, - new Microsoft.Teams.Cards.TaskFetchAction( - Microsoft.Teams.Cards.TaskFetchAction.FromObject(new { opendialogtype = "multi_step_form" })) - { - Title = "Multi-step Form" - }, - new Microsoft.Teams.Cards.TaskFetchAction( - Microsoft.Teams.Cards.TaskFetchAction.FromObject(new { opendialogtype = "mixed_example" })) - { - Title = "Mixed Example" - } + CreateTaskFetchSubmitAction("Simple form test", "simple_form"), + CreateTaskFetchSubmitAction("Webpage Dialog", "webpage_dialog"), + CreateTaskFetchSubmitAction("Multi-step Form", "multi_step_form"), + CreateTaskFetchSubmitAction("Mixed Example", "mixed_example") } }; diff --git a/Samples/Samples.TargetedMessages/Program.cs b/Samples/Samples.TargetedMessages/Program.cs index 7d43ebe8..9c5a7111 100644 --- a/Samples/Samples.TargetedMessages/Program.cs +++ b/Samples/Samples.TargetedMessages/Program.cs @@ -11,7 +11,7 @@ var teams = app.UseTeams(); // Log all incoming activities -teams.OnActivity(async context => +teams.OnActivity(async (context, cancellationToken) => { context.Log.Info($"[ACTIVITY] Type: {context.Activity.Type}, From: {context.Activity.From?.Name ?? "unknown"}"); await context.Next(); diff --git a/Samples/Samples.Threading/Program.cs b/Samples/Samples.Threading/Program.cs new file mode 100644 index 00000000..8a106578 --- /dev/null +++ b/Samples/Samples.Threading/Program.cs @@ -0,0 +1,87 @@ +using Microsoft.Teams.Api; +using Microsoft.Teams.Api.Activities; +using Microsoft.Teams.Apps.Activities; +using Microsoft.Teams.Apps.Extensions; +using Microsoft.Teams.Plugins.AspNetCore.DevTools.Extensions; +using Microsoft.Teams.Plugins.AspNetCore.Extensions; + +var builder = WebApplication.CreateBuilder(args); +builder.AddTeams().AddTeamsDevTools(); +var app = builder.Build(); +var teams = app.UseTeams(); + +teams.OnMessage(async (context, cancellationToken) => +{ + var text = (context.Activity.Text ?? "").ToLowerInvariant(); + var conversationId = context.Ref.Conversation.Id; + var messageId = context.Activity.Id!; + + // When inside a thread, conversationId contains ;messageid=. + // Extract the root ID for threading; for top-level messages, use activity.id. + var threadParts = conversationId.Split(";messageid="); + var threadRootId = threadParts.Length > 1 ? threadParts[1] : messageId; + + // ============================================ + // context.Reply() — reactive threaded reply + // ============================================ + if (text.Contains("test reply")) + { + await context.Reply("This is a threaded reply to your message.", cancellationToken); + return; + } + + // ============================================ + // context.Send() — reactive send to same thread + // ============================================ + if (text.Contains("test send")) + { + await context.Send("This is sent to the same thread, without quoting.", cancellationToken); + return; + } + + // ============================================ + // teams.Reply() — proactive threaded reply + // ============================================ + if (text.Contains("test proactive")) + { + await teams.Reply(conversationId, threadRootId, "This is a proactive threaded reply using teams.Reply().", cancellationToken); + return; + } + + // ============================================ + // ToThreadedConversationId() + teams.Send() — advanced manual control (channels and 1:1 chats only) + // ============================================ + if (text.Contains("test manual")) + { + // ToThreadedConversationId() is only valid for conversations that support threading + var baseId = conversationId.Split(';')[0]; + if (!baseId.EndsWith("@thread.tacv2") && !baseId.EndsWith("@thread.skype") && !baseId.EndsWith("@unq.gbl.spaces")) + { + await context.Reply("This command doesn't support threading in this conversation type.", cancellationToken); + return; + } + var threadId = Microsoft.Teams.Api.Conversation.ToThreadedConversationId(conversationId, threadRootId); + await teams.Send(threadId, "This was sent using ToThreadedConversationId() + teams.Send() for manual control.", cancellationToken: cancellationToken); + return; + } + + // ============================================ + // Help / Default + // ============================================ + if (text.Contains("help")) + { + await context.Reply( + "**Threading Test Bot**\n\n" + + "**Commands:**\n" + + "- `test reply` - context.Reply() reactive threaded reply\n" + + "- `test send` - context.Send() to same thread without quoting\n" + + "- `test proactive` - teams.Reply() proactive threaded reply\n" + + "- `test manual` - ToThreadedConversationId() + teams.Send() for advanced control", + cancellationToken); + return; + } + + await context.Send("Say \"help\" for available commands.", cancellationToken); +}); + +app.Run(); diff --git a/Samples/Samples.Threading/README.md b/Samples/Samples.Threading/README.md new file mode 100644 index 00000000..40cd334c --- /dev/null +++ b/Samples/Samples.Threading/README.md @@ -0,0 +1,38 @@ +# Example: Threading + +A bot that demonstrates reactive and proactive threading in Microsoft Teams channels. + +## Commands + +| Command | Behavior | +|---------|----------| +| `test reply` | `context.Reply()` — reactive threaded reply with visual quote | +| `test send` | `context.Send()` — reactive send to same thread, no quote | +| `test proactive` | `teams.Reply()` — proactive threaded reply | +| `test manual` | `Conversation.ToThreadedConversationId()` + `teams.Send()` — advanced manual control (channels and 1:1 chats only) | +| `help` | Shows available commands | + +## Notes + +- `test reply` and `test send` work in all scopes (1:1, group chat, channels) +- `test proactive` works in all scopes — in channels it threads, in non-threading scopes it sends normally +- `test manual` only works in channels and 1:1 chats since `ToThreadedConversationId()` constructs a threaded conversation ID (group chats and meetings do not support threading) + +## Run + +```bash +dotnet run +``` + +## Configuration + +Set credentials in `appsettings.json`: + +```json +{ + "Teams": { + "ClientId": "", + "ClientSecret": "" + } +} +``` diff --git a/Samples/Samples.Threading/Samples.Threading.csproj b/Samples/Samples.Threading/Samples.Threading.csproj new file mode 100644 index 00000000..b59d514c --- /dev/null +++ b/Samples/Samples.Threading/Samples.Threading.csproj @@ -0,0 +1,19 @@ + + + + net10.0 + enable + enable + + + + + + + + + + + + + diff --git a/Samples/Samples.Threading/appsettings.json b/Samples/Samples.Threading/appsettings.json new file mode 100644 index 00000000..45698703 --- /dev/null +++ b/Samples/Samples.Threading/appsettings.json @@ -0,0 +1,17 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + }, + "Microsoft.Teams": { + "Enable": "*", + "Level": "debug" + } + }, + "Teams": { + "TenantId": "", + "ClientId": "", + "ClientSecret": "" + } +} diff --git a/Tests/Microsoft.Teams.Api.Tests/Auth/CloudEnvironmentTests.cs b/Tests/Microsoft.Teams.Api.Tests/Auth/CloudEnvironmentTests.cs new file mode 100644 index 00000000..fe9572a9 --- /dev/null +++ b/Tests/Microsoft.Teams.Api.Tests/Auth/CloudEnvironmentTests.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.Teams.Api.Auth; + +namespace Microsoft.Teams.Api.Tests.Auth; + +public class CloudEnvironmentTests +{ + [Fact] + public void Public_HasCorrectEndpoints() + { + var env = CloudEnvironment.Public; + + Assert.Equal("https://login.microsoftonline.com", env.LoginEndpoint); + Assert.Equal("botframework.com", env.LoginTenant); + Assert.Equal("https://api.botframework.com/.default", env.BotScope); + Assert.Equal("https://token.botframework.com", env.TokenServiceUrl); + Assert.Equal("https://login.botframework.com/v1/.well-known/openidconfiguration", env.OpenIdMetadataUrl); + Assert.Equal("https://api.botframework.com", env.TokenIssuer); + } + + [Fact] + public void USGov_HasCorrectEndpoints() + { + var env = CloudEnvironment.USGov; + + Assert.Equal("https://login.microsoftonline.us", env.LoginEndpoint); + Assert.Equal("MicrosoftServices.onmicrosoft.us", env.LoginTenant); + Assert.Equal("https://api.botframework.us/.default", env.BotScope); + Assert.Equal("https://tokengcch.botframework.azure.us", env.TokenServiceUrl); + Assert.Equal("https://login.botframework.azure.us/v1/.well-known/openidconfiguration", env.OpenIdMetadataUrl); + Assert.Equal("https://api.botframework.us", env.TokenIssuer); + } + + [Fact] + public void USGovDoD_HasCorrectEndpoints() + { + var env = CloudEnvironment.USGovDoD; + + Assert.Equal("https://login.microsoftonline.us", env.LoginEndpoint); + Assert.Equal("MicrosoftServices.onmicrosoft.us", env.LoginTenant); + Assert.Equal("https://api.botframework.us/.default", env.BotScope); + Assert.Equal("https://apiDoD.botframework.azure.us", env.TokenServiceUrl); + Assert.Equal("https://login.botframework.azure.us/v1/.well-known/openidconfiguration", env.OpenIdMetadataUrl); + Assert.Equal("https://api.botframework.us", env.TokenIssuer); + } + + [Fact] + public void China_HasCorrectEndpoints() + { + var env = CloudEnvironment.China; + + Assert.Equal("https://login.partner.microsoftonline.cn", env.LoginEndpoint); + Assert.Equal("microsoftservices.partner.onmschina.cn", env.LoginTenant); + Assert.Equal("https://api.botframework.azure.cn/.default", env.BotScope); + Assert.Equal("https://token.botframework.azure.cn", env.TokenServiceUrl); + Assert.Equal("https://login.botframework.azure.cn/v1/.well-known/openidconfiguration", env.OpenIdMetadataUrl); + Assert.Equal("https://api.botframework.azure.cn", env.TokenIssuer); + } + + [Theory] + [InlineData("Public", "https://login.microsoftonline.com")] + [InlineData("public", "https://login.microsoftonline.com")] + [InlineData("PUBLIC", "https://login.microsoftonline.com")] + [InlineData("USGov", "https://login.microsoftonline.us")] + [InlineData("usgov", "https://login.microsoftonline.us")] + [InlineData("USGovDoD", "https://login.microsoftonline.us")] + [InlineData("usgovdod", "https://login.microsoftonline.us")] + [InlineData("China", "https://login.partner.microsoftonline.cn")] + [InlineData("china", "https://login.partner.microsoftonline.cn")] + public void FromName_ResolvesCorrectly(string name, string expectedLoginEndpoint) + { + var env = CloudEnvironment.FromName(name); + Assert.Equal(expectedLoginEndpoint, env.LoginEndpoint); + } + + [Theory] + [InlineData("invalid")] + [InlineData("")] + [InlineData("Azure")] + public void FromName_ThrowsForUnknownName(string name) + { + Assert.Throws(() => CloudEnvironment.FromName(name)); + } + + [Fact] + public void FromName_ReturnsStaticInstances() + { + Assert.Same(CloudEnvironment.Public, CloudEnvironment.FromName("Public")); + Assert.Same(CloudEnvironment.USGov, CloudEnvironment.FromName("USGov")); + Assert.Same(CloudEnvironment.USGovDoD, CloudEnvironment.FromName("USGovDoD")); + Assert.Same(CloudEnvironment.China, CloudEnvironment.FromName("China")); + } + + [Fact] + public void WithOverrides_AllNulls_ReturnsSameInstance() + { + var env = CloudEnvironment.Public; + + var result = env.WithOverrides(); + + Assert.Same(env, result); + } + + [Fact] + public void WithOverrides_SingleOverride_ReplacesOnlyThatProperty() + { + var env = CloudEnvironment.Public; + + var result = env.WithOverrides(loginTenant: "my-tenant-id"); + + Assert.NotSame(env, result); + Assert.Equal("my-tenant-id", result.LoginTenant); + Assert.Equal(env.LoginEndpoint, result.LoginEndpoint); + Assert.Equal(env.BotScope, result.BotScope); + Assert.Equal(env.TokenServiceUrl, result.TokenServiceUrl); + Assert.Equal(env.OpenIdMetadataUrl, result.OpenIdMetadataUrl); + Assert.Equal(env.TokenIssuer, result.TokenIssuer); + } + + [Fact] + public void WithOverrides_MultipleOverrides_ReplacesCorrectProperties() + { + var env = CloudEnvironment.China; + + var result = env.WithOverrides( + loginEndpoint: "https://custom.login.cn", + loginTenant: "custom-tenant", + tokenServiceUrl: "https://custom.token.cn" + ); + + Assert.Equal("https://custom.login.cn", result.LoginEndpoint); + Assert.Equal("custom-tenant", result.LoginTenant); + Assert.Equal("https://custom.token.cn", result.TokenServiceUrl); + // unchanged + Assert.Equal(env.BotScope, result.BotScope); + Assert.Equal(env.OpenIdMetadataUrl, result.OpenIdMetadataUrl); + Assert.Equal(env.TokenIssuer, result.TokenIssuer); + } + + [Fact] + public void WithOverrides_AllOverrides_ReplacesAllProperties() + { + var env = CloudEnvironment.Public; + + var result = env.WithOverrides( + loginEndpoint: "a", + loginTenant: "b", + botScope: "c", + tokenServiceUrl: "d", + openIdMetadataUrl: "e", + tokenIssuer: "f", + graphScope: "g" + ); + + Assert.Equal("a", result.LoginEndpoint); + Assert.Equal("b", result.LoginTenant); + Assert.Equal("c", result.BotScope); + Assert.Equal("d", result.TokenServiceUrl); + Assert.Equal("e", result.OpenIdMetadataUrl); + Assert.Equal("f", result.TokenIssuer); + Assert.Equal("g", result.GraphScope); + } + + [Fact] + public void ClientCredentials_DefaultsToPublicCloud() + { + var creds = new ClientCredentials("id", "secret"); + Assert.Same(CloudEnvironment.Public, creds.Cloud); + } + + [Fact] + public void ClientCredentials_CloudCanBeSet() + { + var creds = new ClientCredentials("id", "secret") + { + Cloud = CloudEnvironment.USGov + }; + Assert.Same(CloudEnvironment.USGov, creds.Cloud); + } + + [Fact] + public void ClientCredentials_UsesCloudLoginTenantWhenTenantIdNull() + { + var creds = new ClientCredentials("id", "secret") + { + Cloud = CloudEnvironment.USGov + }; + + // TenantId is null, so Cloud.LoginTenant should be used + Assert.Null(creds.TenantId); + Assert.Equal("MicrosoftServices.onmicrosoft.us", creds.Cloud.LoginTenant); + } +} \ No newline at end of file diff --git a/Tests/Microsoft.Teams.Api.Tests/Clients/BotTokenClientTests.cs b/Tests/Microsoft.Teams.Api.Tests/Clients/BotTokenClientTests.cs index 8b01c9fb..74a0e6d3 100644 --- a/Tests/Microsoft.Teams.Api.Tests/Clients/BotTokenClientTests.cs +++ b/Tests/Microsoft.Teams.Api.Tests/Clients/BotTokenClientTests.cs @@ -147,4 +147,49 @@ public async Task BotTokenClient_HttpClientOptions_Async() Assert.Equal(expectedTenantId, actualTenantId); Assert.Equal("https://api.botframework.com/.default", actualScope[0]); } + + [Fact] + public void ActiveBotScope_DefaultsToPublicBotScope() + { + var client = new BotTokenClient(); + Assert.Equal(BotTokenClient.BotScope, client.ActiveBotScope); + Assert.Equal("https://api.botframework.com/.default", client.ActiveBotScope); + } + + [Fact] + public void ActiveBotScope_CanBeOverridden() + { + var client = new BotTokenClient(); + client.ActiveBotScope = "https://api.botframework.us/.default"; + Assert.Equal("https://api.botframework.us/.default", client.ActiveBotScope); + } + + [Fact] + public void BotScope_StaticFieldUnchanged() + { + Assert.Equal("https://api.botframework.com/.default", BotTokenClient.BotScope); + } + + [Fact] + public async Task BotTokenClient_ActiveBotScope_UsedInGetAsync() + { + var cancellationToken = new CancellationToken(); + string[] actualScope = [""]; + TokenFactory tokenFactory = new TokenFactory(async (tenantId, scope) => + { + actualScope = scope; + return await Task.FromResult(new TokenResponse + { + TokenType = "Bearer", + AccessToken = accessToken + }); + }); + var credentials = new TokenCredentials("clientId", tokenFactory); + var botTokenClient = new BotTokenClient(cancellationToken); + botTokenClient.ActiveBotScope = "https://api.botframework.us/.default"; + + await botTokenClient.GetAsync(credentials); + + Assert.Equal("https://api.botframework.us/.default", actualScope[0]); + } } \ No newline at end of file diff --git a/Tests/Microsoft.Teams.Api.Tests/ConversationTests.cs b/Tests/Microsoft.Teams.Api.Tests/ConversationTests.cs new file mode 100644 index 00000000..dc6dfa97 --- /dev/null +++ b/Tests/Microsoft.Teams.Api.Tests/ConversationTests.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Teams.Api.Tests; + +public class ConversationTests +{ + [Fact] + public void ToThreadedConversationId_ConstructsThreadedConversationId() + { + var result = Conversation.ToThreadedConversationId("19:abc@thread.skype", "1680000000000"); + Assert.Equal("19:abc@thread.skype;messageid=1680000000000", result); + } + + [Fact] + public void ToThreadedConversationId_WorksWithDifferentConversationIdFormats() + { + var result = Conversation.ToThreadedConversationId("19:meeting_abc@thread.v2", "999"); + Assert.Equal("19:meeting_abc@thread.v2;messageid=999", result); + } + + [Fact] + public void ToThreadedConversationId_ThrowsOnEmptyConversationId() + { + Assert.Throws(() => Conversation.ToThreadedConversationId("", "123")); + } + + [Fact] + public void ToThreadedConversationId_ThrowsOnNullConversationId() + { + Assert.Throws(() => Conversation.ToThreadedConversationId(null!, "123")); + } + + [Fact] + public void ToThreadedConversationId_ThrowsOnEmptyMessageId() + { + Assert.Throws(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", "")); + } + + [Fact] + public void ToThreadedConversationId_ThrowsOnZeroMessageId() + { + Assert.Throws(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", "0")); + } + + [Fact] + public void ToThreadedConversationId_ThrowsOnNonNumericMessageId() + { + Assert.Throws(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", "abc")); + } + + [Fact] + public void ToThreadedConversationId_ThrowsOnNegativeMessageId() + { + Assert.Throws(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", "-1")); + } + + [Fact] + public void ToThreadedConversationId_ThrowsOnDecimalMessageId() + { + Assert.Throws(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", "1.5")); + } + + [Fact] + public void ToThreadedConversationId_StripsExistingMessageIdAndReplacesWithThreadRoot() + { + var result = Conversation.ToThreadedConversationId("19:abc@thread.skype;messageid=111", "222"); + Assert.Equal("19:abc@thread.skype;messageid=222", result); + } +} diff --git a/Tests/Microsoft.Teams.Apps.Tests/AppTests.cs b/Tests/Microsoft.Teams.Apps.Tests/AppTests.cs index cdfc6300..5ce7a061 100644 --- a/Tests/Microsoft.Teams.Apps.Tests/AppTests.cs +++ b/Tests/Microsoft.Teams.Apps.Tests/AppTests.cs @@ -300,4 +300,71 @@ public void Test_App_Send_TargetedMessage_WithRecipient_PassesValidation() Assert.Equal("user123", targetedMessage.Recipient.Id); } + [Fact] + public async Task Test_App_Reply_ThreeArgs_ConstructsThreadedId() + { + // arrange + var sender = new Mock(); + sender.Setup(s => s.Send(It.IsAny(), It.IsAny(), It.IsAny())) + .ReturnsAsync((MessageActivity a, ConversationReference r, CancellationToken c) => a); + + var token = new Mock(); + token.Setup(t => t.AppId).Returns("test-app-id"); + token.Setup(t => t.AppDisplayName).Returns("Test App"); + + var options = new AppOptions() { Plugins = [sender.Object] }; + var app = new App(options); + app.Token = token.Object; + + // act + await app.Reply("19:abc@thread.skype", "1680000000000", new MessageActivity("Hello thread")); + + // assert + sender.Verify(s => s.Send( + It.IsAny(), + It.Is(r => r.Conversation.Id == "19:abc@thread.skype;messageid=1680000000000"), + It.IsAny() + ), Times.Once); + } + + [Fact] + public async Task Test_App_Reply_TwoArgs_PassesConversationIdAsIs() + { + // arrange + var sender = new Mock(); + sender.Setup(s => s.Send(It.IsAny(), It.IsAny(), It.IsAny())) + .ReturnsAsync((MessageActivity a, ConversationReference r, CancellationToken c) => a); + + var token = new Mock(); + token.Setup(t => t.AppId).Returns("test-app-id"); + token.Setup(t => t.AppDisplayName).Returns("Test App"); + + var options = new AppOptions() { Plugins = [sender.Object] }; + var app = new App(options); + app.Token = token.Object; + + // act + await app.Reply("19:abc@thread.skype", new MessageActivity("Hello flat")); + + // assert + sender.Verify(s => s.Send( + It.IsAny(), + It.Is(r => r.Conversation.Id == "19:abc@thread.skype"), + It.IsAny() + ), Times.Once); + } + + [Fact] + public async Task Test_App_Reply_ThreeArgs_InvalidMessageId_Throws() + { + // arrange + var credentials = new Mock(); + var options = new AppOptions() { Credentials = credentials.Object }; + var app = new App(options); + + // act & assert + await Assert.ThrowsAsync(() => + app.Reply("19:abc@thread.skype", "not-a-number", new MessageActivity("Hello"))); + } + } \ No newline at end of file diff --git a/Tests/Microsoft.Teams.Apps.Tests/ServiceUrlValidatorTests.cs b/Tests/Microsoft.Teams.Apps.Tests/ServiceUrlValidatorTests.cs new file mode 100644 index 00000000..01b28942 --- /dev/null +++ b/Tests/Microsoft.Teams.Apps.Tests/ServiceUrlValidatorTests.cs @@ -0,0 +1,121 @@ +using Microsoft.Teams.Api.Auth; + +namespace Microsoft.Teams.Apps.Tests; + +public class ServiceUrlValidatorTests +{ + // --- Public cloud --- + + [Theory] + [InlineData("https://smba.trafficmanager.net/teams/")] + [InlineData("https://smba.trafficmanager.net/amer/")] + [InlineData("https://smba.onyx.prod.teams.trafficmanager.net")] + public void IsAllowed_AcceptsPublicCloudDomains(string serviceUrl) + { + Assert.True(ServiceUrlValidator.IsAllowed(serviceUrl, CloudEnvironment.Public)); + } + + // --- Government clouds --- + + [Fact] + public void IsAllowed_AcceptsUSGovDomain() + { + Assert.True(ServiceUrlValidator.IsAllowed("https://smba.infra.gov.teams.microsoft.us/gcch/", CloudEnvironment.USGov)); + } + + [Fact] + public void IsAllowed_AcceptsDoDDomain() + { + Assert.True(ServiceUrlValidator.IsAllowed("https://smba.infra.dod.teams.microsoft.us/", CloudEnvironment.USGovDoD)); + } + + [Fact] + public void IsAllowed_AcceptsChinaDomain() + { + Assert.True(ServiceUrlValidator.IsAllowed("https://frontend.botapi.msg.infra.teams.microsoftonline.cn", CloudEnvironment.China)); + } + + // --- Cross-cloud rejection --- + + [Fact] + public void IsAllowed_RejectsGovDomainWithPublicCloud() + { + Assert.False(ServiceUrlValidator.IsAllowed("https://smba.infra.gov.teams.microsoft.us/", CloudEnvironment.Public)); + } + + // --- Localhost --- + + [Theory] + [InlineData("http://localhost:3978")] + [InlineData("https://localhost:443")] + [InlineData("http://127.0.0.1:3978")] + public void IsAllowed_AcceptsLocalhost(string serviceUrl) + { + Assert.True(ServiceUrlValidator.IsAllowed(serviceUrl, CloudEnvironment.Public)); + } + + // --- Rejected domains --- + + [Theory] + [InlineData("https://evil.com")] + [InlineData("https://botframework.com.evil.com")] + [InlineData("https://attacker.net/api")] + [InlineData("https://attacker.trafficmanager.net")] + public void IsAllowed_RejectsUnknownDomains(string serviceUrl) + { + Assert.False(ServiceUrlValidator.IsAllowed(serviceUrl, CloudEnvironment.Public)); + } + + // --- Empty / null --- + + [Theory] + [InlineData("")] + [InlineData(null)] + public void IsAllowed_AcceptsEmptyOrNull(string? serviceUrl) + { + Assert.True(ServiceUrlValidator.IsAllowed(serviceUrl!, CloudEnvironment.Public)); + } + + // --- Invalid URLs --- + + [Fact] + public void IsAllowed_RejectsInvalidUrl() + { + Assert.False(ServiceUrlValidator.IsAllowed("not-a-url", CloudEnvironment.Public)); + } + + // --- Additional domains --- + + [Fact] + public void IsAllowed_AcceptsAdditionalDomains() + { + var additional = new[] { "api.custom-channel.com" }; + Assert.True(ServiceUrlValidator.IsAllowed("https://api.custom-channel.com", CloudEnvironment.Public, additional)); + } + + [Fact] + public void IsAllowed_RejectsWhenNotInAdditionalDomains() + { + var additional = new[] { "api.custom-channel.com" }; + Assert.False(ServiceUrlValidator.IsAllowed("https://evil.com", CloudEnvironment.Public, additional)); + } + + // --- Wildcard --- + + [Fact] + public void IsAllowed_AcceptsAnyDomainWithWildcard() + { + var additional = new[] { "*" }; + Assert.True(ServiceUrlValidator.IsAllowed("https://anything.example.com", CloudEnvironment.Public, additional)); + } + + // --- botframework.com not in default --- + + [Theory] + [InlineData("https://webchat.botframework.com")] + [InlineData("https://directline.botframework.com")] + public void IsAllowed_RejectsBotframeworkByDefault(string serviceUrl) + { + Assert.False(ServiceUrlValidator.IsAllowed(serviceUrl, CloudEnvironment.Public)); + } +} diff --git a/Tests/Microsoft.Teams.Cards.Tests/AdaptiveCardsTest.cs b/Tests/Microsoft.Teams.Cards.Tests/AdaptiveCardsTest.cs index 44e92bbb..f33a9b00 100644 --- a/Tests/Microsoft.Teams.Cards.Tests/AdaptiveCardsTest.cs +++ b/Tests/Microsoft.Teams.Cards.Tests/AdaptiveCardsTest.cs @@ -10,13 +10,10 @@ public class AdaptiveCardsTest public void Should_Serialize_AdaptiveCard_Simple() { // arrange - AdaptiveCard card = new AdaptiveCard() - { - Body = new List() + AdaptiveCard card = new AdaptiveCard(new List { new TextBlock("Hello, Adaptive Card!") - } - }; + }); // act var json = JsonSerializer.Serialize(card); @@ -58,10 +55,7 @@ public void Should_Deserialize_AdaptiveCard_Simple() public void Should_Serialize_BasicCard_WithToggleInput() { // arrange - recreating CreateBasicAdaptiveCard from samples - var card = new AdaptiveCard - { - Schema = "http://adaptivecards.io/schemas/adaptive-card.json", - Body = new List + var card = new AdaptiveCard(new List { new TextBlock("Hello world") { @@ -72,7 +66,9 @@ public void Should_Serialize_BasicCard_WithToggleInput() { Id = "notify" } - }, + }) + { + Schema = "http://adaptivecards.io/schemas/adaptive-card.json", Actions = new List { new ExecuteAction @@ -153,7 +149,7 @@ public void Should_Deserialize_ProfileCard_WithInputs() ] }"; - var card = JsonSerializer.Deserialize(cardJson); + var card = JsonSerializer.Deserialize(json); Assert.NotNull(card); // Note: Schema might be serialized as $schema in JSON but not always set on deserialized object @@ -190,10 +186,7 @@ public void Should_Deserialize_ProfileCard_WithInputs() public void Should_Serialize_TaskFormCard_WithChoiceSet() { // arrange - recreating CreateTaskFormCard from samples - var card = new AdaptiveCard - { - Schema = "http://adaptivecards.io/schemas/adaptive-card.json", - Body = new List + var card = new AdaptiveCard(new List { new TextBlock("Create New Task") { @@ -206,17 +199,16 @@ public void Should_Serialize_TaskFormCard_WithChoiceSet() Label = "Task Title", Placeholder = "Enter task title" }, - new ChoiceSetInput - { - Id = "priority", - Label = "Priority", - Value = "medium", - Choices = new List + new ChoiceSetInput(new List { new() { Title = "High", Value = "high" }, new() { Title = "Medium", Value = "medium" }, new() { Title = "Low", Value = "low" } - } + }) + { + Id = "priority", + Label = "Priority", + Value = "medium" }, new DateInput { @@ -224,7 +216,9 @@ public void Should_Serialize_TaskFormCard_WithChoiceSet() Label = "Due Date", Value = "2024-01-15" } - } + }) + { + Schema = "http://adaptivecards.io/schemas/adaptive-card.json" }; // act @@ -350,10 +344,7 @@ public void Should_Deserialize_ComplexCard_FromJson() public void Should_Serialize_FeedbackCard_WithMultilineInput() { // arrange - recreating CreateFeedbackCard from samples - var card = new AdaptiveCard - { - Schema = "http://adaptivecards.io/schemas/adaptive-card.json", - Body = new List + var card = new AdaptiveCard(new List { new TextBlock("Feedback Form") { @@ -368,7 +359,9 @@ public void Should_Serialize_FeedbackCard_WithMultilineInput() IsMultiline = true, IsRequired = true } - }, + }) + { + Schema = "http://adaptivecards.io/schemas/adaptive-card.json", Actions = new List { new ExecuteAction @@ -433,7 +426,7 @@ public void Should_Deserialize_ValidationCard_WithNumberInput() ] }"; - var card = JsonSerializer.Deserialize(cardJson); + var card = JsonSerializer.Deserialize(json); Assert.NotNull(card); Assert.Equal(3, card.Body!.Count); @@ -512,12 +505,11 @@ public void Should_Deserialize() public void Should_Not_Serialize_Null_MsTeams_Property_On_SubmitAction() { // arrange - var card = new AdaptiveCard - { - Body = new List + var card = new AdaptiveCard(new List { new TextBlock("Test card with Submit action") - }, + }) + { Actions = new List { new SubmitAction @@ -564,4 +556,63 @@ public void Should_Serialize_Actions() Assert.Equal("Learn More", action.Title); Assert.Equal("https://adaptivecards.microsoft.com", action.Url); } + + [Fact] + public void SubmitData_Should_Set_Action_Field() + { + var data = new SubmitData("save_profile"); + + var json = JsonSerializer.Serialize(data); + using var doc = JsonDocument.Parse(json); + var root = doc.RootElement; + + Assert.True(root.TryGetProperty("action", out var actionElement)); + Assert.Equal("save_profile", actionElement.GetString()); + } + + [Fact] + public void SubmitData_Should_Include_Extra_Data() + { + var data = new SubmitData("save_profile", new Dictionary { ["entity_id"] = "12345" }); + + var json = JsonSerializer.Serialize(data); + using var doc = JsonDocument.Parse(json); + var root = doc.RootElement; + + Assert.True(root.TryGetProperty("action", out var actionElement)); + Assert.Equal("save_profile", actionElement.GetString()); + Assert.True(root.TryGetProperty("entity_id", out var entityElement)); + Assert.Equal("12345", entityElement.GetString()); + } + + [Fact] + public void OpenDialogData_Should_Set_Msteams_And_DialogId() + { + var data = new OpenDialogData("simple_form"); + + var json = JsonSerializer.Serialize(data); + using var doc = JsonDocument.Parse(json); + var root = doc.RootElement; + + Assert.True(root.TryGetProperty("msteams", out var msteamsElement)); + Assert.Equal("task/fetch", msteamsElement.GetProperty("type").GetString()); + Assert.True(root.TryGetProperty("dialog_id", out var dialogIdElement)); + Assert.Equal("simple_form", dialogIdElement.GetString()); + } + + [Fact] + public void OpenDialogData_Should_Include_Extra_Data() + { + var data = new OpenDialogData("simple_form", new Dictionary { ["custom_key"] = "value" }); + + var json = JsonSerializer.Serialize(data); + using var doc = JsonDocument.Parse(json); + var root = doc.RootElement; + + Assert.True(root.TryGetProperty("msteams", out _)); + Assert.True(root.TryGetProperty("dialog_id", out var dialogIdElement)); + Assert.Equal("simple_form", dialogIdElement.GetString()); + Assert.True(root.TryGetProperty("custom_key", out var customElement)); + Assert.Equal("value", customElement.GetString()); + } } \ No newline at end of file diff --git a/Tests/Microsoft.Teams.Plugins.AspNetCore.Tests/Extensions/TeamsValidationSettingsTests.cs b/Tests/Microsoft.Teams.Plugins.AspNetCore.Tests/Extensions/TeamsValidationSettingsTests.cs new file mode 100644 index 00000000..49658400 --- /dev/null +++ b/Tests/Microsoft.Teams.Plugins.AspNetCore.Tests/Extensions/TeamsValidationSettingsTests.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.Teams.Api.Auth; +using Microsoft.Teams.Plugins.AspNetCore.Extensions; + +namespace Microsoft.Teams.Plugins.AspNetCore.Tests.Extensions; + +public class TeamsValidationSettingsTests +{ + [Fact] + public void DefaultConstructor_UsesPublicCloud() + { + var settings = new TeamsValidationSettings(); + + Assert.Equal("https://login.botframework.com/v1/.well-known/openidconfiguration", settings.OpenIdMetadataUrl); + Assert.Equal("https://login.microsoftonline.com", settings.LoginEndpoint); + Assert.Contains("https://api.botframework.com", settings.Issuers); + } + + [Fact] + public void USGovCloud_HasCorrectSettings() + { + var settings = new TeamsValidationSettings(CloudEnvironment.USGov); + + Assert.Equal("https://login.botframework.azure.us/v1/.well-known/openidconfiguration", settings.OpenIdMetadataUrl); + Assert.Equal("https://login.microsoftonline.us", settings.LoginEndpoint); + Assert.Contains("https://api.botframework.us", settings.Issuers); + } + + [Fact] + public void ChinaCloud_HasCorrectSettings() + { + var settings = new TeamsValidationSettings(CloudEnvironment.China); + + Assert.Equal("https://login.botframework.azure.cn/v1/.well-known/openidconfiguration", settings.OpenIdMetadataUrl); + Assert.Equal("https://login.partner.microsoftonline.cn", settings.LoginEndpoint); + Assert.Contains("https://api.botframework.azure.cn", settings.Issuers); + } + + [Fact] + public void AllClouds_IncludeEmulatorIssuers() + { + var clouds = new[] { CloudEnvironment.Public, CloudEnvironment.USGov, CloudEnvironment.USGovDoD, CloudEnvironment.China }; + + foreach (var cloud in clouds) + { + var settings = new TeamsValidationSettings(cloud); + + // Emulator issuers should always be present + Assert.Contains(settings.Issuers, i => i.Contains("d6d49420-f39b-4df7-a1dc-d59a935871db")); + Assert.Contains(settings.Issuers, i => i.Contains("f8cdef31-a31e-4b4a-93e4-5f571e91255a")); + } + } + + [Fact] + public void GetTenantSpecificOpenIdMetadataUrl_UsesCloudLoginEndpoint() + { + var settings = new TeamsValidationSettings(CloudEnvironment.USGov); + + var url = settings.GetTenantSpecificOpenIdMetadataUrl("my-tenant"); + + Assert.Equal("https://login.microsoftonline.us/my-tenant/v2.0/.well-known/openid-configuration", url); + } + + [Fact] + public void GetTenantSpecificOpenIdMetadataUrl_DefaultsToCommon() + { + var settings = new TeamsValidationSettings(CloudEnvironment.China); + + var url = settings.GetTenantSpecificOpenIdMetadataUrl(null); + + Assert.Equal("https://login.partner.microsoftonline.cn/common/v2.0/.well-known/openid-configuration", url); + } + + [Fact] + public void GetValidIssuersForTenant_UsesCloudLoginEndpoint() + { + var settings = new TeamsValidationSettings(CloudEnvironment.USGov); + + var issuers = settings.GetValidIssuersForTenant("my-tenant").ToList(); + + Assert.Single(issuers); + Assert.Equal("https://login.microsoftonline.us/my-tenant/", issuers[0]); + } + + [Fact] + public void GetValidIssuersForTenant_ReturnsEmptyForNullTenant() + { + var settings = new TeamsValidationSettings(CloudEnvironment.USGov); + + var issuers = settings.GetValidIssuersForTenant(null).ToList(); + + Assert.Empty(issuers); + } + + [Fact] + public void AddDefaultAudiences_AddsClientIdAndApiPrefix() + { + var settings = new TeamsValidationSettings(CloudEnvironment.USGov); + + settings.AddDefaultAudiences("my-client-id"); + + Assert.Contains("my-client-id", settings.Audiences); + Assert.Contains("api://my-client-id", settings.Audiences); + } +} \ No newline at end of file diff --git a/core/test/Microsoft.Teams.Bot.Apps.UnitTests/CitationEntityDeepCopyTests.cs b/core/test/Microsoft.Teams.Bot.Apps.UnitTests/CitationEntityDeepCopyTests.cs new file mode 100644 index 00000000..65c75cc2 --- /dev/null +++ b/core/test/Microsoft.Teams.Bot.Apps.UnitTests/CitationEntityDeepCopyTests.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Teams.Bot.Apps.Schema; +using Microsoft.Teams.Bot.Apps.Schema.Entities; + +namespace Microsoft.Teams.Bot.Apps.UnitTests; + +/// +/// Verifies that the CitationEntity copy constructor deep-copies CitationClaim instances +/// so that mutations on the copy do not affect the original (COPY-01 / A-015). +/// +public class CitationEntityDeepCopyTests +{ + private static CitationEntity MakeCitation() => new CitationEntity + { + OType = "Message", + OContext = "https://schema.org", + Type = "message", + Citation = + [ + new CitationClaim + { + Position = 1, + Appearance = new CitationAppearanceDocument + { + Name = "Source A", + Abstract = "Extract from Source A", + Url = new Uri("https://example.com/a"), + EncodingFormat = "text/plain" + } + } + ] + }; + + [Fact] + public void CopyConstructor_Citation_IsDeepCopied() + { + // Arrange + CitationEntity original = MakeCitation(); + + // Act – create a copy via the OMessageEntity copy constructor + CitationEntity copy = new(original); + + // Mutate the copy's first claim + copy.Citation![0].Appearance.Name = "Mutated Name"; + + // Assert – original must be unaffected + Assert.Equal("Source A", original.Citation![0].Appearance.Name); + } + + [Fact] + public void CopyConstructor_Citation_ListIsIndependent() + { + // Arrange + CitationEntity original = MakeCitation(); + CitationEntity copy = new(original); + + // Act – add an item to the copy's list + copy.Citation!.Add(new CitationClaim + { + Position = 99, + Appearance = new CitationAppearanceDocument { Name = "Extra", Abstract = "Extra abstract" } + }); + + // Assert – original list must not grow + Assert.Single(original.Citation!); + } +} diff --git a/version.json b/version.json index a998c5cf..6f241820 100644 --- a/version.json +++ b/version.json @@ -1,7 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "pathFilters": ["./Libraries"], - "version": "2.0.6-preview.{height}", + "version": "2.0.7-preview.{height}", "publicReleaseRefSpec": [ "^refs/heads/main$", "^refs/heads/v\\d+(?:\\.\\d+)?$", From 8f30e5c647f11b4f29aff179c4d3b95157e80fc1 Mon Sep 17 00:00:00 2001 From: Rido Date: Tue, 21 Apr 2026 22:04:05 +0000 Subject: [PATCH 2/2] Enhance CitationEntity and CitationClaim with deep copy constructors and improve citation handling --- .../Schema/Entities/CitationEntity.cs | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/core/src/Microsoft.Teams.Bot.Apps/Schema/Entities/CitationEntity.cs b/core/src/Microsoft.Teams.Bot.Apps/Schema/Entities/CitationEntity.cs index f4a29738..87462a67 100644 --- a/core/src/Microsoft.Teams.Bot.Apps/Schema/Entities/CitationEntity.cs +++ b/core/src/Microsoft.Teams.Bot.Apps/Schema/Entities/CitationEntity.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; namespace Microsoft.Teams.Bot.Apps.Schema.Entities; @@ -123,7 +124,7 @@ public CitationEntity(OMessageEntity entity) : base() if (entity is CitationEntity citationEntity) { Citation = citationEntity.Citation != null - ? new List(citationEntity.Citation) + ? citationEntity.Citation.Select(c => new CitationClaim(c)).ToList() : null; } } @@ -144,6 +145,19 @@ public IList? Citation /// public class CitationClaim { + /// Initializes a new instance of . + public CitationClaim() { } + + /// Creates a deep copy of . + [SetsRequiredMembers] + public CitationClaim(CitationClaim other) + { + ArgumentNullException.ThrowIfNull(other); + Type = other.Type; + Position = other.Position; + Appearance = new CitationAppearanceDocument(other.Appearance); + } + /// /// Gets or sets the schema.org type. Always "Claim". /// @@ -168,6 +182,25 @@ public class CitationClaim /// public class CitationAppearanceDocument { + /// Initializes a new instance of . + public CitationAppearanceDocument() { } + + /// Creates a deep copy of . + [SetsRequiredMembers] + public CitationAppearanceDocument(CitationAppearanceDocument other) + { + ArgumentNullException.ThrowIfNull(other); + Type = other.Type; + Name = other.Name; + Text = other.Text; + Url = other.Url; + Abstract = other.Abstract; + EncodingFormat = other.EncodingFormat; + Image = other.Image is null ? null : new CitationImageObject { Type = other.Image.Type, Name = other.Image.Name }; + Keywords = other.Keywords != null ? new List(other.Keywords) : null; + UsageInfo = other.UsageInfo; + } + /// /// Gets or sets the schema.org type. Always "DigitalDocument". ///