Skip to content

Commit

Permalink
Merge branch 'feature/webinars_resource' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed May 27, 2020
2 parents b9df75b + 242ead7 commit 070f88b
Show file tree
Hide file tree
Showing 26 changed files with 1,832 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Source/ZoomNet.IntegrationTests/Tests/Meetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async Task RunAsync(string userId, IZoomClient client, TextWriter log, Ca
{
await client.Meetings.DeleteAsync(userId, oldMeeting.Id, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Meeting {oldMeeting.Id} deleted").ConfigureAwait(false);
await Task.Delay(250).ConfigureAwait(false); // Brief pause to ensure Zoom has time to catch up
await Task.Delay(250, cancellationToken).ConfigureAwait(false); // Brief pause to ensure Zoom has time to catch up
});
await Task.WhenAll(cleanUpTasks).ConfigureAwait(false);

Expand Down
68 changes: 68 additions & 0 deletions Source/ZoomNet.IntegrationTests/Tests/Webinars.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ZoomNet.Models;

namespace ZoomNet.IntegrationTests.Tests
{
public class Webinars : IIntegrationTest
{
public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested) return;

await log.WriteLineAsync("\n***** WEBINARS *****\n").ConfigureAwait(false);

// GET ALL THE WEBINARS
var paginatedWebinars = await client.Webinars.GetAllAsync(userId, 30, 1, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"There are {paginatedWebinars.TotalRecords} webinars for user {userId}").ConfigureAwait(false);

// CLEANUP PREVIOUS INTEGRATION TESTS THAT MIGHT HAVE BEEN INTERRUPTED BEFORE THEY HAD TIME TO CLEANUP AFTER THEMSELVES
var cleanUpTasks = paginatedWebinars.Records
.Union(paginatedWebinars.Records)
.Where(m => m.Topic.StartsWith("ZoomNet Integration Testing:"))
.Select(async oldWebinar =>
{
await client.Webinars.DeleteAsync(oldWebinar.Id, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Webinar {oldWebinar.Id} deleted").ConfigureAwait(false);
await Task.Delay(250, cancellationToken).ConfigureAwait(false); // Brief pause to ensure Zoom has time to catch up
});
await Task.WhenAll(cleanUpTasks).ConfigureAwait(false);

var settings = new WebinarSettings()
{
ApprovalType = MeetingApprovalType.Manual
};
var trackingFields = new Dictionary<string, string>()
{
{ "field1", "value1"},
{ "field2", "value2"}
};

// Scheduled webinar
var start = DateTime.UtcNow.AddMonths(1);
var duration = 30;
var newScheduledWebinar = await client.Webinars.CreateScheduledWebinarAsync(userId, "ZoomNet Integration Testing: scheduled webinar", "The agenda", start, duration, "p@ss!w0rd", settings, trackingFields, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Scheduled webinar {newScheduledWebinar.Id} created").ConfigureAwait(false);

await client.Webinars.DeleteAsync(newScheduledWebinar.Id, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Scheduled webinar {newScheduledWebinar.Id} deleted").ConfigureAwait(false);

// Recurring webinar
var recurrenceInfo = new RecurrenceInfo()
{
EndTimes = 2,
WeeklyDays = new[] { DayOfWeek.Monday, DayOfWeek.Friday },
Type = RecurrenceType.Weekly
};
var newRecurringWebinar = await client.Webinars.CreateRecurringWebinarAsync(userId, "ZoomNet Integration Testing: recurring webinar", "The agenda", start, duration, recurrenceInfo, "p@ss!w0rd", settings, trackingFields, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Recurring webinar {newRecurringWebinar.Id} created").ConfigureAwait(false);

await client.Webinars.DeleteAsync(newRecurringWebinar.Id, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Recurring webinar {newRecurringWebinar.Id} deleted").ConfigureAwait(false);
}
}
}
1 change: 1 addition & 0 deletions Source/ZoomNet.IntegrationTests/TestsRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public async Task<int> RunAsync()
var integrationTests = new Type[]
{
typeof(Meetings),
typeof(Webinars),
};

// Execute the async tests in parallel (with max degree of parallelism)
Expand Down
16 changes: 16 additions & 0 deletions Source/ZoomNet/IZoomClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,21 @@ public interface IZoomClient
/// The past meetings resource.
/// </value>
IPastMeetings PastMeetings { get; }

/// <summary>
/// Gets the resource which allows you to manage webinars that occured in the past.
/// </summary>
/// <value>
/// The past webinars resource.
/// </value>
IPastWebinars PastWebinars { get; }

/// <summary>
/// Gets the resource which allows you to manage webinars.
/// </summary>
/// <value>
/// The webinars resource.
/// </value>
IWebinars Webinars { get; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;

Expand All @@ -8,7 +8,7 @@ namespace ZoomNet.Models
/// Enumeration to indicate the type of audio available to attendees.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum MeetingAudioType
public enum AudioType
{
/// <summary>
/// VOIP.
Expand Down
11 changes: 5 additions & 6 deletions Source/ZoomNet/Models/MeetingSettings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using ZoomNet.Models;
using Newtonsoft.Json;

namespace ZoomNet.Models
{
Expand Down Expand Up @@ -72,13 +71,13 @@ public class MeetingSettings
/// Gets or sets the value indicating how participants can join the audio portion of the meeting.
/// </summary>
[JsonProperty(PropertyName = "audio")]
public MeetingAudioType? Audio { get; set; }
public AudioType? Audio { get; set; }

/// <summary>
/// Gets or sets AutoRecording.
/// Gets or sets the value indicating if audio is recorded and if so, when the audio is saved.
/// </summary>
[JsonProperty(PropertyName = "auto_recording")]
public string AutoRecording { get; set; }
public RecordingType AutoRecording { get; set; }

/// <summary>
/// Gets or sets the value indicating that only signed-in users can join this meeting.
Expand Down Expand Up @@ -129,7 +128,7 @@ public class MeetingSettings
public string ContactName { get; set; }

/// <summary>
/// Gets or sets the contat email for registration.
/// Gets or sets the contact email for registration.
/// </summary>
[JsonProperty(PropertyName = "contact_email")]
public string ContactEmail { get; set; }
Expand Down
37 changes: 37 additions & 0 deletions Source/ZoomNet/Models/Panelist.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Newtonsoft.Json;

namespace ZoomNet.Models
{
/// <summary>
/// Panelist.
/// </summary>
public class Panelist
{
/// <summary>
/// Gets or sets the panelist id.
/// </summary>
/// <value>
/// The id.
/// </value>
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
public string Id { get; set; }

/// <summary>
/// Gets or sets the panelist's email address.
/// </summary>
[JsonProperty(PropertyName = "email")]
public string Email { get; set; }

/// <summary>
/// Gets or sets the panelist's full name.
/// </summary>
[JsonProperty(PropertyName = "name")]
public string FullName { get; set; }

/// <summary>
/// Gets or sets the panelist's join URL.
/// </summary>
[JsonProperty(PropertyName = "join_url")]
public string JoinUrl { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
namespace ZoomNet.Models
{
/// <summary>
/// A meeting instance that occured in the past.
/// A meeting or webinar instance that occured in the past.
/// </summary>
public class PastMeetingInstance
public class PastInstance
{
/// <summary>
/// Gets or sets the meeting uuid.
/// Gets or sets the uuid.
/// </summary>
/// <value>
/// The uuid.
Expand All @@ -18,9 +18,9 @@ public class PastMeetingInstance
public string Uuid { get; set; }

/// <summary>
/// Gets or sets the date and time when the meeting instance started.
/// Gets or sets the date and time when the instance started.
/// </summary>
/// <value>The meeting start time.</value>
/// <value>The start time.</value>
[JsonProperty(PropertyName = "start_time", NullValueHandling = NullValueHandling.Ignore)]
public DateTime StartedOn { get; set; }
}
Expand Down
31 changes: 31 additions & 0 deletions Source/ZoomNet/Models/RecordingType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;

namespace ZoomNet.Models
{
/// <summary>
/// Enumeration to indicate where the audio recording is saved.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum RecordingType
{
/// <summary>
/// Record on local.
/// </summary>
[EnumMember(Value = "local")]
OnLocal,

/// <summary>
/// Record on cloud.
/// </summary>
[EnumMember(Value = "cloud")]
OnCloud,

/// <summary>
/// Do not record.
/// </summary>
[EnumMember(Value = "none")]
Disabled
}
}
23 changes: 23 additions & 0 deletions Source/ZoomNet/Models/RecurringWebinar.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Newtonsoft.Json;

namespace ZoomNet.Models
{
/// <summary>
/// A meeting.
/// </summary>
/// <seealso cref="ZoomNet.Models.Webinar" />
public class RecurringWebinar : Webinar
{
/// <summary>
/// Gets or sets the occurrences.
/// </summary>
[JsonProperty(PropertyName = "occurrences", NullValueHandling = NullValueHandling.Ignore)]
public MeetingOccurrence[] Occurrences { get; set; }

/// <summary>
/// Gets or sets the recurrence info.
/// </summary>
[JsonProperty(PropertyName = "recurrence", NullValueHandling = NullValueHandling.Ignore)]
public RecurrenceInfo RecurrenceInfo { get; set; }
}
}
28 changes: 28 additions & 0 deletions Source/ZoomNet/Models/ScheduledWebinar.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Newtonsoft.Json;
using System;

namespace ZoomNet.Models
{
/// <summary>
/// A scheduled webinar.
/// </summary>
/// <seealso cref="ZoomNet.Models.Webinar" />
public class ScheduledWebinar : Webinar
{
/// <summary>
/// Gets or sets the webinar start time.
/// </summary>
/// <value>The webinar start time.</value>
[JsonProperty(PropertyName = "start_time", NullValueHandling = NullValueHandling.Ignore)]
public DateTime StartTime { get; set; }

/// <summary>
/// Gets or sets the timezone.
/// For example, "America/Los_Angeles".
/// Please reference our <a href="https://marketplace.zoom.us/docs/api-reference/other-references/abbreviation-lists#timezones">timezone list</a> for supported timezones and their formats.
/// </summary>
/// <value>The webinar timezone. For example, "America/Los_Angeles". Please reference our <a href="https://marketplace.zoom.us/docs/api-reference/other-references/abbreviation-lists#timezones">timezone list</a> for supported timezones and their formats.</value>
[JsonProperty(PropertyName = "timezone", NullValueHandling = NullValueHandling.Ignore)]
public string Timezone { get; set; }
}
}
37 changes: 37 additions & 0 deletions Source/ZoomNet/Models/TrackingSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Newtonsoft.Json;

namespace ZoomNet.Models
{
/// <summary>
/// Tracking Source.
/// </summary>
public class TrackingSource
{
/// <summary>
/// Gets or sets the unique identifier.
/// </summary>
/// <value>
/// The id.
/// </value>
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
public string Id { get; set; }

/// <summary>
/// Gets or sets the name of the source (platform) where the registration URL was shared.
/// </summary>
[JsonProperty(PropertyName = "source_name")]
public string Name { get; set; }

/// <summary>
/// Gets or sets the URL that was shared for the registration.
/// </summary>
[JsonProperty(PropertyName = "tracking_url")]
public string TrackingUrl { get; set; }

/// <summary>
/// Gets or sets the number of visitors who visited the registration page from this source.
/// </summary>
[JsonProperty(PropertyName = "visitor_count")]
public long VisitorCount { get; set; }
}
}
Loading

0 comments on commit 070f88b

Please sign in to comment.