microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Apps/Events/SignInEvent.cs
27lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.Api.Activities.Invokes; |
| 5 | using Microsoft.Teams.Apps.Plugins; |
| 6 | |
| 7 | namespace Microsoft.Teams.Apps.Events; |
| 8 | |
| 9 | public class SignInEvent : Event |
| 10 | { |
| 11 | public required Microsoft.Teams.Api.Token.Response Token { get; set; } |
| 12 | |
| 13 | public required IContext<SignInActivity> Context { get; set; } |
| 14 | } |
| 15 | |
| 16 | public static partial class AppEventExtensions |
| 17 | { |
| 18 | public static App OnSignIn(this App app, Action<ISenderPlugin, SignInEvent> handler) |
| 19 | { |
| 20 | return app.OnEvent(EventType.SignIn, (plugin, @event) => handler((ISenderPlugin)plugin, (SignInEvent)@event)); |
| 21 | } |
| 22 | |
| 23 | public static App OnSignIn(this App app, Func<ISenderPlugin, SignInEvent, CancellationToken, Task> handler) |
| 24 | { |
| 25 | return app.OnEvent(EventType.SignIn, (plugin, @event, token) => handler((ISenderPlugin)plugin, (SignInEvent)@event, token)); |
| 26 | } |
| 27 | } |