Skip to content

Commit

Permalink
(GH-176) Start/Pause/Resume/Stop recording a live meeting. Also, invi…
Browse files Browse the repository at this point in the history
…te participants to a live meeting
  • Loading branch information
Jericho committed Feb 19, 2022
1 parent 6055f64 commit 52d5144
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Source/ZoomNet.IntegrationTests/Tests/Meetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public async Task RunAsync(string userId, IZoomClient client, TextWriter log, Ca
var newInstantMeeting = await client.Meetings.CreateInstantMeetingAsync(userId, "ZoomNet Integration Testing: instant meeting", "The agenda", "p@ss!w0rd", settings, trackingFields, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Instant meeting {newInstantMeeting.Id} created").ConfigureAwait(false);

await client.Meetings.EndAsync(newInstantMeeting.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Instant meeting {newInstantMeeting.Id} ended").ConfigureAwait(false);

var instantMeeting = (InstantMeeting)await client.Meetings.GetAsync(newInstantMeeting.Id, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Instant meeting {instantMeeting.Id} retrieved").ConfigureAwait(false);

await client.Meetings.EndAsync(newInstantMeeting.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Instant meeting {newInstantMeeting.Id} ended").ConfigureAwait(false);

await client.Meetings.DeleteAsync(newInstantMeeting.Id, null, false, false, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Instant meeting {newInstantMeeting.Id} deleted").ConfigureAwait(false);

Expand Down
15 changes: 15 additions & 0 deletions Source/ZoomNet/Extensions/Public.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,20 @@ public static Task<Stream> DownloadFileAsync(this ICloudRecordings cloudRecordin
{
return cloudRecordingsResource.DownloadFileAsync(recordingFile.DownloadUrl);
}

/// <summary>
/// Invite a participant to join a live meeting.
/// </summary>
/// <param name="meetingsResource">The meetingds resource.</param>
/// <param name="meetingId">The meeting ID.</param>
/// <param name="emailAddress">The email address of the person you want to invite.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// The async task.
/// </returns>
public static Task InviteParticipantAsync(this IMeetings meetingsResource, long meetingId, string emailAddress, CancellationToken cancellationToken = default)
{
return meetingsResource.InviteParticipantsAsync(meetingId, new[] { emailAddress });
}
}
}
51 changes: 51 additions & 0 deletions Source/ZoomNet/Resources/IMeetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -538,5 +538,56 @@ public interface IMeetings
/// The async task.
/// </returns>
Task UpdateSurveyAsync(long meetingId, IEnumerable<SurveyQuestion> questions = null, bool allowAnonymous = true, bool showInBrowser = true, string thirdPartySurveyLink = null, CancellationToken cancellationToken = default);

/// <summary>
/// Start recording a live meeting.
/// </summary>
/// <param name="meetingId">The meeting ID.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// The async task.
/// </returns>
Task StartCloudRecordingAsync(long meetingId, CancellationToken cancellationToken = default);

/// <summary>
/// Pause recording a live meeting.
/// </summary>
/// <param name="meetingId">The meeting ID.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// The async task.
/// </returns>
Task PauseCloudRecordingAsync(long meetingId, CancellationToken cancellationToken = default);

/// <summary>
/// Resume recording a live meeting.
/// </summary>
/// <param name="meetingId">The meeting ID.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// The async task.
/// </returns>
Task ResumeCloudRecordingAsync(long meetingId, CancellationToken cancellationToken = default);

/// <summary>
/// Stop recording a live meeting.
/// </summary>
/// <param name="meetingId">The meeting ID.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// The async task.
/// </returns>
Task StopCloudRecordingAsync(long meetingId, CancellationToken cancellationToken = default);

/// <summary>
/// Invite multiple participants to join a live meeting.
/// </summary>
/// <param name="meetingId">The meeting ID.</param>
/// <param name="emailAddresses">The email addresses of the people you want to invite.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// The async task.
/// </returns>
Task InviteParticipantsAsync(long meetingId, IEnumerable<string> emailAddresses, CancellationToken cancellationToken = default);
}
}
80 changes: 79 additions & 1 deletion Source/ZoomNet/Resources/Meetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ public Task<InviteLink[]> CreateInviteLinksAsync(long meetingId, IEnumerable<str

return _client
.PostAsync($"meetings/{meetingId}/invite_links")
.WithBody(data)
.WithJsonBody(data)
.WithCancellationToken(cancellationToken)
.AsObject<InviteLink[]>("attendees");
}
Expand Down Expand Up @@ -975,6 +975,84 @@ public Task UpdateSurveyAsync(long meetingId, IEnumerable<SurveyQuestion> questi
.AsMessage();
}

/// <inheritdoc/>
public Task StartCloudRecordingAsync(long meetingId, CancellationToken cancellationToken = default)
{
var data = new JObject
{
{ "method", "recording.start" }
};

return _client
.PatchAsync($"live_meetings/{meetingId}/events")
.WithJsonBody(data)
.WithCancellationToken(cancellationToken)
.AsMessage();
}

/// <inheritdoc/>
public Task PauseCloudRecordingAsync(long meetingId, CancellationToken cancellationToken = default)
{
var data = new JObject
{
{ "method", "recording.pause" }
};

return _client
.PatchAsync($"live_meetings/{meetingId}/events")
.WithJsonBody(data)
.WithCancellationToken(cancellationToken)
.AsMessage();
}

/// <inheritdoc/>
public Task ResumeCloudRecordingAsync(long meetingId, CancellationToken cancellationToken = default)
{
var data = new JObject
{
{ "method", "recording.resume" }
};

return _client
.PatchAsync($"live_meetings/{meetingId}/events")
.WithJsonBody(data)
.WithCancellationToken(cancellationToken)
.AsMessage();
}

/// <inheritdoc/>
public Task StopCloudRecordingAsync(long meetingId, CancellationToken cancellationToken = default)
{
var data = new JObject
{
{ "method", "recording.stop" }
};

return _client
.PatchAsync($"live_meetings/{meetingId}/events")
.WithJsonBody(data)
.WithCancellationToken(cancellationToken)
.AsMessage();
}

/// <inheritdoc/>
public Task InviteParticipantsAsync(long meetingId, IEnumerable<string> emailAddresses, CancellationToken cancellationToken = default)
{
if (emailAddresses == null || !emailAddresses.Any()) throw new ArgumentNullException("You must provide at least one email address", nameof(emailAddresses));

var data = new JObject
{
{ "method", "participant.invite" },
};
data.AddPropertyIfValue("params/contacts", emailAddresses.Select(emailAddress => new JObject { { "email", emailAddress } }).ToArray());

return _client
.PatchAsync($"live_meetings/{meetingId}/events")
.WithJsonBody(data)
.WithCancellationToken(cancellationToken)
.AsMessage();
}

private Task UpdateRegistrantsStatusAsync(long meetingId, IEnumerable<(string RegistrantId, string RegistrantEmail)> registrantsInfo, string status, string occurrenceId = null, CancellationToken cancellationToken = default)
{
var data = new JObject();
Expand Down

0 comments on commit 52d5144

Please sign in to comment.