microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
feature/user-agent-header

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

81lines · modecode

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