public static WeatherPayload ToWeatherPayload(this WeatherRoot input)
        {
            var payload = new WeatherPayload
            {
                Forecasts = new List <DailyForecast>()
            };

            foreach (var forecast in input.Forecasts)
            {
                payload.Forecasts.Add(new DailyForecast()
                {
                    Day = new ForecastInformation()
                    {
                        Temperature = forecast.Day?.Temp ?? 0,
                        Summary     = forecast.Day?.Narrative,
                        DayName     = forecast.Day?.DayPartName
                    },
                    Night = new ForecastInformation()
                    {
                        Temperature = forecast.Night.Temp,
                        Summary     = forecast.Night.Narrative,
                        DayName     = forecast.Night.DayPartName
                    }
                });
            }
            return(payload);
        }
 public static void MilanWeatherCheck(
    [WeatherTrigger("Milan,IT", 0.05)] WeatherPayload req,
    ILogger log)
 {
     var message = $"{req.CityName} [{req.CurrentTemperature}] at {req.Timestamp}";
     log.LogWarning(message);
 }
 public static async Task TurinWeatherCheck(
     [WeatherTrigger("Turin,IT", 0.1)] WeatherPayload req,
     [TwitterBinding] TwitterBinder tweetMessage,
     ILogger log)
 {
     var message = $"{req.CityName} [{req.CurrentTemperature}] at {req.Timestamp}";
     log.LogWarning(message);
     await tweetMessage.TweetAsync(message);
 }
 public static async Task RomeWeatherCheck(
     [WeatherTrigger("Rome,IT", 0.05)] WeatherPayload req,
     [TwitterBinding] IAsyncCollector<string> tweetMessages,
     ILogger log)
 {
     var message = $"{req.CityName} [{req.CurrentTemperature}] at {req.Timestamp}";
     log.LogWarning(message);
     await tweetMessages.AddAsync(message);
 }
        public static async Task TurinWeatherCheck(
            [WeatherTrigger("Turin,IT", 0.1)] WeatherPayload req,
            [TwitterBinding] TwitterBinder tweetMessage,
            ILogger log)
        {
            var tags    = Environment.GetEnvironmentVariable("Twitter.MessageHashTags");
            var message = $"[{req.CityName}] - Temperature {req.CurrentTemperature}°C at {req.Timestamp} {tags}";

            log.LogWarning(message);
            await tweetMessage.TweetAsync(message);
        }
        public static async Task RomeWeatherCheck(
            [WeatherTrigger("Rome,IT", 0.05, SecondsBetweenCheck = 10)] WeatherPayload req,
            [TwitterBinding] IAsyncCollector <string> tweetMessages,
            ILogger log)
        {
            var tags    = Environment.GetEnvironmentVariable("Twitter.MessageHashTags");
            var message = $"[{req.CityName}] - Temperature {req.CurrentTemperature}°C at {req.Timestamp} {tags}";

            log.LogWarning(message);
            await tweetMessages.AddAsync(message);
        }