microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
next/core-activitybuilder

Branches

Tags

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

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.Api/Clients/MeetingClient.cs

90lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4using System.Text.Json.Serialization;
5
6using Microsoft.Teams.Api.Meetings;
7using Microsoft.Teams.Common.Http;
8
9namespace Microsoft.Teams.Api.Clients;
10
11public class MeetingClient : Client
12{
13 public readonly string ServiceUrl;
14
15 public MeetingClient(string serviceUrl, CancellationToken cancellationToken = default) : base(cancellationToken)
16 {
17 ServiceUrl = serviceUrl;
18 }
19
20 public MeetingClient(string serviceUrl, IHttpClient client, CancellationToken cancellationToken = default) : base(client, cancellationToken)
21 {
22 ServiceUrl = serviceUrl;
23 }
24
25 public MeetingClient(string serviceUrl, IHttpClientOptions options, CancellationToken cancellationToken = default) : base(options, cancellationToken)
26 {
27 ServiceUrl = serviceUrl;
28 }
29
30 public MeetingClient(string serviceUrl, IHttpClientFactory factory, CancellationToken cancellationToken = default) : base(factory, cancellationToken)
31 {
32 ServiceUrl = serviceUrl;
33 }
34
35 public async Task<Meeting> GetByIdAsync(string id)
36 {
37 var request = HttpRequest.Get($"{ServiceUrl}v1/meetings/{id}");
38 var response = await _http.SendAsync<Meeting>(request, _cancellationToken);
39 return response.Body;
40 }
41
42 public async Task<MeetingParticipant> GetParticipantAsync(string meetingId, string id, string tenantId)
43 {
44 var request = HttpRequest.Get($"{ServiceUrl}v1/meetings/{Uri.EscapeDataString(meetingId)}/participants/{Uri.EscapeDataString(id)}?tenantId={Uri.EscapeDataString(tenantId)}");
45 var response = await _http.SendAsync<MeetingParticipant>(request, _cancellationToken);
46 return response.Body;
47 }
48}
49
50/// <summary>
51/// Meeting participant information
52/// </summary>
53public class MeetingParticipant
54{
55 /// <summary>
56 /// The participant's user information
57 /// </summary>
58 [JsonPropertyName("user")]
59 public Account? User { get; set; }
60
61 /// <summary>
62 /// Gets or sets information about the associated meeting.
63 /// </summary>
64 [JsonPropertyName("meeting")]
65 public MeetingInfo? Meeting { get; set; }
66
67 /// <summary>
68 /// Gets or sets the conversation associated with this object.
69 /// </summary>
70 [JsonPropertyName("conversation")]
71 public Conversation? Conversation { get; set; }
72}
73
74/// <summary>
75/// Represents information about a participant's role and meeting status within a meeting context.
76/// </summary>
77public class MeetingInfo
78{
79 /// <summary>
80 /// Gets or sets the role associated with the entity.
81 /// </summary>
82 [JsonPropertyName("role")]
83 public string? Role { get; set; }
84
85 /// <summary>
86 /// Gets or sets a value indicating whether the user is currently in a meeting.
87 /// </summary>
88 [JsonPropertyName("inMeeting")]
89 public bool? InMeeting { get; set; }
90}