microsoft/teams.net

Public

mirrored from https://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
fix/msal-agentic-cache

Branches

Tags

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

Clone

HTTPS

Download ZIP

core/src/Microsoft.Teams.Apps/Api/Clients/ReactionClient.cs

51lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4using Microsoft.Teams.Core.Schema;
5using CoreConversationClient = Microsoft.Teams.Core.ConversationClient;
6
7namespace Microsoft.Teams.Apps.Api.Clients;
8
9/// <summary>
10/// Client for managing reactions on activities in a conversation.
11/// Delegates to the core <see cref="CoreConversationClient"/>.
12/// </summary>
13public class ReactionClient
14{
15 private readonly CoreConversationClient _client;
16 private readonly Uri _serviceUrl;
17
18 internal ReactionClient(Uri serviceUrl, CoreConversationClient client)
19 {
20 _serviceUrl = serviceUrl;
21 _client = client;
22 }
23
24 /// <summary>
25 /// Adds a reaction on an activity in a conversation.
26 /// </summary>
27 /// <param name="conversationId">The conversation id.</param>
28 /// <param name="activityId">The id of the activity to react to.</param>
29 /// <param name="reactionType">The reaction type (for example: "like", "heart", "laugh", etc.).</param>
30 /// <param name="agenticIdentity">Optional agentic identity for authentication.</param>
31 /// <param name="additionalHeaders">Optional custom headers to include in the request.</param>
32 /// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for the task to complete.</param>
33 public Task AddAsync(string conversationId, string activityId, string reactionType, AgenticIdentity? agenticIdentity = null, Dictionary<string, string>? additionalHeaders = null, CancellationToken cancellationToken = default)
34 {
35 return _client.AddReactionAsync(conversationId, activityId, reactionType, _serviceUrl, agenticIdentity: agenticIdentity, customHeaders: additionalHeaders, cancellationToken: cancellationToken);
36 }
37
38 /// <summary>
39 /// Removes a reaction from an activity in a conversation.
40 /// </summary>
41 /// <param name="conversationId">The conversation id.</param>
42 /// <param name="activityId">The id of the activity the reaction is on.</param>
43 /// <param name="reactionType">The reaction type to remove (for example: "like", "heart", "laugh", etc.).</param>
44 /// <param name="agenticIdentity">Optional agentic identity for authentication.</param>
45 /// <param name="additionalHeaders">Optional custom headers to include in the request.</param>
46 /// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for the task to complete.</param>
47 public Task DeleteAsync(string conversationId, string activityId, string reactionType, AgenticIdentity? agenticIdentity = null, Dictionary<string, string>? additionalHeaders = null, CancellationToken cancellationToken = default)
48 {
49 return _client.DeleteReactionAsync(conversationId, activityId, reactionType, _serviceUrl, agenticIdentity: agenticIdentity, customHeaders: additionalHeaders, cancellationToken: cancellationToken);
50 }
51}
52