Skip to main content

dwd_api_sys/apis/
default_api.rs

1/*
2 * Deutscher Wetterdienst: API
3 *
4 * API des Deutschen Wetterdienstes (DWD) aus der DWD App. <br><br> Neben unterschiedlichen Wetterwarnungen (s.u.) lassen sich unter [/dwd.api.proxy.bund.dev/v30/stationOverviewExtended](/dwd.api.proxy.bund.dev/v30/stationOverviewExtended) nach Angabe des Parameters *stationIDs* (z.B. 'G005') auch die Wetterdaten ausgewählter Wetterstationen anfordern (wobei die sog. 'Stationskennung' des DWD anzugeben ist). <br><br> Unter [https://opendata.dwd.de/](https://opendata.dwd.de/) bietet der DWD darüber hinaus auch aktuelle und historische Daten zu diversen Wetter- und Klimaphänomenen zum Download an (vgl. hierzu die offizielle Dokumentation [hier](https://opendata.dwd.de/climate_environment/CDC/Readme_intro_CDC_ftp.pdf)). In diesem Zusammenhang erwähnenswert ist auch eine weitere offizielle Liste aller Wetterstationen (ohne Stationskennung aber mit sog. 'Stations_id') [hier](https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/daily/kl/recent/KL_Tageswerte_Beschreibung_Stationen.txt).
5 *
6 * The version of the OpenAPI document: 1.2.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`alpen_forecast_text_dwms_json_get`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AlpenForecastTextDwmsJsonGetError {
22    Status404(),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`crowd_meldungen_overview_v2_json_get`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum CrowdMeldungenOverviewV2JsonGetError {
30    Status404(),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`gemeinde_warnings_v2_en_json_get`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum GemeindeWarningsV2EnJsonGetError {
38    Status404(),
39    UnknownValue(serde_json::Value),
40}
41
42/// struct for typed errors of method [`gemeinde_warnings_v2_json_get`]
43#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum GemeindeWarningsV2JsonGetError {
46    Status404(),
47    UnknownValue(serde_json::Value),
48}
49
50/// struct for typed errors of method [`sea_warning_text_json_get`]
51#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum SeaWarningTextJsonGetError {
54    Status404(),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`station_overview_extended_get`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum StationOverviewExtendedGetError {
62    Status404(models::Error),
63    Status400(models::Error),
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`warnings_coast_en_json_get`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum WarningsCoastEnJsonGetError {
71    Status404(),
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`warnings_coast_json_get`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum WarningsCoastJsonGetError {
79    Status404(),
80    UnknownValue(serde_json::Value),
81}
82
83/// struct for typed errors of method [`warnings_lawine_json_get`]
84#[derive(Debug, Clone, Serialize, Deserialize)]
85#[serde(untagged)]
86pub enum WarningsLawineJsonGetError {
87    Status404(),
88    UnknownValue(serde_json::Value),
89}
90
91/// struct for typed errors of method [`warnings_nowcast_en_json_get`]
92#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum WarningsNowcastEnJsonGetError {
95    Status404(),
96    UnknownValue(serde_json::Value),
97}
98
99/// struct for typed errors of method [`warnings_nowcast_json_get`]
100#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum WarningsNowcastJsonGetError {
103    Status404(),
104    UnknownValue(serde_json::Value),
105}
106
107
108pub async fn alpen_forecast_text_dwms_json_get(configuration: &configuration::Configuration, ) -> Result<String, Error<AlpenForecastTextDwmsJsonGetError>> {
109
110    let uri_str = format!("{}/alpen_forecast_text_dwms.json", configuration.base_path);
111    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
112
113    if let Some(ref user_agent) = configuration.user_agent {
114        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
115    }
116
117    let req = req_builder.build()?;
118    let resp = configuration.client.execute(req).await?;
119
120    let status = resp.status();
121    let content_type = resp
122        .headers()
123        .get("content-type")
124        .and_then(|v| v.to_str().ok())
125        .unwrap_or("application/octet-stream");
126    let content_type = super::ContentType::from(content_type);
127
128    if !status.is_client_error() && !status.is_server_error() {
129        let content = resp.text().await?;
130        match content_type {
131            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
132            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
133            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
134        }
135    } else {
136        let content = resp.text().await?;
137        let entity: Option<AlpenForecastTextDwmsJsonGetError> = serde_json::from_str(&content).ok();
138        Err(Error::ResponseError(ResponseContent { status, content, entity }))
139    }
140}
141
142/// Der DWD erlaubt Usern das aktuelle Wetter zu melden. In der Response befinden sich alle aktuellen Meldungen
143pub async fn crowd_meldungen_overview_v2_json_get(configuration: &configuration::Configuration, ) -> Result<models::CrowdMeldung, Error<CrowdMeldungenOverviewV2JsonGetError>> {
144
145    let uri_str = format!("{}/crowd_meldungen_overview_v2.json", configuration.base_path);
146    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
147
148    if let Some(ref user_agent) = configuration.user_agent {
149        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
150    }
151
152    let req = req_builder.build()?;
153    let resp = configuration.client.execute(req).await?;
154
155    let status = resp.status();
156    let content_type = resp
157        .headers()
158        .get("content-type")
159        .and_then(|v| v.to_str().ok())
160        .unwrap_or("application/octet-stream");
161    let content_type = super::ContentType::from(content_type);
162
163    if !status.is_client_error() && !status.is_server_error() {
164        let content = resp.text().await?;
165        match content_type {
166            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
167            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CrowdMeldung`"))),
168            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CrowdMeldung`")))),
169        }
170    } else {
171        let content = resp.text().await?;
172        let entity: Option<CrowdMeldungenOverviewV2JsonGetError> = serde_json::from_str(&content).ok();
173        Err(Error::ResponseError(ResponseContent { status, content, entity }))
174    }
175}
176
177pub async fn gemeinde_warnings_v2_en_json_get(configuration: &configuration::Configuration, ) -> Result<models::GemeindeWarnings, Error<GemeindeWarningsV2EnJsonGetError>> {
178
179    let uri_str = format!("{}/gemeinde_warnings_v2_en.json", configuration.base_path);
180    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
181
182    if let Some(ref user_agent) = configuration.user_agent {
183        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
184    }
185
186    let req = req_builder.build()?;
187    let resp = configuration.client.execute(req).await?;
188
189    let status = resp.status();
190    let content_type = resp
191        .headers()
192        .get("content-type")
193        .and_then(|v| v.to_str().ok())
194        .unwrap_or("application/octet-stream");
195    let content_type = super::ContentType::from(content_type);
196
197    if !status.is_client_error() && !status.is_server_error() {
198        let content = resp.text().await?;
199        match content_type {
200            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
201            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GemeindeWarnings`"))),
202            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GemeindeWarnings`")))),
203        }
204    } else {
205        let content = resp.text().await?;
206        let entity: Option<GemeindeWarningsV2EnJsonGetError> = serde_json::from_str(&content).ok();
207        Err(Error::ResponseError(ResponseContent { status, content, entity }))
208    }
209}
210
211pub async fn gemeinde_warnings_v2_json_get(configuration: &configuration::Configuration, ) -> Result<models::GemeindeWarnings, Error<GemeindeWarningsV2JsonGetError>> {
212
213    let uri_str = format!("{}/gemeinde_warnings_v2.json", configuration.base_path);
214    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
215
216    if let Some(ref user_agent) = configuration.user_agent {
217        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
218    }
219
220    let req = req_builder.build()?;
221    let resp = configuration.client.execute(req).await?;
222
223    let status = resp.status();
224    let content_type = resp
225        .headers()
226        .get("content-type")
227        .and_then(|v| v.to_str().ok())
228        .unwrap_or("application/octet-stream");
229    let content_type = super::ContentType::from(content_type);
230
231    if !status.is_client_error() && !status.is_server_error() {
232        let content = resp.text().await?;
233        match content_type {
234            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
235            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GemeindeWarnings`"))),
236            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GemeindeWarnings`")))),
237        }
238    } else {
239        let content = resp.text().await?;
240        let entity: Option<GemeindeWarningsV2JsonGetError> = serde_json::from_str(&content).ok();
241        Err(Error::ResponseError(ResponseContent { status, content, entity }))
242    }
243}
244
245pub async fn sea_warning_text_json_get(configuration: &configuration::Configuration, ) -> Result<String, Error<SeaWarningTextJsonGetError>> {
246
247    let uri_str = format!("{}/sea_warning_text.json", configuration.base_path);
248    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
249
250    if let Some(ref user_agent) = configuration.user_agent {
251        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
252    }
253
254    let req = req_builder.build()?;
255    let resp = configuration.client.execute(req).await?;
256
257    let status = resp.status();
258    let content_type = resp
259        .headers()
260        .get("content-type")
261        .and_then(|v| v.to_str().ok())
262        .unwrap_or("application/octet-stream");
263    let content_type = super::ContentType::from(content_type);
264
265    if !status.is_client_error() && !status.is_server_error() {
266        let content = resp.text().await?;
267        match content_type {
268            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
269            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
270            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
271        }
272    } else {
273        let content = resp.text().await?;
274        let entity: Option<SeaWarningTextJsonGetError> = serde_json::from_str(&content).ok();
275        Err(Error::ResponseError(ResponseContent { status, content, entity }))
276    }
277}
278
279/// Query für eine oder mehrere Wetterstationen
280pub async fn station_overview_extended_get(configuration: &configuration::Configuration, station_ids: Option<Vec<models::StationOverviewExtendedGetStationIdsParameterInner>>) -> Result<std::collections::HashMap<String, models::StationOverview>, Error<StationOverviewExtendedGetError>> {
281    // add a prefix to parameters to efficiently prevent name collisions
282    let p_query_station_ids = station_ids;
283
284    let uri_str = format!("{}/stationOverviewExtended", configuration.base_path);
285    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
286
287    if let Some(ref param_value) = p_query_station_ids {
288        req_builder = match "csv" {
289            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("stationIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
290            _ => req_builder.query(&[("stationIds", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
291        };
292    }
293    if let Some(ref user_agent) = configuration.user_agent {
294        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
295    }
296
297
298    let req = req_builder.build()?;
299    let resp = configuration.client.execute(req).await?;
300
301    let status = resp.status();
302    let content_type = resp
303        .headers()
304        .get("content-type")
305        .and_then(|v| v.to_str().ok())
306        .unwrap_or("application/octet-stream");
307    let content_type = super::ContentType::from(content_type);
308
309
310    if !status.is_client_error() && !status.is_server_error() {
311        let content = resp.text().await?;
312
313        match content_type {
314            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
315            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StationOverview`"))),
316            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StationOverview`")))),
317        }
318    } else {
319        let content = resp.text().await?;
320        let entity: Option<StationOverviewExtendedGetError> = serde_json::from_str(&content).ok();
321        Err(Error::ResponseError(ResponseContent { status, content, entity }))
322    }
323}
324
325pub async fn warnings_coast_en_json_get(configuration: &configuration::Configuration, ) -> Result<models::WarningCoast, Error<WarningsCoastEnJsonGetError>> {
326
327    let uri_str = format!("{}/warnings_coast_en.json", configuration.base_path);
328    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
329
330    if let Some(ref user_agent) = configuration.user_agent {
331        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
332    }
333
334    let req = req_builder.build()?;
335    let resp = configuration.client.execute(req).await?;
336
337    let status = resp.status();
338    let content_type = resp
339        .headers()
340        .get("content-type")
341        .and_then(|v| v.to_str().ok())
342        .unwrap_or("application/octet-stream");
343    let content_type = super::ContentType::from(content_type);
344
345    if !status.is_client_error() && !status.is_server_error() {
346        let content = resp.text().await?;
347        match content_type {
348            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
349            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WarningCoast`"))),
350            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WarningCoast`")))),
351        }
352    } else {
353        let content = resp.text().await?;
354        let entity: Option<WarningsCoastEnJsonGetError> = serde_json::from_str(&content).ok();
355        Err(Error::ResponseError(ResponseContent { status, content, entity }))
356    }
357}
358
359pub async fn warnings_coast_json_get(configuration: &configuration::Configuration, ) -> Result<models::WarningCoast, Error<WarningsCoastJsonGetError>> {
360
361    let uri_str = format!("{}/warnings_coast.json", configuration.base_path);
362    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
363
364    if let Some(ref user_agent) = configuration.user_agent {
365        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
366    }
367
368    let req = req_builder.build()?;
369    let resp = configuration.client.execute(req).await?;
370
371    let status = resp.status();
372    let content_type = resp
373        .headers()
374        .get("content-type")
375        .and_then(|v| v.to_str().ok())
376        .unwrap_or("application/octet-stream");
377    let content_type = super::ContentType::from(content_type);
378
379    if !status.is_client_error() && !status.is_server_error() {
380        let content = resp.text().await?;
381        match content_type {
382            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
383            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WarningCoast`"))),
384            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WarningCoast`")))),
385        }
386    } else {
387        let content = resp.text().await?;
388        let entity: Option<WarningsCoastJsonGetError> = serde_json::from_str(&content).ok();
389        Err(Error::ResponseError(ResponseContent { status, content, entity }))
390    }
391}
392
393pub async fn warnings_lawine_json_get(configuration: &configuration::Configuration, ) -> Result<String, Error<WarningsLawineJsonGetError>> {
394
395    let uri_str = format!("{}/warnings_lawine.json", configuration.base_path);
396    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
397
398    if let Some(ref user_agent) = configuration.user_agent {
399        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
400    }
401
402    let req = req_builder.build()?;
403    let resp = configuration.client.execute(req).await?;
404
405    let status = resp.status();
406    let content_type = resp
407        .headers()
408        .get("content-type")
409        .and_then(|v| v.to_str().ok())
410        .unwrap_or("application/octet-stream");
411    let content_type = super::ContentType::from(content_type);
412
413    if !status.is_client_error() && !status.is_server_error() {
414        let content = resp.text().await?;
415        match content_type {
416            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
417            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
418            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
419        }
420    } else {
421        let content = resp.text().await?;
422        let entity: Option<WarningsLawineJsonGetError> = serde_json::from_str(&content).ok();
423        Err(Error::ResponseError(ResponseContent { status, content, entity }))
424    }
425}
426
427pub async fn warnings_nowcast_en_json_get(configuration: &configuration::Configuration, ) -> Result<models::WarningNowcast, Error<WarningsNowcastEnJsonGetError>> {
428
429    let uri_str = format!("{}/warnings_nowcast_en.json", configuration.base_path);
430    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
431
432    if let Some(ref user_agent) = configuration.user_agent {
433        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
434    }
435
436    let req = req_builder.build()?;
437    let resp = configuration.client.execute(req).await?;
438
439    let status = resp.status();
440    let content_type = resp
441        .headers()
442        .get("content-type")
443        .and_then(|v| v.to_str().ok())
444        .unwrap_or("application/octet-stream");
445    let content_type = super::ContentType::from(content_type);
446
447    if !status.is_client_error() && !status.is_server_error() {
448        let content = resp.text().await?;
449        match content_type {
450            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
451            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WarningNowcast`"))),
452            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WarningNowcast`")))),
453        }
454    } else {
455        let content = resp.text().await?;
456        let entity: Option<WarningsNowcastEnJsonGetError> = serde_json::from_str(&content).ok();
457        Err(Error::ResponseError(ResponseContent { status, content, entity }))
458    }
459}
460
461pub async fn warnings_nowcast_json_get(configuration: &configuration::Configuration, ) -> Result<models::WarningNowcast, Error<WarningsNowcastJsonGetError>> {
462
463    let uri_str = format!("{}/warnings_nowcast.json", configuration.base_path);
464    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
465
466    if let Some(ref user_agent) = configuration.user_agent {
467        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
468    }
469
470    let req = req_builder.build()?;
471    let resp = configuration.client.execute(req).await?;
472
473    let status = resp.status();
474    let content_type = resp
475        .headers()
476        .get("content-type")
477        .and_then(|v| v.to_str().ok())
478        .unwrap_or("application/octet-stream");
479    let content_type = super::ContentType::from(content_type);
480
481    if !status.is_client_error() && !status.is_server_error() {
482        let content = resp.text().await?;
483        match content_type {
484            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
485            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WarningNowcast`"))),
486            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WarningNowcast`")))),
487        }
488    } else {
489        let content = resp.text().await?;
490        let entity: Option<WarningsNowcastJsonGetError> = serde_json::from_str(&content).ok();
491        Err(Error::ResponseError(ResponseContent { status, content, entity }))
492    }
493}
494