pub mod request {
use url::Url;
use crate::{
chat::delete::response::ChatCompletionDeleted,
errors::OapiError,
rest::delete::{Delete, DeleteNoStream},
};
#[derive(Debug, Clone)]
pub struct ChatDeleteRequest<'a> {
pub completion_id: &'a str,
}
impl Delete for ChatDeleteRequest<'_> {
fn build_url(&self, base_url: &str) -> Result<String, crate::errors::OapiError> {
let mut url = Url::parse(base_url).map_err(OapiError::UrlError)?;
url.path_segments_mut()
.map_err(|_| OapiError::UrlCannotBeBase(base_url.to_string()))?
.push("chat")
.push("completions")
.push(self.completion_id);
Ok(url.to_string())
}
}
impl DeleteNoStream for ChatDeleteRequest<'_> {
type Response = ChatCompletionDeleted;
}
}
pub mod response {
use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
pub struct ChatCompletionDeleted {
pub id: String,
pub deleted: bool,
pub object: ChatCompletionDeletedObject,
}
#[derive(Debug, Clone, Deserialize)]
pub enum ChatCompletionDeletedObject {
#[serde(rename = "chat.completion.deleted")]
ChatCompletionDeleted,
}
crate::impl_from_str!(ChatCompletionDeleted);
}