ReportRequests.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using MediaBrowser.Api.UserLibrary;
  2. using ServiceStack;
  3. using System.Collections.Generic;
  4. namespace MediaBrowser.Api.Reports
  5. {
  6. public interface IReportsDownload : IReportsQuery
  7. {
  8. /// <summary> Gets or sets the minimum date. </summary>
  9. /// <value> The minimum date. </value>
  10. string MinDate { get; set; }
  11. }
  12. /// <summary> Interface for reports query. </summary>
  13. public interface IReportsQuery : IReportsHeader
  14. {
  15. /// <summary>
  16. /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.GetActivityLogs has
  17. /// query limit. </summary>
  18. /// <value>
  19. /// true if this MediaBrowser.Api.Reports.GetActivityLogs has query limit, false if not. </value>
  20. bool HasQueryLimit { get; set; }
  21. /// <summary> Gets or sets who group this MediaBrowser.Api.Reports.GetActivityLogs. </summary>
  22. /// <value> Describes who group this MediaBrowser.Api.Reports.GetActivityLogs. </value>
  23. string GroupBy { get; set; }
  24. /// <summary>
  25. /// Skips over a given number of items within the results. Use for paging.
  26. /// </summary>
  27. /// <value>The start index.</value>
  28. int? StartIndex { get; set; }
  29. /// <summary>
  30. /// The maximum number of items to return
  31. /// </summary>
  32. /// <value>The limit.</value>
  33. int? Limit { get; set; }
  34. }
  35. public interface IReportsHeader
  36. {
  37. /// <summary> Gets or sets the report view. </summary>
  38. /// <value> The report view. </value>
  39. string ReportView { get; set; }
  40. /// <summary> Gets or sets the report columns. </summary>
  41. /// <value> The report columns. </value>
  42. string ReportColumns { get; set; }
  43. /// <summary> Gets or sets a list of types of the include items. </summary>
  44. /// <value> A list of types of the include items. </value>
  45. string IncludeItemTypes { get; set; }
  46. /// <summary> Gets or sets a list of types of the displays. </summary>
  47. /// <value> A list of types of the displays. </value>
  48. string DisplayType { get; set; }
  49. }
  50. public class BaseReportRequest : BaseItemsRequest, IReportsQuery
  51. {
  52. /// <summary> Gets or sets the report view. </summary>
  53. /// <value> The report view. </value>
  54. [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportStatistics, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
  55. public string ReportView { get; set; }
  56. /// <summary> Gets or sets the report view. </summary>
  57. /// <value> The report view. </value>
  58. [ApiMember(Name = "DisplayType", Description = "The report display type. Values (None, Screen, Export, ScreenExport)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
  59. public string DisplayType { get; set; }
  60. /// <summary>
  61. /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.BaseReportRequest has
  62. /// query limit. </summary>
  63. /// <value>
  64. /// true if this MediaBrowser.Api.Reports.BaseReportRequest has query limit, false if not. </value>
  65. [ApiMember(Name = "HasQueryLimit", Description = "Optional. If specified, results will include all records.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
  66. public bool HasQueryLimit { get; set; }
  67. /// <summary>
  68. /// Gets or sets who group this MediaBrowser.Api.Reports.BaseReportRequest. </summary>
  69. /// <value> Describes who group this MediaBrowser.Api.Reports.BaseReportRequest. </value>
  70. [ApiMember(Name = "GroupBy", Description = "Optional. If specified, results will include grouped records.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  71. public string GroupBy { get; set; }
  72. /// <summary> Gets or sets the report columns. </summary>
  73. /// <value> The report columns. </value>
  74. [ApiMember(Name = "ReportColumns", Description = "Optional. The columns to show.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  75. public string ReportColumns { get; set; }
  76. }
  77. [Route("/Reports/Items", "GET", Summary = "Gets reports based on library items")]
  78. public class GetItemReport : BaseReportRequest, IReturn<ReportResult>
  79. {
  80. }
  81. [Route("/Reports/Headers", "GET", Summary = "Gets reports headers based on library items")]
  82. public class GetReportHeaders : IReturn<List<ReportHeader>>, IReportsHeader
  83. {
  84. /// <summary> Gets or sets the report view. </summary>
  85. /// <value> The report view. </value>
  86. [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportStatistics, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
  87. public string ReportView { get; set; }
  88. /// <summary> Gets or sets the report view. </summary>
  89. /// <value> The report view. </value>
  90. [ApiMember(Name = "DisplayType", Description = "The report display type. Values (None, Screen, Export, ScreenExport)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
  91. public string DisplayType { get; set; }
  92. /// <summary> Gets or sets a list of types of the include items. </summary>
  93. /// <value> A list of types of the include items. </value>
  94. [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)]
  95. public string IncludeItemTypes { get; set; }
  96. /// <summary> Gets or sets the report columns. </summary>
  97. /// <value> The report columns. </value>
  98. [ApiMember(Name = "ReportColumns", Description = "Optional. The columns to show.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  99. public string ReportColumns { get; set; }
  100. }
  101. [Route("/Reports/Statistics", "GET", Summary = "Gets reports statistics based on library items")]
  102. public class GetReportStatistics : BaseReportRequest, IReturn<ReportStatResult>
  103. {
  104. public int? TopItems { get; set; }
  105. }
  106. [Route("/Reports/Items/Download", "GET", Summary = "Downloads report")]
  107. public class GetReportDownload : BaseReportRequest, IReportsDownload
  108. {
  109. public GetReportDownload()
  110. {
  111. ExportType = ReportExportType.CSV;
  112. }
  113. public ReportExportType ExportType { get; set; }
  114. /// <summary> Gets or sets the minimum date. </summary>
  115. /// <value> The minimum date. </value>
  116. [ApiMember(Name = "MinDate", Description = "Optional. The minimum date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
  117. public string MinDate { get; set; }
  118. }
  119. [Route("/Reports/Activities", "GET", Summary = "Gets activities entries")]
  120. public class GetActivityLogs : IReturn<ReportResult>, IReportsQuery, IReportsDownload
  121. {
  122. /// <summary> Gets or sets the report view. </summary>
  123. /// <value> The report view. </value>
  124. [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportStatistics, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
  125. public string ReportView { get; set; }
  126. /// <summary> Gets or sets the report view. </summary>
  127. /// <value> The report view. </value>
  128. [ApiMember(Name = "DisplayType", Description = "The report display type. Values (None, Screen, Export, ScreenExport)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
  129. public string DisplayType { get; set; }
  130. /// <summary>
  131. /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.GetActivityLogs has
  132. /// query limit. </summary>
  133. /// <value>
  134. /// true if this MediaBrowser.Api.Reports.GetActivityLogs has query limit, false if not. </value>
  135. [ApiMember(Name = "HasQueryLimit", Description = "Optional. If specified, results will include all records.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
  136. public bool HasQueryLimit { get; set; }
  137. /// <summary> Gets or sets who group this MediaBrowser.Api.Reports.GetActivityLogs. </summary>
  138. /// <value> Describes who group this MediaBrowser.Api.Reports.GetActivityLogs. </value>
  139. [ApiMember(Name = "GroupBy", Description = "Optional. If specified, results will include grouped records.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  140. public string GroupBy { get; set; }
  141. /// <summary> Gets or sets the report columns. </summary>
  142. /// <value> The report columns. </value>
  143. [ApiMember(Name = "ReportColumns", Description = "Optional. The columns to show.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  144. public string ReportColumns { get; set; }
  145. /// <summary>
  146. /// Skips over a given number of items within the results. Use for paging.
  147. /// </summary>
  148. /// <value>The start index.</value>
  149. [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")]
  150. public int? StartIndex { get; set; }
  151. /// <summary>
  152. /// The maximum number of items to return
  153. /// </summary>
  154. /// <value>The limit.</value>
  155. [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  156. public int? Limit { get; set; }
  157. /// <summary> Gets or sets the minimum date. </summary>
  158. /// <value> The minimum date. </value>
  159. [ApiMember(Name = "MinDate", Description = "Optional. The minimum date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
  160. public string MinDate { get; set; }
  161. [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)]
  162. public string IncludeItemTypes { get; set; }
  163. }
  164. }