diff --git a/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs b/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs index ed767869f..9b9502844 100644 --- a/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs +++ b/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs @@ -87,6 +87,11 @@ 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.CallQueueStatus))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueueMember))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueueNumberSource))] [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 +875,11 @@ 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.CallQueueStatus[]))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueueMember[]))] + [JsonSerializable(typeof(ZoomNet.Models.CallQueueNumberSource[]))] [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..873f770a4 --- /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 Site Site { get; set; } + + /// + /// Gets or sets the status of the call queue. + /// + [JsonPropertyName("status")] + public CallQueueStatus 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/CallQueueNumberSource.cs b/Source/ZoomNet/Models/CallQueueNumberSource.cs new file mode 100644 index 000000000..7c2dee810 --- /dev/null +++ b/Source/ZoomNet/Models/CallQueueNumberSource.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace ZoomNet.Models +{ + /// + /// Enumeration to indicate the source of callee/caller number. + /// + public enum CallQueueNumberSource + { + /// + /// internal + /// + [EnumMember(Value = "internal")] + Internal, + + /// + /// external + /// + [EnumMember(Value = "external")] + External + } +} diff --git a/Source/ZoomNet/Models/CallQueuePhoneNumber.cs b/Source/ZoomNet/Models/CallQueuePhoneNumber.cs new file mode 100644 index 000000000..879d1229c --- /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 CallQueueNumberSource Source { get; set; } + } +} diff --git a/Source/ZoomNet/Models/CallQueueStatus.cs b/Source/ZoomNet/Models/CallQueueStatus.cs new file mode 100644 index 000000000..01aca8405 --- /dev/null +++ b/Source/ZoomNet/Models/CallQueueStatus.cs @@ -0,0 +1,21 @@ +using System.Runtime.Serialization; + +namespace ZoomNet.Models; + +/// +/// Represents the status of a Call Queue. +/// +public enum CallQueueStatus +{ + /// + /// An active call queue. + /// + [EnumMember(Value = "active")] + Active, + + /// + /// Call queue has been deactivated. + /// + [EnumMember(Value = "inactive")] + Inactive +} diff --git a/Source/ZoomNet/Resources/IPhone.cs b/Source/ZoomNet/Resources/IPhone.cs index 25fe37bc7..3ad36143d 100644 --- a/Source/ZoomNet/Resources/IPhone.cs +++ b/Source/ZoomNet/Resources/IPhone.cs @@ -141,5 +141,41 @@ Task UpdateCallHandlingSettingsAsync( CancellationToken cancellationToken); #endregion + + #region Call Queues Endpoints + /// + /// Get call queue details. + /// + /// The ID of the call queue. + /// The cancellation token. + /// + /// Details about a . + /// + public Task GetCallQueueAsync(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> GetAllCallQueuesAsync(string department = null, string costCenter = null, string siteId = 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> GetCallQueueMembersAsync(string callQueueId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default); + #endregion } } diff --git a/Source/ZoomNet/Resources/Phone.cs b/Source/ZoomNet/Resources/Phone.cs index 281c81067..ae39e4a2c 100644 --- a/Source/ZoomNet/Resources/Phone.cs +++ b/Source/ZoomNet/Resources/Phone.cs @@ -124,5 +124,44 @@ public Task UpdateCallHandlingSettingsAsync( .WithCancellationToken(cancellationToken) .AsMessage(); } + + #region Call Queues + /// + public Task GetCallQueueAsync(string callQueueId, CancellationToken cancellationToken = default) + { + return _client + .GetAsync($"phone/call_queues/{callQueueId}") + .WithCancellationToken(cancellationToken) + .AsObject(); + } + + /// + public Task> GetAllCallQueuesAsync(string department = null, string costCenter = null, string siteId = 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", costCenter) + .WithArgument("site_id", siteId) + .WithArgument("page_size", recordsPerPage) + .WithArgument("next_page_token", pagingToken) + .WithCancellationToken(cancellationToken) + .AsPaginatedResponseWithToken("call_queues"); + } + + /// + public Task> GetCallQueueMembersAsync(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"); + } + #endregion } }