Made BaseJsonHandler strongly typed. Moved DTO entities to their own DTO namespace in Model.

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti
2012-08-17 09:16:50 -04:00
parent 8a2e0badae
commit 5c094afd7e
26 changed files with 85 additions and 74 deletions

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Users;
namespace MediaBrowser.Model.DTO
{
/// <summary>
/// This is a concrete class that the UI can use to deserialize
/// It is flat in the sense that it will be used regardless of the type of BaseItem involved
/// </summary>
public class ApiBaseItem : BaseItem
{
// Series properties
public string Status { get; set; }
public IEnumerable<DayOfWeek> AirDays { get; set; }
public string AirTime { get; set; }
}
/// <summary>
/// This is the full return object when requesting an Item
/// </summary>
public class BaseItemWrapper<T>
where T : BaseItem
{
public T Item { get; set; }
public UserItemData UserItemData { get; set; }
public IEnumerable<BaseItemWrapper<T>> Children { get; set; }
public bool IsFolder { get; set; }
public Guid? ParentId { get; set; }
public string Type { get; set; }
public bool IsType(Type type)
{
return IsType(type.Name);
}
public bool IsType(string type)
{
return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
}
public IEnumerable<PersonInfo> People { get; set; }
/// <summary>
/// If the item does not have a logo, this will hold the Id of the Parent that has one.
/// </summary>
public Guid? ParentLogoItemId { get; set; }
public Guid? ParentBackdropItemId { get; set; }
public int? ParentBackdropCount { get; set; }
}
/// <summary>
/// This is strictly for convenience so the UI's don't have to use the verbose generic syntax of BaseItemWrapper<ApiBaseItem>
/// </summary>
public class ApiBaseItemWrapper : BaseItemWrapper<ApiBaseItem>
{
}
}

View File

@@ -0,0 +1,19 @@

namespace MediaBrowser.Model.DTO
{
/// <summary>
/// This is a stub class used by the api to get IBN types along with their item counts
/// </summary>
public class CategoryInfo<T>
{
/// <summary>
/// The actual genre, year, studio, etc
/// </summary>
public T Item { get; set; }
/// <summary>
/// The number of items that have the genre, year, studio, etc
/// </summary>
public int ItemCount { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
namespace MediaBrowser.Model.DTO
{
/// <summary>
/// This is a serializable stub class that is used by the api to provide information about installed plugins.
/// </summary>
public class PluginInfo
{
public string Name { get; set; }
public string Path { get; set; }
public bool Enabled { get; set; }
public bool DownloadToUI { get; set; }
public DateTime ConfigurationDateLastModified { get; set; }
public Version Version { get; set; }
}
}