microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Api/Activities/Command/CommandResultActivity.cs
67lines · modecode
| 1 | using System.Text.Json.Serialization; |
| 2 | |
| 3 | using Microsoft.Teams.Common; |
| 4 | |
| 5 | namespace Microsoft.Teams.Api.Activities; |
| 6 | |
| 7 | public partial class ActivityType : StringEnum |
| 8 | { |
| 9 | public static readonly ActivityType CommandResult = new("commandResult"); |
| 10 | public bool IsCommandResult => CommandResult.Equals(Value); |
| 11 | } |
| 12 | |
| 13 | /// <summary> |
| 14 | /// Asynchronous external command result. |
| 15 | /// </summary> |
| 16 | public class CommandResultActivity() : Activity(ActivityType.CommandResult) |
| 17 | { |
| 18 | /// <summary> |
| 19 | /// The name of the event. |
| 20 | /// </summary> |
| 21 | [JsonPropertyName("name")] |
| 22 | [JsonPropertyOrder(0)] |
| 23 | public required string Name { get; set; } |
| 24 | |
| 25 | /// <summary> |
| 26 | /// The value for this command. |
| 27 | /// </summary> |
| 28 | [JsonPropertyName("value")] |
| 29 | [JsonPropertyOrder(1)] |
| 30 | public CommandResultValue? Value { get; set; } |
| 31 | } |
| 32 | |
| 33 | /// <summary> |
| 34 | /// The value field of a <see cref="CommandResultActivity"/> contains metadata related to a command result. |
| 35 | /// An optional extensible data payload may be included if defined by the command result activity name. |
| 36 | /// The presence of an error field indicates that the original command failed to complete. |
| 37 | /// </summary> |
| 38 | public class CommandResultValue |
| 39 | { |
| 40 | /// <summary> |
| 41 | /// Gets or sets the id of the command. |
| 42 | /// </summary> |
| 43 | /// <value> |
| 44 | /// Id of the command. |
| 45 | /// </value> |
| 46 | [JsonPropertyName("commandId")] |
| 47 | public required string CommandId { get; set; } |
| 48 | |
| 49 | /// <summary> |
| 50 | /// Gets or sets the data field containing optional parameters specific to this command result activity, |
| 51 | /// as defined by the name. The value of the data field is a complex type. |
| 52 | /// </summary> |
| 53 | /// <value> |
| 54 | /// Open-ended value. |
| 55 | /// </value> |
| 56 | [JsonPropertyName("data")] |
| 57 | public object? Data { get; set; } |
| 58 | |
| 59 | /// <summary> |
| 60 | /// Gets or sets the optional error, if the command result indicates a failure. |
| 61 | /// </summary> |
| 62 | /// <value> |
| 63 | /// Error which occurred during processing of the command. |
| 64 | /// </value> |
| 65 | [JsonPropertyName("error")] |
| 66 | public Error? Error { get; set; } |
| 67 | } |