Пример #1
0
        public override object RequestAction(string action, IDictionary <string, string> query)
        {
            if (action == "getDevices")
            {
                // Return early if there is not an API key
                if (Settings.ApiKey.IsNullOrWhiteSpace())
                {
                    return(new
                    {
                        devices = new List <object>()
                    });
                }

                Settings.Validate().Filter("ApiKey").ThrowOnError();

                var devices = _sonarrV3Proxy.GetProfiles(Settings);

                return(new
                {
                    options = devices.OrderBy(d => d.Name, StringComparer.InvariantCultureIgnoreCase)
                              .Select(d => new
                    {
                        id = d.Id,
                        name = d.Name
                    })
                });
            }

            return(new { });
        }