use crate::client::Client;
use crate::config::Config;
use crate::error::AnthropicError;
use crate::types::models::Model;
use crate::types::models::ModelListParams;
use crate::types::models::ModelsListResponse;
pub struct Models<'c, C: Config> {
client: &'c Client<C>,
}
impl<'c, C: Config> Models<'c, C> {
pub const fn new(client: &'c Client<C>) -> Self {
Self { client }
}
pub async fn list(
&self,
params: &ModelListParams,
) -> Result<ModelsListResponse, AnthropicError> {
self.client.get_with_query("/v1/models", params).await
}
pub async fn get(&self, model_id: &str) -> Result<Model, AnthropicError> {
self.client.get(&format!("/v1/models/{model_id}")).await
}
}
impl<C: Config> crate::Client<C> {
#[must_use]
pub const fn models(&self) -> Models<'_, C> {
Models::new(self)
}
}