using Jellyfin.Server.Middleware;
using Microsoft.AspNetCore.Builder;
namespace Jellyfin.Server.Extensions
{
///
/// Extensions for adding API specific functionality to the application pipeline.
///
public static class ApiApplicationBuilderExtensions
{
///
/// Adds swagger and swagger UI to the application pipeline.
///
/// The application builder.
/// The updated application builder.
public static IApplicationBuilder UseJellyfinApiSwagger(this IApplicationBuilder applicationBuilder)
{
applicationBuilder.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
return applicationBuilder.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Jellyfin API V1");
});
}
///
/// Adds exception middleware to the application pipeline.
///
/// The application builder.
/// The updated application builder.
public static IApplicationBuilder UseExceptionMiddleware(this IApplicationBuilder applicationBuilder)
{
return applicationBuilder.UseMiddleware();
}
}
}