use super::types::BatchItem;
use crate::{ZaiResult, client::ZaiClient};
pub struct BatchCancelRequest {
batch_id: String,
}
impl BatchCancelRequest {
pub fn new(batch_id: impl Into<String>) -> Self {
Self {
batch_id: batch_id.into(),
}
}
pub async fn send_via(&self, client: &ZaiClient) -> ZaiResult<BatchCancelResponse> {
crate::client::validation::require_non_blank(&self.batch_id, "batch_id")?;
let route = crate::client::routes::BATCHES_CANCEL;
let url = client.endpoints().resolve_route(route, &[&self.batch_id])?;
client
.send_empty::<BatchCancelResponse>(route.method(), url)
.await
}
}
pub type BatchCancelResponse = BatchItem;