2018-11-23 07:03:32 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2019-06-14 03:54:25 +00:00
|
|
|
using NzbDrone.Core.Languages;
|
2018-11-23 07:03:32 +00:00
|
|
|
using Radarr.Http;
|
|
|
|
|
2019-12-03 01:36:18 +00:00
|
|
|
namespace Radarr.Api.V3.Profiles.Languages
|
2018-11-23 07:03:32 +00:00
|
|
|
{
|
|
|
|
public class LanguageModule : RadarrRestModule<LanguageResource>
|
|
|
|
{
|
|
|
|
public LanguageModule()
|
|
|
|
{
|
|
|
|
GetResourceAll = GetAll;
|
|
|
|
GetResourceById = GetById;
|
|
|
|
}
|
|
|
|
|
|
|
|
private LanguageResource GetById(int id)
|
|
|
|
{
|
|
|
|
var language = (Language)id;
|
|
|
|
|
|
|
|
return new LanguageResource
|
|
|
|
{
|
|
|
|
Id = (int)language,
|
|
|
|
Name = language.ToString()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
private List<LanguageResource> GetAll()
|
|
|
|
{
|
2019-06-19 02:50:17 +00:00
|
|
|
return Language.All.Select(l => new LanguageResource
|
|
|
|
{
|
|
|
|
Id = (int)l,
|
|
|
|
Name = l.ToString()
|
|
|
|
})
|
2018-11-23 07:03:32 +00:00
|
|
|
.OrderBy(l => l.Name)
|
|
|
|
.ToList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|