This commit is contained in:
Florian RICHER 2025-04-23 20:57:42 +02:00
parent 515b5f946b
commit e8038e2cec
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
6 changed files with 48 additions and 10 deletions

View file

@ -0,0 +1,7 @@
[package]
name = "aiproxy-providers"
version = "0.1.0"
edition = "2024"
[dependencies]
thiserror = { workspace = true }

View file

@ -0,0 +1 @@
mod provider;

View file

@ -0,0 +1,25 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ProviderBuildError {
#[error("Internal error: {0}")]
InternalError(String),
}
pub trait Provider {
}
pub struct ProviderBuilder {
base_url: String,
api_key: Option<String>
}
impl ProviderBuilder {
pub fn build<T>(self) -> Result<Box<T>, ProviderBuildError>
where
T: Provider + TryFrom<ProviderBuilder, Error = ProviderBuildError>,
{
Ok(Box::new(T::try_from(self)?))
}
}