sideko_rest_api 0.9.2

Rust API Client
Documentation
use std::fmt::Display;
#[derive(Debug, Default, Clone)]
pub enum Environment {
    #[default]
    Production,
    MockServer,
}
impl Display for Environment {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Environment::Production => write!(f, "https://api.sideko.dev/v1"),
            Environment::MockServer => {
                write!(
                    f,
                    "https://api.sideko-staging.dev/v1/mock/sideko-octa/sideko-portal/2.11.10"
                )
            }
        }
    }
}
#[derive(Clone, Debug)]
pub enum BaseUrl {
    Env(crate::environment::Environment),
    Custom(String),
}
impl Default for BaseUrl {
    fn default() -> Self {
        BaseUrl::Env(crate::environment::Environment::default())
    }
}
impl std::fmt::Display for BaseUrl {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Env(e) => write!(f, "{e}"),
            Self::Custom(url) => write!(f, "{url}"),
        }
    }
}
impl From<String> for BaseUrl {
    fn from(value: String) -> Self {
        BaseUrl::Custom(value)
    }
}
impl From<Environment> for BaseUrl {
    fn from(value: Environment) -> Self {
        BaseUrl::Env(value)
    }
}