pub struct BaseUrlResolver<'a> { /* private fields */ }Expand description
Resolves the base URL for an API based on a priority hierarchy
Implementations§
Source§impl<'a> BaseUrlResolver<'a>
impl<'a> BaseUrlResolver<'a>
Sourcepub const fn new(spec: &'a CachedSpec) -> Self
pub const fn new(spec: &'a CachedSpec) -> Self
Creates a new URL resolver for the given spec
Sourcepub fn with_global_config(self, config: &'a GlobalConfig) -> Self
pub fn with_global_config(self, config: &'a GlobalConfig) -> Self
Sets the global configuration for API-specific overrides
Sourcepub fn with_environment(self, env: Option<String>) -> Self
pub fn with_environment(self, env: Option<String>) -> Self
Sets the environment explicitly (overrides APERTURE_ENV)
Sourcepub fn resolve(&self, explicit_url: Option<&str>) -> String
pub fn resolve(&self, explicit_url: Option<&str>) -> String
Resolves the base URL according to the priority hierarchy:
- Explicit parameter (for testing)
- Per-API config override with environment support
- Environment variable:
APERTURE_BASE_URL - Cached spec default
- Fallback: https://api.example.com
Sourcepub fn resolve_with_variables(
&self,
explicit_url: Option<&str>,
server_var_args: &[String],
) -> Result<String, Error>
pub fn resolve_with_variables( &self, explicit_url: Option<&str>, server_var_args: &[String], ) -> Result<String, Error>
Resolves the base URL with server variable substitution support
§Arguments
explicit_url- Explicit URL override (for testing)server_var_args- Server variable arguments from CLI (e.g.,["region=us", "env=prod"])
§Returns
Ok(String)- Resolved URL with variables substitutedErr(Error)- Server variable validation or substitution errors
§Errors
Returns errors for:
- Invalid server variable format or values
- Missing required server variables
- URL template substitution failures
Sourcepub fn get_api_config(&self) -> Option<&ApiConfig>
pub fn get_api_config(&self) -> Option<&ApiConfig>
Gets the API config if available
Auto Trait Implementations§
impl<'a> Freeze for BaseUrlResolver<'a>
impl<'a> RefUnwindSafe for BaseUrlResolver<'a>
impl<'a> Send for BaseUrlResolver<'a>
impl<'a> Sync for BaseUrlResolver<'a>
impl<'a> Unpin for BaseUrlResolver<'a>
impl<'a> UnwindSafe for BaseUrlResolver<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more