microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Apps/Plugins/Plugin.cs
48lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.Apps.Events; |
| 5 | |
| 6 | namespace Microsoft.Teams.Apps.Plugins; |
| 7 | |
| 8 | /// <summary> |
| 9 | /// a component for extending the base |
| 10 | /// `App` functionality |
| 11 | /// </summary> |
| 12 | public interface IPlugin |
| 13 | { |
| 14 | /// <summary> |
| 15 | /// emitted when the plugin encounters an error |
| 16 | /// </summary> |
| 17 | public event EventFunction Events; |
| 18 | |
| 19 | /// <summary> |
| 20 | /// lifecycle method called by the `App` once during initialization |
| 21 | /// </summary> |
| 22 | public Task OnInit(App app, CancellationToken cancellationToken = default); |
| 23 | |
| 24 | /// <summary> |
| 25 | /// lifecycle method called by the `App` once during startup |
| 26 | /// </summary> |
| 27 | public Task OnStart(App app, CancellationToken cancellationToken = default); |
| 28 | |
| 29 | /// <summary> |
| 30 | /// called by the `App` when an error occurs |
| 31 | /// </summary> |
| 32 | public Task OnError(App app, IPlugin plugin, ErrorEvent @event, CancellationToken cancellationToken = default); |
| 33 | |
| 34 | /// <summary> |
| 35 | /// called by the `App` when an activity is received |
| 36 | /// </summary> |
| 37 | public Task OnActivity(App app, ISenderPlugin sender, ActivityEvent @event, CancellationToken cancellationToken = default); |
| 38 | |
| 39 | /// <summary> |
| 40 | /// called by the `App` when an activity is sent |
| 41 | /// </summary> |
| 42 | public Task OnActivitySent(App app, ISenderPlugin sender, ActivitySentEvent @event, CancellationToken cancellationToken = default); |
| 43 | |
| 44 | /// <summary> |
| 45 | /// called by the `App` when an activity response is sent |
| 46 | /// </summary> |
| 47 | public Task OnActivityResponse(App app, ISenderPlugin sender, ActivityResponseEvent @event, CancellationToken cancellationToken = default); |
| 48 | } |