< Summary - Jellyfin

Information
Class: Jellyfin.Api.Controllers.LocalizationController
Assembly: Jellyfin.Api
File(s): /srv/git/jellyfin/Jellyfin.Api/Controllers/LocalizationController.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 75
Line coverage: 0%
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
.ctor(...)100%210%
GetCultures()100%210%
GetCountries()100%210%
GetParentalRatings()100%210%
GetLocalizationOptions()100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Api/Controllers/LocalizationController.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using MediaBrowser.Common.Api;
 3using MediaBrowser.Model.Entities;
 4using MediaBrowser.Model.Globalization;
 5using Microsoft.AspNetCore.Authorization;
 6using Microsoft.AspNetCore.Http;
 7using Microsoft.AspNetCore.Mvc;
 8
 9namespace Jellyfin.Api.Controllers;
 10
 11/// <summary>
 12/// Localization controller.
 13/// </summary>
 14[Authorize(Policy = Policies.FirstTimeSetupOrDefault)]
 15public class LocalizationController : BaseJellyfinApiController
 16{
 17    private readonly ILocalizationManager _localization;
 18
 19    /// <summary>
 20    /// Initializes a new instance of the <see cref="LocalizationController"/> class.
 21    /// </summary>
 22    /// <param name="localization">Instance of the <see cref="ILocalizationManager"/> interface.</param>
 023    public LocalizationController(ILocalizationManager localization)
 24    {
 025        _localization = localization;
 026    }
 27
 28    /// <summary>
 29    /// Gets known cultures.
 30    /// </summary>
 31    /// <response code="200">Known cultures returned.</response>
 32    /// <returns>An <see cref="OkResult"/> containing the list of cultures.</returns>
 33    [HttpGet("Cultures")]
 34    [ProducesResponseType(StatusCodes.Status200OK)]
 35    public ActionResult<IEnumerable<CultureDto>> GetCultures()
 36    {
 037        return Ok(_localization.GetCultures());
 38    }
 39
 40    /// <summary>
 41    /// Gets known countries.
 42    /// </summary>
 43    /// <response code="200">Known countries returned.</response>
 44    /// <returns>An <see cref="OkResult"/> containing the list of countries.</returns>
 45    [HttpGet("Countries")]
 46    [ProducesResponseType(StatusCodes.Status200OK)]
 47    public ActionResult<IReadOnlyList<CountryInfo>> GetCountries()
 48    {
 049        return Ok(_localization.GetCountries());
 50    }
 51
 52    /// <summary>
 53    /// Gets known parental ratings.
 54    /// </summary>
 55    /// <response code="200">Known parental ratings returned.</response>
 56    /// <returns>An <see cref="OkResult"/> containing the list of parental ratings.</returns>
 57    [HttpGet("ParentalRatings")]
 58    [ProducesResponseType(StatusCodes.Status200OK)]
 59    public ActionResult<IReadOnlyList<ParentalRating>> GetParentalRatings()
 60    {
 061        return Ok(_localization.GetParentalRatings());
 62    }
 63
 64    /// <summary>
 65    /// Gets localization options.
 66    /// </summary>
 67    /// <response code="200">Localization options returned.</response>
 68    /// <returns>An <see cref="OkResult"/> containing the list of localization options.</returns>
 69    [HttpGet("Options")]
 70    [ProducesResponseType(StatusCodes.Status200OK)]
 71    public ActionResult<IEnumerable<LocalizationOption>> GetLocalizationOptions()
 72    {
 073        return Ok(_localization.GetLocalizationOptions());
 74    }
 75}