This commit is contained in:
Eric Reed 2013-03-08 14:21:38 -05:00
commit 810d6d5dc4
16 changed files with 82 additions and 66 deletions

View File

@ -13,12 +13,12 @@ namespace MediaBrowser.Api
/// <summary> /// <summary>
/// Class ServerEntryPoint /// Class ServerEntryPoint
/// </summary> /// </summary>
public class ServerEntryPoint : IServerEntryPoint public class ApiEntryPoint : IServerEntryPoint
{ {
/// <summary> /// <summary>
/// The instance /// The instance
/// </summary> /// </summary>
public static ServerEntryPoint Instance; public static ApiEntryPoint Instance;
/// <summary> /// <summary>
/// Gets or sets the logger. /// Gets or sets the logger.
@ -27,10 +27,10 @@ namespace MediaBrowser.Api
private ILogger Logger { get; set; } private ILogger Logger { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ServerEntryPoint" /> class. /// Initializes a new instance of the <see cref="ApiEntryPoint" /> class.
/// </summary> /// </summary>
/// <param name="logger">The logger.</param> /// <param name="logger">The logger.</param>
public ServerEntryPoint(ILogger logger) public ApiEntryPoint(ILogger logger)
{ {
Logger = logger; Logger = logger;

View File

@ -1,24 +0,0 @@
using System;
using System.Net;
namespace MediaBrowser.Api
{
/// <summary>
/// Contains some helpers for the api
/// </summary>
public static class ApiService
{
/// <summary>
/// Determines whether [is API URL match] [the specified URL].
/// </summary>
/// <param name="url">The URL.</param>
/// <param name="request">The request.</param>
/// <returns><c>true</c> if [is API URL match] [the specified URL]; otherwise, <c>false</c>.</returns>
public static bool IsApiUrlMatch(string url, HttpListenerRequest request)
{
url = "/api/" + url;
return request.Url.LocalPath.EndsWith(url, StringComparison.OrdinalIgnoreCase);
}
}
}

View File

@ -16,34 +16,49 @@ namespace MediaBrowser.Api
/// Class GetDirectoryContents /// Class GetDirectoryContents
/// </summary> /// </summary>
[Route("/Environment/DirectoryContents", "GET")] [Route("/Environment/DirectoryContents", "GET")]
[ServiceStack.ServiceHost.Api(Description = "Gets the contents of a given directory in the file system")]
public class GetDirectoryContents : IReturn<List<FileSystemEntryInfo>> public class GetDirectoryContents : IReturn<List<FileSystemEntryInfo>>
{ {
/// <summary> /// <summary>
/// Gets or sets the path. /// Gets or sets the path.
/// </summary> /// </summary>
/// <value>The path.</value> /// <value>The path.</value>
[ApiMember(Name = "Path", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Path { get; set; } public string Path { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether [include files]. /// Gets or sets a value indicating whether [include files].
/// </summary> /// </summary>
/// <value><c>true</c> if [include files]; otherwise, <c>false</c>.</value> /// <value><c>true</c> if [include files]; otherwise, <c>false</c>.</value>
[ApiMember(Name = "IncludeFiles", Description = "An optional filter to include or exclude files from the results.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public bool IncludeFiles { get; set; } public bool IncludeFiles { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether [include directories]. /// Gets or sets a value indicating whether [include directories].
/// </summary> /// </summary>
/// <value><c>true</c> if [include directories]; otherwise, <c>false</c>.</value> /// <value><c>true</c> if [include directories]; otherwise, <c>false</c>.</value>
[ApiMember(Name = "IncludeDirectories", Description = "An optional filter to include or exclude folders from the results.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public bool IncludeDirectories { get; set; } public bool IncludeDirectories { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether [include hidden]. /// Gets or sets a value indicating whether [include hidden].
/// </summary> /// </summary>
/// <value><c>true</c> if [include hidden]; otherwise, <c>false</c>.</value> /// <value><c>true</c> if [include hidden]; otherwise, <c>false</c>.</value>
[ApiMember(Name = "IncludeHidden", Description = "An optional filter to include or exclude hidden files and folders.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public bool IncludeHidden { get; set; } public bool IncludeHidden { get; set; }
public GetDirectoryContents()
{
IncludeDirectories = true;
IncludeFiles = true;
}
} }
/// <summary> /// <summary>
/// Class GetDrives /// Class GetDrives
/// </summary> /// </summary>
[Route("/Environment/Drives", "GET")] [Route("/Environment/Drives", "GET")]
[ServiceStack.ServiceHost.Api(Description = "Gets available drives from the server's file system")]
public class GetDrives : IReturn<List<FileSystemEntryInfo>> public class GetDrives : IReturn<List<FileSystemEntryInfo>>
{ {
} }
@ -51,8 +66,9 @@ namespace MediaBrowser.Api
/// <summary> /// <summary>
/// Class GetNetworkComputers /// Class GetNetworkComputers
/// </summary> /// </summary>
[Route("/Environment/NetworkComputers", "GET")] [Route("/Environment/NetworkDevices", "GET")]
public class GetNetworkComputers : IReturn<List<FileSystemEntryInfo>> [ServiceStack.ServiceHost.Api(Description = "Gets a list of devices on the network")]
public class GetNetworkDevices : IReturn<List<FileSystemEntryInfo>>
{ {
} }
@ -128,9 +144,9 @@ namespace MediaBrowser.Api
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public object Get(GetNetworkComputers request) public object Get(GetNetworkDevices request)
{ {
var result = GetNetworkComputers().ToList(); var result = GetNetworkDevices().ToList();
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
@ -155,7 +171,7 @@ namespace MediaBrowser.Api
/// Gets the network computers. /// Gets the network computers.
/// </summary> /// </summary>
/// <returns>IEnumerable{FileSystemEntryInfo}.</returns> /// <returns>IEnumerable{FileSystemEntryInfo}.</returns>
private IEnumerable<FileSystemEntryInfo> GetNetworkComputers() private IEnumerable<FileSystemEntryInfo> GetNetworkDevices()
{ {
return _networkManager.GetNetworkDevices().Select(c => new FileSystemEntryInfo return _networkManager.GetNetworkDevices().Select(c => new FileSystemEntryInfo
{ {

View File

@ -194,11 +194,11 @@ var ApiClient = {
}, },
/** /**
* Gets a list of network computers from the server * Gets a list of network devices from the server
*/ */
getNetworkComputers: function () { getNetworkDevices: function () {
var url = ApiClient.getUrl("Environment/NetworkComputers"); var url = ApiClient.getUrl("Environment/NetworkDevices");
return $.getJSON(url); return $.getJSON(url);
}, },

View File

@ -14,6 +14,7 @@ namespace MediaBrowser.Api
/// Class GetCultures /// Class GetCultures
/// </summary> /// </summary>
[Route("/Localization/Cultures", "GET")] [Route("/Localization/Cultures", "GET")]
[ServiceStack.ServiceHost.Api(Description = "Gets known cultures")]
public class GetCultures : IReturn<List<CultureDto>> public class GetCultures : IReturn<List<CultureDto>>
{ {
} }
@ -22,6 +23,7 @@ namespace MediaBrowser.Api
/// Class GetCountries /// Class GetCountries
/// </summary> /// </summary>
[Route("/Localization/Countries", "GET")] [Route("/Localization/Countries", "GET")]
[ServiceStack.ServiceHost.Api(Description = "Gets known countries")]
public class GetCountries : IReturn<List<CountryInfo>> public class GetCountries : IReturn<List<CountryInfo>>
{ {
} }
@ -30,6 +32,7 @@ namespace MediaBrowser.Api
/// Class ParentalRatings /// Class ParentalRatings
/// </summary> /// </summary>
[Route("/Localization/ParentalRatings", "GET")] [Route("/Localization/ParentalRatings", "GET")]
[ServiceStack.ServiceHost.Api(Description = "Gets known parental ratings")]
public class GetParentalRatings : IReturn<List<ParentalRating>> public class GetParentalRatings : IReturn<List<ParentalRating>>
{ {
} }

View File

@ -81,7 +81,6 @@
<Compile Include="..\SharedVersion.cs"> <Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link> <Link>Properties\SharedVersion.cs</Link>
</Compile> </Compile>
<Compile Include="ApiService.cs" />
<Compile Include="EnvironmentService.cs" /> <Compile Include="EnvironmentService.cs" />
<Compile Include="Images\ImageRequest.cs" /> <Compile Include="Images\ImageRequest.cs" />
<Compile Include="Images\ImageService.cs" /> <Compile Include="Images\ImageService.cs" />
@ -105,7 +104,7 @@
<Compile Include="PluginService.cs" /> <Compile Include="PluginService.cs" />
<Compile Include="ScheduledTasks\ScheduledTaskService.cs" /> <Compile Include="ScheduledTasks\ScheduledTaskService.cs" />
<Compile Include="ScheduledTasks\ScheduledTasksWebSocketListener.cs" /> <Compile Include="ScheduledTasks\ScheduledTasksWebSocketListener.cs" />
<Compile Include="ServerEntryPoint.cs" /> <Compile Include="ApiEntryPoint.cs" />
<Compile Include="SystemService.cs" /> <Compile Include="SystemService.cs" />
<Compile Include="UserLibrary\BaseItemsByNameService.cs" /> <Compile Include="UserLibrary\BaseItemsByNameService.cs" />
<Compile Include="UserLibrary\GenresService.cs" /> <Compile Include="UserLibrary\GenresService.cs" />

View File

@ -16,12 +16,14 @@ namespace MediaBrowser.Api
/// Class GetPackage /// Class GetPackage
/// </summary> /// </summary>
[Route("/Packages/{Name}", "GET")] [Route("/Packages/{Name}", "GET")]
[ServiceStack.ServiceHost.Api(("Gets a package, by name"))]
public class GetPackage : IReturn<PackageInfo> public class GetPackage : IReturn<PackageInfo>
{ {
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.
/// </summary> /// </summary>
/// <value>The name.</value> /// <value>The name.</value>
[ApiMember(Name = "Name", Description = "The name of the package", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Name { get; set; } public string Name { get; set; }
} }
@ -29,12 +31,14 @@ namespace MediaBrowser.Api
/// Class GetPackages /// Class GetPackages
/// </summary> /// </summary>
[Route("/Packages", "GET")] [Route("/Packages", "GET")]
[ServiceStack.ServiceHost.Api(("Gets available packages"))]
public class GetPackages : IReturn<List<PackageInfo>> public class GetPackages : IReturn<List<PackageInfo>>
{ {
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.
/// </summary> /// </summary>
/// <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")]
public PackageType? PackageType { get; set; } public PackageType? PackageType { get; set; }
} }
@ -42,12 +46,14 @@ namespace MediaBrowser.Api
/// 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"))]
public class GetPackageVersionUpdates : IReturn<List<PackageVersionInfo>> public class GetPackageVersionUpdates : IReturn<List<PackageVersionInfo>>
{ {
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.
/// </summary> /// </summary>
/// <value>The name.</value> /// <value>The name.</value>
[ApiMember(Name = "PackageType", Description = "Package type filter (System/UserInstalled)", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
public PackageType PackageType { get; set; } public PackageType PackageType { get; set; }
} }
@ -55,24 +61,28 @@ 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"))]
public class InstallPackage : IReturnVoid public class InstallPackage : IReturnVoid
{ {
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.
/// </summary> /// </summary>
/// <value>The name.</value> /// <value>The name.</value>
[ApiMember(Name = "Name", Description = "Package name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// Gets or sets the version. /// Gets or sets the version.
/// </summary> /// </summary>
/// <value>The version.</value> /// <value>The version.</value>
[ApiMember(Name = "Version", Description = "Optional version. Defaults to latest version.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string Version { get; set; } public string Version { get; set; }
/// <summary> /// <summary>
/// Gets or sets the update class. /// Gets or sets the update class.
/// </summary> /// </summary>
/// <value>The update class.</value> /// <value>The update class.</value>
[ApiMember(Name = "UpdateClass", Description = "Optional update class (Dev, Beta, Release). Defaults to Release.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public PackageVersionClass UpdateClass { get; set; } public PackageVersionClass UpdateClass { get; set; }
} }
@ -80,12 +90,14 @@ 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"))]
public class CancelPackageInstallation : IReturnVoid public class CancelPackageInstallation : IReturnVoid
{ {
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Installation Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public Guid Id { get; set; } public Guid Id { get; set; }
} }

View File

@ -516,7 +516,7 @@ namespace MediaBrowser.Api.Playback
EnableRaisingEvents = true EnableRaisingEvents = true
}; };
ServerEntryPoint.Instance.OnTranscodeBeginning(outputPath, TranscodingJobType, process); ApiEntryPoint.Instance.OnTranscodeBeginning(outputPath, TranscodingJobType, process);
Logger.Info(process.StartInfo.FileName + " " + process.StartInfo.Arguments); Logger.Info(process.StartInfo.FileName + " " + process.StartInfo.Arguments);
@ -535,7 +535,7 @@ namespace MediaBrowser.Api.Playback
{ {
Logger.ErrorException("Error starting ffmpeg", ex); Logger.ErrorException("Error starting ffmpeg", ex);
ServerEntryPoint.Instance.OnTranscodeFailedToStart(outputPath, TranscodingJobType); ApiEntryPoint.Instance.OnTranscodeFailedToStart(outputPath, TranscodingJobType);
state.LogFileStream.Dispose(); state.LogFileStream.Dispose();
@ -586,7 +586,7 @@ namespace MediaBrowser.Api.Playback
process.Dispose(); process.Dispose();
ServerEntryPoint.Instance.OnTranscodingFinished(outputFilePath, TranscodingJobType); ApiEntryPoint.Instance.OnTranscodingFinished(outputFilePath, TranscodingJobType);
if (!exitCode.HasValue || exitCode.Value != 0) if (!exitCode.HasValue || exitCode.Value != 0)
{ {

View File

@ -77,7 +77,7 @@ namespace MediaBrowser.Api.Playback.Hls
} }
else else
{ {
ServerEntryPoint.Instance.OnTranscodeBeginRequest(playlist, TranscodingJobType.Hls); ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlist, TranscodingJobType.Hls);
} }
// Get the current playlist text and convert to bytes // Get the current playlist text and convert to bytes
@ -94,7 +94,7 @@ namespace MediaBrowser.Api.Playback.Hls
} }
finally finally
{ {
ServerEntryPoint.Instance.OnTranscodeEndRequest(playlist, TranscodingJobType.Hls); ApiEntryPoint.Instance.OnTranscodeEndRequest(playlist, TranscodingJobType.Hls);
} }
} }

View File

@ -104,7 +104,7 @@ namespace MediaBrowser.Api.Playback.Progressive
var outputPath = GetOutputFilePath(state); var outputPath = GetOutputFilePath(state);
if (File.Exists(outputPath) && !ServerEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive)) if (File.Exists(outputPath) && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive))
{ {
return ToStaticFileResult(outputPath); return ToStaticFileResult(outputPath);
} }
@ -130,7 +130,7 @@ namespace MediaBrowser.Api.Playback.Progressive
} }
else else
{ {
ServerEntryPoint.Instance.OnTranscodeBeginRequest(outputPath, TranscodingJobType.Progressive); ApiEntryPoint.Instance.OnTranscodeBeginRequest(outputPath, TranscodingJobType.Progressive);
} }
return new ProgressiveStreamWriter return new ProgressiveStreamWriter

View File

@ -41,7 +41,7 @@ namespace MediaBrowser.Api.Playback.Progressive
} }
finally finally
{ {
ServerEntryPoint.Instance.OnTranscodeEndRequest(Path, TranscodingJobType.Progressive); ApiEntryPoint.Instance.OnTranscodeEndRequest(Path, TranscodingJobType.Progressive);
} }
} }

View File

@ -19,6 +19,7 @@ namespace MediaBrowser.Api
/// Class Plugins /// Class Plugins
/// </summary> /// </summary>
[Route("/Plugins", "GET")] [Route("/Plugins", "GET")]
[ServiceStack.ServiceHost.Api(("Gets a list of currently installed plugins"))]
public class GetPlugins : IReturn<List<PluginInfo>> public class GetPlugins : IReturn<List<PluginInfo>>
{ {
} }
@ -27,12 +28,14 @@ namespace MediaBrowser.Api
/// Class GetPluginAssembly /// Class GetPluginAssembly
/// </summary> /// </summary>
[Route("/Plugins/{Id}/Assembly", "GET")] [Route("/Plugins/{Id}/Assembly", "GET")]
[ServiceStack.ServiceHost.Api(("Gets a plugin assembly file"))]
public class GetPluginAssembly public class GetPluginAssembly
{ {
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public Guid Id { get; set; } public Guid Id { get; set; }
} }
@ -40,12 +43,14 @@ namespace MediaBrowser.Api
/// Class UninstallPlugin /// Class UninstallPlugin
/// </summary> /// </summary>
[Route("/Plugins/{Id}", "DELETE")] [Route("/Plugins/{Id}", "DELETE")]
[ServiceStack.ServiceHost.Api(("Uninstalls a plugin"))]
public class UninstallPlugin : IReturnVoid public class UninstallPlugin : IReturnVoid
{ {
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public Guid Id { get; set; } public Guid Id { get; set; }
} }
@ -53,12 +58,14 @@ namespace MediaBrowser.Api
/// Class GetPluginConfiguration /// Class GetPluginConfiguration
/// </summary> /// </summary>
[Route("/Plugins/{Id}/Configuration", "GET")] [Route("/Plugins/{Id}/Configuration", "GET")]
[ServiceStack.ServiceHost.Api(("Gets a plugin's configuration"))]
public class GetPluginConfiguration public class GetPluginConfiguration
{ {
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public Guid Id { get; set; } public Guid Id { get; set; }
} }
@ -66,12 +73,14 @@ namespace MediaBrowser.Api
/// Class UpdatePluginConfiguration /// Class UpdatePluginConfiguration
/// </summary> /// </summary>
[Route("/Plugins/{Id}/Configuration", "POST")] [Route("/Plugins/{Id}/Configuration", "POST")]
[ServiceStack.ServiceHost.Api(("Updates a plugin's configuration"))]
public class UpdatePluginConfiguration : IRequiresRequestStream, IReturnVoid public class UpdatePluginConfiguration : IRequiresRequestStream, IReturnVoid
{ {
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public Guid Id { get; set; } public Guid Id { get; set; }
/// <summary> /// <summary>
@ -85,12 +94,14 @@ namespace MediaBrowser.Api
/// Class GetPluginConfigurationFile /// Class GetPluginConfigurationFile
/// </summary> /// </summary>
[Route("/Plugins/{Id}/ConfigurationFile", "GET")] [Route("/Plugins/{Id}/ConfigurationFile", "GET")]
[ServiceStack.ServiceHost.Api(("Gets a plugin's configuration file, in plain text"))]
public class GetPluginConfigurationFile public class GetPluginConfigurationFile
{ {
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public Guid Id { get; set; } public Guid Id { get; set; }
} }
@ -98,6 +109,7 @@ namespace MediaBrowser.Api
/// Class GetPluginSecurityInfo /// Class GetPluginSecurityInfo
/// </summary> /// </summary>
[Route("/Plugins/SecurityInfo", "GET")] [Route("/Plugins/SecurityInfo", "GET")]
[ServiceStack.ServiceHost.Api(("Gets plugin registration information"))]
public class GetPluginSecurityInfo : IReturn<PluginSecurityInfo> public class GetPluginSecurityInfo : IReturn<PluginSecurityInfo>
{ {
} }
@ -106,6 +118,7 @@ namespace MediaBrowser.Api
/// Class UpdatePluginSecurityInfo /// Class UpdatePluginSecurityInfo
/// </summary> /// </summary>
[Route("/Plugins/SecurityInfo", "POST")] [Route("/Plugins/SecurityInfo", "POST")]
[ServiceStack.ServiceHost.Api(("Updates plugin registration information"))]
public class UpdatePluginSecurityInfo : PluginSecurityInfo, IReturnVoid public class UpdatePluginSecurityInfo : PluginSecurityInfo, IReturnVoid
{ {
} }

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
@ -17,6 +16,7 @@ namespace MediaBrowser.Api
/// Class GetSystemInfo /// Class GetSystemInfo
/// </summary> /// </summary>
[Route("/System/Info", "GET")] [Route("/System/Info", "GET")]
[ServiceStack.ServiceHost.Api(Description = "Gets information about the server")]
public class GetSystemInfo : IReturn<SystemInfo> public class GetSystemInfo : IReturn<SystemInfo>
{ {
@ -32,6 +32,7 @@ namespace MediaBrowser.Api
} }
[Route("/System/Shutdown", "POST")] [Route("/System/Shutdown", "POST")]
[ServiceStack.ServiceHost.Api(("Shuts down the application"))]
public class ShutdownApplication public class ShutdownApplication
{ {
} }
@ -40,6 +41,7 @@ namespace MediaBrowser.Api
/// Class GetConfiguration /// Class GetConfiguration
/// </summary> /// </summary>
[Route("/System/Configuration", "GET")] [Route("/System/Configuration", "GET")]
[ServiceStack.ServiceHost.Api(("Gets application configuration"))]
public class GetConfiguration : IReturn<ServerConfiguration> public class GetConfiguration : IReturn<ServerConfiguration>
{ {
@ -49,6 +51,7 @@ namespace MediaBrowser.Api
/// Class UpdateConfiguration /// Class UpdateConfiguration
/// </summary> /// </summary>
[Route("/System/Configuration", "POST")] [Route("/System/Configuration", "POST")]
[ServiceStack.ServiceHost.Api(("Updates application configuration"))]
public class UpdateConfiguration : ServerConfiguration, IReturnVoid public class UpdateConfiguration : ServerConfiguration, IReturnVoid
{ {
} }

View File

@ -24,6 +24,7 @@ namespace MediaBrowser.Api
/// Class GetUser /// Class GetUser
/// </summary> /// </summary>
[Route("/Users/{Id}", "GET")] [Route("/Users/{Id}", "GET")]
[ServiceStack.ServiceHost.Api(Description = "Gets a user by Id")]
public class GetUser : IReturn<UserDto> public class GetUser : IReturn<UserDto>
{ {
/// <summary> /// <summary>
@ -38,13 +39,14 @@ namespace MediaBrowser.Api
/// Class DeleteUser /// Class DeleteUser
/// </summary> /// </summary>
[Route("/Users/{Id}", "DELETE")] [Route("/Users/{Id}", "DELETE")]
[ServiceStack.ServiceHost.Api(Description = "Deletes a user")]
public class DeleteUser : IReturnVoid public class DeleteUser : IReturnVoid
{ {
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] [ApiMember(Name = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public Guid Id { get; set; } public Guid Id { get; set; }
} }
@ -52,20 +54,21 @@ namespace MediaBrowser.Api
/// Class AuthenticateUser /// Class AuthenticateUser
/// </summary> /// </summary>
[Route("/Users/{Id}/Authenticate", "POST")] [Route("/Users/{Id}/Authenticate", "POST")]
[ServiceStack.ServiceHost.Api(Description = "Authenticates a user")]
public class AuthenticateUser : IReturnVoid public class AuthenticateUser : IReturnVoid
{ {
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] [ApiMember(Name = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public Guid Id { get; set; } public Guid Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the password. /// Gets or sets the password.
/// </summary> /// </summary>
/// <value>The password.</value> /// <value>The password.</value>
[ApiMember(Name = "Password", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "GET")] [ApiMember(Name = "Password", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "POST")]
public string Password { get; set; } public string Password { get; set; }
} }
@ -73,6 +76,7 @@ namespace MediaBrowser.Api
/// Class UpdateUserPassword /// Class UpdateUserPassword
/// </summary> /// </summary>
[Route("/Users/{Id}/Password", "POST")] [Route("/Users/{Id}/Password", "POST")]
[ServiceStack.ServiceHost.Api(Description = "Updates a user's password")]
public class UpdateUserPassword : IReturnVoid public class UpdateUserPassword : IReturnVoid
{ {
/// <summary> /// <summary>
@ -104,6 +108,7 @@ namespace MediaBrowser.Api
/// Class UpdateUser /// Class UpdateUser
/// </summary> /// </summary>
[Route("/Users/{Id}", "POST")] [Route("/Users/{Id}", "POST")]
[ServiceStack.ServiceHost.Api(Description = "Updates a user")]
public class UpdateUser : UserDto, IReturnVoid public class UpdateUser : UserDto, IReturnVoid
{ {
} }
@ -112,6 +117,7 @@ namespace MediaBrowser.Api
/// Class CreateUser /// Class CreateUser
/// </summary> /// </summary>
[Route("/Users", "POST")] [Route("/Users", "POST")]
[ServiceStack.ServiceHost.Api(Description = "Creates a user")]
public class CreateUser : UserDto, IReturn<UserDto> public class CreateUser : UserDto, IReturn<UserDto>
{ {
} }
@ -126,11 +132,6 @@ namespace MediaBrowser.Api
/// </summary> /// </summary>
private readonly IXmlSerializer _xmlSerializer; private readonly IXmlSerializer _xmlSerializer;
/// <summary>
/// The _json serializer
/// </summary>
private readonly IJsonSerializer _jsonSerializer;
/// <summary> /// <summary>
/// The _user manager /// The _user manager
/// </summary> /// </summary>
@ -140,22 +141,15 @@ namespace MediaBrowser.Api
/// Initializes a new instance of the <see cref="UserService" /> class. /// Initializes a new instance of the <see cref="UserService" /> class.
/// </summary> /// </summary>
/// <param name="xmlSerializer">The XML serializer.</param> /// <param name="xmlSerializer">The XML serializer.</param>
/// <param name="jsonSerializer">The json serializer.</param>
/// <exception cref="System.ArgumentNullException">xmlSerializer</exception> /// <exception cref="System.ArgumentNullException">xmlSerializer</exception>
public UserService(IXmlSerializer xmlSerializer, IJsonSerializer jsonSerializer, IUserManager userManager) public UserService(IXmlSerializer xmlSerializer, IUserManager userManager)
: base() : base()
{ {
if (jsonSerializer == null)
{
throw new ArgumentNullException("jsonSerializer");
}
if (xmlSerializer == null) if (xmlSerializer == null)
{ {
throw new ArgumentNullException("xmlSerializer"); throw new ArgumentNullException("xmlSerializer");
} }
_jsonSerializer = jsonSerializer;
_xmlSerializer = xmlSerializer; _xmlSerializer = xmlSerializer;
_userManager = userManager; _userManager = userManager;
} }

View File

@ -295,7 +295,7 @@ namespace MediaBrowser.ServerApplication
} }
// Include composable parts in the Api assembly // Include composable parts in the Api assembly
yield return typeof(ApiService).Assembly; yield return typeof(ApiEntryPoint).Assembly;
// Include composable parts in the Dashboard assembly // Include composable parts in the Dashboard assembly
yield return typeof(DashboardInfo).Assembly; yield return typeof(DashboardInfo).Assembly;

View File

@ -574,7 +574,7 @@ var Dashboard = {
var promise; var promise;
if (path === "Network") { if (path === "Network") {
promise = ApiClient.getNetworkComputers(); promise = ApiClient.getNetworkDevices();
} }
else if (path) { else if (path) {
promise = ApiClient.getDirectoryContents(path, { includeDirectories: true }); promise = ApiClient.getDirectoryContents(path, { includeDirectories: true });