Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down
53 changes: 53 additions & 0 deletions Source/ZoomNet/Models/CallQueue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace ZoomNet.Models
{
/// <summary>
/// A Call Queue.
/// </summary>
public class CallQueue
{
/// <summary>
/// Gets or sets the extension id.
/// </summary>
[JsonPropertyName("extension_id")]
public string ExtensionId { get; set; }

/// <summary>
/// Gets or sets the extension number.
/// </summary>
[JsonPropertyName("extension_number")]
public long? ExtensionNumber { get; set; }

/// <summary>
/// Gets or sets the unique identifier of the call queue.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; }

/// <summary>
/// Gets or sets the name of the call queue.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }

/// <summary>
/// Gets or sets the phone numbers assigned to the call queue.
/// </summary>
[JsonPropertyName("phone_numbers")]
public List<CallQueuePhoneNumber> PhoneNumbers { get; set; }

/// <summary>
/// Gets or sets the site information.
/// </summary>
[JsonPropertyName("site")]
public Site Site { get; set; }

/// <summary>
/// Gets or sets the status of the call queue.
/// </summary>
[JsonPropertyName("status")]
public CallQueueStatus Status { get; set; }
}
}
40 changes: 40 additions & 0 deletions Source/ZoomNet/Models/CallQueueMember.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.Text.Json.Serialization;

namespace ZoomNet.Models
{
/// <summary>
/// Represents a member of a call queue, which can be a user or a common area.
/// </summary>
public class CallQueueMember
{
/// <summary>
/// Gets or sets the member id.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; }

/// <summary>
/// Gets or sets the level of the member.
/// </summary>
[JsonPropertyName("level")]
public string Level { get; set; }

/// <summary>
/// Gets or sets the name of the user or common area.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the user can receive calls. It displays if the level is user.
/// </summary>
[JsonPropertyName("receive_call")]
public bool ReceiveCall { get; set; }

/// <summary>
/// Gets or sets the extension ID of the user or common area.
/// </summary>
[JsonPropertyName("extension_id")]
public string ExtensionId { get; set; }
}
}
22 changes: 22 additions & 0 deletions Source/ZoomNet/Models/CallQueueNumberSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Runtime.Serialization;

namespace ZoomNet.Models
{
/// <summary>
/// Enumeration to indicate the source of callee/caller number.
/// </summary>
public enum CallQueueNumberSource
{
/// <summary>
/// internal
/// </summary>
[EnumMember(Value = "internal")]
Internal,

/// <summary>
/// external
/// </summary>
[EnumMember(Value = "external")]
External
}
}
33 changes: 33 additions & 0 deletions Source/ZoomNet/Models/CallQueuePhoneNumber.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Represents a phone number assigned to a call queue.
/// </summary>
public class CallQueuePhoneNumber
{
/// <summary>
/// Gets or sets the unique identifier of the phone number.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; }

/// <summary>
/// Gets or sets the phone number.
/// </summary>
[JsonPropertyName("number")]
public string Number { get; set; }

/// <summary>
/// gets or sets the source of the phone number.
/// </summary>
[JsonPropertyName("source")]
public CallQueueNumberSource Source { get; set; }
}
}
21 changes: 21 additions & 0 deletions Source/ZoomNet/Models/CallQueueStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Runtime.Serialization;

namespace ZoomNet.Models;

/// <summary>
/// Represents the status of a Call Queue.
/// </summary>
public enum CallQueueStatus
{
/// <summary>
/// An active call queue.
/// </summary>
[EnumMember(Value = "active")]
Active,

/// <summary>
/// Call queue has been deactivated.
/// </summary>
[EnumMember(Value = "inactive")]
Inactive
}
36 changes: 36 additions & 0 deletions Source/ZoomNet/Resources/IPhone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,41 @@ Task UpdateCallHandlingSettingsAsync(
CancellationToken cancellationToken);

#endregion

#region Call Queues Endpoints
/// <summary>
/// Get call queue details.
/// </summary>
/// <param name="callQueueId">The ID of the call queue.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// Details about a <see cref="CallQueue"/>.
/// </returns>
public Task<CallQueue> GetCallQueueAsync(string callQueueId, CancellationToken cancellationToken = default);

/// <summary>
/// Get call queues.
/// </summary>
/// <param name="department">Filter by department.</param>
/// <param name="costCenter">Filter by cost center.</param>
/// <param name="siteId">Filter by site id.</param>
/// <param name="recordsPerPage">The number of records to return.</param>
/// <param name="pagingToken">The paging token.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// A paginated response of <see cref="CallQueue"/>.
/// </returns>
public Task<PaginatedResponseWithToken<CallQueue>> GetAllCallQueuesAsync(string department = null, string costCenter = null, string siteId = null, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default);

/// <summary>
/// Get members currently in call queues.
/// </summary>
/// <param name="callQueueId">The ID of the call queue.</param>
/// <param name="recordsPerPage">The number of records to return.</param>
/// <param name="pagingToken">The paging token.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>An array of current call queue membership entries.</returns>
public Task<PaginatedResponseWithToken<CallQueueMember>> GetCallQueueMembersAsync(string callQueueId, int recordsPerPage = 30, string pagingToken = null, CancellationToken cancellationToken = default);
#endregion
}
}
39 changes: 39 additions & 0 deletions Source/ZoomNet/Resources/Phone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,44 @@ public Task UpdateCallHandlingSettingsAsync(
.WithCancellationToken(cancellationToken)
.AsMessage();
}

#region Call Queues
/// <inheritdoc/>
public Task<CallQueue> GetCallQueueAsync(string callQueueId, CancellationToken cancellationToken = default)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that (according to the specification) this endpoint provides more details about the requested call queue. So we can define CallQueueDetails inherited from CallQueue and add more properties there.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll compare and add the missing properties to the new class as suggested.

{
return _client
.GetAsync($"phone/call_queues/{callQueueId}")
.WithCancellationToken(cancellationToken)
.AsObject<CallQueue>();
}

/// <inheritdoc/>
public Task<PaginatedResponseWithToken<CallQueue>> 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<CallQueue>("call_queues");
}

/// <inheritdoc/>
public Task<PaginatedResponseWithToken<CallQueueMember>> 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<CallQueueMember>("call_queue_members");
}
#endregion
}
}