Skip to content

Commit

Permalink
Merge pull request #98 from MrSimonC/feature/add-templateId-to-recurr…
Browse files Browse the repository at this point in the history
…ing-webinars

Add templateId to CreateRecurringWebinarAsync

Resolves #91
  • Loading branch information
Jericho authored Feb 9, 2021
2 parents 8fc72a6 + acc1c35 commit 9115336
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/ZoomNet.IntegrationTests/Tests/Webinars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task RunAsync(string userId, IZoomClient client, TextWriter log, Ca
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);
var newRecurringWebinar = await client.Webinars.CreateRecurringWebinarAsync(userId, "ZoomNet Integration Testing: recurring webinar", "The agenda", start, duration, recurrenceInfo, "p@ss!w0rd", settings, trackingFields, cancellationToken: cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Recurring webinar {newRecurringWebinar.Id} created").ConfigureAwait(false);

await client.Webinars.DeleteAsync(newRecurringWebinar.Id, null, false, cancellationToken).ConfigureAwait(false);
Expand Down
3 changes: 2 additions & 1 deletion Source/ZoomNet/Resources/IWebinars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ public interface IWebinars
/// <param name="password">Password to join the webinar. Password may only contain the following characters: [a-z A-Z 0-9 @ - _ *]. Max of 10 characters.</param>
/// <param name="settings">Webinar settings.</param>
/// <param name="trackingFields">Tracking fields.</param>
/// <param name="templateId">Template Identifer. If passed in, Zoom advise using the userId in the <paramref name="userId"/> field, rather than email address.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// The new webinar.
/// </returns>
/// <exception cref="System.Exception">Thrown when an exception occured while creating the webinar.</exception>
Task<RecurringWebinar> CreateRecurringWebinarAsync(string userId, string topic, string agenda, DateTime? start, int duration, RecurrenceInfo recurrence, string password = null, WebinarSettings settings = null, IDictionary<string, string> trackingFields = null, CancellationToken cancellationToken = default);
Task<RecurringWebinar> CreateRecurringWebinarAsync(string userId, string topic, string agenda, DateTime? start, int duration, RecurrenceInfo recurrence, string password = null, WebinarSettings settings = null, IDictionary<string, string> trackingFields = null, string templateId = null, CancellationToken cancellationToken = default);

/// <summary>
/// Update the details of a webinar occurrence.
Expand Down
4 changes: 3 additions & 1 deletion Source/ZoomNet/Resources/Webinars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ public Task<ScheduledWebinar> CreateScheduledWebinarAsync(string userId, string
/// <param name="password">Password to join the webinar. By default the password may only contain the following characters: [a-z A-Z 0-9 @ - _ *]. Max of 10 characters. This can be updated within Zoom account settings.</param>
/// <param name="settings">Webinar settings.</param>
/// <param name="trackingFields">Tracking fields.</param>
/// <param name="templateId">Template Identifer. If passed in, Zoom advise using the userId in the <paramref name="userId"/> field, rather than email address.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// The new webinar.
/// </returns>
/// <exception cref="System.Exception">Thrown when an exception occured while creating the webinar.</exception>
public Task<RecurringWebinar> CreateRecurringWebinarAsync(string userId, string topic, string agenda, DateTime? start, int duration, RecurrenceInfo recurrence, string password = null, WebinarSettings settings = null, IDictionary<string, string> trackingFields = null, CancellationToken cancellationToken = default)
public Task<RecurringWebinar> CreateRecurringWebinarAsync(string userId, string topic, string agenda, DateTime? start, int duration, RecurrenceInfo recurrence, string password = null, WebinarSettings settings = null, IDictionary<string, string> trackingFields = null, string templateId = null, CancellationToken cancellationToken = default)
{
var data = new JObject()
{
Expand All @@ -156,6 +157,7 @@ public Task<RecurringWebinar> CreateRecurringWebinarAsync(string userId, string
data.AddPropertyIfValue("timezone", "UTC");
data.AddPropertyIfValue("settings", settings);
data.AddPropertyIfValue("tracking_fields", trackingFields?.Select(tf => new JObject() { { "field", tf.Key }, { "value", tf.Value } }));
data.AddPropertyIfValue("template_id", templateId);

return _client
.PostAsync($"users/{userId}/webinars")
Expand Down

0 comments on commit 9115336

Please sign in to comment.