added swagger api docs

pull/702/head
LukePulverenti 12 years ago
parent 32ba557fe5
commit 4c725e69a8

@ -0,0 +1,38 @@
using ServiceStack.ServiceHost;
using System.Diagnostics;
using System.IO;
namespace MediaBrowser.Common.Implementations.HttpServer
{
/// <summary>
/// Class GetDashboardResource
/// </summary>
[Route("/swagger-ui/{ResourceName*}", "GET")]
public class GetSwaggerResource
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string ResourceName { get; set; }
}
public class SwaggerService : BaseRestService
{
/// <summary>
/// Gets the specified request.
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
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);
}
}
}

@ -122,6 +122,7 @@
<Compile Include="HttpServer\NativeWebSocket.cs" />
<Compile Include="HttpServer\ServerFactory.cs" />
<Compile Include="HttpServer\StreamWriter.cs" />
<Compile Include="HttpServer\SwaggerService.cs" />
<Compile Include="Logging\LogHelper.cs" />
<Compile Include="Logging\NLogger.cs" />
<Compile Include="Logging\NlogManager.cs" />
@ -162,22 +163,48 @@
</ItemGroup>
<ItemGroup>
<Content Include="README.txt" />
<Content Include="swagger-ui\css\screen.css" />
<Content Include="swagger-ui\images\pet_store_api.png" />
<Content Include="swagger-ui\images\wordnik_api.png" />
<Content Include="swagger-ui\css\screen.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\images\pet_store_api.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\images\wordnik_api.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\index.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\lib\backbone-min.js" />
<Content Include="swagger-ui\lib\handlebars.runtime-1.0.0.beta.6.js" />
<Content Include="swagger-ui\lib\jquery.ba-bbq.min.js" />
<Content Include="swagger-ui\lib\jquery.min.js" />
<Content Include="swagger-ui\lib\jquery.slideto.min.js" />
<Content Include="swagger-ui\lib\jquery.wiggle.min.js" />
<Content Include="swagger-ui\lib\swagger.js" />
<Content Include="swagger-ui\lib\underscore-min.js" />
<Content Include="swagger-ui\swagger-ui.js" />
<Content Include="swagger-ui\swagger-ui.min.js" />
<Content Include="swagger-ui\lib\backbone-min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\lib\handlebars.runtime-1.0.0.beta.6.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\lib\jquery.ba-bbq.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\lib\jquery.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\lib\jquery.slideto.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\lib\jquery.wiggle.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\lib\swagger.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\lib\underscore-min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\swagger-ui.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="swagger-ui\swagger-ui.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

@ -42,7 +42,7 @@
<script type="text/javascript">
$(function () {
window.swaggerUi = new SwaggerUi({
discoveryUrl:'../api/resources',
discoveryUrl:'../resources',
apiKey:"",
dom_id:"swagger-ui-container",
supportHeaderParams: false,

@ -172,7 +172,6 @@
<Compile Include="Resolvers\EntityResolutionHelper.cs" />
<Compile Include="Resolvers\ResolverPriority.cs" />
<Compile Include="Library\TVUtils.cs" />
<Compile Include="ScheduledTasks\PeopleValidationTask.cs" />
<Compile Include="ScheduledTasks\RefreshMediaLibraryTask.cs" />
<Compile Include="Library\ItemResolveArgs.cs" />
<Compile Include="IO\DirectoryWatchers.cs" />

@ -12,6 +12,7 @@ using MediaBrowser.Controller.ScheduledTasks;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Implementations.Library.Resolvers;
using MediaBrowser.Server.Implementations.ScheduledTasks;
using MoreLinq;
using System;
using System.Collections.Concurrent;

@ -77,9 +77,10 @@
<Compile Include="Library\UserManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Reflection\TypeMapper.cs" />
<Compile Include="ScheduledTasks\Tasks\ChapterImagesTask.cs" />
<Compile Include="ScheduledTasks\Tasks\ImageCleanupTask.cs" />
<Compile Include="ScheduledTasks\Tasks\PluginUpdateTask.cs" />
<Compile Include="ScheduledTasks\PeopleValidationTask.cs" />
<Compile Include="ScheduledTasks\ChapterImagesTask.cs" />
<Compile Include="ScheduledTasks\ImageCleanupTask.cs" />
<Compile Include="ScheduledTasks\PluginUpdateTask.cs" />
<Compile Include="ServerApplicationPaths.cs" />
<Compile Include="Sqlite\SQLiteDisplayPreferencesRepository.cs" />
<Compile Include="Sqlite\SQLiteExtensions.cs" />

@ -9,7 +9,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.ScheduledTasks.Tasks
namespace MediaBrowser.Server.Implementations.ScheduledTasks
{
/// <summary>
/// Class ChapterImagesTask

@ -11,7 +11,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.ScheduledTasks.Tasks
namespace MediaBrowser.Server.Implementations.ScheduledTasks
{
/// <summary>
/// Class ImageCleanupTask

@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.ScheduledTasks
namespace MediaBrowser.Server.Implementations.ScheduledTasks
{
/// <summary>
/// Class PeopleValidationTask

@ -1,4 +1,5 @@
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
using System;
@ -8,7 +9,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.ScheduledTasks
namespace MediaBrowser.Server.Implementations.ScheduledTasks
{
/// <summary>
/// Plugin Update Task

@ -13,7 +13,12 @@
<Separator x:Name="separatorDeveloperTools"/>
<MenuItem x:Name="cmOpenExplorer" Header="Open Library Explorer" Click="cmOpenExplorer_click" />
<MenuItem x:Name="cmdReloadServer" Header="Restart Server" Click="cmdReloadServer_click" />
<MenuItem x:Name="cmdApiDocs" Header="View Api Documentation" Click="cmdApiDocs_Click" />
<MenuItem x:Name="cmdApiDocs" Header="View Api Documentation">
<MenuItem x:Name="cmdStandardApiDocs" Header="Standard" Click="cmdApiDocs_Click">
</MenuItem>
<MenuItem x:Name="cmdSwaggerApiDocs" Header="Swagger" Click="cmdSwaggerApiDocs_Click">
</MenuItem>
</MenuItem>
<Separator/>
<MenuItem x:Name="cmShowLogWindow" Header="Show Log Window" IsCheckable="True" Click="CmShowLogWindow_click"/>
<MenuItem x:Name="cmVisitCT" Header="Visit Community" Click="cmVisitCT_click"/>

@ -162,6 +162,12 @@ namespace MediaBrowser.ServerApplication
Kernel.Instance.WebApplicationName + "/metadata");
}
void cmdSwaggerApiDocs_Click(object sender, EventArgs e)
{
App.OpenUrl("http://localhost:" + _configurationManager.Configuration.HttpServerPortNumber + "/" +
Kernel.Instance.WebApplicationName + "/swagger-ui/index.html");
}
/// <summary>
/// Occurs when [property changed].
/// </summary>

@ -375,6 +375,9 @@ xcopy "$(SolutionDir)Mediabrowser.Uninstaller\bin\Release\MediaBrowser.Uninstall
xcopy "$(SolutionDir)Mediabrowser.Uninstaller.Execute\bin\Release\MediaBrowser.Uninstaller.Execute.exe" "$(SolutionDir)..\Deploy\Server\System\" /y
xcopy "$(SolutionDir)Mediabrowser.Installer\bin\Release\MediaBrowser.Installer.exe" "$(SolutionDir)..\Deploy\Server\System\" /y
mkdir "$(SolutionDir)..\Deploy\Server\System\swagger-ui"
xcopy "$(TargetDir)swagger-ui" "$(SolutionDir)..\Deploy\Server\System\swagger-ui" /y /s
xcopy "$(TargetDir)$(TargetFileName).config" "$(SolutionDir)..\Deploy\Server\System\" /y
xcopy "$(TargetDir)*.dll" "$(SolutionDir)..\Deploy\Server\System" /y

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -398,6 +398,7 @@
<EmbeddedResource Include="Html\css\images\mblogoicon.png" />
<EmbeddedResource Include="Html\css\images\mblogotextblack.png" />
<EmbeddedResource Include="Html\css\images\mblogotextwhite.png" />
<EmbeddedResource Include="Html\css\images\clients\dlna.png" />
<Content Include="Html\css\images\stars.png" />
<EmbeddedResource Include="Html\scripts\MediaPlayer.js" />
</ItemGroup>

Loading…
Cancel
Save