From e56d43b9e7f097fd870a88b0b1519081e4ebb57c Mon Sep 17 00:00:00 2001 From: Candifloss Date: Thu, 9 Oct 2025 23:28:34 +0530 Subject: [PATCH] Initiate library - Create `Cargo.toml` - Create basic library structure - Initiate basic modules - Edit README --- .gitignore | 5 +++++ Cargo.toml | 18 ++++++++++++++++++ README.md | 4 ++++ src/free_api_v25/current.rs | 1 + src/free_api_v25/forecast.rs | 1 + src/free_api_v25/mod.rs | 25 +++++++++++++++++++++++++ src/free_api_v25/query.rs | 1 + src/lib.rs | 12 ++++++++++++ src/onecall_api_v30/mod.rs | 3 +++ 9 files changed, 70 insertions(+) create mode 100644 Cargo.toml create mode 100644 src/free_api_v25/current.rs create mode 100644 src/free_api_v25/forecast.rs create mode 100644 src/free_api_v25/mod.rs create mode 100644 src/free_api_v25/query.rs create mode 100644 src/lib.rs create mode 100644 src/onecall_api_v30/mod.rs diff --git a/.gitignore b/.gitignore index ab951f8..620f8f6 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,8 @@ Cargo.lock # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + + +# Added by cargo + +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d33713d --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "owm-rs" +description = "Rust SDK for the OpenWeatherMap APIs" +version = "0.0.1" +edition = "2024" +license = "GPL-3.0-or-later" +authors = ["candifloss "] +repository = "https://git.candifloss.cc/candifloss/OpenWeatherMapSDK.git" +readme = "README.md" +keywords = ["weather", "api", "openweathermap", "sdk"] +categories = ["api-bindings"] + +[dependencies] +toml = "0.9.6" +dirs = "6.0.0" +serde = { version = "1.0.225", features = ["derive"] } +serde_json = "1.0.145" +chrono = { version = "0.4.42", features = ["serde"] } \ No newline at end of file diff --git a/README.md b/README.md index acdb9e1..9d2455a 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,7 @@ A light-weight Rust SDK for the OpenWeatherMap APIs. It provides abstractions for APIs including Free API 2.5 and One Call 3.0, enabling simple weather data integration into your apps. + +## Status + +Work In Progress! Not suitable for general use... yet... \ No newline at end of file diff --git a/src/free_api_v25/current.rs b/src/free_api_v25/current.rs new file mode 100644 index 0000000..0a2053a --- /dev/null +++ b/src/free_api_v25/current.rs @@ -0,0 +1 @@ +// WIP diff --git a/src/free_api_v25/forecast.rs b/src/free_api_v25/forecast.rs new file mode 100644 index 0000000..0a2053a --- /dev/null +++ b/src/free_api_v25/forecast.rs @@ -0,0 +1 @@ +// WIP diff --git a/src/free_api_v25/mod.rs b/src/free_api_v25/mod.rs new file mode 100644 index 0000000..fd4a6e2 --- /dev/null +++ b/src/free_api_v25/mod.rs @@ -0,0 +1,25 @@ +//! Free-tier `OpenWeatherMap` API v2.5 +//! +//! Includes `/weather` and `/forecast` endpoints. +//! Might include other endpoints like `/history` later. + +/// Current weather +/// +/// For the `/weather` endpoint, which provides the current weather data. +pub mod current; + +/// Weather forecast +/// +/// For the `/forecast` endpoint, which provides weather forecast data. +pub mod forecast; + +/// API queries +/// +/// The structs, values, and methods required for API calls. +pub mod query; + +/* These are commented out until later to avoid `clippy` warnings. +pub use current::*; +pub use forecast::*; +pub use query::*; +*/ diff --git a/src/free_api_v25/query.rs b/src/free_api_v25/query.rs new file mode 100644 index 0000000..0a2053a --- /dev/null +++ b/src/free_api_v25/query.rs @@ -0,0 +1 @@ +// WIP diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..07583ba --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,12 @@ +//! # `OpenWeatherMap` SDK +//! A Rust SDK for the `OpenWeatherMap` APIs. +//! It provides abstractions for APIs to enable simple weather data integration into your apps. +//! +//! ## Currently Available APIs +//! - `free_api25`: `OpenWeatherMap` Free API v2.5 +//! +//! ## Coming soon +//! - `onecall_api_v30`: `OpenWeatherMap` One Call API v3.0 + +pub mod free_api_v25; +pub mod onecall_api_v30; // WIP diff --git a/src/onecall_api_v30/mod.rs b/src/onecall_api_v30/mod.rs new file mode 100644 index 0000000..c67f814 --- /dev/null +++ b/src/onecall_api_v30/mod.rs @@ -0,0 +1,3 @@ +//! `OpenWeatherMap` One Call API v3.0 +//! +//! Work In Progress!