using MediaBrowser.Api.UserLibrary; using MediaBrowser.Model.Entities; using ServiceStack; using System; using System.Collections.Generic; using System.Linq; namespace MediaBrowser.Api.Reports { public interface IReportsDownload : IReportsQuery { /// Gets or sets the minimum date. /// The minimum date. string MinDate { get; set; } } /// Interface for reports query. public interface IReportsQuery : IReportsHeader { /// /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.GetActivityLogs has /// query limit. /// /// true if this MediaBrowser.Api.Reports.GetActivityLogs has query limit, false if not. bool HasQueryLimit { get; set; } /// Gets or sets who group this MediaBrowser.Api.Reports.GetActivityLogs. /// Describes who group this MediaBrowser.Api.Reports.GetActivityLogs. string GroupBy { get; set; } /// /// Skips over a given number of items within the results. Use for paging. /// /// The start index. int? StartIndex { get; set; } /// /// The maximum number of items to return /// /// The limit. int? Limit { get; set; } } public interface IReportsHeader { /// Gets or sets the report view. /// The report view. string ReportView { get; set; } /// Gets or sets the report columns. /// The report columns. string ReportColumns { get; set; } /// Gets or sets a list of types of the include items. /// A list of types of the include items. string IncludeItemTypes { get; set; } /// Gets or sets a list of types of the displays. /// A list of types of the displays. string DisplayType { get; set; } } public class BaseReportRequest : BaseItemsRequest, IReportsQuery { /// Gets or sets the report view. /// The report view. [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportStatistics, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public string ReportView { get; set; } /// Gets or sets the report view. /// The report view. [ApiMember(Name = "DisplayType", Description = "The report display type. Values (None, Screen, Export, ScreenExport)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public string DisplayType { get; set; } /// /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.BaseReportRequest has /// query limit. /// /// true if this MediaBrowser.Api.Reports.BaseReportRequest has query limit, false if not. [ApiMember(Name = "HasQueryLimit", Description = "Optional. If specified, results will include all records.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool HasQueryLimit { get; set; } /// /// Gets or sets who group this MediaBrowser.Api.Reports.BaseReportRequest. /// Describes who group this MediaBrowser.Api.Reports.BaseReportRequest. [ApiMember(Name = "GroupBy", Description = "Optional. If specified, results will include grouped records.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string GroupBy { get; set; } /// Gets or sets the report columns. /// The report columns. [ApiMember(Name = "ReportColumns", Description = "Optional. The columns to show.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string ReportColumns { get; set; } } [Route("/Reports/Items", "GET", Summary = "Gets reports based on library items")] public class GetItemReport : BaseReportRequest, IReturn { } [Route("/Reports/Headers", "GET", Summary = "Gets reports headers based on library items")] public class GetReportHeaders : IReturn>, IReportsHeader { /// Gets or sets the report view. /// The report view. [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportStatistics, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public string ReportView { get; set; } /// Gets or sets the report view. /// The report view. [ApiMember(Name = "DisplayType", Description = "The report display type. Values (None, Screen, Export, ScreenExport)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public string DisplayType { get; set; } /// Gets or sets a list of types of the include items. /// A list of types of the include items. [ApiMember(Name = "IncludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string IncludeItemTypes { get; set; } /// Gets or sets the report columns. /// The report columns. [ApiMember(Name = "ReportColumns", Description = "Optional. The columns to show.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string ReportColumns { get; set; } } [Route("/Reports/Statistics", "GET", Summary = "Gets reports statistics based on library items")] public class GetReportStatistics : BaseReportRequest, IReturn { public int? TopItems { get; set; } } [Route("/Reports/Items/Download", "GET", Summary = "Downloads report")] public class GetReportDownload : BaseReportRequest, IReportsDownload { public GetReportDownload() { ExportType = ReportExportType.CSV; } public ReportExportType ExportType { get; set; } /// Gets or sets the minimum date. /// The minimum date. [ApiMember(Name = "MinDate", Description = "Optional. The minimum date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] public string MinDate { get; set; } } [Route("/Reports/Activities", "GET", Summary = "Gets activities entries")] public class GetActivityLogs : IReturn, IReportsQuery, IReportsDownload { /// Gets or sets the report view. /// The report view. [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportStatistics, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public string ReportView { get; set; } /// Gets or sets the report view. /// The report view. [ApiMember(Name = "DisplayType", Description = "The report display type. Values (None, Screen, Export, ScreenExport)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public string DisplayType { get; set; } /// /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.GetActivityLogs has /// query limit. /// /// true if this MediaBrowser.Api.Reports.GetActivityLogs has query limit, false if not. [ApiMember(Name = "HasQueryLimit", Description = "Optional. If specified, results will include all records.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool HasQueryLimit { get; set; } /// Gets or sets who group this MediaBrowser.Api.Reports.GetActivityLogs. /// Describes who group this MediaBrowser.Api.Reports.GetActivityLogs. [ApiMember(Name = "GroupBy", Description = "Optional. If specified, results will include grouped records.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string GroupBy { get; set; } /// Gets or sets the report columns. /// The report columns. [ApiMember(Name = "ReportColumns", Description = "Optional. The columns to show.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string ReportColumns { get; set; } /// /// Skips over a given number of items within the results. Use for paging. /// /// The start index. [ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? StartIndex { get; set; } /// /// The maximum number of items to return /// /// The limit. [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? Limit { get; set; } /// Gets or sets the minimum date. /// The minimum date. [ApiMember(Name = "MinDate", Description = "Optional. The minimum date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] public string MinDate { get; set; } [ApiMember(Name = "IncludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string IncludeItemTypes { get; set; } } }