From 4c725e69a8bb96da1f69fc3d958c680b77712f81 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Mon, 4 Mar 2013 22:34:02 -0500 Subject: [PATCH] added swagger api docs --- .../HttpServer/SwaggerService.cs | 38 +++++++++++++ ...MediaBrowser.Common.Implementations.csproj | 53 +++++++++++++----- .../swagger-ui/index.html | 2 +- .../MediaBrowser.Controller.csproj | 1 - .../Library/LibraryManager.cs | 1 + ...MediaBrowser.Server.Implementations.csproj | 7 ++- .../{Tasks => }/ChapterImagesTask.cs | 2 +- .../{Tasks => }/ImageCleanupTask.cs | 2 +- .../ScheduledTasks/PeopleValidationTask.cs | 2 +- .../{Tasks => }/PluginUpdateTask.cs | 3 +- .../MainWindow.xaml | 7 ++- .../MainWindow.xaml.cs | 6 ++ .../MediaBrowser.ServerApplication.csproj | 3 + .../Html/css/images/clients/dlna.png | Bin 2914 -> 2071 bytes .../MediaBrowser.WebDashboard.csproj | 1 + 15 files changed, 105 insertions(+), 23 deletions(-) create mode 100644 MediaBrowser.Common.Implementations/HttpServer/SwaggerService.cs rename MediaBrowser.Server.Implementations/ScheduledTasks/{Tasks => }/ChapterImagesTask.cs (98%) rename MediaBrowser.Server.Implementations/ScheduledTasks/{Tasks => }/ImageCleanupTask.cs (99%) rename {MediaBrowser.Controller => MediaBrowser.Server.Implementations}/ScheduledTasks/PeopleValidationTask.cs (97%) rename MediaBrowser.Server.Implementations/ScheduledTasks/{Tasks => }/PluginUpdateTask.cs (97%) diff --git a/MediaBrowser.Common.Implementations/HttpServer/SwaggerService.cs b/MediaBrowser.Common.Implementations/HttpServer/SwaggerService.cs new file mode 100644 index 000000000..a4808834d --- /dev/null +++ b/MediaBrowser.Common.Implementations/HttpServer/SwaggerService.cs @@ -0,0 +1,38 @@ +using ServiceStack.ServiceHost; +using System.Diagnostics; +using System.IO; + +namespace MediaBrowser.Common.Implementations.HttpServer +{ + /// + /// Class GetDashboardResource + /// + [Route("/swagger-ui/{ResourceName*}", "GET")] + public class GetSwaggerResource + { + /// + /// Gets or sets the name. + /// + /// The name. + public string ResourceName { get; set; } + } + + public class SwaggerService : BaseRestService + { + /// + /// Gets the specified request. + /// + /// The request. + /// System.Object. + public object Get(GetSwaggerResource request) + { + var runningDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); + + var swaggerDirectory = Path.Combine(runningDirectory, "swagger-ui"); + + var requestedFile = Path.Combine(swaggerDirectory, request.ResourceName.Replace('/', '\\')); + + return ToStaticFileResult(requestedFile); + } + } +} diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj index bbbf9490e..2f3ebdf19 100644 --- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj +++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj @@ -122,6 +122,7 @@ + @@ -162,22 +163,48 @@ - - - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest - - - - - - - - - - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + diff --git a/MediaBrowser.Common.Implementations/swagger-ui/index.html b/MediaBrowser.Common.Implementations/swagger-ui/index.html index 5d2a8d88d..0b2b02b10 100644 --- a/MediaBrowser.Common.Implementations/swagger-ui/index.html +++ b/MediaBrowser.Common.Implementations/swagger-ui/index.html @@ -42,7 +42,7 @@