microsoft/teams.net

Public

mirrored fromhttps://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v2.0.0-preview.5

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.Apps/Contexts/Context.Client.cs

72lines · modecode

1using Microsoft.Teams.Api.Activities;
2
3namespace Microsoft.Teams.Apps;
4
5public partial interface IContext
6{
7 /// <summary>
8 /// an object that can send activities
9 /// </summary>
10 /// <param name="context">the parent context</param>
11 public class Client(IContext<IActivity> context)
12 {
13 /// <summary>
14 /// send an activity to the conversation
15 /// </summary>
16 /// <param name="activity">activity activity to send</param>
17 public Task<T> Send<T>(T activity) where T : IActivity => context.Send(activity);
18
19 /// <summary>
20 /// send a message activity to the conversation
21 /// </summary>
22 /// <param name="text">the text to send</param>
23 public Task<MessageActivity> Send(string text) => context.Send(text);
24
25 /// <summary>
26 /// send a message activity with a card attachment
27 /// </summary>
28 /// <param name="card">the card to send as an attachment</param>
29 public Task<MessageActivity> Send(Cards.AdaptiveCard card) => context.Send(card);
30
31 /// <summary>
32 /// send an activity to the conversation as a reply
33 /// </summary>
34 /// <param name="activity">activity activity to send</param>
35 public Task<T> Reply<T>(T activity) where T : IActivity => context.Reply(activity);
36
37 /// <summary>
38 /// send a message activity to the conversation as a reply
39 /// </summary>
40 /// <param name="text">the text to send</param>
41 public Task<MessageActivity> Reply(string text) => context.Reply(text);
42
43 /// <summary>
44 /// send a message activity with a card attachment as a reply
45 /// </summary>
46 /// <param name="card">the card to send as an attachment</param>
47 public Task<MessageActivity> Reply(Cards.AdaptiveCard card) => context.Reply(card);
48
49 /// <summary>
50 /// send a typing activity
51 /// </summary>
52 public Task<TypingActivity> Typing(string? text = null) => context.Typing(text);
53
54 /// <summary>
55 /// trigger user signin flow for the activity sender
56 /// </summary>
57 /// <param name="options">option overrides</param>
58 /// <returns>the existing user token if found</returns>
59 public Task<string?> SignIn(SignInOptions? options = null) => context.SignIn(options);
60
61 /// <summary>
62 /// trigger user signin flow for the activity sender
63 /// </summary>
64 /// <param name="connectionName">the connection name</param>
65 public Task SignOut(string? connectionName = null) => context.SignOut(connectionName);
66 }
67
68 /// <summary>
69 /// calls the next handler in the route chain
70 /// </summary>
71 public delegate Task<object?> Next();
72}