microsoft/teams.net

Public

mirrored fromhttps://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
kavin/agents-sdk-interop

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.Cards/Utilities/SubmitData.cs

32lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4namespace Microsoft.Teams.Cards;
5
6/// <summary>
7/// Utility class for creating submit data with action-based routing.
8///
9/// Extends the generated <see cref="SubmitActionData"/> with a convenience constructor
10/// that accepts an action identifier for handler routing.
11/// </summary>
12/// <example>
13/// <code>
14/// new ExecuteAction { Data = new Union&lt;string, SubmitActionData&gt;(new SubmitData("save_profile", new() { ["entity_id"] = "12345" })) }
15/// </code>
16/// </example>
17public class SubmitData : SubmitActionData
18{
19 private const string ReservedKeyword = "action";
20
21 public SubmitData(string action, IDictionary<string, object?>? extraData = null)
22 {
23 if (extraData != null)
24 {
25 foreach (var kvp in extraData)
26 {
27 NonSchemaProperties[kvp.Key] = kvp.Value;
28 }
29 }
30 NonSchemaProperties[ReservedKeyword] = action;
31 }
32}