1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2021 - 2025 GreenYun Organization
// SPDX-License-Identifier: MIT
//! Weather information
//!
//! Weather information contains such datasets:
//! - 9-day Weather Forecast ([`NineDay`])
//! - Current Weather Report ([`Current`])
//! - Local Weather Forecast ([`Local`])
//! - Weather Warning Information ([`Info`])
//! - Weather Warning Summary ([`Summary`])
//! - Special Weather Tips ([`Tips`])
//!
//! Each of these data types have implementation of [`API`](crate::API).
//! `fetch` function fetches and parses response from the API and return the
//! data type if succeeded. `fetch` will not resolve any network problems, so
//! apps running under various network should fetch the JSON-based response by
//! itself. All these data types have implementations of
//! [`Deserialize`](serde::de::Deserialize) for parsing JSON data.
//!
//! To generate the API URL, simply call [`Type::url(lang)`](crate::API::url()).
//!
//! - **HTTP Request Method**: GET
//! - **Return Type**: JSON
//!
//! ## Example
//!
//! Parse the JSON data (already stored in `s` of `&str`) and get the dataset:
//!
//! ```no_run
//! use hko::weather::Local;
//!
//! # fn f(s: &str) -> anyhow::Result<Local> {
//! let l : Local = serde_json::from_str(s)?;
//! # Ok(l)
//! # }
//! ```
//!
//! Simply `fetch` and wait for the dataset written in English:
//!
//! ```no_run
//! # use hko::common::Lang;
//! use hko::weather::Current;
//! use hko::fetch;
//!
//! # async fn f() -> anyhow::Result<Current> {
//! let c : Current = fetch(Lang::EN).await?;
//! # Ok(c)
//! # }
//! ```
pub use ;