microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v2.0.8

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

48lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4using Microsoft.Teams.Core.Schema;
5
6using CoreConversationClient = Microsoft.Teams.Core.ConversationClient;
7
8namespace Microsoft.Teams.Apps.Api.Clients;
9
10/// <summary>
11/// Client for managing conversation members.
12/// Delegates to the core <see cref="CoreConversationClient"/>.
13/// </summary>
14public class MemberClient
15{
16 private readonly CoreConversationClient _client;
17 private readonly Uri _serviceUrl;
18
19 internal MemberClient(Uri serviceUrl, CoreConversationClient client)
20 {
21 _serviceUrl = serviceUrl;
22 _client = client;
23 }
24
25 /// <summary>
26 /// Get all members of a conversation.
27 /// </summary>
28 public Task<IList<ConversationAccount>> GetAsync(string conversationId, AgenticIdentity? agenticIdentity = null, CancellationToken cancellationToken = default)
29 {
30 return _client.GetConversationMembersAsync(conversationId, _serviceUrl, agenticIdentity: agenticIdentity, cancellationToken: cancellationToken);
31 }
32
33 /// <summary>
34 /// Get a specific member of a conversation by ID.
35 /// </summary>
36 public Task<T> GetByIdAsync<T>(string conversationId, string memberId, AgenticIdentity? agenticIdentity = null, CancellationToken cancellationToken = default) where T : ConversationAccount
37 {
38 return _client.GetConversationMemberAsync<T>(conversationId, memberId, _serviceUrl, agenticIdentity: agenticIdentity, cancellationToken: cancellationToken);
39 }
40
41 /// <summary>
42 /// Get a specific member of a conversation by ID.
43 /// </summary>
44 public Task<ConversationAccount> GetByIdAsync(string conversationId, string memberId, AgenticIdentity? agenticIdentity = null, CancellationToken cancellationToken = default)
45 {
46 return GetByIdAsync<ConversationAccount>(conversationId, memberId, agenticIdentity, cancellationToken);
47 }
48}