jellyfin/MediaBrowser.Api/LocalizationService.cs

94 lines
2.6 KiB
C#
Raw Normal View History

2013-03-06 22:34:00 -07:00
using MediaBrowser.Controller.Localization;
2013-02-20 18:33:05 -07:00
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using ServiceStack.ServiceHost;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Api
{
/// <summary>
/// Class GetCultures
/// </summary>
[Route("/Localization/Cultures", "GET")]
2013-04-10 08:32:09 -07:00
[Api(Description = "Gets known cultures")]
2013-02-20 18:33:05 -07:00
public class GetCultures : IReturn<List<CultureDto>>
{
}
/// <summary>
/// Class GetCountries
/// </summary>
[Route("/Localization/Countries", "GET")]
2013-04-10 08:32:09 -07:00
[Api(Description = "Gets known countries")]
2013-02-20 18:33:05 -07:00
public class GetCountries : IReturn<List<CountryInfo>>
{
}
/// <summary>
/// Class ParentalRatings
/// </summary>
[Route("/Localization/ParentalRatings", "GET")]
2013-04-10 08:32:09 -07:00
[Api(Description = "Gets known parental ratings")]
2013-02-20 18:33:05 -07:00
public class GetParentalRatings : IReturn<List<ParentalRating>>
{
}
/// <summary>
/// Class CulturesService
/// </summary>
2013-03-15 22:52:33 -07:00
public class LocalizationService : BaseApiService
2013-02-20 18:33:05 -07:00
{
/// <summary>
/// The _localization
/// </summary>
private readonly ILocalizationManager _localization;
/// <summary>
/// Initializes a new instance of the <see cref="LocalizationService"/> class.
/// </summary>
/// <param name="localization">The localization.</param>
public LocalizationService(ILocalizationManager localization)
{
_localization = localization;
}
2013-02-20 18:33:05 -07:00
/// <summary>
/// Gets the specified request.
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
public object Get(GetParentalRatings request)
{
var result = _localization.GetParentalRatings().ToList();
2013-02-20 18:33:05 -07:00
return ToOptimizedResult(result);
}
/// <summary>
/// Gets the specified request.
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
public object Get(GetCountries request)
{
var result = _localization.GetCountries().ToList();
2013-02-20 18:33:05 -07:00
return ToOptimizedResult(result);
}
/// <summary>
/// Gets the specified request.
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
public object Get(GetCultures request)
{
var result = _localization.GetCultures().ToList();
2013-02-20 18:33:05 -07:00
return ToOptimizedResult(result);
}
}
}