Add module src/free_api_v25/query/urls.rs
This commit is contained in:
parent
e11c1e4604
commit
6438fd9740
@ -1 +1,21 @@
|
||||
//! Query construction for `OpenWeatherMap` API v2.5
|
||||
//!
|
||||
//! Provides types and utilities for building request URLs for the
|
||||
//! `/weather` and `/forecast` endpoints.
|
||||
//!
|
||||
//! ## Examples
|
||||
//!
|
||||
//! ```no_run
|
||||
//! use owm_api25::query::{QueryParams, Units, WEATHER_URL};
|
||||
//!
|
||||
//! let query = QueryParams {
|
||||
//! api_key: "MY_KEY".into(),
|
||||
//! city_name: Some("London".into()),
|
||||
//! ..Default::default()
|
||||
//! };
|
||||
//!
|
||||
//! let url = query.weather_url().unwrap();
|
||||
//! assert!(url.contains("q=London"));
|
||||
//! ```
|
||||
|
||||
pub mod urls;
|
||||
|
10
src/free_api_v25/query/urls.rs
Normal file
10
src/free_api_v25/query/urls.rs
Normal file
@ -0,0 +1,10 @@
|
||||
//! Base URLs for `OpenWeatherMap` API v2.5
|
||||
|
||||
/// Base URL
|
||||
pub const BASE_URL: &str = "https://api.openweathermap.org/data/2.5";
|
||||
|
||||
/// URL for current weather endpoint
|
||||
pub const WEATHER_URL: &str = "https://api.openweathermap.org/data/2.5/weather";
|
||||
|
||||
/// URL for weather forecast endpoint
|
||||
pub const FORECAST_URL: &str = "https://api.openweathermap.org/data/2.5/forecast";
|
Loading…
x
Reference in New Issue
Block a user