2017-08-24 21:52:19 +02:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using MediaBrowser.Controller.Dlna;
|
2014-07-02 20:34:08 +02:00
|
|
|
|
using MediaBrowser.Controller.Net;
|
2014-03-26 20:21:29 +01:00
|
|
|
|
using MediaBrowser.Model.Dlna;
|
2016-10-25 21:02:04 +02:00
|
|
|
|
using MediaBrowser.Model.Services;
|
2014-03-26 20:21:29 +01:00
|
|
|
|
|
2014-04-10 17:06:54 +02:00
|
|
|
|
namespace MediaBrowser.Api.Dlna
|
2014-03-26 20:21:29 +01:00
|
|
|
|
{
|
|
|
|
|
[Route("/Dlna/ProfileInfos", "GET", Summary = "Gets a list of profiles")]
|
2017-08-19 21:43:35 +02:00
|
|
|
|
public class GetProfileInfos : IReturn<DeviceProfileInfo[]>
|
2014-03-26 20:21:29 +01: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 22:00:56 +02:00
|
|
|
|
[Route("/Dlna/Profiles/{Id}", "POST", Summary = "Updates a profile")]
|
2014-03-26 21:14:47 +01:00
|
|
|
|
public class UpdateProfile : DeviceProfile, IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/Dlna/Profiles", "POST", Summary = "Creates a profile")]
|
|
|
|
|
public class CreateProfile : DeviceProfile, IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-15 03:31:03 +01:00
|
|
|
|
[Authenticated(Roles = "Admin")]
|
2014-03-26 20:21:29 +01:00
|
|
|
|
public class DlnaService : BaseApiService
|
|
|
|
|
{
|
|
|
|
|
private readonly IDlnaManager _dlnaManager;
|
|
|
|
|
|
|
|
|
|
public DlnaService(IDlnaManager dlnaManager)
|
|
|
|
|
{
|
|
|
|
|
_dlnaManager = dlnaManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetProfileInfos request)
|
|
|
|
|
{
|
2017-08-19 21:43:35 +02:00
|
|
|
|
var result = _dlnaManager.GetProfileInfos().ToArray();
|
2014-03-26 20:21:29 +01:00
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetProfile request)
|
|
|
|
|
{
|
|
|
|
|
var result = _dlnaManager.GetProfile(request.Id);
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetDefaultProfile request)
|
|
|
|
|
{
|
|
|
|
|
var result = _dlnaManager.GetDefaultProfile();
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Delete(DeleteProfile request)
|
|
|
|
|
{
|
|
|
|
|
_dlnaManager.DeleteProfile(request.Id);
|
|
|
|
|
}
|
2014-03-26 21:14:47 +01:00
|
|
|
|
|
|
|
|
|
public void Post(UpdateProfile request)
|
|
|
|
|
{
|
|
|
|
|
_dlnaManager.UpdateProfile(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Post(CreateProfile request)
|
|
|
|
|
{
|
|
|
|
|
_dlnaManager.CreateProfile(request);
|
|
|
|
|
}
|
2014-03-26 20:21:29 +01:00
|
|
|
|
}
|
2016-07-23 22:00:56 +02:00
|
|
|
|
}
|