2013-03-06 22:34:00 -07:00
|
|
|
|
using MediaBrowser.Controller.Localization;
|
2014-07-02 11:34:08 -07:00
|
|
|
|
using MediaBrowser.Controller.Net;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
|
using MediaBrowser.Model.Globalization;
|
2013-12-07 08:52:38 -07:00
|
|
|
|
using ServiceStack;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Api
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class GetCultures
|
|
|
|
|
/// </summary>
|
2014-03-23 13:07:02 -07:00
|
|
|
|
[Route("/Localization/Cultures", "GET", Summary = "Gets known cultures")]
|
2013-02-20 18:33:05 -07:00
|
|
|
|
public class GetCultures : IReturn<List<CultureDto>>
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class GetCountries
|
|
|
|
|
/// </summary>
|
2014-03-23 13:07:02 -07:00
|
|
|
|
[Route("/Localization/Countries", "GET", Summary = "Gets known countries")]
|
2013-02-20 18:33:05 -07:00
|
|
|
|
public class GetCountries : IReturn<List<CountryInfo>>
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class ParentalRatings
|
|
|
|
|
/// </summary>
|
2014-03-23 13:07:02 -07:00
|
|
|
|
[Route("/Localization/ParentalRatings", "GET", Summary = "Gets known parental ratings")]
|
2013-02-20 18:33:05 -07:00
|
|
|
|
public class GetParentalRatings : IReturn<List<ParentalRating>>
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-30 18:00:47 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class ParentalRatings
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("/Localization/Options", "GET", Summary = "Gets localization options")]
|
|
|
|
|
public class GetLocalizationOptions : IReturn<List<LocalizatonOption>>
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class CulturesService
|
|
|
|
|
/// </summary>
|
2014-11-14 19:31:03 -07:00
|
|
|
|
[Authenticated(AllowBeforeStartupWizard = true)]
|
2013-03-15 22:52:33 -07:00
|
|
|
|
public class LocalizationService : BaseApiService
|
2013-02-20 18:33:05 -07:00
|
|
|
|
{
|
2013-06-06 07:33:11 -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)
|
|
|
|
|
{
|
2013-06-06 07:33:11 -07:00
|
|
|
|
var result = _localization.GetParentalRatings().ToList();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-05-07 14:41:38 -07:00
|
|
|
|
return ToOptimizedResult(result);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-30 18:00:47 -07:00
|
|
|
|
public object Get(GetLocalizationOptions request)
|
|
|
|
|
{
|
|
|
|
|
var result = _localization.GetLocalizationOptions().ToList();
|
|
|
|
|
|
2014-05-07 14:41:38 -07:00
|
|
|
|
return ToOptimizedResult(result);
|
2014-03-30 18:00:47 -07:00
|
|
|
|
}
|
|
|
|
|
|
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(GetCountries request)
|
|
|
|
|
{
|
2013-06-06 07:33:11 -07:00
|
|
|
|
var result = _localization.GetCountries().ToList();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-05-07 14:41:38 -07:00
|
|
|
|
return ToOptimizedResult(result);
|
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(GetCultures request)
|
|
|
|
|
{
|
2013-06-06 07:33:11 -07:00
|
|
|
|
var result = _localization.GetCultures().ToList();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-05-07 14:41:38 -07:00
|
|
|
|
return ToOptimizedResult(result);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|