diff options
Diffstat (limited to 'Emby.Server.Implementations')
| -rw-r--r-- | Emby.Server.Implementations/Services/ServiceController.cs | 2 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Services/ServicePath.cs | 6 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Services/SwaggerService.cs | 14 |
3 files changed, 16 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/Services/ServiceController.cs b/Emby.Server.Implementations/Services/ServiceController.cs index 4dc14a193..3fd6d88f8 100644 --- a/Emby.Server.Implementations/Services/ServiceController.cs +++ b/Emby.Server.Implementations/Services/ServiceController.cs @@ -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); } diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs index df5d71374..0ca36df19 100644 --- a/Emby.Server.Implementations/Services/ServicePath.cs +++ b/Emby.Server.Implementations/Services/ServicePath.cs @@ -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); diff --git a/Emby.Server.Implementations/Services/SwaggerService.cs b/Emby.Server.Implementations/Services/SwaggerService.cs index 63cbb78dd..be3b4cbba 100644 --- a/Emby.Server.Implementations/Services/SwaggerService.cs +++ b/Emby.Server.Implementations/Services/SwaggerService.cs @@ -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" |
