using MediaBrowser.Common.Implementations.HttpServer; using MediaBrowser.Controller; using MediaBrowser.Model.Weather; using ServiceStack.ServiceHost; using System.Linq; using System.Threading; namespace MediaBrowser.Api { /// /// Class Weather /// [Route("/Weather", "GET")] public class GetWeather : IReturn { /// /// Gets or sets the location. /// /// The location. public string Location { get; set; } } /// /// Class WeatherService /// public class WeatherService : BaseRestService { /// /// Gets the specified request. /// /// The request. /// System.Object. public object Get(GetWeather request) { var result = Kernel.Instance.WeatherProviders.First().GetWeatherInfoAsync(request.Location, CancellationToken.None).Result; return ToOptimizedResult(result); } } }