use crate::qdrant::*;
#[must_use]
#[derive(Clone)]
pub struct DeleteVectorNameRequestBuilder {
pub(crate) collection_name: Option<String>,
pub(crate) wait: Option<Option<bool>>,
pub(crate) vector_name: Option<String>,
pub(crate) timeout: Option<Option<u64>>,
pub(crate) ordering: Option<Option<WriteOrdering>>,
}
impl DeleteVectorNameRequestBuilder {
pub fn collection_name(self, value: impl Into<String>) -> Self {
let mut new = self;
new.collection_name = Option::Some(value.into());
new
}
pub fn wait(self, value: bool) -> Self {
let mut new = self;
new.wait = Option::Some(Option::Some(value));
new
}
pub fn vector_name(self, value: impl Into<String>) -> Self {
let mut new = self;
new.vector_name = Option::Some(value.into());
new
}
pub fn timeout(self, value: u64) -> Self {
let mut new = self;
new.timeout = Option::Some(Option::Some(value));
new
}
pub fn ordering<VALUE: core::convert::Into<WriteOrdering>>(self, value: VALUE) -> Self {
let mut new = self;
new.ordering = Option::Some(Option::Some(value.into()));
new
}
fn build_inner(self) -> Result<DeleteVectorNameRequest, DeleteVectorNameRequestBuilderError> {
Ok(DeleteVectorNameRequest {
collection_name: match self.collection_name {
Some(value) => value,
None => {
return Result::Err(core::convert::Into::into(
::derive_builder::UninitializedFieldError::from("collection_name"),
));
}
},
wait: self.wait.unwrap_or_default(),
vector_name: match self.vector_name {
Some(value) => value,
None => {
return Result::Err(core::convert::Into::into(
::derive_builder::UninitializedFieldError::from("vector_name"),
));
}
},
timeout: self.timeout.unwrap_or_default(),
ordering: self.ordering.unwrap_or_default(),
})
}
fn create_empty() -> Self {
Self {
collection_name: core::default::Default::default(),
wait: core::default::Default::default(),
vector_name: core::default::Default::default(),
timeout: core::default::Default::default(),
ordering: core::default::Default::default(),
}
}
}
impl From<DeleteVectorNameRequestBuilder> for DeleteVectorNameRequest {
fn from(value: DeleteVectorNameRequestBuilder) -> Self {
value.build_inner().unwrap_or_else(|_| {
panic!(
"Failed to convert {0} to {1}",
"DeleteVectorNameRequestBuilder", "DeleteVectorNameRequest"
)
})
}
}
impl DeleteVectorNameRequestBuilder {
pub fn build(self) -> DeleteVectorNameRequest {
self.build_inner().unwrap_or_else(|_| {
panic!(
"Failed to build {0} into {1}",
"DeleteVectorNameRequestBuilder", "DeleteVectorNameRequest"
)
})
}
}
impl DeleteVectorNameRequestBuilder {
pub(crate) fn empty() -> Self {
Self::create_empty()
}
}
#[non_exhaustive]
#[derive(Debug)]
pub enum DeleteVectorNameRequestBuilderError {
UninitializedField(&'static str),
ValidationError(String),
}
impl std::fmt::Display for DeleteVectorNameRequestBuilderError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::UninitializedField(field) => {
write!(f, "`{field}` must be initialized")
}
Self::ValidationError(error) => write!(f, "{error}"),
}
}
}
impl std::error::Error for DeleteVectorNameRequestBuilderError {}
impl From<derive_builder::UninitializedFieldError> for DeleteVectorNameRequestBuilderError {
fn from(error: derive_builder::UninitializedFieldError) -> Self {
Self::UninitializedField(error.field_name())
}
}
impl From<String> for DeleteVectorNameRequestBuilderError {
fn from(error: String) -> Self {
Self::ValidationError(error)
}
}