Example #1
0
        private SwaggerSpec GetSpec()
        {
            string host = null;
            Uri    uri;

            if (Uri.TryCreate(Request.RawUrl, UriKind.Absolute, out uri))
            {
                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" },
                tags    = GetTags(),
                swagger = "2.0",
                info    = new SwaggerInfo
                {
                    title       = "Emby Server API",
                    version     = "1.0.0",
                    description = "Explore the Emby Server API",
                    contact     = new SwaggerConcactInfo
                    {
                        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,

                components = new SwaggerComponents
                {
                    securitySchemes = securitySchemes
                }
            };

            return(spec);
        }
Example #2
0
        private SwaggerSpec GetSpec()
        {
            string host = null;
            Uri    uri;

            if (Uri.TryCreate(Request.RawUrl, UriKind.Absolute, out uri))
            {
                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" },
                tags    = GetTags(),
                swagger = "2.0",
                info    = new SwaggerInfo
                {
                    title       = "Veso Server API",
                    version     = "1.0.0",
                    description = "Explore the Veso Server API",
                    contact     = new SwaggerConcactInfo
                    {
                        name = "Veso Community",
                        url  = "https://veso.readthedocs.io/en/latest/user-docs/getting-help/"
                    }
                },
                paths       = GetPaths(),
                definitions = GetDefinitions(),
                basePath    = "/veso",
                host        = host,

                components = new SwaggerComponents
                {
                    securitySchemes = securitySchemes
                }
            };

            return(spec);
        }