add optional package filter and remove IUIPlugin interface

This commit is contained in:
Luke Pulverenti 2013-04-03 14:43:49 -04:00
parent 121a27854c
commit 5fb369f3e6
5 changed files with 14 additions and 36 deletions

View File

@ -30,7 +30,7 @@ namespace MediaBrowser.Api
/// Class GetPackages /// Class GetPackages
/// </summary> /// </summary>
[Route("/Packages", "GET")] [Route("/Packages", "GET")]
[ServiceStack.ServiceHost.Api(("Gets available packages"))] [Api(("Gets available packages"))]
public class GetPackages : IReturn<List<PackageInfo>> public class GetPackages : IReturn<List<PackageInfo>>
{ {
/// <summary> /// <summary>
@ -39,13 +39,16 @@ namespace MediaBrowser.Api
/// <value>The name.</value> /// <value>The name.</value>
[ApiMember(Name = "PackageType", Description = "Optional package type filter (System/UserInstalled)", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "PackageType", Description = "Optional package type filter (System/UserInstalled)", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public PackageType? PackageType { get; set; } public PackageType? PackageType { get; set; }
[ApiMember(Name = "Applications", Description = "Optional. Filter by target system type. Allows multiple, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET", AllowMultiple = true)]
public string Applications { get; set; }
} }
/// <summary> /// <summary>
/// Class GetPackageVersionUpdates /// Class GetPackageVersionUpdates
/// </summary> /// </summary>
[Route("/Packages/Updates", "GET")] [Route("/Packages/Updates", "GET")]
[ServiceStack.ServiceHost.Api(("Gets available package updates for currently installed packages"))] [Api(("Gets available package updates for currently installed packages"))]
public class GetPackageVersionUpdates : IReturn<List<PackageVersionInfo>> public class GetPackageVersionUpdates : IReturn<List<PackageVersionInfo>>
{ {
/// <summary> /// <summary>
@ -60,7 +63,7 @@ namespace MediaBrowser.Api
/// Class InstallPackage /// Class InstallPackage
/// </summary> /// </summary>
[Route("/Packages/Installed/{Name}", "POST")] [Route("/Packages/Installed/{Name}", "POST")]
[ServiceStack.ServiceHost.Api(("Installs a package"))] [Api(("Installs a package"))]
public class InstallPackage : IReturnVoid public class InstallPackage : IReturnVoid
{ {
/// <summary> /// <summary>
@ -89,7 +92,7 @@ namespace MediaBrowser.Api
/// Class CancelPackageInstallation /// Class CancelPackageInstallation
/// </summary> /// </summary>
[Route("/Packages/Installing/{Id}", "DELETE")] [Route("/Packages/Installing/{Id}", "DELETE")]
[ServiceStack.ServiceHost.Api(("Cancels a package installation"))] [Api(("Cancels a package installation"))]
public class CancelPackageInstallation : IReturnVoid public class CancelPackageInstallation : IReturnVoid
{ {
/// <summary> /// <summary>
@ -165,6 +168,13 @@ namespace MediaBrowser.Api
{ {
var packages = _installationManager.GetAvailablePackages(CancellationToken.None, request.PackageType, _appHost.ApplicationVersion).Result; var packages = _installationManager.GetAvailablePackages(CancellationToken.None, request.PackageType, _appHost.ApplicationVersion).Result;
if (!string.IsNullOrEmpty(request.Applications))
{
var apps = request.Applications.Split(',').Select(i => (PackageTargetSystem)Enum.Parse(typeof(PackageTargetSystem), i, true));
packages = packages.Where(p => apps.Contains(p.targetSystem));
}
return ToOptimizedResult(packages.ToList()); return ToOptimizedResult(packages.ToList());
} }

View File

@ -85,7 +85,6 @@
<Compile Include="Net\MimeTypes.cs" /> <Compile Include="Net\MimeTypes.cs" />
<Compile Include="Net\WebSocketConnectEventArgs.cs" /> <Compile Include="Net\WebSocketConnectEventArgs.cs" />
<Compile Include="Plugins\IPlugin.cs" /> <Compile Include="Plugins\IPlugin.cs" />
<Compile Include="Plugins\IUIPlugin.cs" />
<Compile Include="Progress\ActionableProgress.cs" /> <Compile Include="Progress\ActionableProgress.cs" />
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>

View File

@ -299,7 +299,6 @@ namespace MediaBrowser.Common.Plugins
var info = new PluginInfo var info = new PluginInfo
{ {
Name = Name, Name = Name,
DownloadToUI = this is IUIPlugin,
Version = Version.ToString(), Version = Version.ToString(),
AssemblyFileName = AssemblyFileName, AssemblyFileName = AssemblyFileName,
ConfigurationDateLastModified = ConfigurationDateLastModified, ConfigurationDateLastModified = ConfigurationDateLastModified,
@ -310,13 +309,6 @@ namespace MediaBrowser.Common.Plugins
ConfigurationFileName = ConfigurationFileName ConfigurationFileName = ConfigurationFileName
}; };
var uiPlugin = this as IUIPlugin;
if (uiPlugin != null)
{
info.MinimumRequiredUIVersion = uiPlugin.MinimumRequiredUIVersion.ToString();
}
return info; return info;
} }

View File

@ -1,16 +0,0 @@
using System;
namespace MediaBrowser.Common.Plugins
{
/// <summary>
/// Interface IUIPlugin
/// </summary>
public interface IUIPlugin : IPlugin
{
/// <summary>
/// Gets the minimum required UI version.
/// </summary>
/// <value>The minimum required UI version.</value>
Version MinimumRequiredUIVersion { get; }
}
}

View File

@ -17,13 +17,6 @@ namespace MediaBrowser.Model.Plugins
[ProtoMember(1)] [ProtoMember(1)]
public string Name { get; set; } public string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [download to UI].
/// </summary>
/// <value><c>true</c> if [download to UI]; otherwise, <c>false</c>.</value>
[ProtoMember(2)]
public bool DownloadToUI { get; set; }
/// <summary> /// <summary>
/// Gets or sets the configuration date last modified. /// Gets or sets the configuration date last modified.
/// </summary> /// </summary>