microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Api/Activities/Events/EventActivity.cs
28lines · 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.Events; |
| 9 | |
| 10 | [JsonConverter(typeof(JsonConverter<Name>))] |
| 11 | public partial class Name(string value) : StringEnum(value) |
| 12 | { |
| 13 | public Type ToType() |
| 14 | { |
| 15 | if (IsReadReceipt) return typeof(ReadReceiptActivity); |
| 16 | if (IsMeetingStart) return typeof(MeetingStartActivity); |
| 17 | if (IsMeetingEnd) return typeof(MeetingEndActivity); |
| 18 | if (IsMeetingParticipantJoin) return typeof(MeetingParticipantJoinActivity); |
| 19 | if (IsMeetingParticipantLeave) return typeof(MeetingParticipantLeaveActivity); |
| 20 | return typeof(EventActivity); |
| 21 | } |
| 22 | |
| 23 | public string ToPrettyString() |
| 24 | { |
| 25 | var value = ToString(); |
| 26 | return $"{value.First().ToString().ToUpper()}{value.AsSpan(1).ToString()}"; |
| 27 | } |
| 28 | } |