aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Reports/ReportRequests.cs
blob: b11e293d5bd0dc3247007b58963aaf2416a29f3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
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
    {
        /// <summary> Gets or sets the minimum date. </summary>
        /// <value> The minimum date. </value>
        string MinDate { get; set; }
    }

    /// <summary> Interface for reports query. </summary>
    public interface IReportsQuery : IReportsHeader
    {
        /// <summary>
        /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.GetActivityLogs has
        /// query limit. </summary>
        /// <value>
        /// true if this MediaBrowser.Api.Reports.GetActivityLogs has query limit, false if not. </value>
        bool HasQueryLimit { get; set; }
        /// <summary> Gets or sets who group this MediaBrowser.Api.Reports.GetActivityLogs. </summary>
        /// <value> Describes who group this MediaBrowser.Api.Reports.GetActivityLogs. </value>
        string GroupBy { get; set; }

        /// <summary>
        /// Skips over a given number of items within the results. Use for paging.
        /// </summary>
        /// <value>The start index.</value>
        int? StartIndex { get; set; }
        /// <summary>
        /// The maximum number of items to return
        /// </summary>
        /// <value>The limit.</value>
        int? Limit { get; set; }

    }
    public interface IReportsHeader
    {
        /// <summary> Gets or sets the report view. </summary>
        /// <value> The report view. </value>
        string ReportView { get; set; }

        /// <summary> Gets or sets the report columns. </summary>
        /// <value> The report columns. </value>
        string ReportColumns { get; set; }

        /// <summary> Gets or sets a list of types of the include items. </summary>
        /// <value> A list of types of the include items. </value>
        string IncludeItemTypes { get; set; }

        /// <summary> Gets or sets a list of types of the displays. </summary>
        /// <value> A list of types of the displays. </value>
        string DisplayType { get; set; }

    }

    public class BaseReportRequest : BaseItemsRequest, IReportsQuery
    {
        /// <summary> Gets or sets the report view. </summary>
        /// <value> The report view. </value>
        [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportStatistics, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
        public string ReportView { get; set; }
        
        /// <summary> Gets or sets the report view. </summary>
        /// <value> The report view. </value>
        [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; }

        /// <summary>
        /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.BaseReportRequest has
        /// query limit. </summary>
        /// <value>
        /// true if this MediaBrowser.Api.Reports.BaseReportRequest has query limit, false if not. </value>
        [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; }

        /// <summary>
        /// Gets or sets who group this MediaBrowser.Api.Reports.BaseReportRequest. </summary>
        /// <value> Describes who group this MediaBrowser.Api.Reports.BaseReportRequest. </value>
        [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; }

        /// <summary> Gets or sets the report columns. </summary>
        /// <value> The report columns. </value>
        [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<ReportResult>
	{

	}

	[Route("/Reports/Headers", "GET", Summary = "Gets reports headers based on library items")]
    public class GetReportHeaders : IReturn<List<ReportHeader>>, IReportsHeader
    {
        /// <summary> Gets or sets the report view. </summary>
        /// <value> The report view. </value>
        [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportStatistics, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
        public string ReportView { get; set; }

        /// <summary> Gets or sets the report view. </summary>
        /// <value> The report view. </value>
        [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; }

        /// <summary> Gets or sets a list of types of the include items. </summary>
        /// <value> A list of types of the include items. </value>
        [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; }

        /// <summary> Gets or sets the report columns. </summary>
        /// <value> The report columns. </value>
        [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<ReportStatResult>
	{
		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; }

        /// <summary> Gets or sets the minimum date. </summary>
        /// <value> The minimum date. </value>
        [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<ReportResult>, IReportsQuery, IReportsDownload
    {
        /// <summary> Gets or sets the report view. </summary>
        /// <value> The report view. </value>
        [ApiMember(Name = "ReportView", Description = "The report view. Values (ReportData, ReportStatistics, ReportActivities)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
        public string ReportView { get; set; }

        /// <summary> Gets or sets the report view. </summary>
        /// <value> The report view. </value>
        [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; }

        /// <summary>
        /// Gets or sets a value indicating whether this MediaBrowser.Api.Reports.GetActivityLogs has
        /// query limit. </summary>
        /// <value>
        /// true if this MediaBrowser.Api.Reports.GetActivityLogs has query limit, false if not. </value>
        [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; }

        /// <summary> Gets or sets who group this MediaBrowser.Api.Reports.GetActivityLogs. </summary>
        /// <value> Describes who group this MediaBrowser.Api.Reports.GetActivityLogs. </value>
        [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; }

        /// <summary> Gets or sets the report columns. </summary>
        /// <value> The report columns. </value>
        [ApiMember(Name = "ReportColumns", Description = "Optional. The columns to show.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
        public string ReportColumns { get; set; }

        /// <summary>
        /// Skips over a given number of items within the results. Use for paging.
        /// </summary>
        /// <value>The start index.</value>
        [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; }

        /// <summary>
        /// The maximum number of items to return
        /// </summary>
        /// <value>The limit.</value>
        [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; }

        /// <summary> Gets or sets the minimum date. </summary>
        /// <value> The minimum date. </value>
        [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; }
    }
}