1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-30 19:45:57 +00:00
Lidarr/NzbDrone.Api/Settings/SettingsModule.cs
2013-03-03 16:10:58 -08:00

31 lines
No EOL
848 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Api.Settings
{
public class SettingsModule : NzbDroneApiModule
{
private readonly ConfigService _configService;
public SettingsModule(ConfigService configService)
: base("/settings")
{
_configService = configService;
Get["/"] = x => GetAllSettings();
}
private Response GetAllSettings()
{
var collection = Request.Query.Collection;
if(collection.HasValue && Boolean.Parse(collection.Value))
return _configService.All().AsResponse();
return _configService.All().ToDictionary(c => c.Key, c => c.Value).AsResponse();
}
}
}