3.2.30.17

This commit is contained in:
Luke Pulverenti
2017-09-11 15:25:13 -04:00
parent 95084d6f7d
commit 2f99a78230
7 changed files with 30 additions and 16 deletions

View File

@@ -75,7 +75,7 @@ namespace Emby.Server.Implementations.Services
var attrs = appHost.GetRouteAttributes(requestType);
foreach (RouteAttribute attr in attrs)
{
var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, attr.Path, attr.Verbs, attr.Summary);
var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, attr.Path, attr.Verbs, attr.IsHidden, attr.Summary, attr.Description);
RegisterRestPath(restPath);
}

View File

@@ -51,6 +51,8 @@ namespace Emby.Server.Implementations.Services
public string Path { get { return this.restPath; } }
public string Summary { get; private set; }
public string Description { get; private set; }
public bool IsHidden { get; private set; }
public int Priority { get; set; } //passed back to RouteAttribute
@@ -91,10 +93,12 @@ namespace Emby.Server.Implementations.Services
return list;
}
public RestPath(Func<Type, object> createInstanceFn, Func<Type, Func<string, object>> getParseFn, Type requestType, string path, string verbs, string summary = null)
public RestPath(Func<Type, object> createInstanceFn, Func<Type, Func<string, object>> getParseFn, Type requestType, string path, string verbs, bool isHidden = false, string summary = null, string description = null)
{
this.RequestType = requestType;
this.Summary = summary;
this.IsHidden = isHidden;
this.Description = description;
this.restPath = path;
this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpper().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);

View File

@@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Services
public string host { get; set; }
public string basePath { get; set; }
public SwaggerTag[] tags { get; set; }
public Dictionary<string, Dictionary<string, SwaggerMethod>> paths { get; set; }
public IDictionary<string, Dictionary<string, SwaggerMethod>> paths { get; set; }
public Dictionary<string, SwaggerDefinition> definitions { get; set; }
}
@@ -147,16 +147,21 @@ namespace Emby.Server.Implementations.Services
return new Dictionary<string, SwaggerDefinition>();
}
private Dictionary<string, Dictionary<string, SwaggerMethod>> GetPaths()
private IDictionary<string, Dictionary<string, SwaggerMethod>> GetPaths()
{
var paths = new Dictionary<string, Dictionary<string, SwaggerMethod>>();
var paths = new SortedDictionary<string, Dictionary<string, SwaggerMethod>>();
var all = ServiceController.Instance.RestPathMap.ToList();
var all = ServiceController.Instance.RestPathMap.OrderBy(i => i.Key, StringComparer.OrdinalIgnoreCase).ToList();
foreach (var current in all)
{
foreach (var info in current.Value)
{
if (info.IsHidden)
{
continue;
}
if (info.Path.StartsWith("/mediabrowser", StringComparison.OrdinalIgnoreCase))
{
continue;
@@ -191,6 +196,7 @@ namespace Emby.Server.Implementations.Services
result[verb.ToLower()] = new SwaggerMethod
{
summary = info.Summary,
description = info.Description,
produces = new[]
{
"application/json"