use crate::error::Error;
use crate::seed::client::SeedClient;
use crate::seed::config::CallOptions;
use crate::seed::models::{StoreIngest, StoreIngestAck, StoreQuery, StoreQueryResult, StoreStatus};
pub struct StoreResource<'c> {
pub(crate) client: &'c SeedClient,
}
impl<'c> StoreResource<'c> {
pub async fn status(&self) -> Result<StoreStatus, Error> {
self.client.request_get("/store/status").await
}
pub async fn status_with(&self, opts: CallOptions) -> Result<StoreStatus, Error> {
self.client.request_get_opts("/store/status", &opts).await
}
pub async fn query(&self, req: StoreQuery) -> Result<StoreQueryResult, Error> {
self.client.request_post("/store/query", &req, true).await
}
pub async fn query_with(
&self,
req: StoreQuery,
opts: CallOptions,
) -> Result<StoreQueryResult, Error> {
self.client
.request_post_opts("/store/query", &req, true, &opts)
.await
}
pub async fn ingest(&self, req: StoreIngest) -> Result<StoreIngestAck, Error> {
self.client.request_post("/store/ingest", &req, false).await
}
pub async fn ingest_with(
&self,
req: StoreIngest,
opts: CallOptions,
) -> Result<StoreIngestAck, Error> {
self.client
.request_post_opts("/store/ingest", &req, false, &opts)
.await
}
}