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
2 changes: 2 additions & 0 deletions Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ namespace ZoomNet.Json
[JsonSerializable(typeof(ZoomNet.Models.NoiseSuppressionType))]
[JsonSerializable(typeof(ZoomNet.Models.NumberOfEmployees))]
[JsonSerializable(typeof(ZoomNet.Models.OAuthGrantType))]
[JsonSerializable(typeof(ZoomNet.Models.OperationLog[]))]
[JsonSerializable(typeof(ZoomNet.Models.ReportPhoneOperationsLogType))]
[JsonSerializable(typeof(ZoomNet.Models.Panelist))]
[JsonSerializable(typeof(ZoomNet.Models.Participant))]
[JsonSerializable(typeof(ZoomNet.Models.ParticipantChatSaveType))]
Expand Down
35 changes: 35 additions & 0 deletions Source/ZoomNet/Models/OperationLog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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 log entry for an operation performed in Zoom.
/// </summary>
public class OperationLog
{
/// <summary>Gets or sets the action.</summary>
[JsonPropertyName("action")]
public string Action { get; set; }

/// <summary>Gets or sets the operation type.</summary>
[JsonPropertyName("category_type")]
public string CategoryType { get; set; }

/// <summary>Gets or sets the operation detail.</summary>
[JsonPropertyName("operation_detail")]
public string OperationDetail { get; set; }

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

/// <summary>Gets or sets the timestamp.</summary>
[JsonPropertyName("time")]
public DateTime Time { get; set; }
}
}
189 changes: 189 additions & 0 deletions Source/ZoomNet/Models/ReportPhoneOperationsLogType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
using System.Runtime.Serialization;

namespace ZoomNet.Models;

/// <summary>
/// Phone operation categories and their descriptions from Zoom Phone API.
/// </summary>
public enum ReportPhoneOperationsLogType
{
/// <summary>All Operation Types.</summary>
[EnumMember(Value = "all")]
All,

/// <summary>Approved account.</summary>
[EnumMember(Value = "account_allow_list")]
AccountAllowList,

/// <summary>Blocked account.</summary>
[EnumMember(Value = "account_blocked")]
AccountBlocked,

/// <summary>Auto receptionist.</summary>
[EnumMember(Value = "auto_receptionist")]
AutoReceptionist,

/// <summary>Directory backup routing rules.</summary>
[EnumMember(Value = "backup_routing_rule")]
BackupRoutingRule,

/// <summary>Call monitoring (barge/monitor/whisper).</summary>
[EnumMember(Value = "barge_monitor_whisper")]
BargeMonitorWhisper,

/// <summary>Call forwarding.</summary>
[EnumMember(Value = "call_forward")]
CallForward,

/// <summary>Call logs.</summary>
[EnumMember(Value = "call_log")]
CallLog,

/// <summary>Call queues.</summary>
[EnumMember(Value = "call_queue")]
CallQueue,

/// <summary>Call setting.</summary>
[EnumMember(Value = "call_setting")]
CallSetting,

/// <summary>Calling plan.</summary>
[EnumMember(Value = "calling_plan")]
CallingPlan,

/// <summary>Company information.</summary>
[EnumMember(Value = "company_info")]
CompanyInfo,

/// <summary>Contact center.</summary>
[EnumMember(Value = "contact_center")]
ContactCenter,

/// <summary>Domain of the contact center.</summary>
[EnumMember(Value = "contact_center_domain")]
ContactCenterDomain,

/// <summary>CSV file imports.</summary>
[EnumMember(Value = "csv_import")]
CsvImport,

/// <summary>Custom voicemail greeting.</summary>
[EnumMember(Value = "custom_vm_greeting")]
CustomVoicemailGreeting,

/// <summary>Call delegation.</summary>
[EnumMember(Value = "delegation")]
Delegation,

/// <summary>Zoom Phone device.</summary>
[EnumMember(Value = "device")]
Device,

/// <summary>Dial-by-name directory.</summary>
[EnumMember(Value = "dial_by_name")]
DialByName,

/// <summary>Emergency address.</summary>
[EnumMember(Value = "emergency_address")]
EmergencyAddress,

/// <summary>Emergency calling.</summary>
[EnumMember(Value = "emergency_calling")]
EmergencyCalling,

/// <summary>Emergency service.</summary>
[EnumMember(Value = "emergency_service")]
EmergencyService,

/// <summary>Extension number.</summary>
[EnumMember(Value = "extension")]
Extension,

/// <summary>Extension line keys.</summary>
[EnumMember(Value = "extension_line_keys")]
ExtensionLineKeys,

/// <summary>Extension template.</summary>
[EnumMember(Value = "extension_template")]
ExtensionTemplate,

/// <summary>External contacts.</summary>
[EnumMember(Value = "external_contacts")]
ExternalContacts,

/// <summary>Holiday hours.</summary>
[EnumMember(Value = "holiday_hours")]
HolidayHours,

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

/// <summary>Multiple sites.</summary>
[EnumMember(Value = "multiple_site")]
MultipleSite,

/// <summary>Outbound number.</summary>
[EnumMember(Value = "outbound_number")]
OutboundNumber,

/// <summary>Phone number.</summary>
[EnumMember(Value = "phone_number")]
PhoneNumber,

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

/// <summary>Provision templates.</summary>
[EnumMember(Value = "provision_template")]
ProvisionTemplate,

/// <summary>Call recordings.</summary>
[EnumMember(Value = "recording")]
Recording,

/// <summary>Shared line groups.</summary>
[EnumMember(Value = "shared_line_group")]
SharedLineGroup,

/// <summary>SIP group.</summary>
[EnumMember(Value = "sip_group")]
SipGroup,

/// <summary>SIP trunk group.</summary>
[EnumMember(Value = "sip_trunk_group")]
SipTrunkGroup,

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

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

/// <summary>Blocked user.</summary>
[EnumMember(Value = "user_blocked")]
UserBlocked,

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

/// <summary>Emergency number routing rule.</summary>
[EnumMember(Value = "emergency_number_routing_rule")]
EmergencyNumberRoutingRule,

/// <summary>Account options.</summary>
[EnumMember(Value = "account_options")]
AccountOptions,

/// <summary>Zoom Phone roles.</summary>
[EnumMember(Value = "zoom_phone_role")]
ZoomPhoneRole,

/// <summary>Zoom Rooms PBX Support.</summary>
[EnumMember(Value = "zoom_room")]
ZoomRoom,
}
21 changes: 21 additions & 0 deletions Source/ZoomNet/Resources/IReports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,26 @@ public interface IReports
/// The object of <see cref="DailyUsageReport"></see>.
/// </returns>
public Task<DailyUsageReport> GetDailyUsageReportAsync(int year, int month, string groupId = null, CancellationToken cancellationToken = default);

/// <summary>
/// Gets the phone system operation logs report.
/// </summary>
/// <remarks>
/// The phone system operation logs report allows account owners and admins to view monthly Zoom phone related admin operation details.
/// </remarks>
/// <param name="from">Start date.</param>
/// <param name="to">End date.</param>
/// <param name="type">Type of report.</param>
/// <param name="recordsPerPage">The number of records returned within a single API call.</param>
/// <param name="pageToken">
/// The next page token is used to paginate through large result sets.
/// A next page token will be returned whenever the set of available results exceeds the current page size.
/// The expiration period for this token is 15 minutes.
/// </param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// An array of <see cref="OperationLog">report items</see>.
/// </returns>
public Task<PaginatedResponseWithToken<OperationLog>> GetOperationLogsReportAsync(DateTime from, DateTime to, ReportPhoneOperationsLogType type = ReportPhoneOperationsLogType.All, int recordsPerPage = 30, string pageToken = null, CancellationToken cancellationToken = default);
}
}
16 changes: 16 additions & 0 deletions Source/ZoomNet/Resources/Reports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ public Task<DailyUsageReport> GetDailyUsageReportAsync(int year, int month, stri
.AsObject<DailyUsageReport>();
}

/// <inheritdoc/>
public Task<PaginatedResponseWithToken<OperationLog>> GetOperationLogsReportAsync(DateTime from, DateTime to, ReportPhoneOperationsLogType type = ReportPhoneOperationsLogType.All, int recordsPerPage = 30, string pageToken = null, CancellationToken cancellationToken = default)
{
VerifyReportDatesRange(from, to);
Utils.ValidateRecordPerPage(recordsPerPage);

return _client.GetAsync("phone/reports/operationlogs")
.WithArgument("from", from.ToZoomFormat(dateOnly: true))
.WithArgument("to", to.ToZoomFormat(dateOnly: true))
.WithArgument("category_type", type.ToEnumString())
.WithArgument("page_size", recordsPerPage)
.WithArgument("next_page_token", pageToken)
.WithCancellationToken(cancellationToken)
.AsPaginatedResponseWithToken<OperationLog>("operation_logs");
}

private static void VerifyReportDatesRange(DateTime from, DateTime to)
{
if (to < from)
Expand Down