jellyfin/Emby.Dlna/Api/DlnaService.cs

89 lines
2.7 KiB
C#
Raw Normal View History

#pragma warning disable CS1591
2020-04-02 10:49:58 -04:00
using System.Diagnostics.CodeAnalysis;
using System.Linq;
2017-08-24 15:52:19 -04:00
using MediaBrowser.Controller.Dlna;
2014-07-02 14:34:08 -04:00
using MediaBrowser.Controller.Net;
2014-03-26 15:21:29 -04:00
using MediaBrowser.Model.Dlna;
2016-10-25 15:02:04 -04:00
using MediaBrowser.Model.Services;
2014-03-26 15:21:29 -04:00
2018-09-12 13:26:21 -04:00
namespace Emby.Dlna.Api
2014-03-26 15:21:29 -04:00
{
[Route("/Dlna/ProfileInfos", "GET", Summary = "Gets a list of profiles")]
2017-08-19 15:43:35 -04:00
public class GetProfileInfos : IReturn<DeviceProfileInfo[]>
2014-03-26 15:21:29 -04:00
{
}
[Route("/Dlna/Profiles/{Id}", "DELETE", Summary = "Deletes a profile")]
public class DeleteProfile : IReturnVoid
{
[ApiMember(Name = "Id", Description = "Profile Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public string Id { get; set; }
}
[Route("/Dlna/Profiles/Default", "GET", Summary = "Gets the default profile")]
public class GetDefaultProfile : IReturn<DeviceProfile>
{
}
[Route("/Dlna/Profiles/{Id}", "GET", Summary = "Gets a single profile")]
public class GetProfile : IReturn<DeviceProfile>
{
[ApiMember(Name = "Id", Description = "Profile Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
}
2016-07-23 16:00:56 -04:00
[Route("/Dlna/Profiles/{Id}", "POST", Summary = "Updates a profile")]
2014-03-26 16:14:47 -04:00
public class UpdateProfile : DeviceProfile, IReturnVoid
{
}
[Route("/Dlna/Profiles", "POST", Summary = "Creates a profile")]
public class CreateProfile : DeviceProfile, IReturnVoid
{
}
2014-11-14 21:31:03 -05:00
[Authenticated(Roles = "Admin")]
2018-09-12 13:26:21 -04:00
public class DlnaService : IService
2014-03-26 15:21:29 -04:00
{
private readonly IDlnaManager _dlnaManager;
public DlnaService(IDlnaManager dlnaManager)
{
_dlnaManager = dlnaManager;
}
2020-04-02 10:49:58 -04:00
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "request", Justification = "Required for ServiceStack")]
2014-03-26 15:21:29 -04:00
public object Get(GetProfileInfos request)
{
2018-09-12 13:26:21 -04:00
return _dlnaManager.GetProfileInfos().ToArray();
2014-03-26 15:21:29 -04:00
}
public object Get(GetProfile request)
{
2018-09-12 13:26:21 -04:00
return _dlnaManager.GetProfile(request.Id);
2014-03-26 15:21:29 -04:00
}
2020-04-02 10:49:58 -04:00
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "request", Justification = "Required for ServiceStack")]
2014-03-26 15:21:29 -04:00
public object Get(GetDefaultProfile request)
{
2018-09-12 13:26:21 -04:00
return _dlnaManager.GetDefaultProfile();
2014-03-26 15:21:29 -04:00
}
public void Delete(DeleteProfile request)
{
_dlnaManager.DeleteProfile(request.Id);
}
2014-03-26 16:14:47 -04:00
public void Post(UpdateProfile request)
{
_dlnaManager.UpdateProfile(request);
}
public void Post(CreateProfile request)
{
_dlnaManager.CreateProfile(request);
}
2014-03-26 15:21:29 -04:00
}
}