zai_rs/batches/
retrieve.rs1use super::types::BatchItem;
2use crate::{ZaiResult, client::ZaiClient};
3
4pub struct BatchGetRequest {
6 batch_id: String,
7}
8
9impl BatchGetRequest {
10 pub fn new(batch_id: impl Into<String>) -> Self {
12 Self {
13 batch_id: batch_id.into(),
14 }
15 }
16
17 pub async fn send_via(&self, client: &ZaiClient) -> ZaiResult<BatchGetResponse> {
20 crate::client::validation::require_non_blank(&self.batch_id, "batch_id")?;
21 let route = crate::client::routes::BATCHES_GET;
22 let url = client.endpoints().resolve_route(route, &[&self.batch_id])?;
23 client
24 .send_empty::<BatchGetResponse>(route.method(), url)
25 .await
26 }
27}
28
29pub type BatchGetResponse = BatchItem;