use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct SiteData { pub license: String, pub date_time: Vec, pub location: Location, pub warnings: Option, pub current_conditions: CurrentConditions, pub forecast_group: ForecastGroup, // TODO(acli): hourly forecasts are not implemented yet. pub yesterday_conditions: Yesterday, pub rise_set: RiseSet, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Name { pub name: String, #[serde(rename = "$value")] pub value: u8, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct DateTime { pub name: String, pub zone: String, #[serde(rename = "UTCOffset")] pub utc_offset: String, pub year: u16, pub month: Name, pub day: Name, pub hour: u8, pub minute: u8, pub time_stamp: String, pub text_summary: String, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Location { pub continent: String, pub country: CodeName, pub province: CodeName, pub name: CodeName, pub region: String, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct CodeName { pub code: String, pub lat: Option, pub lon: Option, #[serde(rename = "$value")] pub name: String, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct IconCode { pub format: String, #[serde(rename = "$value")] pub value: String, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct MetricWithUnits { pub units: Option, pub unit_type: Option, pub change: Option, pub tendency: Option, #[serde(rename = "$value")] pub value: Option, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Wind { pub speed: MetricWithUnits, pub gust: MetricWithUnits, pub direction: String, pub bearing: MetricWithUnits, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct CurrentConditions { pub station: CodeName, pub date_time: Vec, pub condition: String, pub icon_code: IconCode, pub temperature: MetricWithUnits, pub dewpoint: MetricWithUnits, pub wind_chill: Option, pub pressure: MetricWithUnits, pub visibility: MetricWithUnits, pub relative_humidity: MetricWithUnits, pub wind: Option, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Warnings { pub url: String, pub event: Vec, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Event { pub r#type: String, pub priority: String, pub description: String, pub date_time: Vec, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct ForecastGroup { pub date_time: Vec, pub regional_normals: RegionalNormals, pub forecast: Vec, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct RegionalNormals { pub text_summary: String, pub temperature: Vec, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Period { pub text_forecast_name: String, #[serde(rename = "$value")] pub value: String, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct CloudPrecip { pub text_summary: String, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Forecast { pub period: Period, pub text_summary: String, pub cloud_precip: CloudPrecip, pub abbreviated_forecast: AbbreviatedForecast, pub temperatures: Temperatures, pub winds: Winds, pub precipitation: Option, pub uv: Option, pub relative_humidity: MetricWithUnits, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct AbbreviatedForecast { pub icon_code: IconCode, pub pop: MetricWithUnits, pub text_summary: String, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Temperatures { pub text_summary: String, pub temperature: MetricWithUnits, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Winds { pub text_summary: Option, pub wind: Option>, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct PrecipitationType { pub start: String, pub end: String, #[serde(rename = "$value")] pub value: Option, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Accumulation { pub name: String, pub amount: MetricWithUnits, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Precipitation { pub text_summary: Option, pub precip_type: Vec, pub accumulation: Option, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Visibility { pub cause: String, pub text_summary: String, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct UVIndex { pub category: String, pub index: String, pub text_summary: String, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Yesterday { pub temperature: Vec, } #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct RiseSet { pub disclaimer: String, pub date_time: Vec, }