Skip to content

Commit

Permalink
Merge branch 'release/0.83.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed Nov 2, 2024
2 parents 6e5d9b1 + ed13511 commit ca7a7fc
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 145 deletions.
111 changes: 59 additions & 52 deletions Source/ZoomNet.IntegrationTests/Tests/Meetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,29 @@ public async Task RunAsync(User myUser, string[] myPermissions, IZoomClient clie
var paginatedUpcomingMeetings = await client.Meetings.GetAllAsync(myUser.Id, MeetingListType.Upcoming, 100, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"There are {paginatedUpcomingMeetings.TotalRecords} upcoming meetings").ConfigureAwait(false);

var paginatedUpcomingMeetingsMeetings = await client.Meetings.GetAllAsync(myUser.Id, MeetingListType.UpcomingMeetings, 100, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"There are {paginatedUpcomingMeetingsMeetings.TotalRecords} UpcomingMeetings meetings").ConfigureAwait(false);

var paginatedPreviousMeetings = await client.Meetings.GetAllAsync(myUser.Id, MeetingListType.PreviousMeetings, 100, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"There are {paginatedPreviousMeetings.TotalRecords} previous meetings").ConfigureAwait(false);

// CLEANUP PREVIOUS INTEGRATION TESTS THAT MIGHT HAVE BEEN INTERRUPTED BEFORE THEY HAD TIME TO CLEANUP AFTER THEMSELVES
var cleanUpTasks = paginatedScheduledMeetings.Records
.Union(paginatedLiveMeetings.Records)
.Union(paginatedUpcomingMeetings.Records)
.Union(paginatedUpcomingMeetingsMeetings.Records)
.Union(paginatedPreviousMeetings.Records)
.Where(m => m.Topic.StartsWith("ZoomNet Integration Testing:"))
.Select(async oldMeeting =>
.GroupBy(m => m.Id)
.Select(async grp =>
{
await client.Meetings.DeleteAsync(oldMeeting.Id, null, false, false, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Meeting {oldMeeting.Id} deleted").ConfigureAwait(false);
await client.Meetings.DeleteAsync(grp.Key, null, false, false, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Meeting {grp.Key} 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);

// For an unknown reason, using myUser.Id to retrieve meeting templates causes an "Invalid token" exception.
// That's why I use "me" on the following line:
var templates = await client.Meetings.GetTemplatesAsync("me", cancellationToken).ConfigureAwait(false);
var templates = await client.Meetings.GetTemplatesAsync(myUser.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Retrieved {templates.Length} meeting templates").ConfigureAwait(false);

var settings = new MeetingSettings()
Expand All @@ -60,7 +67,7 @@ public async Task RunAsync(User myUser, string[] myPermissions, IZoomClient clie
};

// Instant meeting
var newInstantMeeting = await client.Meetings.CreateInstantMeetingAsync(myUser.Id, "ZoomNet Integration Testing: instant meeting", "The agenda", "p@ss!w0rd", settings, trackingFields, null, cancellationToken).ConfigureAwait(false);
var newInstantMeeting = await client.Meetings.CreateInstantMeetingAsync(myUser.Id, "ZoomNet Integration Testing: instant meeting", "The agenda", null, settings, trackingFields, null, true, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Instant meeting {newInstantMeeting.Id} created").ConfigureAwait(false);

var instantMeeting = (InstantMeeting)await client.Meetings.GetAsync(newInstantMeeting.Id, null, cancellationToken).ConfigureAwait(false);
Expand All @@ -78,7 +85,7 @@ public async Task RunAsync(User myUser, string[] myPermissions, IZoomClient clie
// Scheduled meeting
var start = DateTime.UtcNow.AddMonths(1);
var duration = 30;
var newScheduledMeeting = await client.Meetings.CreateScheduledMeetingAsync(myUser.Id, "ZoomNet Integration Testing: scheduled meeting", "The agenda", start, duration, TimeZones.UTC, "p@ss!w0rd", settings, trackingFields, null, cancellationToken).ConfigureAwait(false);
var newScheduledMeeting = await client.Meetings.CreateScheduledMeetingAsync(myUser.Id, "ZoomNet Integration Testing: scheduled meeting", "The agenda", start, duration, TimeZones.UTC, "pass@word!", settings, trackingFields, null, true, false, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Scheduled meeting {newScheduledMeeting.Id} created").ConfigureAwait(false);

var updatedSettings = new MeetingSettings() { Audio = AudioType.Voip };
Expand All @@ -88,53 +95,53 @@ public async Task RunAsync(User myUser, string[] myPermissions, IZoomClient clie
var scheduledMeeting = (ScheduledMeeting)await client.Meetings.GetAsync(newScheduledMeeting.Id, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Scheduled meeting {scheduledMeeting.Id} retrieved").ConfigureAwait(false);

var requiredFields = new[]
{
RegistrationField.PurchasingTimeFrame,
RegistrationField.RoleInPurchaseProcess
};
var optionalFields = new[]
{
RegistrationField.Address,
RegistrationField.City,
RegistrationField.Country,
RegistrationField.PostalCode,
RegistrationField.State,
RegistrationField.Phone,
RegistrationField.Industry,
RegistrationField.Organization,
RegistrationField.JobTitle,
RegistrationField.NumberOfEmployees,
RegistrationField.Comments
};
var customQuestions = new[]
if (myUser.Type == UserType.Licensed)
{
new RegistrationCustomQuestionForMeeting
var requiredFields = new[]
{
Title = "Are you happy?",
Type = RegistrationCustomQuestionTypeForMeeting.Single,
IsRequired = true,
Answers = new[] { "Yes", "No", "Maybe", "I don't know" }
},
new RegistrationCustomQuestionForMeeting
RegistrationField.PurchasingTimeFrame,
RegistrationField.RoleInPurchaseProcess
};
var optionalFields = new[]
{
Title = "Tell us about yourself",
Type = RegistrationCustomQuestionTypeForMeeting.Short,
IsRequired = false
}
};
await client.Meetings.UpdateRegistrationQuestionsAsync(newScheduledMeeting.Id, requiredFields, optionalFields, customQuestions, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Added {customQuestions.Length} custom registration questions to this meeting.").ConfigureAwait(false);
RegistrationField.Address,
RegistrationField.City,
RegistrationField.Country,
RegistrationField.PostalCode,
RegistrationField.State,
RegistrationField.Phone,
RegistrationField.Industry,
RegistrationField.Organization,
RegistrationField.JobTitle,
RegistrationField.NumberOfEmployees,
RegistrationField.Comments
};
var customQuestions = new[]
{
new RegistrationCustomQuestionForMeeting
{
Title = "Are you happy?",
Type = RegistrationCustomQuestionTypeForMeeting.Single,
IsRequired = true,
Answers = new[] { "Yes", "No", "Maybe", "I don't know" }
},
new RegistrationCustomQuestionForMeeting
{
Title = "Tell us about yourself",
Type = RegistrationCustomQuestionTypeForMeeting.Short,
IsRequired = false
}
};
await client.Meetings.UpdateRegistrationQuestionsAsync(newScheduledMeeting.Id, requiredFields, optionalFields, customQuestions, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Added {customQuestions.Length} custom registration questions to this meeting.").ConfigureAwait(false);

var registrationQuestions = await client.Meetings.GetRegistrationQuestionsAsync(newScheduledMeeting.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Here's a quick summary of the registration form for meeting {newScheduledMeeting.Id}:").ConfigureAwait(false);
await log.WriteLineAsync($" - there are {registrationQuestions.RequiredFields.Length} required fields.").ConfigureAwait(false);
await log.WriteLineAsync($" - there are {registrationQuestions.OptionalFields.Length} optional fields.").ConfigureAwait(false);
await log.WriteLineAsync($" - there are {registrationQuestions.Questions.Count(q => q.IsRequired)} required custom questions.").ConfigureAwait(false);
await log.WriteLineAsync($" - there are {registrationQuestions.Questions.Count(q => !q.IsRequired)} optional custom questions.").ConfigureAwait(false);
var registrationQuestions = await client.Meetings.GetRegistrationQuestionsAsync(newScheduledMeeting.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Here's a quick summary of the registration form for meeting {newScheduledMeeting.Id}:").ConfigureAwait(false);
await log.WriteLineAsync($" - there are {registrationQuestions.RequiredFields.Length} required fields.").ConfigureAwait(false);
await log.WriteLineAsync($" - there are {registrationQuestions.OptionalFields.Length} optional fields.").ConfigureAwait(false);
await log.WriteLineAsync($" - there are {registrationQuestions.Questions.Count(q => q.IsRequired)} required custom questions.").ConfigureAwait(false);
await log.WriteLineAsync($" - there are {registrationQuestions.Questions.Count(q => !q.IsRequired)} optional custom questions.").ConfigureAwait(false);

if (myUser.Type == UserType.Licensed)
{
var registrants = new List<BatchRegistrant>
{
new BatchRegistrant { Email = "firstBatchRegistrant@example.com", FirstName = "Mariful", LastName = "Maruf" },
Expand Down Expand Up @@ -239,7 +246,7 @@ public async Task RunAsync(User myUser, string[] myPermissions, IZoomClient clie
WeeklyDays = new[] { DayOfWeek.Monday, DayOfWeek.Friday },
Type = RecurrenceType.Weekly
};
var newRecurringMeeting = await client.Meetings.CreateRecurringMeetingAsync(myUser.Id, "ZoomNet Integration Testing: recurring meeting", "The agenda", start, duration, recurrenceInfo, TimeZones.UTC, "p@ss!w0rd", settings, trackingFields, null, cancellationToken).ConfigureAwait(false);
var newRecurringMeeting = await client.Meetings.CreateRecurringMeetingAsync(myUser.Id, "ZoomNet Integration Testing: recurring meeting", "The agenda", start, duration, recurrenceInfo, TimeZones.UTC, "p@ss!w0rd", settings, trackingFields, null, false, false, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Recurring meeting {newRecurringMeeting.Id} created").ConfigureAwait(false);

await client.Meetings.UpdateRecurringMeetingAsync(newRecurringMeeting.Id, topic: "ZoomNet Integration Testing: UPDATED recurring meeting", cancellationToken: cancellationToken).ConfigureAwait(false);
Expand All @@ -259,7 +266,7 @@ public async Task RunAsync(User myUser, string[] myPermissions, IZoomClient clie
await log.WriteLineAsync($"Recurring meeting {newRecurringMeeting.Id} deleted").ConfigureAwait(false);

// Recurring meeting with no fixed time
var newRecurringNoFixTimeMeeting = await client.Meetings.CreateRecurringMeetingAsync(myUser.Id, "ZoomNet Integration Testing: recurring meeting with no fixed time", "The agenda", start, duration, null, TimeZones.UTC, "p@ss!w0rd", settings, null, null, cancellationToken).ConfigureAwait(false);
var newRecurringNoFixTimeMeeting = await client.Meetings.CreateRecurringMeetingAsync(myUser.Id, "ZoomNet Integration Testing: recurring meeting with no fixed time", "The agenda", start, duration, null, TimeZones.UTC, "p@ss!w0rd", settings, null, null, false, false, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"Recurring meeting with no fixed time {newRecurringNoFixTimeMeeting.Id} created").ConfigureAwait(false);

await client.Meetings.DeleteAsync(newRecurringNoFixTimeMeeting.Id, null, false, false, cancellationToken).ConfigureAwait(false);
Expand Down
87 changes: 30 additions & 57 deletions Source/ZoomNet/IZoomClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@ public interface IZoomClient
/// <summary>
/// Gets the resource which allows you to manage sub accounts.
/// </summary>
/// <value>
/// The accounts resource.
/// </value>
IAccounts Accounts { get; }

/// <summary>
/// Gets the resource which allows you to manage call logs.
/// </summary>
ICallLogs CallLogs { get; }

/// <summary>
/// Gets the resource which allows you to manage chat channels, messages, etc.
/// </summary>
/// <value>
/// The chat resource.
/// </value>
IChat Chat { get; }

/// <summary>
/// Gets the resource which allows you to manage chatbot messages.
/// </summary>
IChatbot Chatbot { get; }

/// <summary>
/// Gets the resource which allows you to manage cloud recordings.
/// </summary>
Expand All @@ -40,97 +44,66 @@ public interface IZoomClient
/// </value>
IContacts Contacts { get; }

/// <summary>
/// Gets the resource which allows you to view metrics.
/// </summary>
IDashboards Dashboards { get; }

/// <summary>
/// Gets the resource which allows you to notify Zoom that you comply with the policy which requires
/// you to handle user's data in accordance to the user's preference after the user uninstalls your app.
/// </summary>
/// <value>
/// The data compliance resource.
/// </value>
[Obsolete("The Data Compliance API is deprecated")]
IDataCompliance DataCompliance { get; }

/// <summary>
/// Gets the resource that allows you to manage groups.
/// </summary>
IGroups Groups { get; }

/// <summary>
/// Gets the resource which allows you to manage meetings.
/// </summary>
/// <value>
/// The meetings resource.
/// </value>
IMeetings Meetings { get; }

/// <summary>
/// Gets the resource which allows you to manage meetings that occured in the past.
/// </summary>
/// <value>
/// 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 roles.
/// </summary>
/// <value>
/// The roles resource.
/// </value>
IRoles Roles { get; }

/// <summary>
/// Gets the resource which allows you to manage users.
/// </summary>
/// <value>
/// The users resource.
/// </value>
IUsers Users { get; }

/// <summary>
/// Gets the resource which allows you to manage webinars.
/// </summary>
/// <value>
/// The webinars resource.
/// </value>
IWebinars Webinars { get; }

/// <summary>
/// Gets the resource which allows you to view metrics.
/// Gets the resource which allows you to access Zoom Phone API endpoints.
/// </summary>
IDashboards Dashboards { get; }
IPhone Phone { get; }

/// <summary>
/// Gets the resource which allows you to view reports.
/// </summary>
IReports Reports { get; }

/// <summary>
/// Gets the resource which allows you to manage call logs.
/// </summary>
ICallLogs CallLogs { get; }

/// <summary>
/// Gets the resource which allows you to manage chatbot messages.
/// Gets the resource which allows you to manage roles.
/// </summary>
IChatbot Chatbot { get; }
IRoles Roles { get; }

/// <summary>
/// Gets the resource which allows you to access Zoom Phone API endpoints.
/// Gets the resource which allows you to manage SMS messages and sessions.
/// </summary>
IPhone Phone { get; }
ISms Sms { get; }

/// <summary>
/// Gets the resource which allows you to manage SMS messages and sessions.
/// Gets the resource which allows you to manage users.
/// </summary>
ISms Sms { get; }
IUsers Users { get; }

/// <summary>
/// Gets the resource that allows you to manage groups.
/// Gets the resource which allows you to manage webinars.
/// </summary>
IGroups Groups { get; }
IWebinars Webinars { get; }
}
}
19 changes: 16 additions & 3 deletions Source/ZoomNet/Models/MeetingListType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,34 @@ namespace ZoomNet.Models
public enum MeetingListType
{
/// <summary>
/// Scheduled.
/// All valid previous (unexpired) meetings, live meetings, and upcoming scheduled meetings.
/// </summary>
[EnumMember(Value = "scheduled")]
Scheduled,

/// <summary>
/// Live.
/// All the ongoing meetings.
/// </summary>
[EnumMember(Value = "live")]
Live,

/// <summary>
/// Upcoming.
/// All upcoming meetings, including live meetings.
/// </summary>
[EnumMember(Value = "upcoming")]
Upcoming,

/// <summary>
/// All upcoming meetings, including live meetings.
/// </summary>
/// <remarks>I don't know what the distinction between "upcoming" and "upcoming_meetings is.</remarks>
[EnumMember(Value = "upcoming_meetings")]
UpcomingMeetings,

/// <summary>
/// All the previous meetings.
/// </summary>
[EnumMember(Value = "previous_meetings")]
PreviousMeetings,
}
}
Loading

0 comments on commit ca7a7fc

Please sign in to comment.