use spiral_contract::call::CallError;
use uuid::Uuid;
use super::generated::vector_indexes::AuthenticatedClient;
pub use crate::api::vector_indexes::*;
pub type HttpVectorIndexClient = AuthenticatedClient;
impl AuthenticatedClient {
pub async fn storage_binding_optional(
&self,
vector_index_id: Uuid,
request: StorageAccessRequest,
) -> Result<Option<StorageBinding>, CallError<VectorIndexesError>> {
match self.storage_binding(vector_index_id, request).await {
Ok(binding) => Ok(Some(binding)),
Err(CallError::Service(error)) if error.status() == 404 => Ok(None),
Err(CallError::UnknownRemote(error)) if error.status() == 404 => Ok(None),
Err(error) => Err(error),
}
}
}