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<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    let req = req_builder.build()?;
298    let resp = configuration.client.execute(req).await?;
299
300    let status = resp.status();
301    let content_type = resp
302        .headers()
303        .get("content-type")
304        .and_then(|v| v.to_str().ok())
305        .unwrap_or("application/octet-stream");
306    let content_type = super::ContentType::from(content_type);
307
308    if !status.is_client_error() && !status.is_server_error() {
309        let content = resp.text().await?;
310        match content_type {
311            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
312            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StationOverview`"))),
313            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`")))),
314        }
315    } else {
316        let content = resp.text().await?;
317        let entity: Option<StationOverviewExtendedGetError> = serde_json::from_str(&content).ok();
318        Err(Error::ResponseError(ResponseContent { status, content, entity }))
319    }
320}
321
322pub async fn warnings_coast_en_json_get(configuration: &configuration::Configuration, ) -> Result<models::WarningCoast, Error<WarningsCoastEnJsonGetError>> {
323
324    let uri_str = format!("{}/warnings_coast_en.json", configuration.base_path);
325    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
326
327    if let Some(ref user_agent) = configuration.user_agent {
328        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
329    }
330
331    let req = req_builder.build()?;
332    let resp = configuration.client.execute(req).await?;
333
334    let status = resp.status();
335    let content_type = resp
336        .headers()
337        .get("content-type")
338        .and_then(|v| v.to_str().ok())
339        .unwrap_or("application/octet-stream");
340    let content_type = super::ContentType::from(content_type);
341
342    if !status.is_client_error() && !status.is_server_error() {
343        let content = resp.text().await?;
344        match content_type {
345            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
346            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WarningCoast`"))),
347            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`")))),
348        }
349    } else {
350        let content = resp.text().await?;
351        let entity: Option<WarningsCoastEnJsonGetError> = serde_json::from_str(&content).ok();
352        Err(Error::ResponseError(ResponseContent { status, content, entity }))
353    }
354}
355
356pub async fn warnings_coast_json_get(configuration: &configuration::Configuration, ) -> Result<models::WarningCoast, Error<WarningsCoastJsonGetError>> {
357
358    let uri_str = format!("{}/warnings_coast.json", configuration.base_path);
359    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
360
361    if let Some(ref user_agent) = configuration.user_agent {
362        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
363    }
364
365    let req = req_builder.build()?;
366    let resp = configuration.client.execute(req).await?;
367
368    let status = resp.status();
369    let content_type = resp
370        .headers()
371        .get("content-type")
372        .and_then(|v| v.to_str().ok())
373        .unwrap_or("application/octet-stream");
374    let content_type = super::ContentType::from(content_type);
375
376    if !status.is_client_error() && !status.is_server_error() {
377        let content = resp.text().await?;
378        match content_type {
379            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
380            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WarningCoast`"))),
381            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`")))),
382        }
383    } else {
384        let content = resp.text().await?;
385        let entity: Option<WarningsCoastJsonGetError> = serde_json::from_str(&content).ok();
386        Err(Error::ResponseError(ResponseContent { status, content, entity }))
387    }
388}
389
390pub async fn warnings_lawine_json_get(configuration: &configuration::Configuration, ) -> Result<String, Error<WarningsLawineJsonGetError>> {
391
392    let uri_str = format!("{}/warnings_lawine.json", configuration.base_path);
393    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
394
395    if let Some(ref user_agent) = configuration.user_agent {
396        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
397    }
398
399    let req = req_builder.build()?;
400    let resp = configuration.client.execute(req).await?;
401
402    let status = resp.status();
403    let content_type = resp
404        .headers()
405        .get("content-type")
406        .and_then(|v| v.to_str().ok())
407        .unwrap_or("application/octet-stream");
408    let content_type = super::ContentType::from(content_type);
409
410    if !status.is_client_error() && !status.is_server_error() {
411        let content = resp.text().await?;
412        match content_type {
413            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
414            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
415            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`")))),
416        }
417    } else {
418        let content = resp.text().await?;
419        let entity: Option<WarningsLawineJsonGetError> = serde_json::from_str(&content).ok();
420        Err(Error::ResponseError(ResponseContent { status, content, entity }))
421    }
422}
423
424pub async fn warnings_nowcast_en_json_get(configuration: &configuration::Configuration, ) -> Result<models::WarningNowcast, Error<WarningsNowcastEnJsonGetError>> {
425
426    let uri_str = format!("{}/warnings_nowcast_en.json", configuration.base_path);
427    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
428
429    if let Some(ref user_agent) = configuration.user_agent {
430        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
431    }
432
433    let req = req_builder.build()?;
434    let resp = configuration.client.execute(req).await?;
435
436    let status = resp.status();
437    let content_type = resp
438        .headers()
439        .get("content-type")
440        .and_then(|v| v.to_str().ok())
441        .unwrap_or("application/octet-stream");
442    let content_type = super::ContentType::from(content_type);
443
444    if !status.is_client_error() && !status.is_server_error() {
445        let content = resp.text().await?;
446        match content_type {
447            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
448            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WarningNowcast`"))),
449            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`")))),
450        }
451    } else {
452        let content = resp.text().await?;
453        let entity: Option<WarningsNowcastEnJsonGetError> = serde_json::from_str(&content).ok();
454        Err(Error::ResponseError(ResponseContent { status, content, entity }))
455    }
456}
457
458pub async fn warnings_nowcast_json_get(configuration: &configuration::Configuration, ) -> Result<models::WarningNowcast, Error<WarningsNowcastJsonGetError>> {
459
460    let uri_str = format!("{}/warnings_nowcast.json", configuration.base_path);
461    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
462
463    if let Some(ref user_agent) = configuration.user_agent {
464        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
465    }
466
467    let req = req_builder.build()?;
468    let resp = configuration.client.execute(req).await?;
469
470    let status = resp.status();
471    let content_type = resp
472        .headers()
473        .get("content-type")
474        .and_then(|v| v.to_str().ok())
475        .unwrap_or("application/octet-stream");
476    let content_type = super::ContentType::from(content_type);
477
478    if !status.is_client_error() && !status.is_server_error() {
479        let content = resp.text().await?;
480        match content_type {
481            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
482            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WarningNowcast`"))),
483            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`")))),
484        }
485    } else {
486        let content = resp.text().await?;
487        let entity: Option<WarningsNowcastJsonGetError> = serde_json::from_str(&content).ok();
488        Err(Error::ResponseError(ResponseContent { status, content, entity }))
489    }
490}
491