microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/sub-pr-188-again

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

111lines · 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 /// <param name="isTargeted">whether the activity is targeted</param>
21 /// <remarks>
22 /// <para>The <paramref name="isTargeted"/> parameter is in preview.</para>
23 /// <para>Targeted messages are delivered privately to the recipient specified in the activity's Recipient property.</para>
24 /// </remarks>
25 public Task<T> Send<T>(T activity, bool isTargeted = false) where T : IActivity => context.Send(activity, isTargeted);
26
27 /// <summary>
28 /// send a message activity to the conversation
29 /// </summary>
30 /// <param name="text">the text to send</param>
31 /// <param name="isTargeted">whether the activity is targeted</param>
32 /// <remarks>
33 /// <para>The <paramref name="isTargeted"/> parameter is in preview.</para>
34 /// <para>Targeted messages are delivered privately to the recipient specified in the activity's Recipient property.</para>
35 /// </remarks>
36 public Task<MessageActivity> Send(string text, bool isTargeted = false) => context.Send(text, isTargeted);
37
38 /// <summary>
39 /// send a message activity with a card attachment
40 /// </summary>
41 /// <param name="card">the card to send as an attachment</param>
42 /// <param name="isTargeted">whether the activity is targeted</param>
43 /// <remarks>
44 /// <para>The <paramref name="isTargeted"/> parameter is in preview.</para>
45 /// <para>Targeted messages are delivered privately to the recipient specified in the activity's Recipient property.</para>
46 /// </remarks>
47 public Task<MessageActivity> Send(Cards.AdaptiveCard card, bool isTargeted = false) => context.Send(card, isTargeted);
48
49 /// <summary>
50 /// send an activity to the conversation as a reply
51 /// </summary>
52 /// <param name="activity">activity activity to send</param>
53 /// <param name="isTargeted">whether the activity is targeted</param>
54 /// <remarks>
55 /// <para>The <paramref name="isTargeted"/> parameter is in preview.</para>
56 /// <para>Targeted messages are delivered privately to the recipient specified in the activity's Recipient property.</para>
57 /// </remarks>
58 public Task<T> Reply<T>(T activity, bool isTargeted = false) where T : IActivity => context.Reply(activity, isTargeted);
59
60 /// <summary>
61 /// send a message activity to the conversation as a reply
62 /// </summary>
63 /// <param name="text">the text to send</param>
64 /// <param name="isTargeted">whether the activity is targeted</param>
65 /// <remarks>
66 /// <para>The <paramref name="isTargeted"/> parameter is in preview.</para>
67 /// <para>Targeted messages are delivered privately to the recipient specified in the activity's Recipient property.</para>
68 /// </remarks>
69 public Task<MessageActivity> Reply(string text, bool isTargeted = false) => context.Reply(text, isTargeted);
70
71 /// <summary>
72 /// send a message activity with a card attachment as a reply
73 /// </summary>
74 /// <param name="card">the card to send as an attachment</param>
75 /// <param name="isTargeted">whether the activity is targeted</param>
76 /// <remarks>
77 /// <para>The <paramref name="isTargeted"/> parameter is in preview.</para>
78 /// <para>Targeted messages are delivered privately to the recipient specified in the activity's Recipient property.</para>
79 /// </remarks>
80 public Task<MessageActivity> Reply(Cards.AdaptiveCard card, bool isTargeted = false) => context.Reply(card, isTargeted);
81
82 /// <summary>
83 /// send a typing activity
84 /// </summary>
85 public Task<TypingActivity> Typing(string? text = null) => context.Typing(text);
86
87 /// <summary>
88 /// trigger user signin flow for the activity sender
89 /// </summary>
90 /// <param name="options">option overrides</param>
91 /// <returns>the existing user token if found</returns>
92 public Task<string?> SignIn(OAuthOptions? options = null) => context.SignIn(options);
93
94 /// <summary>
95 /// trigger user SSO signin flow for the activity sender
96 /// </summary>
97 /// <param name="options">option overrides</param>
98 public Task SignIn(SSOOptions options) => context.SignIn(options);
99
100 /// <summary>
101 /// trigger user signin flow for the activity sender
102 /// </summary>
103 /// <param name="connectionName">the connection name</param>
104 public Task SignOut(string? connectionName = null) => context.SignOut(connectionName);
105 }
106
107 /// <summary>
108 /// calls the next handler in the route chain
109 /// </summary>
110 public delegate Task<object?> Next();
111}