openai_interface/containers/
delete.rs1use url::Url;
7
8use crate::{
9 errors::OapiError,
10 rest::delete::{Delete, DeleteNoStream},
11};
12
13#[derive(Debug, Clone)]
15pub struct DeleteContainerRequest<'a> {
16 pub container_id: &'a str,
18}
19
20impl Delete for DeleteContainerRequest<'_> {
21 fn build_url(&self, base_url: &str) -> Result<String, OapiError> {
25 let mut url = Url::parse(base_url.trim_end_matches('/')).map_err(OapiError::UrlError)?;
26 url.path_segments_mut()
27 .map_err(|_| OapiError::UrlCannotBeBase(base_url.to_string()))?
28 .push("containers")
29 .push(self.container_id);
30 Ok(url.to_string())
31 }
32}
33
34impl DeleteNoStream for DeleteContainerRequest<'_> {
35 type Response = DeleteContainerResponse;
36}
37
38#[derive(Debug, Clone, serde::Deserialize)]
40pub struct DeleteContainerResponse {
41 pub id: String,
43 pub deleted: bool,
45 #[serde(default)]
48 pub object: Option<String>,
49}
50
51crate::impl_from_str!(DeleteContainerResponse);