data_gov/
lib.rs

1pub const DATA_GOV_BASE_URL: &str = "https://catalog.data.gov/api/3";
2
3// Re-export the CKAN crate for direct access
4pub use data_gov_ckan as ckan;
5
6// Public modules
7pub mod client;
8pub mod colors;
9pub mod config;
10pub mod error;
11
12// Re-export main types for convenience
13pub use client::DataGovClient;
14pub use colors::{ColorHelper, ColorMode};
15pub use config::{DataGovConfig, OperatingMode};
16pub use error::{DataGovError, Result};
17
18// pub trait CKANResponse: serde::de::DeserializeOwned {}
19
20// // Extension trait for automatic conversion
21// pub trait IntoCKANResponse {
22//     fn into_ckan<T>(self) -> T
23//     where
24//         T: CKANResponse;
25// }
26
27// impl IntoCKANResponse for serde_json::Value {
28//     fn into_ckan<T>(self) -> T
29//     where
30//         T: CKANResponse,
31//     {
32//         serde_json::from_value::<T>(self)
33//             .expect("Failed to convert Value to target struct")
34//     }
35// }
36
37// #[derive(serde::Deserialize, Debug)]
38// pub struct PackageSearchResult {
39//     pub help: String,
40//     pub success: bool,
41//     pub result: PackageSearchResultDetail,
42// }
43
44// impl CKANResponse for PackageSearchResult {}
45
46// #[derive(serde::Deserialize, Debug)]
47// pub struct PackageSearchResultDetail {
48//     pub count: u32,
49//     pub sort: Option<String>,
50//     pub results: Vec<PackageSearchResultItem>,
51//     // pub facets: Option<serde_json::Value>,
52//     // pub search_facets: Option<serde_json::Value>,
53// }
54
55// #[derive(serde::Deserialize, Debug)]
56// pub struct PackageSearchResultItem {
57//     pub display_name: Option<String>,
58//     pub id: String,
59//     pub name: String,
60//     pub state: String,
61//     pub vocabulary_id: Option<String>,
62// }
63
64// impl PackageSearchResultItem {
65
66//     // Metadata contains resource URLs and more
67//     pub fn to_metadata_url(&self) -> String {
68//         format!("https://catalog.data.gov/harvest/object/{}", self.id)
69//     }
70// }