diff --git a/Source/ZoomNet/IZoomClient.cs b/Source/ZoomNet/IZoomClient.cs index 792429862..2bb8451e5 100644 --- a/Source/ZoomNet/IZoomClient.cs +++ b/Source/ZoomNet/IZoomClient.cs @@ -121,6 +121,11 @@ public interface IZoomClient /// IWebinars Webinars { get; } + /// + /// Gets the resource which allows you to manage call queues. + /// + ICallQueues CallQueues { get; } + /// /// Determines if the specified scopes have been granted. /// diff --git a/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs b/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs index ed767869f..916fdd6f7 100644 --- a/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs +++ b/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs @@ -87,6 +87,10 @@ namespace ZoomNet.Json [JsonSerializable(typeof(ZoomNet.Models.CallLogTransferInfoExtensionType))] [JsonSerializable(typeof(ZoomNet.Models.CallLogTransferInfoNumberType))] [JsonSerializable(typeof(ZoomNet.Models.CallLogType))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueue))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueuePhoneNumber))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueueSite))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueueMember))] [JsonSerializable(typeof(ZoomNet.Models.ChatbotMessage.ChatbotAction), TypeInfoPropertyName = "ChatbotMessageChatbotAction")] [JsonSerializable(typeof(ZoomNet.Models.ChatbotMessage.ChatbotActions), TypeInfoPropertyName = "ChatbotMessageChatbotActions")] [JsonSerializable(typeof(ZoomNet.Models.ChatbotMessage.ChatbotActionStyle), TypeInfoPropertyName = "ChatbotMessageChatbotActionStyle")] @@ -870,6 +874,10 @@ namespace ZoomNet.Json [JsonSerializable(typeof(ZoomNet.Models.CallLogTransferInfoExtensionType[]))] [JsonSerializable(typeof(ZoomNet.Models.CallLogTransferInfoNumberType[]))] [JsonSerializable(typeof(ZoomNet.Models.CallLogType[]))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueue[]))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueuePhoneNumber[]))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueueSite[]))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueueMember[]))] [JsonSerializable(typeof(ZoomNet.Models.ChatbotMessage.ChatbotAction[]), TypeInfoPropertyName = "ChatbotMessageChatbotActionArray")] [JsonSerializable(typeof(ZoomNet.Models.ChatbotMessage.ChatbotActions[]), TypeInfoPropertyName = "ChatbotMessageChatbotActionsArray")] [JsonSerializable(typeof(ZoomNet.Models.ChatbotMessage.ChatbotActionStyle[]), TypeInfoPropertyName = "ChatbotMessageChatbotActionStyleArray")] diff --git a/Source/ZoomNet/Models/CallQueue.cs b/Source/ZoomNet/Models/CallQueue.cs new file mode 100644 index 000000000..778b49924 --- /dev/null +++ b/Source/ZoomNet/Models/CallQueue.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace ZoomNet.Models +{ + /// + /// A Call Queue. + /// + public class CallQueue + { + /// + /// Gets or sets the extension id. + /// + [JsonPropertyName("extension_id")] + public string ExtensionId { get; set; } + + /// + /// Gets or sets the extension number. + /// + [JsonPropertyName("extension_number")] + public long? ExtensionNumber { get; set; } + + /// + /// Gets or sets the unique identifier of the call queue. + /// + [JsonPropertyName("id")] + public string Id { get; set; } + + /// + /// Gets or sets the name of the call queue. + /// + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or sets the phone numbers assigned to the call queue. + /// + [JsonPropertyName("phone_numbers")] + public List PhoneNumbers { get; set; } + + /// + /// Gets or sets the site information. + /// + [JsonPropertyName("site")] + public CallQueueSite Site { get; set; } + + /// + /// Gets or sets the status of the call queue. + /// + [JsonPropertyName("status")] + public string Status { get; set; } + } +} diff --git a/Source/ZoomNet/Models/CallQueueMember.cs b/Source/ZoomNet/Models/CallQueueMember.cs new file mode 100644 index 000000000..e259cfa82 --- /dev/null +++ b/Source/ZoomNet/Models/CallQueueMember.cs @@ -0,0 +1,40 @@ +using System.Text.Json.Serialization; + +namespace ZoomNet.Models +{ + /// + /// Represents a member of a call queue, which can be a user or a common area. + /// + public class CallQueueMember + { + /// + /// Gets or sets the member id. + /// + [JsonPropertyName("id")] + public string Id { get; set; } + + /// + /// Gets or sets the level of the member. + /// + [JsonPropertyName("level")] + public string Level { get; set; } + + /// + /// Gets or sets the name of the user or common area. + /// + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or sets a value indicating whether the user can receive calls. It displays if the level is user. + /// + [JsonPropertyName("receive_call")] + public bool ReceiveCall { get; set; } + + /// + /// Gets or sets the extension ID of the user or common area. + /// + [JsonPropertyName("extension_id")] + public string ExtensionId { get; set; } + } +} diff --git a/Source/ZoomNet/Models/CallQueuePhoneNumber.cs b/Source/ZoomNet/Models/CallQueuePhoneNumber.cs new file mode 100644 index 000000000..ddb6361fb --- /dev/null +++ b/Source/ZoomNet/Models/CallQueuePhoneNumber.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace ZoomNet.Models +{ + /// + /// Represents a phone number assigned to a call queue. + /// + public class CallQueuePhoneNumber + { + /// + /// Gets or sets the unique identifier of the phone number. + /// + [JsonPropertyName("id")] + public string Id { get; set; } + + /// + /// Gets or sets the phone number. + /// + [JsonPropertyName("number")] + public string Number { get; set; } + + /// + /// gets or sets the source of the phone number. + /// + [JsonPropertyName("source")] + public string Source { get; set; } + } +} diff --git a/Source/ZoomNet/Models/CallQueueSite.cs b/Source/ZoomNet/Models/CallQueueSite.cs new file mode 100644 index 000000000..fb59b0464 --- /dev/null +++ b/Source/ZoomNet/Models/CallQueueSite.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace ZoomNet.Models +{ + /// + /// Represents a site where a Call Queue is assigned. + /// + public class CallQueueSite + { + /// + /// Gets or sets the Unique identifier of the site where the Call Queue is assigned. + /// + [JsonPropertyName("id")] + public string Id { get; set; } + + /// + /// Gets or sets the name of the site. + /// + [JsonPropertyName("name")] + public string Name { get; set; } + } +} diff --git a/Source/ZoomNet/Resources/CallQueues.cs b/Source/ZoomNet/Resources/CallQueues.cs new file mode 100644 index 000000000..581bc06bd --- /dev/null +++ b/Source/ZoomNet/Resources/CallQueues.cs @@ -0,0 +1,60 @@ +using Pathoschild.Http.Client; +using System.Threading; +using System.Threading.Tasks; +using ZoomNet.Models; +using ZoomNet.Utilities; + +namespace ZoomNet.Resources +{ + /// + public class CallQueues : ICallQueues + { + private readonly IClient _client; + + /// + /// Initializes a new instance of the class. + /// + /// The HTTP client. + internal CallQueues(IClient client) + { + _client = client; + } + + /// + public Task GetAsync(string callQueueId, CancellationToken cancellationToken = default) + { + return _client + .GetAsync($"phone/call_queues/{callQueueId}") + .WithCancellationToken(cancellationToken) + .AsObject(); + } + + /// + public Task> GetAllAsync(string department = null, string cost_center = null, string site_id = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default) + { + Utils.ValidateRecordPerPage(recordsPerPage, max: 100); + + return _client + .GetAsync($"phone/call_queues") + .WithArgument("department", department) + .WithArgument("cost_center", cost_center) + .WithArgument("site_id", site_id) + .WithArgument("page_size", recordsPerPage) + .WithArgument("next_page_token", pagingToken) + .WithCancellationToken(cancellationToken) + .AsPaginatedResponseWithToken("call_queues"); + } + + /// + public Task> GetMembersAsync(string callQueueId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default) + { + Utils.ValidateRecordPerPage(recordsPerPage); + return _client + .GetAsync($"phone/call_queues/{callQueueId}/members") + .WithArgument("page_size", recordsPerPage) + .WithArgument("next_page_token", pagingToken) + .WithCancellationToken(cancellationToken) + .AsPaginatedResponseWithToken("call_queue_members"); + } + } +} diff --git a/Source/ZoomNet/Resources/ICallQueues.cs b/Source/ZoomNet/Resources/ICallQueues.cs new file mode 100644 index 000000000..873f70071 --- /dev/null +++ b/Source/ZoomNet/Resources/ICallQueues.cs @@ -0,0 +1,46 @@ +using System.Threading; +using System.Threading.Tasks; +using ZoomNet.Models; + +namespace ZoomNet.Resources +{ + /// + /// Allows you to manage call queues. + /// + public interface ICallQueues + { + /// + /// Get call queue details. + /// + /// The ID of the call queue. + /// The cancellation token. + /// + /// Details about a . + /// + public Task GetAsync(string callQueueId, CancellationToken cancellationToken = default); + + /// + /// Get call queues. + /// + /// Filter by department. + /// Filter by cost center. + /// Filter by site id. + /// The number of records to return. + /// The paging token. + /// The cancellation token. + /// + /// A paginated response of . + /// + public Task> GetAllAsync(string department = null, string cost_center = null, string site_id = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + + /// + /// Get members currently in call queues. + /// + /// The ID of the call queue. + /// The number of records to return. + /// The paging token. + /// The cancellation token. + /// An array of current call queue membership entries. + public Task> GetMembersAsync(string callQueueId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + } +} diff --git a/Source/ZoomNet/ZoomClient.cs b/Source/ZoomNet/ZoomClient.cs index c1e91dbf3..cd1cbf210 100644 --- a/Source/ZoomNet/ZoomClient.cs +++ b/Source/ZoomNet/ZoomClient.cs @@ -130,6 +130,9 @@ public static string Version /// public IWebinars Webinars { get; private set; } + /// + public ICallQueues CallQueues { get; private set; } + #endregion #region CTOR @@ -245,6 +248,7 @@ private ZoomClient(IConnectionInfo connectionInfo, HttpClient httpClient, bool d TrackingFields = new TrackingFields(_fluentClient); Users = new Users(_fluentClient); Webinars = new Webinars(_fluentClient); + CallQueues = new CallQueues(_fluentClient); } ///