microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
docs/update-release-process

Branches

Tags

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

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.Api/Activities/Command/CommandResultActivity.cs

70lines · modecode

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