diff --git a/Libraries/Microsoft.Teams.Api/Clients/MeetingClient.cs b/Libraries/Microsoft.Teams.Api/Clients/MeetingClient.cs index 9c8ef2da..cd14260a 100644 --- a/Libraries/Microsoft.Teams.Api/Clients/MeetingClient.cs +++ b/Libraries/Microsoft.Teams.Api/Clients/MeetingClient.cs @@ -39,9 +39,9 @@ public async Task GetByIdAsync(string id) return response.Body; } - public async Task GetParticipantAsync(string meetingId, string id) + public async Task GetParticipantAsync(string meetingId, string id, string tenantId) { - var request = HttpRequest.Get($"{ServiceUrl}v1/meetings/{meetingId}/participants/{id}"); + var request = HttpRequest.Get($"{ServiceUrl}v1/meetings/{Uri.EscapeDataString(meetingId)}/participants/{Uri.EscapeDataString(id)}?tenantId={Uri.EscapeDataString(tenantId)}"); var response = await _http.SendAsync(request, _cancellationToken); return response.Body; } @@ -52,38 +52,39 @@ public async Task GetParticipantAsync(string meetingId, stri /// public class MeetingParticipant { - /// - /// Unique identifier for the participant - /// - [JsonPropertyName("id")] - [JsonPropertyOrder(0)] - public required string Id { get; set; } - /// /// The participant's user information /// [JsonPropertyName("user")] - [JsonPropertyOrder(1)] public Account? User { get; set; } /// - /// The participant's role in the meeting + /// Gets or sets information about the associated meeting. /// - [JsonPropertyName("role")] - [JsonPropertyOrder(2)] - public string? Role { get; set; } + [JsonPropertyName("meeting")] + public MeetingInfo? Meeting { get; set; } + + /// + /// Gets or sets the conversation associated with this object. + /// + [JsonPropertyName("conversation")] + public Conversation? Conversation { get; set; } +} +/// +/// Represents information about a participant's role and meeting status within a meeting context. +/// +public class MeetingInfo +{ /// - /// Whether the participant is an organizer + /// Gets or sets the role associated with the entity. /// - [JsonPropertyName("isOrganizer")] - [JsonPropertyOrder(3)] - public bool IsOrganizer { get; set; } + [JsonPropertyName("role")] + public string? Role { get; set; } /// - /// The time when the participant joined the meeting + /// Gets or sets a value indicating whether the user is currently in a meeting. /// - [JsonPropertyName("joinTime")] - [JsonPropertyOrder(4)] - public DateTime? JoinTime { get; set; } + [JsonPropertyName("inMeeting")] + public bool? InMeeting { get; set; } } \ No newline at end of file diff --git a/Samples/Samples.Meetings/Program.cs b/Samples/Samples.Meetings/Program.cs index 885fd0f4..4341007b 100644 --- a/Samples/Samples.Meetings/Program.cs +++ b/Samples/Samples.Meetings/Program.cs @@ -1,11 +1,10 @@ -using System.Diagnostics; +using System.Text.Json; using Microsoft.Teams.Api.Activities; -using Microsoft.Teams.Api.Activities.Events; +using Microsoft.Teams.Api.Meetings; using Microsoft.Teams.Apps; using Microsoft.Teams.Apps.Activities; using Microsoft.Teams.Apps.Activities.Events; -using Microsoft.Teams.Apps.Annotations; using Microsoft.Teams.Cards; using Microsoft.Teams.Common.Logging; using Microsoft.Teams.Plugins.AspNetCore.Extensions; @@ -132,4 +131,4 @@ await context.Send($"you said '{context.Activity.Text}'"); }); -app.Run(); \ No newline at end of file +app.Run(); diff --git a/Tests/Microsoft.Teams.Api.Tests/Clients/MeetingClientTests.cs b/Tests/Microsoft.Teams.Api.Tests/Clients/MeetingClientTests.cs index 700c7ae4..d39f012a 100644 --- a/Tests/Microsoft.Teams.Api.Tests/Clients/MeetingClientTests.cs +++ b/Tests/Microsoft.Teams.Api.Tests/Clients/MeetingClientTests.cs @@ -55,11 +55,9 @@ public async Task MeetingClient_GetParticipantAsync() StatusCode = HttpStatusCode.OK, Body = new MeetingParticipant { - Id = "participant1", User = new Account { Id = "user1", Name = "John Doe" }, - Role = "Presenter", - IsOrganizer = true, - JoinTime = DateTime.UtcNow + Meeting = new MeetingInfo { Role = "Presenter", InMeeting = true }, + Conversation = new Conversation { Id = "conversation1", Name = "General" } } }); @@ -68,15 +66,14 @@ public async Task MeetingClient_GetParticipantAsync() string participantId = "participant1"; var meetingClient = new MeetingClient(serviceUrl, mockHandler.Object); - var result = await meetingClient.GetParticipantAsync(meetingId, participantId); + var result = await meetingClient.GetParticipantAsync(meetingId, participantId, "tenant-id"); - Assert.Equal("participant1", result.Id); Assert.Equal("user1", result.User?.Id); Assert.Equal("John Doe", result.User?.Name); - Assert.Equal("Presenter", result.Role); - Assert.True(result.IsOrganizer); + Assert.Equal("Presenter", result.Meeting?.Role); + Assert.True(result.Meeting?.InMeeting); - string expectedUrl = "https://serviceurl.com/v1/meetings/meeting123/participants/participant1"; + string expectedUrl = "https://serviceurl.com/v1/meetings/meeting123/participants/participant1?tenantId=tenant-id"; HttpMethod expectedMethod = HttpMethod.Get; mockHandler.Verify(x => x.SendAsync( It.Is(arg => arg.Url == expectedUrl && arg.Method == expectedMethod),