microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Api/Activities/Command/CommandActivity.cs
53lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using System.Text.Json.Serialization; |
| 5 | |
| 6 | using Microsoft.Teams.Common; |
| 7 | |
| 8 | namespace Microsoft.Teams.Api.Activities; |
| 9 | |
| 10 | public partial class ActivityType : StringEnum |
| 11 | { |
| 12 | public static readonly ActivityType Command = new("command"); |
| 13 | public bool IsCommand => Command.Equals(Value); |
| 14 | } |
| 15 | |
| 16 | public class CommandActivity() : Activity(ActivityType.Command) |
| 17 | { |
| 18 | /// <summary> |
| 19 | /// The name of the event. |
| 20 | /// </summary> |
| 21 | [JsonPropertyName("name")] |
| 22 | [JsonPropertyOrder(31)] |
| 23 | public required string Name { get; set; } |
| 24 | |
| 25 | /// <summary> |
| 26 | /// The value for this command. |
| 27 | /// </summary> |
| 28 | [JsonPropertyName("value")] |
| 29 | [JsonPropertyOrder(32)] |
| 30 | public CommandValue? Value { get; set; } |
| 31 | } |
| 32 | |
| 33 | /// <summary> |
| 34 | /// The value field of a ICommandActivity contains metadata related to a command. |
| 35 | /// An optional extensible data payload may be included if defined by the command activity name. |
| 36 | /// </summary> |
| 37 | public class CommandValue |
| 38 | { |
| 39 | /// <summary> |
| 40 | /// ID of the command. |
| 41 | /// </summary> |
| 42 | [JsonPropertyName("channelId")] |
| 43 | [JsonPropertyOrder(0)] |
| 44 | public required string ChannelId { get; set; } |
| 45 | |
| 46 | /// <summary> |
| 47 | /// The data field containing optional parameters specific to this command activity, |
| 48 | /// as defined by the name. The value of the data field is a complex type. |
| 49 | /// </summary> |
| 50 | [JsonPropertyName("data")] |
| 51 | [JsonPropertyOrder(1)] |
| 52 | public object? Data { get; set; } |
| 53 | } |