pub struct ApiCatalog {
pub providers: HashMap<String, Provider>,
pub models: HashMap<String, Vec<Model>>,
pub cached_at: Option<DateTime<Utc>>,
pub ttl_seconds: u64,
}Expand description
OpenCode API catalog containing all available providers and models.
Fields§
§providers: HashMap<String, Provider>All providers supported by OpenCode.
models: HashMap<String, Vec<Model>>All models supported by OpenCode, indexed by provider name.
cached_at: Option<DateTime<Utc>>When this catalog was cached (for TTL tracking).
ttl_seconds: u64Time-to-live in seconds for this catalog.
Implementations§
Source§impl ApiCatalog
impl ApiCatalog
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if the catalog is expired based on its cached_at timestamp and TTL.
Sourcepub fn has_provider(&self, provider: &str) -> bool
pub fn has_provider(&self, provider: &str) -> bool
Check if a provider exists in the catalog.
Sourcepub fn has_model(&self, provider: &str, model: &str) -> bool
pub fn has_model(&self, provider: &str, model: &str) -> bool
Check if a specific model exists for a provider.
Sourcepub fn get_model_ids(&self, provider: &str) -> Vec<String>
pub fn get_model_ids(&self, provider: &str) -> Vec<String>
Get all model IDs for a provider.
Sourcepub fn provider_names(&self) -> Vec<String>
pub fn provider_names(&self) -> Vec<String>
Get all provider names.
Trait Implementations§
Source§impl Clone for ApiCatalog
impl Clone for ApiCatalog
Source§fn clone(&self) -> ApiCatalog
fn clone(&self) -> ApiCatalog
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ApiCatalog
impl Debug for ApiCatalog
Source§impl<'de> Deserialize<'de> for ApiCatalog
impl<'de> Deserialize<'de> for ApiCatalog
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ApiCatalog
impl RefUnwindSafe for ApiCatalog
impl Send for ApiCatalog
impl Sync for ApiCatalog
impl Unpin for ApiCatalog
impl UnwindSafe for ApiCatalog
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more