use url::Url;
use crate::{
errors::OapiError,
rest::post::{Post, PostNoStream},
vector_stores::file_batches::VectorStoreFileBatch,
};
#[derive(Debug, Clone)]
pub struct CancelVectorStoreFileBatchRequest<'a> {
#[serde(skip)]
pub vector_store_id: &'a str,
#[serde(skip)]
pub batch_id: &'a str,
}
impl Post for CancelVectorStoreFileBatchRequest<'_> {
fn is_streaming(&self) -> bool {
false
}
fn build_url(&self, base_url: &str) -> Result<String, OapiError> {
let mut url =
Url::parse(base_url.trim_end_matches('/')).map_err(OapiError::UrlError)?;
url.path_segments_mut()
.map_err(|_| OapiError::UrlCannotBeBase(base_url.to_string()))?
.push("vector_stores")
.push(self.vector_store_id)
.push("file_batches")
.push(self.batch_id)
.push("cancel");
Ok(url.to_string())
}
}
impl PostNoStream for CancelVectorStoreFileBatchRequest<'_> {
type Response = VectorStoreFileBatch;
}