2012-09-07 16:17:39 +00:00
|
|
|
|
using MediaBrowser.Common.Net.Handlers;
|
2012-08-15 13:20:29 +00:00
|
|
|
|
using MediaBrowser.Controller;
|
2012-08-29 12:21:56 +00:00
|
|
|
|
using MediaBrowser.Model.DTO;
|
2012-09-07 16:17:39 +00:00
|
|
|
|
using System.Collections.Generic;
|
2012-09-08 14:52:13 +00:00
|
|
|
|
using System.ComponentModel.Composition;
|
2012-09-07 16:17:39 +00:00
|
|
|
|
using System.Linq;
|
2012-09-08 14:52:13 +00:00
|
|
|
|
using System.Net;
|
2012-09-07 16:17:39 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2012-07-16 16:50:44 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Api.HttpHandlers
|
|
|
|
|
{
|
2012-09-08 14:52:13 +00:00
|
|
|
|
[Export(typeof(BaseHandler))]
|
2012-09-02 05:30:25 +00:00
|
|
|
|
class UsersHandler : BaseSerializationHandler<IEnumerable<DTOUser>>
|
2012-07-16 16:50:44 +00:00
|
|
|
|
{
|
2012-09-08 14:52:13 +00:00
|
|
|
|
public override bool HandlesRequest(HttpListenerRequest request)
|
|
|
|
|
{
|
|
|
|
|
return ApiService.IsApiUrlMatch("users", request);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-29 12:21:56 +00:00
|
|
|
|
protected override Task<IEnumerable<DTOUser>> GetObjectToSerialize()
|
2012-07-16 16:50:44 +00:00
|
|
|
|
{
|
2012-08-29 12:21:56 +00:00
|
|
|
|
return Task.FromResult<IEnumerable<DTOUser>>(Kernel.Instance.Users.Select(u => ApiService.GetDTOUser(u)));
|
2012-07-16 16:50:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|