ReportRequests.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. using MediaBrowser.Api.UserLibrary;
  2. using System.Collections.Generic;
  3. using MediaBrowser.Model.Services;
  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, 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, 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/Items/Download", "GET", Summary = "Downloads report")]
  102. public class GetReportDownload : BaseReportRequest, IReportsDownload
  103. {
  104. public GetReportDownload()
  105. {
  106. ExportType = ReportExportType.CSV;
  107. }
  108. public ReportExportType ExportType { get; set; }
  109. /// <summary> Gets or sets the minimum date. </summary>
  110. /// <value> The minimum date. </value>
  111. [ApiMember(Name = "MinDate", Description = "Optional. The minimum date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
  112. public string MinDate { get; set; }
  113. }
  114. [Route("/Reports/Activities", "GET", Summary = "Gets activities entries")]
  115. public class GetActivityLogs : IReturn<ReportResult>, IReportsQuery, IReportsDownload
  116. {
  117. /// <summary> Gets or sets the report view. </summary>
  118. /// <value> The report view. </value>
  119. [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
  120. public string ReportView { get; set; }
  121. /// <summary> Gets or sets the report view. </summary>
  122. /// <value> The report view. </value>
  123. [ApiMember(Name = "DisplayType", Description = "The report display type. Values (None, Screen, Export, ScreenExport)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
  124. public string DisplayType { get; set; }
  125. /// <summary>
  126. /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.GetActivityLogs has
  127. /// query limit. </summary>
  128. /// <value>
  129. /// true if this MediaBrowser.Api.Reports.GetActivityLogs has query limit, false if not. </value>
  130. [ApiMember(Name = "HasQueryLimit", Description = "Optional. If specified, results will include all records.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
  131. public bool HasQueryLimit { get; set; }
  132. /// <summary> Gets or sets who group this MediaBrowser.Api.Reports.GetActivityLogs. </summary>
  133. /// <value> Describes who group this MediaBrowser.Api.Reports.GetActivityLogs. </value>
  134. [ApiMember(Name = "GroupBy", Description = "Optional. If specified, results will include grouped records.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  135. public string GroupBy { get; set; }
  136. /// <summary> Gets or sets the report columns. </summary>
  137. /// <value> The report columns. </value>
  138. [ApiMember(Name = "ReportColumns", Description = "Optional. The columns to show.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  139. public string ReportColumns { get; set; }
  140. /// <summary>
  141. /// Skips over a given number of items within the results. Use for paging.
  142. /// </summary>
  143. /// <value>The start index.</value>
  144. [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")]
  145. public int? StartIndex { get; set; }
  146. /// <summary>
  147. /// The maximum number of items to return
  148. /// </summary>
  149. /// <value>The limit.</value>
  150. [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  151. public int? Limit { get; set; }
  152. /// <summary> Gets or sets the minimum date. </summary>
  153. /// <value> The minimum date. </value>
  154. [ApiMember(Name = "MinDate", Description = "Optional. The minimum date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
  155. public string MinDate { get; set; }
  156. [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)]
  157. public string IncludeItemTypes { get; set; }
  158. }
  159. }