jellyfin/MediaBrowser.Api/HttpHandlers/ItemListHandler.cs

43 lines
979 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Api.HttpHandlers
{
public abstract class ItemListHandler : JsonHandler
{
public ItemListHandler(RequestContext ctx)
: base(ctx)
{
}
protected sealed override object ObjectToSerialize
{
get
{
return ItemsToSerialize.Select(i =>
{
return ItemHandler.GetSerializationObject(i, false, UserId);
});
}
}
protected abstract IEnumerable<BaseItem> ItemsToSerialize
{
get;
}
protected Guid UserId
{
get
{
return Guid.Parse(QueryString["userid"]);
}
}
}
}