microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Apps/Plugins/SenderPlugin.cs
67lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.Api; |
| 5 | using Microsoft.Teams.Api.Activities; |
| 6 | using Microsoft.Teams.Apps.Events; |
| 7 | |
| 8 | namespace Microsoft.Teams.Apps.Plugins; |
| 9 | |
| 10 | /// <summary> |
| 11 | /// a plugin that can send activities |
| 12 | /// </summary> |
| 13 | public interface ISenderPlugin : IPlugin |
| 14 | { |
| 15 | /// <summary> |
| 16 | /// called by the `App` |
| 17 | /// to send an activity |
| 18 | /// </summary> |
| 19 | /// <param name="activity">the activity to send</param> |
| 20 | /// <param name="reference">the conversation reference</param> |
| 21 | /// <returns>the sent activity</returns> |
| 22 | public Task<IActivity> Send(IActivity activity, ConversationReference reference, CancellationToken cancellationToken = default); |
| 23 | |
| 24 | /// <summary> |
| 25 | /// called by the `App` |
| 26 | /// to send an activity |
| 27 | /// </summary> |
| 28 | /// <param name="activity">the activity to send</param> |
| 29 | /// <param name="reference">the conversation reference</param> |
| 30 | /// <param name="isTargeted">whether the activity is targeted</param> |
| 31 | /// <returns>the sent activity</returns> |
| 32 | public Task<IActivity> Send(IActivity activity, ConversationReference reference, bool isTargeted, CancellationToken cancellationToken = default); |
| 33 | |
| 34 | /// <summary> |
| 35 | /// called by the `App` |
| 36 | /// to send an activity |
| 37 | /// </summary> |
| 38 | /// <typeparam name="TActivity">the activity type</typeparam> |
| 39 | /// <param name="activity">the activity to send</param> |
| 40 | /// <param name="reference">the conversation reference</param> |
| 41 | /// <returns>the sent activity</returns> |
| 42 | public Task<TActivity> Send<TActivity>(TActivity activity, ConversationReference reference, CancellationToken cancellationToken = default) where TActivity : IActivity; |
| 43 | |
| 44 | /// <summary> |
| 45 | /// called by the `App` |
| 46 | /// to send an activity |
| 47 | /// </summary> |
| 48 | /// <typeparam name="TActivity">the activity type</typeparam> |
| 49 | /// <param name="activity">the activity to send</param> |
| 50 | /// <param name="reference">the conversation reference</param> |
| 51 | /// <param name="isTargeted">whether the activity is targeted</param> |
| 52 | /// <returns>the sent activity</returns> |
| 53 | public Task<TActivity> Send<TActivity>(TActivity activity, ConversationReference reference, bool isTargeted, CancellationToken cancellationToken = default) where TActivity : IActivity; |
| 54 | |
| 55 | /// <summary> |
| 56 | /// called by the `App` |
| 57 | /// to create a new activity stream |
| 58 | /// </summary> |
| 59 | /// <param name="reference">the conversation reference</param> |
| 60 | /// <returns>a new stream</returns> |
| 61 | public IStreamer CreateStream(ConversationReference reference, CancellationToken cancellationToken = default); |
| 62 | |
| 63 | /// <summary> |
| 64 | /// process an activity |
| 65 | /// </summary> |
| 66 | public Task<Response> Do(ActivityEvent @event, CancellationToken cancellationToken = default); |
| 67 | } |