Radarr/src/Radarr.Api.V2/Profiles/Languages/LanguageModule.cs

42 lines
1.2 KiB
C#
Raw Normal View History

2018-11-23 07:03:32 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Core.Languages;
2018-11-23 07:03:32 +00:00
using NzbDrone.Core.Parser;
using Radarr.Http;
namespace Radarr.Api.V2.Profiles.Languages
{
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()
{
return ((Language[])Enum.GetValues(typeof (Language)))
.Select(l => new LanguageResource
{
Id = (int) l,
Name = l.ToString()
})
.OrderBy(l => l.Name)
.ToList();
}
}
}