pub struct Client { /* private fields */ }Expand description
Asynchronous client for a running DataPress server.
Cheap to clone (wraps an Arc internally via reqwest::Client);
share one instance across tasks.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(base_url: impl Into<String>) -> Result<Self>
pub fn new(base_url: impl Into<String>) -> Result<Self>
Construct a client with defaults for base_url.
Sourcepub fn builder(base_url: impl Into<String>) -> ClientBuilder
pub fn builder(base_url: impl Into<String>) -> ClientBuilder
Start a ClientBuilder.
Sourcepub async fn healthz(&self) -> Result<JsonValue>
pub async fn healthz(&self) -> Result<JsonValue>
Liveness probe — GET /healthz (always at the host root).
Sourcepub async fn readyz(&self) -> Result<JsonValue>
pub async fn readyz(&self) -> Result<JsonValue>
Readiness probe — GET /readyz. Returns a 503 error while the
server is still loading datasets.
Sourcepub async fn schema(&self, dataset: &str) -> Result<JsonValue>
pub async fn schema(&self, dataset: &str) -> Result<JsonValue>
Fetch the schema description for dataset.
Sourcepub async fn count(
&self,
dataset: &str,
predicates: &[Predicate],
) -> Result<u64>
pub async fn count( &self, dataset: &str, predicates: &[Predicate], ) -> Result<u64>
Count matching rows. predicates is the same predicate shape used
by QueryRequest; None/empty = unfiltered.
Sourcepub async fn query_json(
&self,
dataset: &str,
request: &QueryRequest,
) -> Result<QueryResponse>
pub async fn query_json( &self, dataset: &str, request: &QueryRequest, ) -> Result<QueryResponse>
Run a structured query and return the decoded JSON envelope.
Sourcepub async fn sql(
&self,
sql: impl Into<String>,
max_rows: Option<u64>,
) -> Result<SqlResponse>
pub async fn sql( &self, sql: impl Into<String>, max_rows: Option<u64>, ) -> Result<SqlResponse>
Run a raw read-only SQL statement (POST /sql). The endpoint must
be enabled server-side ([sql].enabled = true), else a 404 is
returned.
Sourcepub async fn reload(&self, dataset: &str) -> Result<JsonValue>
pub async fn reload(&self, dataset: &str) -> Result<JsonValue>
Trigger an in-place reload of dataset (requires admin_token or
the configured reload scopes).
Sourcepub async fn query_arrow_bytes(
&self,
dataset: &str,
request: &QueryRequest,
) -> Result<Bytes>
pub async fn query_arrow_bytes( &self, dataset: &str, request: &QueryRequest, ) -> Result<Bytes>
Run a structured query against the Arrow IPC streaming endpoint
(POST /datasets/{name}/query/stream), returning the raw IPC
stream bytes. Use Client::query_arrow to decode them into
record batches.
Sourcepub async fn query_arrow(
&self,
dataset: &str,
request: &QueryRequest,
) -> Result<Vec<RecordBatch>>
pub async fn query_arrow( &self, dataset: &str, request: &QueryRequest, ) -> Result<Vec<RecordBatch>>
Run a structured query and decode the Arrow IPC response into a
vector of arrow::record_batch::RecordBatch.