Schema endpoint
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user