Schema endpoint
All checks were successful
CI / Typos (push) Successful in 19s
CI / Build and test (push) Successful in 1m46s
CI / Clippy (push) Successful in 3m24s
Docker / build-and-push (push) Successful in 4m8s
CI / Build and test (all features) (push) Successful in 7m9s

This commit is contained in:
2026-03-26 20:04:33 -07:00
parent fac300431a
commit 795d2ee825
4 changed files with 49 additions and 4 deletions

View File

@@ -10,7 +10,9 @@ use std::pin::Pin;
use thiserror::Error;
use tracing::{trace, warn};
pub use pile_dataset::serve::{ItemsResponse, LookupRequest, LookupResponse};
pub use pile_dataset::serve::{
FieldSpec, FieldsResponse, ItemsResponse, LookupRequest, LookupResponse,
};
#[derive(Debug, Error)]
pub enum ClientError {
@@ -197,6 +199,14 @@ impl DatasetClient {
Ok(FieldResponse { content_type, data })
}
/// `GET /schema` — retrieve this dataset's schema.
pub async fn schema(&self) -> Result<FieldsResponse, ClientError> {
let url = format!("{}/schema", self.base_url);
trace!(url, "GET /schema");
let resp = self.client.get(url).send().await?;
check_status(resp).await?.json().await.map_err(Into::into)
}
/// `GET /items` — paginate over all items in this dataset, ordered by (source, key).
pub async fn list_items(
&self,