diff --git a/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs b/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs index ed767869f..4868ee95b 100644 --- a/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs +++ b/Source/ZoomNet/Json/ZoomNetJsonSerializerContext.cs @@ -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))] diff --git a/Source/ZoomNet/Models/OperationLog.cs b/Source/ZoomNet/Models/OperationLog.cs new file mode 100644 index 000000000..731ece511 --- /dev/null +++ b/Source/ZoomNet/Models/OperationLog.cs @@ -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 +{ + /// + /// Represents a log entry for an operation performed in Zoom. + /// + public class OperationLog + { + /// Gets or sets the action. + [JsonPropertyName("action")] + public string Action { get; set; } + + /// Gets or sets the operation type. + [JsonPropertyName("category_type")] + public string CategoryType { get; set; } + + /// Gets or sets the operation detail. + [JsonPropertyName("operation_detail")] + public string OperationDetail { get; set; } + + /// Gets or sets the Operator. + [JsonPropertyName("operator")] + public string Operator { get; set; } + + /// Gets or sets the timestamp. + [JsonPropertyName("time")] + public DateTime Time { get; set; } + } +} diff --git a/Source/ZoomNet/Models/ReportPhoneOperationsLogType.cs b/Source/ZoomNet/Models/ReportPhoneOperationsLogType.cs new file mode 100644 index 000000000..0aa264705 --- /dev/null +++ b/Source/ZoomNet/Models/ReportPhoneOperationsLogType.cs @@ -0,0 +1,189 @@ +using System.Runtime.Serialization; + +namespace ZoomNet.Models; + +/// +/// Phone operation categories and their descriptions from Zoom Phone API. +/// +public enum ReportPhoneOperationsLogType +{ + /// All Operation Types. + [EnumMember(Value = "all")] + All, + + /// Approved account. + [EnumMember(Value = "account_allow_list")] + AccountAllowList, + + /// Blocked account. + [EnumMember(Value = "account_blocked")] + AccountBlocked, + + /// Auto receptionist. + [EnumMember(Value = "auto_receptionist")] + AutoReceptionist, + + /// Directory backup routing rules. + [EnumMember(Value = "backup_routing_rule")] + BackupRoutingRule, + + /// Call monitoring (barge/monitor/whisper). + [EnumMember(Value = "barge_monitor_whisper")] + BargeMonitorWhisper, + + /// Call forwarding. + [EnumMember(Value = "call_forward")] + CallForward, + + /// Call logs. + [EnumMember(Value = "call_log")] + CallLog, + + /// Call queues. + [EnumMember(Value = "call_queue")] + CallQueue, + + /// Call setting. + [EnumMember(Value = "call_setting")] + CallSetting, + + /// Calling plan. + [EnumMember(Value = "calling_plan")] + CallingPlan, + + /// Company information. + [EnumMember(Value = "company_info")] + CompanyInfo, + + /// Contact center. + [EnumMember(Value = "contact_center")] + ContactCenter, + + /// Domain of the contact center. + [EnumMember(Value = "contact_center_domain")] + ContactCenterDomain, + + /// CSV file imports. + [EnumMember(Value = "csv_import")] + CsvImport, + + /// Custom voicemail greeting. + [EnumMember(Value = "custom_vm_greeting")] + CustomVoicemailGreeting, + + /// Call delegation. + [EnumMember(Value = "delegation")] + Delegation, + + /// Zoom Phone device. + [EnumMember(Value = "device")] + Device, + + /// Dial-by-name directory. + [EnumMember(Value = "dial_by_name")] + DialByName, + + /// Emergency address. + [EnumMember(Value = "emergency_address")] + EmergencyAddress, + + /// Emergency calling. + [EnumMember(Value = "emergency_calling")] + EmergencyCalling, + + /// Emergency service. + [EnumMember(Value = "emergency_service")] + EmergencyService, + + /// Extension number. + [EnumMember(Value = "extension")] + Extension, + + /// Extension line keys. + [EnumMember(Value = "extension_line_keys")] + ExtensionLineKeys, + + /// Extension template. + [EnumMember(Value = "extension_template")] + ExtensionTemplate, + + /// External contacts. + [EnumMember(Value = "external_contacts")] + ExternalContacts, + + /// Holiday hours. + [EnumMember(Value = "holiday_hours")] + HolidayHours, + + /// Location. + [EnumMember(Value = "location")] + Location, + + /// Multiple sites. + [EnumMember(Value = "multiple_site")] + MultipleSite, + + /// Outbound number. + [EnumMember(Value = "outbound_number")] + OutboundNumber, + + /// Phone number. + [EnumMember(Value = "phone_number")] + PhoneNumber, + + /// Policy. + [EnumMember(Value = "policy")] + Policy, + + /// Provision templates. + [EnumMember(Value = "provision_template")] + ProvisionTemplate, + + /// Call recordings. + [EnumMember(Value = "recording")] + Recording, + + /// Shared line groups. + [EnumMember(Value = "shared_line_group")] + SharedLineGroup, + + /// SIP group. + [EnumMember(Value = "sip_group")] + SipGroup, + + /// SIP trunk group. + [EnumMember(Value = "sip_trunk_group")] + SipTrunkGroup, + + /// Spam. + [EnumMember(Value = "spam")] + Spam, + + /// User. + [EnumMember(Value = "user")] + User, + + /// Blocked user. + [EnumMember(Value = "user_blocked")] + UserBlocked, + + /// Voicemail. + [EnumMember(Value = "voicemail")] + Voicemail, + + /// Emergency number routing rule. + [EnumMember(Value = "emergency_number_routing_rule")] + EmergencyNumberRoutingRule, + + /// Account options. + [EnumMember(Value = "account_options")] + AccountOptions, + + /// Zoom Phone roles. + [EnumMember(Value = "zoom_phone_role")] + ZoomPhoneRole, + + /// Zoom Rooms PBX Support. + [EnumMember(Value = "zoom_room")] + ZoomRoom, +} diff --git a/Source/ZoomNet/Resources/IReports.cs b/Source/ZoomNet/Resources/IReports.cs index cb7bd2e0f..5d30df619 100644 --- a/Source/ZoomNet/Resources/IReports.cs +++ b/Source/ZoomNet/Resources/IReports.cs @@ -99,5 +99,26 @@ public interface IReports /// The object of . /// public Task GetDailyUsageReportAsync(int year, int month, string groupId = null, CancellationToken cancellationToken = default); + + /// + /// Gets the phone system operation logs report. + /// + /// + /// The phone system operation logs report allows account owners and admins to view monthly Zoom phone related admin operation details. + /// + /// Start date. + /// End date. + /// Type of report. + /// The number of records returned within a single API call. + /// + /// 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. + /// + /// The cancellation token. + /// + /// An array of report items. + /// + public Task> GetOperationLogsReportAsync(DateTime from, DateTime to, ReportPhoneOperationsLogType type = ReportPhoneOperationsLogType.All, int recordsPerPage = 30, string pageToken = null, CancellationToken cancellationToken = default); } } diff --git a/Source/ZoomNet/Resources/Reports.cs b/Source/ZoomNet/Resources/Reports.cs index 7edb3ba60..460342d33 100644 --- a/Source/ZoomNet/Resources/Reports.cs +++ b/Source/ZoomNet/Resources/Reports.cs @@ -94,6 +94,22 @@ public Task GetDailyUsageReportAsync(int year, int month, stri .AsObject(); } + /// + public Task> 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("operation_logs"); + } + private static void VerifyReportDatesRange(DateTime from, DateTime to) { if (to < from)