Skip to content

Commit

Permalink
(GH-176) Get meeting templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed Feb 18, 2022
1 parent ef35189 commit 094c6ef
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Source/ZoomNet.IntegrationTests/Tests/Meetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public async Task RunAsync(string userId, IZoomClient client, TextWriter log, Ca
});
await Task.WhenAll(cleanUpTasks).ConfigureAwait(false);

var templates = await client.Meetings.GetTemplatesAsync(userId, cancellationToken).ConfigureAwait(false);

var settings = new MeetingSettings()
{
Audio = AudioType.Telephony,
Expand Down
28 changes: 28 additions & 0 deletions Source/ZoomNet/Models/MeetingTemplate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Newtonsoft.Json;

namespace ZoomNet.Models
{
/// <summary>
/// Details of a meeting template.
/// </summary>
public class MeetingTemplate
{
/// <summary>
/// Gets or sets the unique identifier of the template.
/// </summary>
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }

/// <summary>
/// Gets or sets the name of the template.
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }

/// <summary>
/// Gets or sets the type of the template.
/// </summary>
[JsonProperty(PropertyName = "type")]
public MeetingTemplateType Type { get; set; }
}
}
18 changes: 18 additions & 0 deletions Source/ZoomNet/Models/MeetingTemplateType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace ZoomNet.Models
{
/// <summary>
/// Type of meeting template.
/// </summary>
public enum MeetingTemplateType
{
/// <summary>
/// Meeting template.
/// </summary>
Meeting = 1,

/// <summary>
/// Admin meeting template.
/// </summary>
Admin = 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace ZoomNet.Models
/// <summary>
/// Details of a webinar template.
/// </summary>
public class Template
public class WebinarTemplate
{
/// <summary>
/// Gets or sets the Id of the template.
Expand Down
10 changes: 10 additions & 0 deletions Source/ZoomNet/Resources/IMeetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,5 +472,15 @@ public interface IMeetings
/// The async task.
/// </returns>
Task StopLiveStreamAsync(long meetingId, CancellationToken cancellationToken = default);

/// <summary>
/// Retrieve all the templates that are available to be used by a user.
/// </summary>
/// <param name="userId">The user Id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// An array of <see cref="MeetingTemplate" />.
/// </returns>
Task<MeetingTemplate[]> GetTemplatesAsync(string userId, CancellationToken cancellationToken = default);
}
}
4 changes: 2 additions & 2 deletions Source/ZoomNet/Resources/IWebinars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ public interface IWebinars
/// <param name="userId">The user Id or email address.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// An array of <see cref="Template" />.
/// An array of <see cref="WebinarTemplate" />.
/// </returns>
Task<Template[]> GetTemplatesAsync(string userId, CancellationToken cancellationToken = default);
Task<WebinarTemplate[]> GetTemplatesAsync(string userId, CancellationToken cancellationToken = default);
}
}
9 changes: 9 additions & 0 deletions Source/ZoomNet/Resources/Meetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,15 @@ public Task StopLiveStreamAsync(long meetingId, CancellationToken cancellationTo
.AsMessage();
}

/// <inheritdoc/>
public Task<MeetingTemplate[]> GetTemplatesAsync(string userId, CancellationToken cancellationToken = default)
{
return _client
.GetAsync($"users/{userId}/meeting_templates")
.WithCancellationToken(cancellationToken)
.AsObject<MeetingTemplate[]>("templates");
}

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
13 changes: 3 additions & 10 deletions Source/ZoomNet/Resources/Webinars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,20 +787,13 @@ public Task<TrackingSource[]> GetTrackingSourcesAsync(long webinarId, Cancellati
.AsObject<TrackingSource[]>("tracking_sources");
}

/// <summary>
/// Retrieve all the templates created for a user.
/// </summary>
/// <param name="userId">The user Id or email address.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// An array of <see cref="Template" />.
/// </returns>
public Task<Template[]> GetTemplatesAsync(string userId, CancellationToken cancellationToken = default)
/// <inheritdoc/>
public Task<WebinarTemplate[]> GetTemplatesAsync(string userId, CancellationToken cancellationToken = default)
{
return _client
.GetAsync($"users/{userId}/webinar_templates")
.WithCancellationToken(cancellationToken)
.AsObject<Template[]>("templates");
.AsObject<WebinarTemplate[]>("templates");
}

private Task UpdateRegistrantsStatusAsync(long webinarId, IEnumerable<(string RegistrantId, string RegistrantEmail)> registrantsInfo, string status, string occurrenceId = null, CancellationToken cancellationToken = default)
Expand Down

0 comments on commit 094c6ef

Please sign in to comment.