< Summary - Jellyfin

Information
Class: Jellyfin.Api.BaseJellyfinApiController
Assembly: Jellyfin.Api
File(s): /srv/git/jellyfin/Jellyfin.Api/BaseJellyfinApiController.cs
Line coverage
50%
Covered lines: 1
Uncovered lines: 1
Coverable lines: 2
Total lines: 37
Line coverage: 50%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Ok(...)100%11100%
Ok(...)100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Api/BaseJellyfinApiController.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.Net.Mime;
 3using Jellyfin.Api.Results;
 4using Jellyfin.Extensions.Json;
 5using Microsoft.AspNetCore.Mvc;
 6
 7namespace Jellyfin.Api;
 8
 9/// <summary>
 10/// Base api controller for the API setting a default route.
 11/// </summary>
 12[ApiController]
 13[Route("[controller]")]
 14[Produces(
 15    MediaTypeNames.Application.Json,
 16    JsonDefaults.CamelCaseMediaType,
 17    JsonDefaults.PascalCaseMediaType)]
 18public class BaseJellyfinApiController : ControllerBase
 19{
 20    /// <summary>
 21    /// Create a new <see cref="OkResult{T}"/>.
 22    /// </summary>
 23    /// <param name="value">The value to return.</param>
 24    /// <typeparam name="T">The type to return.</typeparam>
 25    /// <returns>The <see cref="ActionResult{T}"/>.</returns>
 26    protected ActionResult<IEnumerable<T>> Ok<T>(IEnumerable<T>? value)
 727        => new OkResult<IEnumerable<T>?>(value);
 28
 29    /// <summary>
 30    /// Create a new <see cref="OkResult{T}"/>.
 31    /// </summary>
 32    /// <param name="value">The value to return.</param>
 33    /// <typeparam name="T">The type to return.</typeparam>
 34    /// <returns>The <see cref="ActionResult{T}"/>.</returns>
 35    protected ActionResult<T> Ok<T>(T value)
 036        => new OkResult<T>(value);
 37}