@@ -208,41 +208,130 @@ namespace Search {
208208 }
209209}
210210
211+ /**
212+ * Statistics namespace for querying usage and activity metrics
213+ */
211214namespace Statistics {
212215 /**
213- * Statistics parameters
216+ * Parameters for querying statistics data
214217 */
215218 model StatisticsParameters extends QueryParameters .FilterParameters {
219+ /**
220+ * The start date for aggregating statistics. If not provided, it will be set to one year before `aggregateTo`.
221+ */
216222 @ query aggregateFrom ? : plainDate ;
223+
224+ /**
225+ * The end date for aggregating statistics. If not provided, statistics up to the current date will be included.
226+ */
217227 @ query aggregateTo ? : plainDate ;
228+
229+ /**
230+ * The preferred time interval for aggregating statistics data. Determines how data points are grouped in the time series.
231+ * Note: There is a maximum limit of 1000 data points in the time series. If the requested interval combined with the
232+ * date range would exceed this limit, the interval will be automatically adjusted to a larger granularity to stay
233+ * within the limit. Default is "hour".
234+ */
235+ @ query aggregateInterval ? :
236+ | "hour"
237+ | "day"
238+ | "week"
239+ | "month"
240+ | "year" = "hour" ;
218241 }
242+ /**
243+ * Response containing statistics data with summary and optional time series
244+ */
219245 model StatisticsResponse {
220246 @ statusCode _ : 200 ;
221247
222248 @ body
223249 body : {
224- @ visibility (Lifecycle .Read ) innsynskrav ? : {
225- @ visibility (Lifecycle .Read ) count : integer ;
226- @ visibility (Lifecycle .Read ) interval : integer ;
227- @ visibility (Lifecycle .Read ) bucket : {
228- @ visibility (Lifecycle .Read ) time : utcDateTime ;
229- @ visibility (Lifecycle .Read ) count : integer ;
230- }[];
250+ /**
251+ * Aggregated summary of statistics over the entire queried period
252+ */
253+ @ visibility (Lifecycle .Read ) summary : {
254+ /**
255+ * Total number of entities created in the period
256+ */
257+ @ visibility (Lifecycle .Read ) createdCount : integer ;
258+
259+ /**
260+ * Total number of entities created with fulltext content in the period
261+ */
262+ @ visibility (Lifecycle .Read ) createdWithFulltextCount : integer ;
263+
264+ /**
265+ * Total number of innsynskrav (access requests) created in the period
266+ */
267+ @ visibility (Lifecycle .Read ) createdInnsynskravCount : integer ;
268+
269+ /**
270+ * Total number of document downloads in the period
271+ */
272+ @ visibility (Lifecycle .Read ) downloadCount : integer ;
231273 };
232- @ visibility (Lifecycle .Read ) download ? : {
233- @ visibility (Lifecycle .Read ) count : integer ;
234- @ visibility (Lifecycle .Read ) interval : integer ;
235- @ visibility (Lifecycle .Read ) bucket : {
236- @ visibility (Lifecycle .Read ) time : utcDateTime ;
237- @ visibility (Lifecycle .Read ) count : integer ;
238- }[];
274+
275+ @ visibility (Lifecycle .Read ) metadata : {
276+ /**
277+ * The aggregation interval used for the time series data
278+ */
279+ @ visibility (Lifecycle .Read ) aggregateInterval : string ;
280+
281+ /**
282+ * The start date for the aggregated statistics
283+ */
284+ @ visibility (Lifecycle .Read ) aggregateFrom ? : plainDate ;
285+
286+ /**
287+ * The end date for the aggregated statistics
288+ */
289+ @ visibility (Lifecycle .Read ) aggregateTo ? : plainDate ;
239290 };
291+
292+ /**
293+ * Time series data showing statistics broken down by the specified aggregation interval.
294+ * Each entry represents metrics for a specific time period.
295+ */
296+ @ visibility (Lifecycle .Read ) timeSeries ? : {
297+ /**
298+ * The timestamp for this time series data point
299+ */
300+ @ visibility (Lifecycle .Read ) time : utcDateTime ;
301+
302+ /**
303+ * Number of entities created during this time interval
304+ */
305+ @ visibility (Lifecycle .Read ) createdCount : integer ;
306+
307+ /**
308+ * Number of entities created with fulltext content during this time interval
309+ */
310+ @ visibility (Lifecycle .Read ) createdWithFulltextCount : integer ;
311+
312+ /**
313+ * Number of innsynskrav (access requests) created during this time interval
314+ */
315+ @ visibility (Lifecycle .Read ) createdInnsynskravCount : integer ;
316+
317+ /**
318+ * Number of document downloads during this time interval
319+ */
320+ @ visibility (Lifecycle .Read ) downloadCount : integer ;
321+ }[];
240322 };
241323 }
242324
325+ /**
326+ * Statistics API endpoints for querying usage and activity metrics
327+ */
243328 @ route ("/statistics" )
244329 @ tag ("Statistics" )
245330 interface Statistics {
331+ /**
332+ * Query statistics data with optional filtering and aggregation parameters.
333+ * Returns both a summary of total statistics and optional time series data.
334+ */
246335 @ route ("" )
247336 @ get
248337 query (... StatisticsParameters ): StatisticsResponse ;
0 commit comments