Skip to main content

data_gov_catalog/
lib.rs

1//! Async client for the [data.gov](https://data.gov) Catalog API.
2//!
3//! The Catalog API replaced data.gov's CKAN action API in 2026. It exposes
4//! full-text search over the federal dataset catalog together with organization
5//! and keyword listings, spatial lookups, and direct access to individual
6//! harvest records. Metadata is returned in the
7//! [DCAT-US 3](https://resources.data.gov/resources/dcat-us/) vocabulary.
8//!
9//! Start with [`CatalogClient`]: construct a [`Configuration`] (the default
10//! points at `https://catalog.data.gov`), wrap it in an `Arc`, and call one
11//! of the async methods such as [`CatalogClient::search`] or
12//! [`CatalogClient::organizations`].
13//!
14//! ```no_run
15//! use data_gov_catalog::{CatalogClient, Configuration, SearchParams};
16//! use std::sync::Arc;
17//!
18//! # #[tokio::main]
19//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
20//! let client = CatalogClient::new(Arc::new(Configuration::default()));
21//! let page = client
22//!     .search(SearchParams::new().q("climate").per_page(5))
23//!     .await?;
24//! println!("{} results on this page", page.results.len());
25//! # Ok(()) }
26//! ```
27
28pub mod client;
29pub mod models;
30
31pub use client::{CatalogClient, CatalogError, Configuration, SearchParams};