Refactor and expose more information

This commit was merged in pull request #1.
This commit is contained in:
2025-07-14 20:40:41 +02:00
committed by GitHub
parent 1e71c06fc3
commit 9cfbdc21d0
20 changed files with 409 additions and 162 deletions

View File

@@ -1,4 +1,4 @@
namespace HomeApi;
namespace HomeApi.Models.Configuration;
public class ApiConfiguration
{
@@ -10,11 +10,13 @@ public class ApiConfiguration
public class BaseUrls
{
public string Weather { get; set; } = string.Empty;
public string SL { get; set; } = string.Empty;
public string Nominatim { get; set; } = string.Empty;
public string Aurora { get; set; } = string.Empty;
}
public class Keys
{
public string Weather { get; set; } = string.Empty;
public string SL { get; set; } = string.Empty;
public string Nominatim { get; set; } = string.Empty;
public string Aurora { get; set; } = string.Empty;
}

View File

@@ -1,10 +1,8 @@
namespace HomeApi.Models;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
public class AuroraForecast
namespace HomeApi.Models.Response;
public class AuroraForecastApiResponse
{
[JsonPropertyName("date")]
public DateTime Date { get; set; }

View File

@@ -0,0 +1,8 @@
namespace HomeApi.Models.Response;
public class NomatimApiResponse
{
public string Lat { get; set; }
public string Lon { get; set; }
public string Name { get; set; }
}

View File

@@ -1,3 +1,5 @@
namespace HomeApi.Models.Response;
public class WeatherData
{
public Location Location { get; set; }
@@ -169,4 +171,4 @@ public class Alert
public string Expires { get; set; }
public string Desc { get; set; }
public string Instruction { get; set; }
}
}

View File

@@ -1,6 +1,8 @@
using HomeApi.Models.Response;
namespace HomeApi.Models;
public class Home
public class WeatherInformation
{
public string CityName { get; set; } = string.Empty;
public Current Current { get; set; } = new();
@@ -12,12 +14,27 @@ public class Current
public string Date { get; set; }
public double Feelslike { get; set; }
public int IsDay { get; set; }
public double WindPerHour { get; set; } = new();
public double WindGustPerHour { get; set; } = new();
public double Temperature { get; set; } = new();
public double WindPerMeterSecond { get; set; } = 0;
public double WindGustPerMeterSecond { get; set; } = 0;
public double Temperature { get; set; } = 0;
public string LastUpdated { get; set; } = string.Empty;
public int Cloud { get; set; }
public string WindDirection { get; set; } = string.Empty;
public Location WeatherDataLocation { get; set; } = new();
public AirQuality AirQuality { get; set; }
public Probability AuroraProbability { get; set; } = new();
}
public class Location
{
public string Name { get; set; }
public string Region { get; set; }
public string Country { get; set; }
public double Lat { get; set; }
public double Lon { get; set; }
}
public class Probability
{
public DateTime Date { get; set; }
@@ -42,8 +59,8 @@ public class Forecast
public double MinTempC { get; set; }
public double MaxTempC { get; set; }
public string DayIcon { get; set; }
public WeatherSummary Day { get; set; }
public WeatherSummary Night { get; set; }
public WeatherSummary? Day { get; set; }
public WeatherSummary? Night { get; set; }
public Astro Astro { get; set; }
}
public class Astro
@@ -56,6 +73,18 @@ public class Astro
public double? Moon_Illumination { get; set; }
}
public class AirQuality
{
public double Co { get; set; }
public double No2 { get; set; }
public double O3 { get; set; }
public double So2 { get; set; }
public double Pm2_5 { get; set; }
public double Pm10 { get; set; }
public int Us_Epa_Index { get; set; }
public int Gb_Defra_Index { get; set; }
}
public class WeatherSummary
{
public string ConditionText { get; set; }