From ef507ece843d195243060296e4f02a3f2fae6527 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 30 Aug 2020 13:37:26 -0400 Subject: [PATCH 01/12] (GH-10) Add the CloudRecordings resource --- Source/ZoomNet/IZoomClient.cs | 8 ++++++++ Source/ZoomNet/ZoomClient.cs | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/Source/ZoomNet/IZoomClient.cs b/Source/ZoomNet/IZoomClient.cs index 287efcc9..86d644d4 100644 --- a/Source/ZoomNet/IZoomClient.cs +++ b/Source/ZoomNet/IZoomClient.cs @@ -7,6 +7,14 @@ namespace ZoomNet /// public interface IZoomClient { + /// + /// Gets the resource which allows you to manage cloud recordings. + /// + /// + /// The cloud recordings resource. + /// + ICloudRecordings CloudRecordings { get; } + /// /// Gets the resource which allows you to manage meetings. /// diff --git a/Source/ZoomNet/ZoomClient.cs b/Source/ZoomNet/ZoomClient.cs index f2ec0c6f..13a61b2f 100644 --- a/Source/ZoomNet/ZoomClient.cs +++ b/Source/ZoomNet/ZoomClient.cs @@ -55,6 +55,14 @@ public static string Version } } + /// + /// Gets the resource which allows you to manage cloud recordings. + /// + /// + /// The recordings resource. + /// + public ICloudRecordings CloudRecordings { get; private set; } + /// /// Gets the resource which allows you to manage meetings. /// @@ -184,6 +192,7 @@ private ZoomClient(IConnectionInfo connectionInfo, HttpClient httpClient, bool d _fluentClient.Filters.Add(new DiagnosticHandler(_options.LogLevelSuccessfulCalls, _options.LogLevelFailedCalls)); _fluentClient.Filters.Add(new ZoomErrorHandler()); + CloudRecordings = new CloudRecordings(_fluentClient); Meetings = new Meetings(_fluentClient); PastMeetings = new PastMeetings(_fluentClient); PastWebinars = new PastWebinars(_fluentClient); From 40c2be8081c176cc10b921b86d1d56e06c2cf4ec Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 30 Aug 2020 13:38:44 -0400 Subject: [PATCH 02/12] (GH-10) Add CloudRecordings.GetUserRecordingsAsync and CloudRecordings.GetMeetingRecordingsAsync methods --- Source/ZoomNet/Models/Recording.cs | 60 ++++++++ Source/ZoomNet/Models/RecordingContentType.cs | 57 +++++++ Source/ZoomNet/Models/RecordingFile.cs | 67 +++++++++ Source/ZoomNet/Models/RecordingFileType.cs | 38 +++++ Source/ZoomNet/Resources/CloudRecordings.cs | 142 ++++++++++++++++++ Source/ZoomNet/Resources/ICloudRecordings.cs | 72 +++++++++ 6 files changed, 436 insertions(+) create mode 100644 Source/ZoomNet/Models/Recording.cs create mode 100644 Source/ZoomNet/Models/RecordingContentType.cs create mode 100644 Source/ZoomNet/Models/RecordingFile.cs create mode 100644 Source/ZoomNet/Models/RecordingFileType.cs create mode 100644 Source/ZoomNet/Resources/CloudRecordings.cs create mode 100644 Source/ZoomNet/Resources/ICloudRecordings.cs diff --git a/Source/ZoomNet/Models/Recording.cs b/Source/ZoomNet/Models/Recording.cs new file mode 100644 index 00000000..686008ba --- /dev/null +++ b/Source/ZoomNet/Models/Recording.cs @@ -0,0 +1,60 @@ +using Newtonsoft.Json; +using System; + +namespace ZoomNet.Models +{ + /// + /// A recording. + /// + public class Recording + { + /// Gets or sets the unique id. + /// The unique id. + [JsonProperty("uuid", NullValueHandling = NullValueHandling.Ignore)] + public string Uuid { get; set; } + + /// Gets or sets the recording id. + /// The id. + [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] + public long Id { get; set; } + + /// Gets or sets the ID of the user account. + /// The account id. + [JsonProperty("account_id", NullValueHandling = NullValueHandling.Ignore)] + public string AccountId { get; set; } + + /// Gets or sets the ID of the user who is set as the host of the meeting. + /// The user id. + [JsonProperty("host_id", NullValueHandling = NullValueHandling.Ignore)] + public string HostId { get; set; } + + /// Gets or sets the topic of the meeting. + /// The topic. + [JsonProperty("topic", NullValueHandling = NullValueHandling.Ignore)] + public string Topic { get; set; } + + /// Gets or sets the date and time when the meeting started. + /// The start time. + [JsonProperty(PropertyName = "start_time", NullValueHandling = NullValueHandling.Ignore)] + public DateTime StartTime { get; set; } + + /// Gets or sets the meeting duration. + /// The duration. + [JsonProperty("duration", NullValueHandling = NullValueHandling.Ignore)] + public long Duration { get; set; } + + /// Gets or sets the total size of the recording. + /// The total size. + [JsonProperty(PropertyName = "total_size", NullValueHandling = NullValueHandling.Ignore)] + public long TotalSize { get; set; } + + /// Gets or sets the number of files. + /// The number of files. + [JsonProperty(PropertyName = "recording_count", NullValueHandling = NullValueHandling.Ignore)] + public long FilesCount { get; set; } + + /// Gets or sets the recording files. + [JsonProperty(PropertyName = "recording_files", NullValueHandling = NullValueHandling.Ignore)] + public RecordingFile[] RecordingFiles { get; set; } + } +} diff --git a/Source/ZoomNet/Models/RecordingContentType.cs b/Source/ZoomNet/Models/RecordingContentType.cs new file mode 100644 index 00000000..e77291f9 --- /dev/null +++ b/Source/ZoomNet/Models/RecordingContentType.cs @@ -0,0 +1,57 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.Runtime.Serialization; + +namespace ZoomNet.Models +{ + /// + /// Enumeration to indicate the type of content in a recording file. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecordingContentType + { + /// Shared screen with speaker view closed captioned. + [EnumMember(Value = "shared_screen_with_speaker_view(CC)")] + SharedScreenWithSpeakerViewClosedCaptioned, + + /// Shared screen with speaker view. + [EnumMember(Value = "shared_screen_with_speaker_view")] + SharedScreenWithSpeakerView, + + /// Shared screen with gallery view. + [EnumMember(Value = "shared_screen_with_gallery_view")] + SharedScreenWithGalleryView, + + /// Speaker view. + [EnumMember(Value = "speaker_view")] + SpeakerView, + + /// Gallery view. + [EnumMember(Value = "gallery_view")] + GalleryView, + + /// Shared screen. + [EnumMember(Value = "shared_screen")] + SharedScreen, + + /// Audio only. + [EnumMember(Value = "audio_only")] + AudioOnly, + + /// Audio transcript. + [EnumMember(Value = "audio_transcript")] + AudioTranscript, + + /// Chat file. + [EnumMember(Value = "chat_file")] + ChatFile, + + /// timeline. + [EnumMember(Value = "timeline")] + Timeline, + + /// Active speaker. + [EnumMember(Value = "active_speaker")] + ActiveSpeaker + } +} diff --git a/Source/ZoomNet/Models/RecordingFile.cs b/Source/ZoomNet/Models/RecordingFile.cs new file mode 100644 index 00000000..4413457e --- /dev/null +++ b/Source/ZoomNet/Models/RecordingFile.cs @@ -0,0 +1,67 @@ +using Newtonsoft.Json; +using System; + +namespace ZoomNet.Models +{ + /// + /// A recording file. + /// + public class RecordingFile + { + /// Gets or sets the recording file id. + /// The id. + [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] + public long Id { get; set; } + + /// Gets or sets the ID of the meeting. + /// The meeting id. + [JsonProperty("meeting_id", NullValueHandling = NullValueHandling.Ignore)] + public long MeetingId { get; set; } + + /// Gets or sets the date and time when the recording started. + /// The start time. + [JsonProperty(PropertyName = "recording_start", NullValueHandling = NullValueHandling.Ignore)] + public DateTime StartTime { get; set; } + + /// Gets or sets the date and time when the recording ended. + /// The end time. + [JsonProperty(PropertyName = "recording_end", NullValueHandling = NullValueHandling.Ignore)] + public DateTime EndTime { get; set; } + + /// Gets or sets the file type. + /// The file type. + [JsonProperty("file_type", NullValueHandling = NullValueHandling.Ignore)] + public RecordingFileType FileType { get; set; } + + /// Gets or sets the size of the file. + /// The size. + [JsonProperty(PropertyName = "file_size", NullValueHandling = NullValueHandling.Ignore)] + public long Size { get; set; } + + /// Gets or sets the URL which can be used to play the file. + /// The play URL. + [JsonProperty(PropertyName = "play_url", NullValueHandling = NullValueHandling.Ignore)] + public string PlayUrl { get; set; } + + /// Gets or sets the URL which can be used to download the file. + /// The download URL. + [JsonProperty(PropertyName = "download_url", NullValueHandling = NullValueHandling.Ignore)] + public string DownloadUrl { get; set; } + + /// Gets or sets the recording status. + /// The status. + [JsonProperty(PropertyName = "status", NullValueHandling = NullValueHandling.Ignore)] + public string Status { get; set; } + + /// Gets or sets the date and time when the recording was deleted. + /// The delete time. + /// Returned in the response only for trash query. + [JsonProperty(PropertyName = "deleted_time", NullValueHandling = NullValueHandling.Ignore)] + public DateTime? DeleteTime { get; set; } + + /// Gets or sets the content type. + /// The content type. + [JsonProperty("recording_type", NullValueHandling = NullValueHandling.Ignore)] + public RecordingContentType ContentType { get; set; } + } +} diff --git a/Source/ZoomNet/Models/RecordingFileType.cs b/Source/ZoomNet/Models/RecordingFileType.cs new file mode 100644 index 00000000..9a2d0102 --- /dev/null +++ b/Source/ZoomNet/Models/RecordingFileType.cs @@ -0,0 +1,38 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.Runtime.Serialization; + +namespace ZoomNet.Models +{ + /// + /// Enumeration to indicate the type of recording file. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecordingFileType + { + /// Video. + [EnumMember(Value = "mp4")] + Video, + + /// Audio only. + [EnumMember(Value = "m4a")] + Audio, + + /// Timestamp file of the recording in JSON format. + /// To get a timeline file, the 'Add timestamp to the recording' setting must be enabled. + [EnumMember(Value = "timeline")] + Timeline, + + /// Transcription of the recording in VTT format. + [EnumMember(Value = "transcript")] + Transcript, + + /// A text file containing in-meeting chat messages that were sent during the meeting. + [EnumMember(Value = "chat")] + Chat, + + /// File contains closed captions of the recording in VTT file format. + [EnumMember(Value = "cc")] + ClosedCaptioning + } +} diff --git a/Source/ZoomNet/Resources/CloudRecordings.cs b/Source/ZoomNet/Resources/CloudRecordings.cs new file mode 100644 index 00000000..2ef4374d --- /dev/null +++ b/Source/ZoomNet/Resources/CloudRecordings.cs @@ -0,0 +1,142 @@ +using Pathoschild.Http.Client; +using System; +using System.Threading; +using System.Threading.Tasks; +using ZoomNet.Models; + +namespace ZoomNet.Resources +{ + /// + /// Allows you to manage cloud recordings. + /// + /// + /// See Zoom documentation for more information. + /// + public class CloudRecordings : ICloudRecordings + { + private readonly Pathoschild.Http.Client.IClient _client; + + /// + /// Initializes a new instance of the class. + /// + /// The HTTP client. + internal CloudRecordings(Pathoschild.Http.Client.IClient client) + { + _client = client; + } + + /// + /// Retrieve all cloud recordings for a user. + /// + /// The user Id or email address. + /// Indicates if you want to list recordings from trash. + /// The start date. + /// The end date. + /// The number of records returned within a single API call. + /// The current page number of returned records. + /// The cancellation token. + /// + /// An array of recordings. + /// + [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] + public Task> GetUserRecordingsAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default) + { + if (recordsPerPage < 1 || recordsPerPage > 300) + { + throw new ArgumentOutOfRangeException(nameof(recordsPerPage), "Records per page must be between 1 and 300"); + } + + return _client + .GetAsync($"users/{userId}/recordings") + .WithArgument("trash", queryTrash.ToString().ToLower()) + .WithArgument("from", from?.ToString("yyyy-mm-dd")) + .WithArgument("to", to?.ToString("yyyy-mm-dd")) + .WithArgument("page_size", recordsPerPage) + .WithArgument("page", page) + .WithCancellationToken(cancellationToken) + .AsPaginatedResponse("meetings", null); + } + + /// + /// Retrieve all cloud recordings for a user. + /// + /// The user Id or email address. + /// Indicates if you want to list recordings from trash. + /// The start date. + /// The end date. + /// The number of records returned within a single API call. + /// The paging token. + /// The cancellation token. + /// + /// An array of recordings. + /// + public Task> GetUserRecordingsAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default) + { + if (recordsPerPage < 1 || recordsPerPage > 300) + { + throw new ArgumentOutOfRangeException(nameof(recordsPerPage), "Records per page must be between 1 and 300"); + } + + return _client + .GetAsync($"users/{userId}/recordings") + .WithArgument("trash", queryTrash.ToString().ToLower()) + .WithArgument("from", from?.ToString("yyyy-mm-dd")) + .WithArgument("to", to?.ToString("yyyy-mm-dd")) + .WithArgument("page_size", recordsPerPage) + .WithArgument("next_page_token", pagingToken) + .WithCancellationToken(cancellationToken) + .AsPaginatedResponseWithToken("meetings", null); + } + + /// + /// Retrieve all cloud recordings for a meeting. + /// + /// The meeting Id or UUID. + /// The number of records returned within a single API call. + /// The current page number of returned records. + /// The cancellation token. + /// + /// An array of recordings. + /// + [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] + public Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default) + { + if (recordsPerPage < 1 || recordsPerPage > 300) + { + throw new ArgumentOutOfRangeException(nameof(recordsPerPage), "Records per page must be between 1 and 300"); + } + + return _client + .GetAsync($"meetings/{meetingId}/recordings") + .WithArgument("page_size", recordsPerPage) + .WithArgument("page", page) + .WithCancellationToken(cancellationToken) + .AsPaginatedResponse("meetings", null); + } + + /// + /// Retrieve all cloud recordings for a user. + /// + /// The meeting Id or UUID. + /// The number of records returned within a single API call. + /// The paging token. + /// The cancellation token. + /// + /// An array of recordings. + /// + public Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default) + { + if (recordsPerPage < 1 || recordsPerPage > 300) + { + throw new ArgumentOutOfRangeException(nameof(recordsPerPage), "Records per page must be between 1 and 300"); + } + + return _client + .GetAsync($"meetings/{meetingId}/recordings") + .WithArgument("page_size", recordsPerPage) + .WithArgument("next_page_token", pagingToken) + .WithCancellationToken(cancellationToken) + .AsPaginatedResponseWithToken("meetings", null); + } + } +} diff --git a/Source/ZoomNet/Resources/ICloudRecordings.cs b/Source/ZoomNet/Resources/ICloudRecordings.cs new file mode 100644 index 00000000..0a57128a --- /dev/null +++ b/Source/ZoomNet/Resources/ICloudRecordings.cs @@ -0,0 +1,72 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using ZoomNet.Models; + +namespace ZoomNet.Resources +{ + /// + /// Allows you to manage cloud recordings. + /// + /// + /// See Zoom documentation for more information. + /// + public interface ICloudRecordings + { + /// + /// Retrieve all cloud recordings for a user. + /// + /// The user Id or email address. + /// Indicates if you want to list recordings from trash. + /// The start date. + /// The end date. + /// The number of records returned within a single API call. + /// The current page number of returned records. + /// The cancellation token. + /// + /// An array of recordings. + /// + [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] + Task> GetUserRecordingsAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); + + /// + /// Retrieve all cloud recordings for a user. + /// + /// The user Id or email address. + /// Indicates if you want to list recordings from trash. + /// The start date. + /// The end date. + /// The number of records returned within a single API call. + /// The paging token. + /// The cancellation token. + /// + /// An array of recordings. + /// + Task> GetUserRecordingsAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + + /// + /// Retrieve all cloud recordings for a meeting. + /// + /// The meeting Id or UUID. + /// The number of records returned within a single API call. + /// The current page number of returned records. + /// The cancellation token. + /// + /// An array of recordings. + /// + [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] + Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); + + /// + /// Retrieve all cloud recordings for a meeting. + /// + /// The meeting Id or UUID. + /// The number of records returned within a single API call. + /// The paging token. + /// The cancellation token. + /// + /// An array of recordings. + /// + Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + } +} From 73082ef47fce841a6e1bc4ad204abc8578dd9bff Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 30 Aug 2020 13:41:14 -0400 Subject: [PATCH 03/12] (GH-10) Integration tests --- .../Tests/CloudRecordings.cs | 20 +++++++++++++++++++ .../ZoomNet.IntegrationTests/TestsRunner.cs | 1 + 2 files changed, 21 insertions(+) create mode 100644 Source/ZoomNet.IntegrationTests/Tests/CloudRecordings.cs diff --git a/Source/ZoomNet.IntegrationTests/Tests/CloudRecordings.cs b/Source/ZoomNet.IntegrationTests/Tests/CloudRecordings.cs new file mode 100644 index 00000000..26fd2c42 --- /dev/null +++ b/Source/ZoomNet.IntegrationTests/Tests/CloudRecordings.cs @@ -0,0 +1,20 @@ +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace ZoomNet.IntegrationTests.Tests +{ + public class CloudRecordings : IIntegrationTest + { + public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) return; + + await log.WriteLineAsync("\n***** CLOUD RECORDINGS *****\n").ConfigureAwait(false); + + // GET ALL THE RECORDINGS FOR A GIVEN USER + var paginatedRecordings = await client.CloudRecordings.GetUserRecordingsAsync(userId, false, null, null, 100, null, cancellationToken).ConfigureAwait(false); + await log.WriteLineAsync($"User {userId} has {paginatedRecordings.TotalRecords} recordings stored in the cloud").ConfigureAwait(false); + } + } +} diff --git a/Source/ZoomNet.IntegrationTests/TestsRunner.cs b/Source/ZoomNet.IntegrationTests/TestsRunner.cs index 85a74da1..f57d54b3 100644 --- a/Source/ZoomNet.IntegrationTests/TestsRunner.cs +++ b/Source/ZoomNet.IntegrationTests/TestsRunner.cs @@ -95,6 +95,7 @@ public async Task RunAsync() // These are the integration tests that we will execute var integrationTests = new Type[] { + typeof(CloudRecordings), typeof(Dashboards), typeof(Meetings), typeof(Users), From 3bf4ffaefc99500ca86b2e95d739c661ee92bb61 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 30 Aug 2020 15:30:50 -0400 Subject: [PATCH 04/12] (GH-10) Delete meeting recordings --- Source/ZoomNet/Resources/CloudRecordings.cs | 34 ++++++++++++++++++++ Source/ZoomNet/Resources/ICloudRecordings.cs | 20 ++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Source/ZoomNet/Resources/CloudRecordings.cs b/Source/ZoomNet/Resources/CloudRecordings.cs index 2ef4374d..163e1fb8 100644 --- a/Source/ZoomNet/Resources/CloudRecordings.cs +++ b/Source/ZoomNet/Resources/CloudRecordings.cs @@ -138,5 +138,39 @@ public Task> GetMeetingRecordingsAsync(str .WithCancellationToken(cancellationToken) .AsPaginatedResponseWithToken("meetings", null); } + + /// + /// Move recordings for a meeting to trash. + /// + /// The meeting Id or UUID. + /// The cancellation token. + /// + /// The async task. + /// + public Task MoveMeetingRecordingsToTrashAsync(string meetingId, CancellationToken cancellationToken = default) + { + return _client + .DeleteAsync($"meetings/{meetingId}/recordings") + .WithArgument("action", "trash") + .WithCancellationToken(cancellationToken) + .AsMessage(); + } + + /// + /// Permanently delete recordings for a meeting. + /// + /// The meeting Id or UUID. + /// The cancellation token. + /// + /// The async task. + /// + public Task DeleteMeetingRecordingsAsync(string meetingId, CancellationToken cancellationToken = default) + { + return _client + .DeleteAsync($"meetings/{meetingId}/recordings") + .WithArgument("action", "delete") + .WithCancellationToken(cancellationToken) + .AsMessage(); + } } } diff --git a/Source/ZoomNet/Resources/ICloudRecordings.cs b/Source/ZoomNet/Resources/ICloudRecordings.cs index 0a57128a..083c89c3 100644 --- a/Source/ZoomNet/Resources/ICloudRecordings.cs +++ b/Source/ZoomNet/Resources/ICloudRecordings.cs @@ -68,5 +68,25 @@ public interface ICloudRecordings /// An array of recordings. /// Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + + /// + /// Move recordings for a meeting to trash. + /// + /// The meeting Id or UUID. + /// The cancellation token. + /// + /// The async task. + /// + Task MoveMeetingRecordingsToTrashAsync(string meetingId, CancellationToken cancellationToken = default); + + /// + /// Permanently delete recordings for a meeting. + /// + /// The meeting Id or UUID. + /// The cancellation token. + /// + /// The async task. + /// + Task DeleteMeetingRecordingsAsync(string meetingId, CancellationToken cancellationToken = default); } } From 371b495f4cf1d6fc177e6227cf6d64be3e543d65 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 30 Aug 2020 15:37:07 -0400 Subject: [PATCH 05/12] (GH-10) Delete meeting recording file --- Source/ZoomNet/Resources/CloudRecordings.cs | 36 ++++++++++++++++++++ Source/ZoomNet/Resources/ICloudRecordings.cs | 26 ++++++++++++-- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/Source/ZoomNet/Resources/CloudRecordings.cs b/Source/ZoomNet/Resources/CloudRecordings.cs index 163e1fb8..e3abfae8 100644 --- a/Source/ZoomNet/Resources/CloudRecordings.cs +++ b/Source/ZoomNet/Resources/CloudRecordings.cs @@ -172,5 +172,41 @@ public Task DeleteMeetingRecordingsAsync(string meetingId, CancellationToken can .WithCancellationToken(cancellationToken) .AsMessage(); } + + /// + /// Move a specific recording file for a meeting to trash. + /// + /// The meeting Id or UUID. + /// The recording id. + /// The cancellation token. + /// + /// The async task. + /// + public Task MoveMeetingRecordingToTrashAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default) + { + return _client + .DeleteAsync($"meetings/{meetingId}/recordings/{recordingId}") + .WithArgument("action", "trash") + .WithCancellationToken(cancellationToken) + .AsMessage(); + } + + /// + /// Permanently delete a specific recording file for a meeting. + /// + /// The meeting Id or UUID. + /// The recording id. + /// The cancellation token. + /// + /// The async task. + /// + public Task DeleteMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default) + { + return _client + .DeleteAsync($"meetings/{meetingId}/recordings/{recordingId}") + .WithArgument("action", "delete") + .WithCancellationToken(cancellationToken) + .AsMessage(); + } } } diff --git a/Source/ZoomNet/Resources/ICloudRecordings.cs b/Source/ZoomNet/Resources/ICloudRecordings.cs index 083c89c3..fb57618c 100644 --- a/Source/ZoomNet/Resources/ICloudRecordings.cs +++ b/Source/ZoomNet/Resources/ICloudRecordings.cs @@ -70,7 +70,7 @@ public interface ICloudRecordings Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); /// - /// Move recordings for a meeting to trash. + /// Move recording files for a meeting to trash. /// /// The meeting Id or UUID. /// The cancellation token. @@ -80,7 +80,7 @@ public interface ICloudRecordings Task MoveMeetingRecordingsToTrashAsync(string meetingId, CancellationToken cancellationToken = default); /// - /// Permanently delete recordings for a meeting. + /// Permanently delete recording files for a meeting. /// /// The meeting Id or UUID. /// The cancellation token. @@ -88,5 +88,27 @@ public interface ICloudRecordings /// The async task. /// Task DeleteMeetingRecordingsAsync(string meetingId, CancellationToken cancellationToken = default); + + /// + /// Move a specific recording file for a meeting to trash. + /// + /// The meeting Id or UUID. + /// The recording id. + /// The cancellation token. + /// + /// The async task. + /// + Task MoveMeetingRecordingToTrashAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); + + /// + /// Permanently delete a specific recording file for a meeting. + /// + /// The meeting Id or UUID. + /// The recording id. + /// The cancellation token. + /// + /// The async task. + /// + Task DeleteMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); } } From 714ac49e55d2fd98168b407b48caab8d99bc66b4 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 30 Aug 2020 15:43:10 -0400 Subject: [PATCH 06/12] (GH-10) Recover recordings --- Source/ZoomNet/Resources/CloudRecordings.cs | 37 ++++++++++++++++++++ Source/ZoomNet/Resources/ICloudRecordings.cs | 22 ++++++++++++ 2 files changed, 59 insertions(+) diff --git a/Source/ZoomNet/Resources/CloudRecordings.cs b/Source/ZoomNet/Resources/CloudRecordings.cs index e3abfae8..4ad88965 100644 --- a/Source/ZoomNet/Resources/CloudRecordings.cs +++ b/Source/ZoomNet/Resources/CloudRecordings.cs @@ -208,5 +208,42 @@ public Task DeleteMeetingRecordingAsync(string meetingId, string recordingId, Ca .WithCancellationToken(cancellationToken) .AsMessage(); } + + /// + /// Recover all deleted recordings of a specific meeting from trash. + /// + /// The meeting Id or UUID. + /// The cancellation token. + /// + /// The async task. + /// + /// Zoom allows recordings to be recovered from trash for up to 30 days from deletion date. + public Task RecoverMeetingRecordingsAsync(string meetingId, CancellationToken cancellationToken = default) + { + return _client + .PutAsync($"meetings/{meetingId}/recordings/status") + .WithArgument("action", "recover") + .WithCancellationToken(cancellationToken) + .AsMessage(); + } + + /// + /// Recover a specific recording file of a meeting. + /// + /// The meeting Id or UUID. + /// The recording id. + /// The cancellation token. + /// + /// The async task. + /// + /// Zoom allows recordings to be recovered from trash for up to 30 days from deletion date. + public Task RecoverMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default) + { + return _client + .PutAsync($"meetings/{meetingId}/recordings/{recordingId}/status") + .WithArgument("action", "recover") + .WithCancellationToken(cancellationToken) + .AsMessage(); + } } } diff --git a/Source/ZoomNet/Resources/ICloudRecordings.cs b/Source/ZoomNet/Resources/ICloudRecordings.cs index fb57618c..d5285a4b 100644 --- a/Source/ZoomNet/Resources/ICloudRecordings.cs +++ b/Source/ZoomNet/Resources/ICloudRecordings.cs @@ -110,5 +110,27 @@ public interface ICloudRecordings /// The async task. /// Task DeleteMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); + + /// + /// Recover all deleted recordings of a meeting from trash. + /// + /// The meeting Id or UUID. + /// The cancellation token. + /// + /// The async task. + /// + /// Zoom allows recordings to be recovered from trash for up to 30 days from deletion date. + Task RecoverMeetingRecordingsAsync(string meetingId, CancellationToken cancellationToken = default); + + /// + /// Recover a specific recording file of a meeting. + /// + /// The meeting Id or UUID. + /// The recording id. + /// The cancellation token. + /// + /// The async task. + /// + Task RecoverMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); } } From cbc15abd51ff29f6fe9c23d5c6e44d0aa7cd1e9b Mon Sep 17 00:00:00 2001 From: Jericho Date: Mon, 31 Aug 2020 14:37:51 -0400 Subject: [PATCH 07/12] Fix copy-paste mistake in XML comment --- Source/ZoomNet/Resources/Meetings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ZoomNet/Resources/Meetings.cs b/Source/ZoomNet/Resources/Meetings.cs index a097ad14..97f335a6 100644 --- a/Source/ZoomNet/Resources/Meetings.cs +++ b/Source/ZoomNet/Resources/Meetings.cs @@ -487,7 +487,7 @@ public Task GetPollsAsync(long meetingId, CancellationToken cancellation /// The poll questions. /// The cancellation token. /// - /// The async task. + /// A . /// public Task CreatePoll(long meetingId, string title, IEnumerable questions, CancellationToken cancellationToken = default) { From dfe8e0de3ec63efe67d2b3c9906d788355ac70e9 Mon Sep 17 00:00:00 2001 From: Jericho Date: Mon, 31 Aug 2020 14:38:29 -0400 Subject: [PATCH 08/12] (GH-10) GetMeetingRecordingSettingsAsync --- Source/ZoomNet/Models/RecordingSettings.cs | 64 +++++++++++++++++++ Source/ZoomNet/Models/RecordingSharingType.cs | 31 +++++++++ Source/ZoomNet/Resources/CloudRecordings.cs | 16 +++++ Source/ZoomNet/Resources/ICloudRecordings.cs | 10 +++ 4 files changed, 121 insertions(+) create mode 100644 Source/ZoomNet/Models/RecordingSettings.cs create mode 100644 Source/ZoomNet/Models/RecordingSharingType.cs diff --git a/Source/ZoomNet/Models/RecordingSettings.cs b/Source/ZoomNet/Models/RecordingSettings.cs new file mode 100644 index 00000000..a2e0e56a --- /dev/null +++ b/Source/ZoomNet/Models/RecordingSettings.cs @@ -0,0 +1,64 @@ +using Newtonsoft.Json; + +namespace ZoomNet.Models +{ + /// + /// Meeting recording settings. + /// + public class RecordingSettings + { + /// + /// Gets or sets the value indicating how the meeting recording is shared. + /// + [JsonProperty(PropertyName = "share_recording")] + public RecordingSharingType SharingType { get; set; } + + /// + /// Gets or sets a value indicating whether gets or sets the value indicating whether only authenticated user can view the recording. + /// + [JsonProperty(PropertyName = "recording_authentication")] + public bool RequiresAuthentication { get; set; } + + /// + /// Gets or sets the authentication options. + /// + [JsonProperty(PropertyName = "authentication_option")] + public string AuthenticationOptions { get; set; } + + /// + /// Gets or sets a value indicating whether the recording can be downloaded. + /// + [JsonProperty(PropertyName = "viewer_download")] + public bool AllowDownload { get; set; } + + /// + /// Gets or sets the password. + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + /// + /// Gets or sets a value indicating whether registration is required to view the recording. + /// + [JsonProperty(PropertyName = "on_demand")] + public bool RegistrationRequired { get; set; } + + /// + /// Gets or sets the approval type for the registration. + /// + [JsonProperty(PropertyName = "approval_type")] + public MeetingApprovalType RegistrationApprovalType { get; set; } + + /// + /// Gets or sets a value indicating whether to send an email to the host when someone registers to view the recording. + /// + [JsonProperty(PropertyName = "send_email_to_host")] + public bool NotifyHost { get; set; } + + /// + /// Gets or sets a value indicating whether to show social share buttons on registration page. + /// + [JsonProperty(PropertyName = "show_social_share_buttons")] + public bool ShowSocialShareButtons { get; set; } + } +} diff --git a/Source/ZoomNet/Models/RecordingSharingType.cs b/Source/ZoomNet/Models/RecordingSharingType.cs new file mode 100644 index 00000000..d16e3b27 --- /dev/null +++ b/Source/ZoomNet/Models/RecordingSharingType.cs @@ -0,0 +1,31 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.Runtime.Serialization; + +namespace ZoomNet.Models +{ + /// + /// Enumeration to indicate the type of audio available to attendees. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecordingSharingType + { + /// + /// Publicly. + /// + [EnumMember(Value = "publicly")] + Publicly, + + /// + /// Internally. + /// + [EnumMember(Value = "internally")] + Internally, + + /// + /// None. + /// + [EnumMember(Value = "none")] + None + } +} diff --git a/Source/ZoomNet/Resources/CloudRecordings.cs b/Source/ZoomNet/Resources/CloudRecordings.cs index 4ad88965..ba15d594 100644 --- a/Source/ZoomNet/Resources/CloudRecordings.cs +++ b/Source/ZoomNet/Resources/CloudRecordings.cs @@ -245,5 +245,21 @@ public Task RecoverMeetingRecordingAsync(string meetingId, string recordingId, C .WithCancellationToken(cancellationToken) .AsMessage(); } + + /// + /// Retrieve settings applied to a meeting's cloud recording. + /// + /// The meeting Id or UUID. + /// The cancellation token. + /// + /// The . + /// + public Task GetMeetingRecordingSettingsAsync(string meetingId, CancellationToken cancellationToken = default) + { + return _client + .GetAsync($"meetings/{meetingId}/recordings/settings") + .WithCancellationToken(cancellationToken) + .AsObject(null, null); + } } } diff --git a/Source/ZoomNet/Resources/ICloudRecordings.cs b/Source/ZoomNet/Resources/ICloudRecordings.cs index d5285a4b..435a40fe 100644 --- a/Source/ZoomNet/Resources/ICloudRecordings.cs +++ b/Source/ZoomNet/Resources/ICloudRecordings.cs @@ -132,5 +132,15 @@ public interface ICloudRecordings /// The async task. /// Task RecoverMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); + + /// + /// Retrieve settings applied to a meeting's cloud recording. + /// + /// The meeting Id or UUID. + /// The cancellation token. + /// + /// The . + /// + Task GetMeetingRecordingSettingsAsync(string meetingId, CancellationToken cancellationToken = default); } } From 5f0fcf4ea4413fc360db3b575911abecc3df1463 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 6 Sep 2020 11:21:54 -0400 Subject: [PATCH 09/12] (GH-10) Rename GetUserRecordingsAsync to GetRecordingsForUserAsync --- .../Tests/CloudRecordings.cs | 2 +- Source/ZoomNet/Resources/CloudRecordings.cs | 22 +++++++++---------- Source/ZoomNet/Resources/ICloudRecordings.cs | 22 +++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Source/ZoomNet.IntegrationTests/Tests/CloudRecordings.cs b/Source/ZoomNet.IntegrationTests/Tests/CloudRecordings.cs index 26fd2c42..e7b4dd12 100644 --- a/Source/ZoomNet.IntegrationTests/Tests/CloudRecordings.cs +++ b/Source/ZoomNet.IntegrationTests/Tests/CloudRecordings.cs @@ -13,7 +13,7 @@ public async Task RunAsync(string userId, IZoomClient client, TextWriter log, Ca await log.WriteLineAsync("\n***** CLOUD RECORDINGS *****\n").ConfigureAwait(false); // GET ALL THE RECORDINGS FOR A GIVEN USER - var paginatedRecordings = await client.CloudRecordings.GetUserRecordingsAsync(userId, false, null, null, 100, null, cancellationToken).ConfigureAwait(false); + var paginatedRecordings = await client.CloudRecordings.GetRecordingsForUserAsync(userId, false, null, null, 100, null, cancellationToken).ConfigureAwait(false); await log.WriteLineAsync($"User {userId} has {paginatedRecordings.TotalRecords} recordings stored in the cloud").ConfigureAwait(false); } } diff --git a/Source/ZoomNet/Resources/CloudRecordings.cs b/Source/ZoomNet/Resources/CloudRecordings.cs index ba15d594..a23e2357 100644 --- a/Source/ZoomNet/Resources/CloudRecordings.cs +++ b/Source/ZoomNet/Resources/CloudRecordings.cs @@ -39,7 +39,7 @@ internal CloudRecordings(Pathoschild.Http.Client.IClient client) /// An array of recordings. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - public Task> GetUserRecordingsAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default) + public Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default) { if (recordsPerPage < 1 || recordsPerPage > 300) { @@ -70,7 +70,7 @@ public Task> GetUserRecordingsAsync(string userId, /// /// An array of recordings. /// - public Task> GetUserRecordingsAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default) + public Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default) { if (recordsPerPage < 1 || recordsPerPage > 300) { @@ -99,7 +99,7 @@ public Task> GetUserRecordingsAsync(string /// An array of recordings. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - public Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default) + public Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default) { if (recordsPerPage < 1 || recordsPerPage > 300) { @@ -124,7 +124,7 @@ public Task> GetMeetingRecordingsAsync(string meeti /// /// An array of recordings. /// - public Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default) + public Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default) { if (recordsPerPage < 1 || recordsPerPage > 300) { @@ -147,7 +147,7 @@ public Task> GetMeetingRecordingsAsync(str /// /// The async task. /// - public Task MoveMeetingRecordingsToTrashAsync(string meetingId, CancellationToken cancellationToken = default) + public Task MoveRecordingsToTrashAsync(string meetingId, CancellationToken cancellationToken = default) { return _client .DeleteAsync($"meetings/{meetingId}/recordings") @@ -164,7 +164,7 @@ public Task MoveMeetingRecordingsToTrashAsync(string meetingId, CancellationToke /// /// The async task. /// - public Task DeleteMeetingRecordingsAsync(string meetingId, CancellationToken cancellationToken = default) + public Task DeleteRecordingsAsync(string meetingId, CancellationToken cancellationToken = default) { return _client .DeleteAsync($"meetings/{meetingId}/recordings") @@ -182,7 +182,7 @@ public Task DeleteMeetingRecordingsAsync(string meetingId, CancellationToken can /// /// The async task. /// - public Task MoveMeetingRecordingToTrashAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default) + public Task MoveRecordingToTrashAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default) { return _client .DeleteAsync($"meetings/{meetingId}/recordings/{recordingId}") @@ -200,7 +200,7 @@ public Task MoveMeetingRecordingToTrashAsync(string meetingId, string recordingI /// /// The async task. /// - public Task DeleteMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default) + public Task DeleteRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default) { return _client .DeleteAsync($"meetings/{meetingId}/recordings/{recordingId}") @@ -218,7 +218,7 @@ public Task DeleteMeetingRecordingAsync(string meetingId, string recordingId, Ca /// The async task. /// /// Zoom allows recordings to be recovered from trash for up to 30 days from deletion date. - public Task RecoverMeetingRecordingsAsync(string meetingId, CancellationToken cancellationToken = default) + public Task RecoverRecordingsAsync(string meetingId, CancellationToken cancellationToken = default) { return _client .PutAsync($"meetings/{meetingId}/recordings/status") @@ -237,7 +237,7 @@ public Task RecoverMeetingRecordingsAsync(string meetingId, CancellationToken ca /// The async task. /// /// Zoom allows recordings to be recovered from trash for up to 30 days from deletion date. - public Task RecoverMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default) + public Task RecoverRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default) { return _client .PutAsync($"meetings/{meetingId}/recordings/{recordingId}/status") @@ -254,7 +254,7 @@ public Task RecoverMeetingRecordingAsync(string meetingId, string recordingId, C /// /// The . /// - public Task GetMeetingRecordingSettingsAsync(string meetingId, CancellationToken cancellationToken = default) + public Task GetRecordingSettingsAsync(string meetingId, CancellationToken cancellationToken = default) { return _client .GetAsync($"meetings/{meetingId}/recordings/settings") diff --git a/Source/ZoomNet/Resources/ICloudRecordings.cs b/Source/ZoomNet/Resources/ICloudRecordings.cs index 435a40fe..0be8922b 100644 --- a/Source/ZoomNet/Resources/ICloudRecordings.cs +++ b/Source/ZoomNet/Resources/ICloudRecordings.cs @@ -27,7 +27,7 @@ public interface ICloudRecordings /// An array of recordings. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - Task> GetUserRecordingsAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); + Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); /// /// Retrieve all cloud recordings for a user. @@ -42,7 +42,7 @@ public interface ICloudRecordings /// /// An array of recordings. /// - Task> GetUserRecordingsAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); /// /// Retrieve all cloud recordings for a meeting. @@ -55,7 +55,7 @@ public interface ICloudRecordings /// An array of recordings. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); + Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); /// /// Retrieve all cloud recordings for a meeting. @@ -67,7 +67,7 @@ public interface ICloudRecordings /// /// An array of recordings. /// - Task> GetMeetingRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); /// /// Move recording files for a meeting to trash. @@ -77,7 +77,7 @@ public interface ICloudRecordings /// /// The async task. /// - Task MoveMeetingRecordingsToTrashAsync(string meetingId, CancellationToken cancellationToken = default); + Task MoveRecordingsToTrashAsync(string meetingId, CancellationToken cancellationToken = default); /// /// Permanently delete recording files for a meeting. @@ -87,7 +87,7 @@ public interface ICloudRecordings /// /// The async task. /// - Task DeleteMeetingRecordingsAsync(string meetingId, CancellationToken cancellationToken = default); + Task DeleteRecordingsAsync(string meetingId, CancellationToken cancellationToken = default); /// /// Move a specific recording file for a meeting to trash. @@ -98,7 +98,7 @@ public interface ICloudRecordings /// /// The async task. /// - Task MoveMeetingRecordingToTrashAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); + Task MoveRecordingToTrashAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); /// /// Permanently delete a specific recording file for a meeting. @@ -109,7 +109,7 @@ public interface ICloudRecordings /// /// The async task. /// - Task DeleteMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); + Task DeleteRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); /// /// Recover all deleted recordings of a meeting from trash. @@ -120,7 +120,7 @@ public interface ICloudRecordings /// The async task. /// /// Zoom allows recordings to be recovered from trash for up to 30 days from deletion date. - Task RecoverMeetingRecordingsAsync(string meetingId, CancellationToken cancellationToken = default); + Task RecoverRecordingsAsync(string meetingId, CancellationToken cancellationToken = default); /// /// Recover a specific recording file of a meeting. @@ -131,7 +131,7 @@ public interface ICloudRecordings /// /// The async task. /// - Task RecoverMeetingRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); + Task RecoverRecordingAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); /// /// Retrieve settings applied to a meeting's cloud recording. @@ -141,6 +141,6 @@ public interface ICloudRecordings /// /// The . /// - Task GetMeetingRecordingSettingsAsync(string meetingId, CancellationToken cancellationToken = default); + Task GetRecordingSettingsAsync(string meetingId, CancellationToken cancellationToken = default); } } From d53d0eacba8ca7b5d766bbf12da459555e897702 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 6 Sep 2020 11:25:39 -0400 Subject: [PATCH 10/12] (GH-10) GetRecordingRegistrantsAsync --- Source/ZoomNet/Resources/CloudRecordings.cs | 51 ++++++++++++++++++++ Source/ZoomNet/Resources/ICloudRecordings.cs | 25 ++++++++++ 2 files changed, 76 insertions(+) diff --git a/Source/ZoomNet/Resources/CloudRecordings.cs b/Source/ZoomNet/Resources/CloudRecordings.cs index a23e2357..e001267c 100644 --- a/Source/ZoomNet/Resources/CloudRecordings.cs +++ b/Source/ZoomNet/Resources/CloudRecordings.cs @@ -261,5 +261,56 @@ public Task GetRecordingSettingsAsync(string meetingId, Cance .WithCancellationToken(cancellationToken) .AsObject(null, null); } + + /// + /// Retrieve all registrants for a recording. + /// + /// The meeting Id or UUID. + /// The number of records returned within a single API call. + /// The current page number of returned records. + /// The cancellation token. + /// + /// An array of registrants. + /// + [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] + public Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default) + { + if (recordsPerPage < 1 || recordsPerPage > 300) + { + throw new ArgumentOutOfRangeException(nameof(recordsPerPage), "Records per page must be between 1 and 300"); + } + + return _client + .GetAsync($"meetings/{meetingId}/recordings/registrants") + .WithArgument("page_size", recordsPerPage) + .WithArgument("page", page) + .WithCancellationToken(cancellationToken) + .AsPaginatedResponse("registrants", null); + } + + /// + /// Retrieve all registrants for a recording. + /// + /// The meeting Id or UUID. + /// The number of records returned within a single API call. + /// The paging token. + /// The cancellation token. + /// + /// An array of registrants. + /// + public Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default) + { + if (recordsPerPage < 1 || recordsPerPage > 300) + { + throw new ArgumentOutOfRangeException(nameof(recordsPerPage), "Records per page must be between 1 and 300"); + } + + return _client + .GetAsync($"meetings/{meetingId}/recordings/registrants") + .WithArgument("page_size", recordsPerPage) + .WithArgument("next_page_token", pagingToken) + .WithCancellationToken(cancellationToken) + .AsPaginatedResponseWithToken("registrants", null); + } } } diff --git a/Source/ZoomNet/Resources/ICloudRecordings.cs b/Source/ZoomNet/Resources/ICloudRecordings.cs index 0be8922b..9bed73bd 100644 --- a/Source/ZoomNet/Resources/ICloudRecordings.cs +++ b/Source/ZoomNet/Resources/ICloudRecordings.cs @@ -142,5 +142,30 @@ public interface ICloudRecordings /// The . /// Task GetRecordingSettingsAsync(string meetingId, CancellationToken cancellationToken = default); + + /// + /// Retrieve all registrants for a recording. + /// + /// The meeting Id or UUID. + /// The number of records returned within a single API call. + /// The current page number of returned records. + /// The cancellation token. + /// + /// An array of registrants. + /// + [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] + Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); + + /// + /// Retrieve all registrants for a recording. + /// + /// The meeting Id or UUID. + /// The number of records returned within a single API call. + /// The paging token. + /// The cancellation token. + /// + /// An array of registrants. + /// + Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); } } From d9c7517fd1a50109b8fa553bd6a6f7e4dd29c152 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 22 Nov 2020 11:54:53 -0500 Subject: [PATCH 11/12] (GH-10) AddRegistrantAsync --- .../ZoomNet/Models/RecordingRegistration.cs | 30 +++++ Source/ZoomNet/Resources/CloudRecordings.cs | 123 ++++++++++++++++++ Source/ZoomNet/Resources/ICloudRecordings.cs | 101 ++++++++++++-- 3 files changed, 246 insertions(+), 8 deletions(-) create mode 100644 Source/ZoomNet/Models/RecordingRegistration.cs diff --git a/Source/ZoomNet/Models/RecordingRegistration.cs b/Source/ZoomNet/Models/RecordingRegistration.cs new file mode 100644 index 00000000..db9e1201 --- /dev/null +++ b/Source/ZoomNet/Models/RecordingRegistration.cs @@ -0,0 +1,30 @@ +using Newtonsoft.Json; + +namespace ZoomNet.Models +{ + /// + /// A registration for a recording. + /// + public class RecordingRegistration + { + /// Gets or sets the registrant id. + /// The registrant id. + [JsonProperty("registrant_id", NullValueHandling = NullValueHandling.Ignore)] + public string RegistrantId { get; set; } + + /// Gets or sets the meeting id. + /// The meeting id. + [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] + public long MeetingId { get; set; } + + /// Gets or sets the meeting topic. + /// The topic. + [JsonProperty("topic", NullValueHandling = NullValueHandling.Ignore)] + public string Topic { get; set; } + + /// Gets or sets the URL for the on-demand recording. + /// The user id. + [JsonProperty("share_url", NullValueHandling = NullValueHandling.Ignore)] + public string ShareUrl { get; set; } + } +} diff --git a/Source/ZoomNet/Resources/CloudRecordings.cs b/Source/ZoomNet/Resources/CloudRecordings.cs index e001267c..08fadf4f 100644 --- a/Source/ZoomNet/Resources/CloudRecordings.cs +++ b/Source/ZoomNet/Resources/CloudRecordings.cs @@ -1,5 +1,8 @@ +using Newtonsoft.Json.Linq; using Pathoschild.Http.Client; using System; +using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using ZoomNet.Models; @@ -312,5 +315,125 @@ public Task> GetRecordingRegistrantsAsync .WithCancellationToken(cancellationToken) .AsPaginatedResponseWithToken("registrants", null); } + + /// + /// Add a registrant to an on-demand recording. + /// + /// The meeting ID. + /// Registrant's email address. + /// Registrant's first name. + /// Registrant's last name. + /// Registrant's address. + /// Registrant's city. + /// Registrant's country. + /// Registrant's zip/postal code. + /// Registrant's state/province. + /// Registrant's phone number. + /// Registrant's industry. + /// Registrant's organization. + /// Registrant's job title. + /// This field can be included to gauge interest of attendees towards buying your product or service. + /// Registrant's role in purchase decision. + /// Number of employees. + /// A field that allows registrants to provide any questions or comments that they might have. + /// The cancellation token. + /// + /// A . + /// + public Task AddRegistrantAsync(long meetingId, string email, string firstName, string lastName, string address, string city, string country, string zip, string state, string phone, string industry, string organization, string jobTitle, string purchasingTimeFrame, string roleInPurchaseProcess, string numberOfEmployees, string comments, CancellationToken cancellationToken = default) + { + var data = new JObject(); + data.AddPropertyIfValue("email", email); + data.AddPropertyIfValue("first_name", firstName); + data.AddPropertyIfValue("last_name", lastName); + data.AddPropertyIfValue("address", address); + data.AddPropertyIfValue("city", city); + data.AddPropertyIfValue("country", country); + data.AddPropertyIfValue("zip", zip); + data.AddPropertyIfValue("state", state); + data.AddPropertyIfValue("phone", phone); + data.AddPropertyIfValue("industry", industry); + data.AddPropertyIfValue("org", organization); + data.AddPropertyIfValue("job_title", jobTitle); + data.AddPropertyIfValue("purchasing_time_frame", purchasingTimeFrame); + data.AddPropertyIfValue("role_in_purchasing_process", roleInPurchaseProcess); + data.AddPropertyIfValue("no_of_employees", numberOfEmployees); + data.AddPropertyIfValue("comments", comments); + + return _client + .PostAsync($"meetings/{meetingId}/recordings/registrants") + .WithJsonBody(data) + .WithCancellationToken(cancellationToken) + .AsObject(); + } + + /// + /// Approve a registration for a meeting. + /// + /// The meeting ID. + /// The registrant ID. + /// The cancellation token. + /// + /// The async task. + /// + public Task ApproveRegistrantAsync(long meetingId, string registrantId, CancellationToken cancellationToken = default) + { + return ApproveRegistrantsAsync(meetingId, new[] { registrantId }, cancellationToken); + } + + /// + /// Approve multiple registrations for a meeting. + /// + /// The meeting ID. + /// ID for each registrant to be approved. + /// The cancellation token. + /// + /// The async task. + /// + public Task ApproveRegistrantsAsync(long meetingId, IEnumerable registrantIds, CancellationToken cancellationToken = default) + { + return UpdateRegistrantsStatusAsync(meetingId, registrantIds, "approve", cancellationToken); + } + + /// + /// Reject a registration for a meeting. + /// + /// The meeting ID. + /// The registrant ID. + /// The cancellation token. + /// + /// The async task. + /// + public Task RejectRegistrantAsync(long meetingId, string registrantId, CancellationToken cancellationToken = default) + { + return RejectRegistrantsAsync(meetingId, new[] { registrantId }, cancellationToken); + } + + /// + /// Reject multiple registrations for a meeting. + /// + /// The meeting ID. + /// ID for each registrant to be rejected. + /// The cancellation token. + /// + /// The async task. + /// + public Task RejectRegistrantsAsync(long meetingId, IEnumerable registrantIds, CancellationToken cancellationToken = default) + { + return UpdateRegistrantsStatusAsync(meetingId, registrantIds, "deny", cancellationToken); + } + + private Task UpdateRegistrantsStatusAsync(long meetingId, IEnumerable registrantIds, string status, CancellationToken cancellationToken = default) + { + var data = new JObject(); + data.AddPropertyIfValue("action", status); + data.AddPropertyIfValue("registrants", registrantIds.ToArray()); + + return _client + .PutAsync($"meetings/{meetingId}/recordings/registrants/status") + .WithJsonBody(data) + .WithCancellationToken(cancellationToken) + .AsMessage(); + } } } diff --git a/Source/ZoomNet/Resources/ICloudRecordings.cs b/Source/ZoomNet/Resources/ICloudRecordings.cs index 9bed73bd..6599bc87 100644 --- a/Source/ZoomNet/Resources/ICloudRecordings.cs +++ b/Source/ZoomNet/Resources/ICloudRecordings.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using ZoomNet.Models; @@ -27,7 +28,9 @@ public interface ICloudRecordings /// An array of recordings. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); + Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, + DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, + CancellationToken cancellationToken = default); /// /// Retrieve all cloud recordings for a user. @@ -42,7 +45,9 @@ public interface ICloudRecordings /// /// An array of recordings. /// - Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, + DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, + CancellationToken cancellationToken = default); /// /// Retrieve all cloud recordings for a meeting. @@ -55,7 +60,8 @@ public interface ICloudRecordings /// An array of recordings. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); + Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, + CancellationToken cancellationToken = default); /// /// Retrieve all cloud recordings for a meeting. @@ -67,7 +73,8 @@ public interface ICloudRecordings /// /// An array of recordings. /// - Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, + string pagingToken = null, CancellationToken cancellationToken = default); /// /// Move recording files for a meeting to trash. @@ -98,7 +105,8 @@ public interface ICloudRecordings /// /// The async task. /// - Task MoveRecordingToTrashAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); + Task MoveRecordingToTrashAsync(string meetingId, string recordingId, + CancellationToken cancellationToken = default); /// /// Permanently delete a specific recording file for a meeting. @@ -141,7 +149,8 @@ public interface ICloudRecordings /// /// The . /// - Task GetRecordingSettingsAsync(string meetingId, CancellationToken cancellationToken = default); + Task GetRecordingSettingsAsync(string meetingId, + CancellationToken cancellationToken = default); /// /// Retrieve all registrants for a recording. @@ -154,7 +163,8 @@ public interface ICloudRecordings /// An array of registrants. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); + Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, + int page = 1, CancellationToken cancellationToken = default); /// /// Retrieve all registrants for a recording. @@ -166,6 +176,81 @@ public interface ICloudRecordings /// /// An array of registrants. /// - Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + Task> GetRecordingRegistrantsAsync(string meetingId, + int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + + /// + /// Add a registrant to an on-demand recording. + /// + /// The meeting ID. + /// Registrant's email address. + /// Registrant's first name. + /// Registrant's last name. + /// Registrant's address. + /// Registrant's city. + /// Registrant's country. + /// Registrant's zip/postal code. + /// Registrant's state/province. + /// Registrant's phone number. + /// Registrant's industry. + /// Registrant's organization. + /// Registrant's job title. + /// This field can be included to gauge interest of attendees towards buying your product or service. + /// Registrant's role in purchase decision. + /// Number of employees. + /// A field that allows registrants to provide any questions or comments that they might have. + /// The cancellation token. + /// + /// A . + /// + Task AddRegistrantAsync(long meetingId, string email, string firstName, string lastName, + string address, string city, string country, string zip, string state, string phone, string industry, + string organization, string jobTitle, string purchasingTimeFrame, string roleInPurchaseProcess, + string numberOfEmployees, string comments, CancellationToken cancellationToken = default); + + /// + /// Approve a registration for a meeting. + /// + /// The meeting ID. + /// The registrant ID. + /// The cancellation token. + /// + /// The async task. + /// + Task ApproveRegistrantAsync(long meetingId, string registrantId, CancellationToken cancellationToken = default); + + /// + /// Approve multiple registrations for a meeting. + /// + /// The meeting ID. + /// ID for each registrant to be approved. + /// The cancellation token. + /// + /// The async task. + /// + Task ApproveRegistrantsAsync(long meetingId, IEnumerable registrantIds, + CancellationToken cancellationToken = default); + + /// + /// Reject a registration for a meeting. + /// + /// The meeting ID. + /// The registrant ID. + /// The cancellation token. + /// + /// The async task. + /// + Task RejectRegistrantAsync(long meetingId, string registrantId, CancellationToken cancellationToken = default); + + /// + /// Reject multiple registrations for a meeting. + /// + /// The meeting ID. + /// ID for each registrant to be rejected. + /// The cancellation token. + /// + /// The async task. + /// + Task RejectRegistrantsAsync(long meetingId, IEnumerable registrantIds, CancellationToken cancellationToken = default); } } From 14273de0256ff2be1918deedf54e00071aa29737 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 22 Nov 2020 12:17:37 -0500 Subject: [PATCH 12/12] Fix SA1117: The parameters should all be placed on the same line or each parameter should be placed on its own line --- Source/ZoomNet/Resources/ICloudRecordings.cs | 34 ++++++-------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/Source/ZoomNet/Resources/ICloudRecordings.cs b/Source/ZoomNet/Resources/ICloudRecordings.cs index 6599bc87..7734f6ba 100644 --- a/Source/ZoomNet/Resources/ICloudRecordings.cs +++ b/Source/ZoomNet/Resources/ICloudRecordings.cs @@ -28,9 +28,7 @@ public interface ICloudRecordings /// An array of recordings. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, - DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, - CancellationToken cancellationToken = default); + Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); /// /// Retrieve all cloud recordings for a user. @@ -45,9 +43,7 @@ Task> GetRecordingsForUserAsync(string userId, bool /// /// An array of recordings. /// - Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, - DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, - CancellationToken cancellationToken = default); + Task> GetRecordingsForUserAsync(string userId, bool queryTrash = false, DateTime? from = null, DateTime? to = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); /// /// Retrieve all cloud recordings for a meeting. @@ -60,8 +56,7 @@ Task> GetRecordingsForUserAsync(string use /// An array of recordings. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, - CancellationToken cancellationToken = default); + Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); /// /// Retrieve all cloud recordings for a meeting. @@ -73,8 +68,7 @@ Task> GetRecordingsAsync(string meetingId, int reco /// /// An array of recordings. /// - Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, - string pagingToken = null, CancellationToken cancellationToken = default); + Task> GetRecordingsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); /// /// Move recording files for a meeting to trash. @@ -105,8 +99,7 @@ Task> GetRecordingsAsync(string meetingId, /// /// The async task. /// - Task MoveRecordingToTrashAsync(string meetingId, string recordingId, - CancellationToken cancellationToken = default); + Task MoveRecordingToTrashAsync(string meetingId, string recordingId, CancellationToken cancellationToken = default); /// /// Permanently delete a specific recording file for a meeting. @@ -149,8 +142,7 @@ Task MoveRecordingToTrashAsync(string meetingId, string recordingId, /// /// The . /// - Task GetRecordingSettingsAsync(string meetingId, - CancellationToken cancellationToken = default); + Task GetRecordingSettingsAsync(string meetingId, CancellationToken cancellationToken = default); /// /// Retrieve all registrants for a recording. @@ -163,8 +155,7 @@ Task GetRecordingSettingsAsync(string meetingId, /// An array of registrants. /// [Obsolete("Zoom is in the process of deprecating the \"page number\" and \"page count\" fields.")] - Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, - int page = 1, CancellationToken cancellationToken = default); + Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, int page = 1, CancellationToken cancellationToken = default); /// /// Retrieve all registrants for a recording. @@ -176,8 +167,7 @@ Task> GetRecordingRegistrantsAsync(string meetingI /// /// An array of registrants. /// - Task> GetRecordingRegistrantsAsync(string meetingId, - int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + Task> GetRecordingRegistrantsAsync(string meetingId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); /// /// Add a registrant to an on-demand recording. @@ -203,10 +193,7 @@ Task> GetRecordingRegistrantsAsync(string /// /// A . /// - Task AddRegistrantAsync(long meetingId, string email, string firstName, string lastName, - string address, string city, string country, string zip, string state, string phone, string industry, - string organization, string jobTitle, string purchasingTimeFrame, string roleInPurchaseProcess, - string numberOfEmployees, string comments, CancellationToken cancellationToken = default); + Task AddRegistrantAsync(long meetingId, string email, string firstName, string lastName, string address, string city, string country, string zip, string state, string phone, string industry, string organization, string jobTitle, string purchasingTimeFrame, string roleInPurchaseProcess, string numberOfEmployees, string comments, CancellationToken cancellationToken = default); /// /// Approve a registration for a meeting. @@ -228,8 +215,7 @@ Task AddRegistrantAsync(long meetingId, string email, str /// /// The async task. /// - Task ApproveRegistrantsAsync(long meetingId, IEnumerable registrantIds, - CancellationToken cancellationToken = default); + Task ApproveRegistrantsAsync(long meetingId, IEnumerable registrantIds, CancellationToken cancellationToken = default); /// /// Reject a registration for a meeting.