1use super::types::BatchItem;
2use crate::{ZaiResult, client::ZaiClient};
3
4pub struct BatchCancelRequest {
6 batch_id: String,
7}
8
9impl BatchCancelRequest {
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<BatchCancelResponse> {
19 crate::client::validation::require_non_blank(&self.batch_id, "batch_id")?;
20 let route = crate::client::routes::BATCHES_CANCEL;
21 let url = client.endpoints().resolve_route(route, &[&self.batch_id])?;
22 client
23 .send_empty::<BatchCancelResponse>(route.method(), url)
24 .await
25 }
26}
27
28pub type BatchCancelResponse = BatchItem;