Fetches country flags from the worldwide counter. Returns a list of emoji flags, or an empty vec on failure.
()
| 78 | /// Fetches country flags from the worldwide counter. |
| 79 | /// Returns a list of emoji flags, or an empty vec on failure. |
| 80 | pub fn fetch_country_flags() -> Vec<String> { |
| 81 | let agent = agent_with_timeout(Duration::from_millis(500)); |
| 82 | let Ok(mut resp) = agent.get(&format!("{WORKER_URL}/countries")).call() else { |
| 83 | return Vec::new(); |
| 84 | }; |
| 85 | let Ok(parsed): Result<CountriesResponse, _> = resp.body_mut().read_json() else { |
| 86 | return Vec::new(); |
| 87 | }; |
| 88 | parsed.flags |
| 89 | } |
| 90 | |
| 91 | /// Response from GitHub releases API (only the fields we need). |
| 92 | #[derive(serde::Deserialize)] |
no test coverage detected