microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Api/Activities/Invokes/Messages/FetchTaskActivity.cs
98lines · 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.Invokes; |
| 9 | |
| 10 | public partial class Name : StringEnum |
| 11 | { |
| 12 | public partial class Messages : StringEnum |
| 13 | { |
| 14 | public static readonly Messages FetchTask = new("message/fetchTask"); |
| 15 | public bool IsFetchTask => FetchTask.Equals(Value); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | /// <summary> |
| 20 | /// The feedback button the user clicked. |
| 21 | /// </summary> |
| 22 | [JsonConverter(typeof(JsonConverter<Reaction>))] |
| 23 | public partial class Reaction(string value) : StringEnum(value) |
| 24 | { |
| 25 | public static readonly Reaction Like = new("like"); |
| 26 | public bool IsLike => Like.Equals(Value); |
| 27 | |
| 28 | public static readonly Reaction Dislike = new("dislike"); |
| 29 | public bool IsDislike => Dislike.Equals(Value); |
| 30 | } |
| 31 | |
| 32 | public static partial class Messages |
| 33 | { |
| 34 | /// <summary> |
| 35 | /// Sent when a message has a custom feedback loop and the user clicks a |
| 36 | /// feedback button. The bot should respond with a task module (dialog) to |
| 37 | /// collect feedback. |
| 38 | /// </summary> |
| 39 | public class FetchTaskActivity() : MessageActivity(Name.Messages.FetchTask) |
| 40 | { |
| 41 | /// <summary> |
| 42 | /// A value that is associated with the activity. |
| 43 | /// </summary> |
| 44 | [JsonPropertyName("value")] |
| 45 | [JsonPropertyOrder(32)] |
| 46 | public new required FetchTaskValue Value |
| 47 | { |
| 48 | get => (FetchTaskValue)base.Value!; |
| 49 | set => base.Value = value; |
| 50 | } |
| 51 | |
| 52 | /// <summary> |
| 53 | /// The value associated with a message fetch task. |
| 54 | /// </summary> |
| 55 | public class FetchTaskValue |
| 56 | { |
| 57 | /// <summary> |
| 58 | /// The data payload containing action name and value. |
| 59 | /// </summary> |
| 60 | [JsonPropertyName("data")] |
| 61 | [JsonPropertyOrder(0)] |
| 62 | public required FetchTaskData Data { get; set; } |
| 63 | } |
| 64 | |
| 65 | /// <summary> |
| 66 | /// The data payload nested inside the fetch task value. |
| 67 | /// </summary> |
| 68 | public class FetchTaskData |
| 69 | { |
| 70 | /// <summary> |
| 71 | /// The name of the action. |
| 72 | /// </summary> |
| 73 | [JsonPropertyName("actionName")] |
| 74 | [JsonPropertyOrder(0)] |
| 75 | public string ActionName { get; set; } = "feedback"; |
| 76 | |
| 77 | /// <summary> |
| 78 | /// Contains the user's reaction. |
| 79 | /// </summary> |
| 80 | [JsonPropertyName("actionValue")] |
| 81 | [JsonPropertyOrder(1)] |
| 82 | public required FetchTaskActionValue ActionValue { get; set; } |
| 83 | } |
| 84 | |
| 85 | /// <summary> |
| 86 | /// The nested action value containing the user's reaction. |
| 87 | /// </summary> |
| 88 | public class FetchTaskActionValue |
| 89 | { |
| 90 | /// <summary> |
| 91 | /// The feedback button the user clicked. |
| 92 | /// </summary> |
| 93 | [JsonPropertyName("reaction")] |
| 94 | [JsonPropertyOrder(0)] |
| 95 | public required Reaction Reaction { get; set; } |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |