You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
2.0 KiB
51 lines
2.0 KiB
4 years ago
|
using System;
|
||
|
using System.Globalization;
|
||
|
using Jellyfin.Api.Constants;
|
||
|
using MediaBrowser.Model.Activity;
|
||
|
using MediaBrowser.Model.Querying;
|
||
|
using Microsoft.AspNetCore.Authorization;
|
||
|
using Microsoft.AspNetCore.Http;
|
||
|
using Microsoft.AspNetCore.Mvc;
|
||
|
|
||
4 years ago
|
namespace Jellyfin.Api.Controllers
|
||
4 years ago
|
{
|
||
|
/// <summary>
|
||
|
/// Activity log controller.
|
||
|
/// </summary>
|
||
4 years ago
|
[Route("/System/ActivityLog")]
|
||
4 years ago
|
[Authorize(Policy = Policies.RequiresElevation)]
|
||
|
public class ActivityLogController : BaseJellyfinApiController
|
||
|
{
|
||
|
private readonly IActivityManager _activityManager;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Initializes a new instance of the <see cref="ActivityLogController"/> class.
|
||
|
/// </summary>
|
||
|
/// <param name="activityManager">Instance of <see cref="IActivityManager"/> interface.</param>
|
||
|
public ActivityLogController(IActivityManager activityManager)
|
||
|
{
|
||
|
_activityManager = activityManager;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Gets activity log entries.
|
||
|
/// </summary>
|
||
|
/// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped from the results.</param>
|
||
|
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
||
|
/// <param name="minDate">Optional. The minimum date. Format = ISO.</param>
|
||
|
/// <param name="hasUserId">Optional. Only returns activities that have a user associated.</param>
|
||
|
/// <response code="200">Activity log returned.</response>
|
||
|
/// <returns>A <see cref="QueryResult{ActivityLogEntry}"/> containing the log entries.</returns>
|
||
4 years ago
|
[HttpGet("Entries")]
|
||
4 years ago
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||
|
public ActionResult<QueryResult<ActivityLogEntry>> GetLogEntries(
|
||
|
[FromQuery] int? startIndex,
|
||
|
[FromQuery] int? limit,
|
||
4 years ago
|
[FromQuery] DateTime? minDate,
|
||
4 years ago
|
bool? hasUserId)
|
||
|
{
|
||
4 years ago
|
return _activityManager.GetActivityLogEntries(minDate, hasUserId, startIndex, limit);
|
||
4 years ago
|
}
|
||
|
}
|
||
|
}
|