2019-02-06 21:54:57 +00:00
|
|
|
using System.Threading.Tasks;
|
2019-01-13 20:01:16 +00:00
|
|
|
using MediaBrowser.Controller.Net;
|
2013-02-21 01:33:05 +00:00
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
using MediaBrowser.Model.Globalization;
|
2016-10-25 19:02:04 +00:00
|
|
|
using MediaBrowser.Model.Services;
|
2013-02-21 01:33:05 +00:00
|
|
|
|
|
|
|
namespace MediaBrowser.Api
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Class GetCultures
|
|
|
|
/// </summary>
|
2014-03-23 20:07:02 +00:00
|
|
|
[Route("/Localization/Cultures", "GET", Summary = "Gets known cultures")]
|
2017-08-19 19:43:35 +00:00
|
|
|
public class GetCultures : IReturn<CultureDto[]>
|
2013-02-21 01:33:05 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Class GetCountries
|
|
|
|
/// </summary>
|
2014-03-23 20:07:02 +00:00
|
|
|
[Route("/Localization/Countries", "GET", Summary = "Gets known countries")]
|
2017-08-19 19:43:35 +00:00
|
|
|
public class GetCountries : IReturn<CountryInfo[]>
|
2013-02-21 01:33:05 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Class ParentalRatings
|
|
|
|
/// </summary>
|
2014-03-23 20:07:02 +00:00
|
|
|
[Route("/Localization/ParentalRatings", "GET", Summary = "Gets known parental ratings")]
|
2017-08-19 19:43:35 +00:00
|
|
|
public class GetParentalRatings : IReturn<ParentalRating[]>
|
2013-02-21 01:33:05 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-03-31 01:00:47 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Class ParentalRatings
|
|
|
|
/// </summary>
|
|
|
|
[Route("/Localization/Options", "GET", Summary = "Gets localization options")]
|
2019-01-25 21:27:33 +00:00
|
|
|
public class GetLocalizationOptions : IReturn<LocalizationOption[]>
|
2014-03-31 01:00:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-02-21 01:33:05 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Class CulturesService
|
|
|
|
/// </summary>
|
2014-11-15 02:31:03 +00:00
|
|
|
[Authenticated(AllowBeforeStartupWizard = true)]
|
2013-03-16 05:52:33 +00:00
|
|
|
public class LocalizationService : BaseApiService
|
2013-02-21 01:33:05 +00:00
|
|
|
{
|
2013-06-06 14:33:11 +00: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-21 01:33:05 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the specified request.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
/// <returns>System.Object.</returns>
|
|
|
|
public object Get(GetParentalRatings request)
|
|
|
|
{
|
2017-08-19 19:43:35 +00:00
|
|
|
var result = _localization.GetParentalRatings();
|
2013-02-21 01:33:05 +00:00
|
|
|
|
2014-05-07 21:41:38 +00:00
|
|
|
return ToOptimizedResult(result);
|
2013-02-21 01:33:05 +00:00
|
|
|
}
|
|
|
|
|
2014-03-31 01:00:47 +00:00
|
|
|
public object Get(GetLocalizationOptions request)
|
|
|
|
{
|
2017-08-19 19:43:35 +00:00
|
|
|
var result = _localization.GetLocalizationOptions();
|
2014-03-31 01:00:47 +00:00
|
|
|
|
2014-05-07 21:41:38 +00:00
|
|
|
return ToOptimizedResult(result);
|
2014-03-31 01:00:47 +00:00
|
|
|
}
|
|
|
|
|
2013-02-21 01:33:05 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the specified request.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
/// <returns>System.Object.</returns>
|
2019-02-06 21:40:49 +00:00
|
|
|
public async Task<object> Get(GetCountries request)
|
2013-02-21 01:33:05 +00:00
|
|
|
{
|
2019-02-06 21:40:49 +00:00
|
|
|
var result = await _localization.GetCountries();
|
2013-02-21 01:33:05 +00:00
|
|
|
|
2014-05-07 21:41:38 +00:00
|
|
|
return ToOptimizedResult(result);
|
2013-02-21 01:33:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the specified request.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
/// <returns>System.Object.</returns>
|
|
|
|
public object Get(GetCultures request)
|
|
|
|
{
|
2017-08-09 19:56:38 +00:00
|
|
|
var result = _localization.GetCultures();
|
2013-02-21 01:33:05 +00:00
|
|
|
|
2014-05-07 21:41:38 +00:00
|
|
|
return ToOptimizedResult(result);
|
2013-02-21 01:33:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|