jellyfin-server/MediaBrowser.Api/HttpHandlers/UsersHandler.cs
LukePulverenti Luke Pulverenti luke pulverenti 93b42641d2 Switched to MEF to register http handlers
2012-09-08 10:52:13 -04:00

26 lines
815 B
C#

using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Controller;
using MediaBrowser.Model.DTO;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
namespace MediaBrowser.Api.HttpHandlers
{
[Export(typeof(BaseHandler))]
class UsersHandler : BaseSerializationHandler<IEnumerable<DTOUser>>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("users", request);
}
protected override Task<IEnumerable<DTOUser>> GetObjectToSerialize()
{
return Task.FromResult<IEnumerable<DTOUser>>(Kernel.Instance.Users.Select(u => ApiService.GetDTOUser(u)));
}
}
}