move reports to plugin

This commit is contained in:
Luke Pulverenti
2017-09-16 00:14:10 -04:00
parent f3096b8340
commit bc643d4dda
24 changed files with 43 additions and 2703 deletions

View File

@@ -23,6 +23,19 @@ namespace Emby.Server.Implementations.Services
public SwaggerTag[] tags { get; set; }
public IDictionary<string, Dictionary<string, SwaggerMethod>> paths { get; set; }
public Dictionary<string, SwaggerDefinition> definitions { get; set; }
public SwaggerComponents components { get; set; }
}
public class SwaggerComponents
{
public Dictionary<string, SwaggerSecurityScheme> securitySchemes { get; set; }
}
public class SwaggerSecurityScheme
{
public string name { get; set; }
public string type { get; set; }
public string @in { get; set; }
}
public class SwaggerInfo
@@ -38,6 +51,8 @@ namespace Emby.Server.Implementations.Services
public class SwaggerConcactInfo
{
public string email { get; set; }
public string name { get; set; }
public string url { get; set; }
}
public class SwaggerTag
@@ -56,6 +71,7 @@ namespace Emby.Server.Implementations.Services
public string[] produces { get; set; }
public SwaggerParam[] parameters { get; set; }
public Dictionary<string, SwaggerResponse> responses { get; set; }
public Dictionary<string, string[]>[] security { get; set; }
}
public class SwaggerParam
@@ -111,6 +127,15 @@ namespace Emby.Server.Implementations.Services
host = uri.Host;
}
var securitySchemes = new Dictionary<string, SwaggerSecurityScheme>();
securitySchemes["api_key"] = new SwaggerSecurityScheme
{
name = "api_key",
type = "apiKey",
@in = "query"
};
var spec = new SwaggerSpec
{
schemes = new[] { "http" },
@@ -123,14 +148,20 @@ namespace Emby.Server.Implementations.Services
description = "Explore the Emby Server API",
contact = new SwaggerConcactInfo
{
email = "api@emby.media"
name = "Emby Developer Community",
url = "https://emby.media/community/index.php?/forum/47-developer-api"
},
termsOfService = "https://emby.media/terms"
},
paths = GetPaths(),
definitions = GetDefinitions(),
basePath = "/emby",
host = host
host = host,
components = new SwaggerComponents
{
securitySchemes = securitySchemes
}
};
return spec;
@@ -193,6 +224,13 @@ namespace Emby.Server.Implementations.Services
description = "OK"
};
var security = new List<Dictionary<string, string[]>>();
var apiKeySecurity = new Dictionary<string, string[]>();
apiKeySecurity["api_key"] = new string[] { };
security.Add(apiKeySecurity);
result[verb.ToLower()] = new SwaggerMethod
{
summary = info.Summary,
@@ -210,7 +248,9 @@ namespace Emby.Server.Implementations.Services
parameters = new SwaggerParam[] { },
responses = responses
responses = responses,
security = security.ToArray()
};
}