Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions Libraries/Microsoft.Teams.Api/Clients/MeetingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public async Task<Meeting> GetByIdAsync(string id)
return response.Body;
}

public async Task<MeetingParticipant> GetParticipantAsync(string meetingId, string id)
public async Task<MeetingParticipant> 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<MeetingParticipant>(request, _cancellationToken);
return response.Body;
}
Expand All @@ -52,38 +52,39 @@ public async Task<MeetingParticipant> GetParticipantAsync(string meetingId, stri
/// </summary>
public class MeetingParticipant
{
/// <summary>
/// Unique identifier for the participant
/// </summary>
[JsonPropertyName("id")]
[JsonPropertyOrder(0)]
public required string Id { get; set; }

/// <summary>
/// The participant's user information
/// </summary>
[JsonPropertyName("user")]
[JsonPropertyOrder(1)]
public Account? User { get; set; }

/// <summary>
/// The participant's role in the meeting
/// Gets or sets information about the associated meeting.
/// </summary>
[JsonPropertyName("role")]
[JsonPropertyOrder(2)]
public string? Role { get; set; }
[JsonPropertyName("meeting")]
public MeetingInfo? Meeting { get; set; }

/// <summary>
/// Gets or sets the conversation associated with this object.
/// </summary>
[JsonPropertyName("conversation")]
public Conversation? Conversation { get; set; }
}

/// <summary>
/// Represents information about a participant's role and meeting status within a meeting context.
/// </summary>
public class MeetingInfo
{
/// <summary>
/// Whether the participant is an organizer
/// Gets or sets the role associated with the entity.
/// </summary>
[JsonPropertyName("isOrganizer")]
[JsonPropertyOrder(3)]
public bool IsOrganizer { get; set; }
[JsonPropertyName("role")]
public string? Role { get; set; }

/// <summary>
/// The time when the participant joined the meeting
/// Gets or sets a value indicating whether the user is currently in a meeting.
/// </summary>
[JsonPropertyName("joinTime")]
[JsonPropertyOrder(4)]
public DateTime? JoinTime { get; set; }
[JsonPropertyName("inMeeting")]
public bool? InMeeting { get; set; }
}
7 changes: 3 additions & 4 deletions Samples/Samples.Meetings/Program.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -132,4 +131,4 @@
await context.Send($"you said '{context.Activity.Text}'");
});

app.Run();
app.Run();
15 changes: 6 additions & 9 deletions Tests/Microsoft.Teams.Api.Tests/Clients/MeetingClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
}
});

Expand All @@ -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<MeetingParticipant>(
It.Is<IHttpRequest>(arg => arg.Url == expectedUrl && arg.Method == expectedMethod),
Expand Down
Loading