Add module src/free_api_v25/query/urls.rs

This commit is contained in:
Candifloss 2025-10-10 01:30:12 +05:30
parent e11c1e4604
commit 6438fd9740
2 changed files with 30 additions and 0 deletions

View File

@ -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;

View 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";