microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
core/src/Microsoft.Teams.Apps/Api/Clients/ConversationApiClient.cs
51lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.Core; |
| 5 | using Microsoft.Teams.Core.Schema; |
| 6 | |
| 7 | using CoreConversationClient = Microsoft.Teams.Core.ConversationClient; |
| 8 | |
| 9 | namespace Microsoft.Teams.Apps.Api.Clients; |
| 10 | |
| 11 | /// <summary> |
| 12 | /// Client for managing conversations, exposing sub-clients for activities, members, and reactions. |
| 13 | /// Delegates to the core <see cref="CoreConversationClient"/>. |
| 14 | /// </summary> |
| 15 | public class ConversationApiClient |
| 16 | { |
| 17 | private readonly CoreConversationClient _client; |
| 18 | private readonly Uri _serviceUrl; |
| 19 | |
| 20 | /// <summary> |
| 21 | /// Client for activity operations. |
| 22 | /// </summary> |
| 23 | public ActivityClient Activities { get; } |
| 24 | |
| 25 | /// <summary> |
| 26 | /// Client for member operations. |
| 27 | /// </summary> |
| 28 | public MemberClient Members { get; } |
| 29 | |
| 30 | /// <summary> |
| 31 | /// Client for reaction operations. |
| 32 | /// </summary> |
| 33 | public ReactionClient Reactions { get; } |
| 34 | |
| 35 | internal ConversationApiClient(Uri serviceUrl, CoreConversationClient client) |
| 36 | { |
| 37 | _serviceUrl = serviceUrl; |
| 38 | _client = client; |
| 39 | Activities = new ActivityClient(serviceUrl, client); |
| 40 | Members = new MemberClient(serviceUrl, client); |
| 41 | Reactions = new ReactionClient(serviceUrl, client); |
| 42 | } |
| 43 | |
| 44 | /// <summary> |
| 45 | /// Create a new conversation. |
| 46 | /// </summary> |
| 47 | public Task<CreateConversationResponse> CreateAsync(ConversationParameters request, AgenticIdentity? agenticIdentity = null, Dictionary<string, string>? additionalHeaders = null, CancellationToken cancellationToken = default) |
| 48 | { |
| 49 | return _client.CreateConversationAsync(request, _serviceUrl, agenticIdentity: agenticIdentity, customHeaders: additionalHeaders, cancellationToken: cancellationToken); |
| 50 | } |
| 51 | } |
| 52 | |