microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Cards/Actions/TaskFetchAction.cs
42lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.Common; |
| 5 | |
| 6 | namespace Microsoft.Teams.Cards; |
| 7 | |
| 8 | /// <summary> |
| 9 | /// This class is deprecated. Please use <see cref="TaskFetchSubmitActionData"/> instead. This will be removed in a future version of the SDK. |
| 10 | /// </summary> |
| 11 | [Obsolete("This class is deprecated. Use TaskFetchSubmitActionData instead. This will be removed in a future version of the SDK.")] |
| 12 | public class TaskFetchAction : SubmitAction |
| 13 | { |
| 14 | public TaskFetchAction(IDictionary<string, object?>? value = null) |
| 15 | { |
| 16 | var submitActionData = new SubmitActionData |
| 17 | { |
| 18 | Msteams = new TaskFetchSubmitActionData() |
| 19 | }; |
| 20 | |
| 21 | if (value != null) |
| 22 | { |
| 23 | foreach (var kvp in value) |
| 24 | { |
| 25 | submitActionData.NonSchemaProperties[kvp.Key] = kvp.Value; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | Data = new Union<string, SubmitActionData>(submitActionData); |
| 30 | } |
| 31 | |
| 32 | public static IDictionary<string, object?> FromObject(object obj) |
| 33 | { |
| 34 | if (obj == null) throw new ArgumentNullException(nameof(obj)); |
| 35 | |
| 36 | return obj.GetType() |
| 37 | .GetProperties() |
| 38 | .ToDictionary( |
| 39 | p => p.Name, |
| 40 | p => (object?)p.GetValue(obj)); |
| 41 | } |
| 42 | } |