Skip to content

Commit

Permalink
Additional methods on the Users resource
Browse files Browse the repository at this point in the history
Resolves #186
  • Loading branch information
Jericho committed Mar 1, 2022
1 parent 482a8aa commit efcf1e1
Show file tree
Hide file tree
Showing 48 changed files with 1,445 additions and 373 deletions.
46 changes: 19 additions & 27 deletions Source/ZoomNet.IntegrationTests/Tests/Users.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ZoomNet.Models;
Expand All @@ -14,26 +13,28 @@ public async Task RunAsync(string userId, IZoomClient client, TextWriter log, Ca

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

// GET ALL THE USERS
var paginatedUsers = await client.Users.GetAllAsync(UserStatus.Active, null, 100, (string)null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"There are {paginatedUsers.Records.Length} users").ConfigureAwait(false);

// CLEANUP PREVIOUS INTEGRATION TESTS THAT MIGHT HAVE BEEN INTERRUPTED BEFORE THEY HAD TIME TO CLEANUP AFTER THEMSELVES
var cleanUpTasks = paginatedUsers.Records
.Where(m => m.FirstName == "ZoomNet" && m.LastName == "Integration Testing")
.Select(async oldUser =>
{
await client.Users.DeleteAsync(oldUser.Id, null, false, false, false, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"User {oldUser.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);

// GET MY USER
var myUser = await client.Users.GetCurrentAsync(cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"My user retrieved. My email address is {myUser.Email}").ConfigureAwait(false);
await Task.Delay(500, cancellationToken).ConfigureAwait(false);

// UPDATE MY USER
await client.Users.UpdateAsync(myUser.Id,
firstName: "Hello",
lastName: "World",
company: "Microsoft",
department: "Accounting",
jobTitle: "CFO",
location: "3rd floor",
manager: "Bob",
phoneNumbers: new[]
{
new UserPhoneNumber { Country = Country.Canada, CountryCode = "+1", Number = "555-555-1234", Type = UserPhoneType.Office }
},
cancellationToken: cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("My user was updated").ConfigureAwait(false);
await Task.Delay(500, cancellationToken).ConfigureAwait(false);

// GET MY ASSISTANTS
var myAssistants = await client.Users.GetAssistantsAsync(myUser.Id, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"My user has {myAssistants.Length} assistants").ConfigureAwait(false);
Expand All @@ -58,18 +59,9 @@ public async Task RunAsync(string userId, IZoomClient client, TextWriter log, Ca
await Task.Delay(500, cancellationToken).ConfigureAwait(false);

// GET MY PERMISSIONS
var myPermissions = await client.Users.GetPermissionsAsync(myUser.Id, cancellationToken).ConfigureAwait(false);
var myPermissions = await client.Users.GetPermissionsAsync("me", cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"My permissions retrieved: I have been granted {myPermissions.Length} permissions").ConfigureAwait(false);
//await Task.Delay(500, cancellationToken).ConfigureAwait(false);

// CREATE NEW USER (commenting out this integration test because I currently do not have permission to create users)
//var newUser = await client.Users.CreateAsync("[email protected]", "ZoomNet", "Integration Testing", null, UserType.Basic, UserCreateType.Normal, cancellationToken).ConfigureAwait(false);
//await log.WriteLineAsync($"New user created: {newUser.Id}").ConfigureAwait(false);
//await Task.Delay(500, cancellationToken).ConfigureAwait(false);

// DELETE USER
//await client.Users.DeleteAsync(newUser.Id, null, false, false, false, cancellationToken).ConfigureAwait(false);
//await log.WriteLineAsync($"User {newUser.Id} deleted").ConfigureAwait(false);
await Task.Delay(500, cancellationToken).ConfigureAwait(false);
}
}
}
17 changes: 17 additions & 0 deletions Source/ZoomNet/Models/AttendeeChatSaveType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace ZoomNet.Models
{
/// <summary>
/// Enumeration to indicate if a attendee is allowed to save webinar chats.
/// </summary>
public enum AttendeeChatSaveType
{
/// <summary> The attendee cannot save chat.</summary>
Disallowed = 1,

/// <summary>The attendee can only save host and panelist chats.</summary>
HostAndPanelists = 2,

/// <summary>Attendees can save all webinar chats.</summary>
All = 3
}
}
17 changes: 17 additions & 0 deletions Source/ZoomNet/Models/AttendeeChatType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace ZoomNet.Models
{
/// <summary>
/// Enumeration to indicate the groups a given attendee can chat with.
/// </summary>
public enum AttendeeChatType
{
/// <summary> The attendee cannot use chat.</summary>
Disallowed = 1,

/// <summary>Attendee can chat with Host and panelists only.</summary>
HostAndPanelists = 2,

/// <summary>The attendee can chat with everyone.</summary>
Everyone = 3
}
}
31 changes: 31 additions & 0 deletions Source/ZoomNet/Models/AudioConferencingCallSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Newtonsoft.Json;

namespace ZoomNet.Models
{
/// <summary>
/// A user's Tol=free and fee-base toll call settings.
/// </summary>
public class AudioConferencingCallSettings
{
/// <summary>
/// Gets or sets a value indicating whether webinar attendees can dial in through the account's Toll-free and Fee-based Toll Call phone numbers.
/// </summary>
/// <remarks>
/// This feature is only available in version 5.2.2 and higher.
/// </remarks>
[JsonProperty(PropertyName = "allow_webinar_attendees_dial")]
public bool WebinarAttendeesCanDialIn { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the user has the Toll-free and Fee-based Toll Call setting enabled.
/// </summary>
[JsonProperty(PropertyName = "enable")]
public bool Enabled { get; set; }

/// <summary>
/// Gets or sets the user's Toll-free and Fee-based Toll Call phone number information.
/// </summary>
[JsonProperty(PropertyName = "numbers")]
public AudioConferencingPhoneNumberInformation[] Numbers { get; set; }
}
}
40 changes: 40 additions & 0 deletions Source/ZoomNet/Models/AudioConferencingPhoneNumberInformation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Newtonsoft.Json;

namespace ZoomNet.Models
{
/// <summary>
/// Toll-free and Fee-based Toll Call phone number information.
/// </summary>
public class AudioConferencingPhoneNumberInformation
{
/// <summary>
/// Gets or sets the phone number's E.164 country calling code.
/// </summary>
[JsonProperty(PropertyName = "code")]
public string CallingCode { get; set; }

/// <summary>
/// Gets or sets the phone number's E.164 country calling code.
/// </summary>
[JsonProperty(PropertyName = "country_code")]
public Country CountryCode { get; set; }

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

/// <summary>
/// Gets or sets the phone number display number.
/// </summary>
[JsonProperty(PropertyName = "display_number")]
public string DisplayNumber { get; set; }

/// <summary>
/// Gets or sets the phone number.
/// </summary>
[JsonProperty(PropertyName = "number")]
public string Number { get; set; }
}
}
24 changes: 3 additions & 21 deletions Source/ZoomNet/Models/AudioConferencingUserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,9 @@ namespace ZoomNet.Models
public class AudioConferencingUserSettings
{
/// <summary>
/// Gets or sets a value indicating whether a notification is sent when attendees join a meeting before the host.
/// Gets or sets the user's Toll-free and Fee-based Toll Call settings.
/// </summary>
[JsonProperty(PropertyName = "jbh_reminder")]
public bool AttendeesJoinBeforeHost { get; set; }

/// <summary>
/// Gets or sets a value indicating whether a notification is sent when a meeting is cancelled.
/// </summary>
[JsonProperty(PropertyName = "cancel_meeting_reminder")]
public bool CancelMeeting { get; set; }

/// <summary>
/// Gets or sets a value indicating whether a notification is sent when an alternative host is set or removed from a meeting.
/// </summary>
[JsonProperty(PropertyName = "alternative_host_reminder")]
public bool ChangeAlternativeHost { get; set; }

/// <summary>
/// Gets or sets a value indicating whether a notification is sent to the host when a meeting is scheduled, rescheduled or cancelled.
/// </summary>
[JsonProperty(PropertyName = "schedule_for_reminder")]
public bool MeetingScheduled { get; set; }
[JsonProperty(PropertyName = "toll_free_and_fee_based_toll_call")]
public AudioConferencingCallSettings AudioConferencingCallSettings { get; set; }
}
}
6 changes: 6 additions & 0 deletions Source/ZoomNet/Models/AuthenticationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,11 @@ public class AuthenticationOptions
/// </summary>
[JsonProperty(PropertyName = "domains")]
public string Domains { get; set; }

/// <summary>
/// Gets or sets a value indicating whether this is the default authentication option.
/// </summary>
[JsonProperty(PropertyName = "default_option")]
public bool IsDefault { get; set; }
}
}
30 changes: 30 additions & 0 deletions Source/ZoomNet/Models/ClosedCaptioningSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Newtonsoft.Json;

namespace ZoomNet.Models
{
/// <summary>
/// Closed captioning settings.
/// </summary>
public class ClosedCaptioningSettings
{
/// <summary>Gets or sets a value indicating whether to allow a live transcription service to transcribe meetings.</summary>
[JsonProperty(PropertyName = "auto_transcribing")]
public bool AllowAutoTranscription { get; set; }

/// <summary>Gets or sets a value indicating whether to allow the host to type closed captions or assign a participant or 3rd-party service to provide closed captioning.</summary>
[JsonProperty(PropertyName = "enable")]
public bool Enabled { get; set; }

/// <summary>Gets or sets a value indicating whether to allow participants to save closed captions or transcripts.</summary>
[JsonProperty(PropertyName = "save_caption")]
public bool AllowParticipantsToSave { get; set; }

/// <summary>Gets or sets a value indicating whether to allow the use of an API token to integrate with 3rd-party closed captioning services.</summary>
[JsonProperty(PropertyName = "third_party_captioning_service")]
public bool AllowThirdPartyCaptioningService { get; set; }

/// <summary>Gets or sets a value indicating whether to allow the viewing of full transcripts in the in-meeting side panel.</summary>
[JsonProperty(PropertyName = "view_full_transcript")]
public bool AllowFullTranscriptViewing { get; set; }
}
}
31 changes: 31 additions & 0 deletions Source/ZoomNet/Models/ConcurrentMeetingType.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 the type of concurrent meeting.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ConcurrentMeetingType
{
/// <summary>
/// Basic.
/// </summary>
[EnumMember(Value = "Basic")]
Basic,

/// <summary>
/// Plus.
/// </summary>
[EnumMember(Value = "Plus")]
Plus,

/// <summary>
/// None.
/// </summary>
[EnumMember(Value = "None")]
None
}
}
2 changes: 1 addition & 1 deletion Source/ZoomNet/Models/Country.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public enum Country
[EnumMember(Value = "KZ")]
Kazakhstan,

/// <summary>Lao People's Democratic Republic</summary>
/// <summary>Lao People's Democratic Republic (AKA Laos)</summary>
[EnumMember(Value = "LA")]
Lao_People_s_Democratic_Republic,

Expand Down
69 changes: 69 additions & 0 deletions Source/ZoomNet/Models/DataCenterRegion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;

namespace ZoomNet.Models
{
/// <summary>
/// Data center region.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum DataCenterRegion
{
/// <summary>Europe</summary>
[EnumMember(Value = "EU")]
Europe,

/// <summary>Hong Kong</summary>
[EnumMember(Value = "HK")]
HongKong,

/// <summary>Australia</summary>
[EnumMember(Value = "AU")]
Australia,

/// <summary>India</summary>
[EnumMember(Value = "IN")]
India,

/// <summary>Latin America</summary>
[EnumMember(Value = "LA")]
LatinAmerica,

/// <summary>Tokyo</summary>
[EnumMember(Value = "TY")]
Tokyo,

/// <summary>China</summary>
[EnumMember(Value = "CN")]
China,

/// <summary>United States of America</summary>
[EnumMember(Value = "US")]
UnitedStatesOfAmerica,

/// <summary>Canada</summary>
[EnumMember(Value = "CA")]
Canada,

/// <summary>Canada</summary>
[EnumMember(Value = "DE")]
Germany,

/// <summary>Canada</summary>
[EnumMember(Value = "NL")]
Netherlands,

/// <summary>Mexico</summary>
[EnumMember(Value = "MX")]
Mexico,

/// <summary>Singapore</summary>
[EnumMember(Value = "SG")]
Singapore,

/// <summary>Ireland</summary>
[EnumMember(Value = "IE")]
Ireland,
}
}
Loading

0 comments on commit efcf1e1

Please sign in to comment.