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