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.
36 lines
1.0 KiB
36 lines
1.0 KiB
using MediaBrowser.Common.Net.Handlers;
|
|
using MediaBrowser.Controller.Entities;
|
|
using MediaBrowser.Model.DTO;
|
|
using System.ComponentModel.Composition;
|
|
using System.Net;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MediaBrowser.Api.HttpHandlers
|
|
{
|
|
/// <summary>
|
|
/// Provides a handler to retrieve a single item
|
|
/// </summary>
|
|
[Export(typeof(BaseHandler))]
|
|
public class ItemHandler : BaseSerializationHandler<DTOBaseItem>
|
|
{
|
|
public override bool HandlesRequest(HttpListenerRequest request)
|
|
{
|
|
return ApiService.IsApiUrlMatch("item", request);
|
|
}
|
|
|
|
protected override Task<DTOBaseItem> GetObjectToSerialize()
|
|
{
|
|
User user = ApiService.GetUserById(QueryString["userid"], true);
|
|
|
|
BaseItem item = ApiService.GetItemById(QueryString["id"]);
|
|
|
|
if (item == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return ApiService.GetDTOBaseItem(item, user);
|
|
}
|
|
}
|
|
}
|