microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Api/MessageExtensions/Result.cs
79lines · modecode
| 1 | using System.Text.Json.Serialization; |
| 2 | |
| 3 | using Microsoft.Teams.Common; |
| 4 | |
| 5 | namespace Microsoft.Teams.Api.MessageExtensions; |
| 6 | |
| 7 | /// <summary> |
| 8 | /// Possible values include: 'result', 'auth', 'config', 'message', 'botMessagePreview', 'silentAuth'. |
| 9 | /// </summary> |
| 10 | [JsonConverter(typeof(JsonConverter<ResultType>))] |
| 11 | public class ResultType(string value) : StringEnum(value) |
| 12 | { |
| 13 | public static readonly ResultType Result = new("result"); |
| 14 | public bool IsResult => Result.Equals(Value); |
| 15 | |
| 16 | public static readonly ResultType Auth = new("auth"); |
| 17 | public bool IsAuth => Auth.Equals(Value); |
| 18 | |
| 19 | public static readonly ResultType Config = new("config"); |
| 20 | public bool IsConfig => Config.Equals(Value); |
| 21 | |
| 22 | public static readonly ResultType Message = new("message"); |
| 23 | public bool IsMessage => Message.Equals(Value); |
| 24 | |
| 25 | public static readonly ResultType BotMessagePreview = new("botMessagePreview"); |
| 26 | public bool IsBotMessagePreview => BotMessagePreview.Equals(Value); |
| 27 | |
| 28 | public static readonly ResultType SilentAuth = new("silentAuth"); |
| 29 | public bool IsSilentAuth => SilentAuth.Equals(Value); |
| 30 | } |
| 31 | |
| 32 | /// <summary> |
| 33 | /// Messaging extension result |
| 34 | /// </summary> |
| 35 | public class Result |
| 36 | { |
| 37 | /// <summary> |
| 38 | /// Hint for how to deal with multiple attachments. Possible values include: 'list', 'grid' |
| 39 | /// </summary> |
| 40 | [JsonPropertyName("attachmentLayout")] |
| 41 | [JsonPropertyOrder(0)] |
| 42 | public Api.Attachment.Layout? AttachmentLayout { get; set; } |
| 43 | |
| 44 | /// <summary> |
| 45 | /// The type of the result. Possible values include: |
| 46 | /// 'result', 'auth', 'config', 'message', 'botMessagePreview' |
| 47 | /// </summary> |
| 48 | [JsonPropertyName("type")] |
| 49 | [JsonPropertyOrder(1)] |
| 50 | public ResultType? Type { get; set; } |
| 51 | |
| 52 | /// <summary> |
| 53 | /// (Only when type is result) Attachments |
| 54 | /// </summary> |
| 55 | [JsonPropertyName("attachments")] |
| 56 | [JsonPropertyOrder(2)] |
| 57 | public IList<Attachment>? Attachments { get; set; } |
| 58 | |
| 59 | /// <summary> |
| 60 | /// suggested actions |
| 61 | /// </summary> |
| 62 | [JsonPropertyName("suggestedActions")] |
| 63 | [JsonPropertyOrder(3)] |
| 64 | public SuggestedActions? SuggestedActions { get; set; } |
| 65 | |
| 66 | /// <summary> |
| 67 | /// (Only when type is message) Text |
| 68 | /// </summary> |
| 69 | [JsonPropertyName("text")] |
| 70 | [JsonPropertyOrder(4)] |
| 71 | public string? Text { get; set; } |
| 72 | |
| 73 | /// <summary> |
| 74 | /// (Only when type is botMessagePreview) Message activity to preview |
| 75 | /// </summary> |
| 76 | [JsonPropertyName("activityPreview")] |
| 77 | [JsonPropertyOrder(5)] |
| 78 | public Activities.Activity? ActivityPreview { get; set; } |
| 79 | } |