use std::rc::Rc;
use crate::Config;
use crate::model::{Show, ShowId};
use super::{Error, make_request};
pub struct Client {
config: Rc<Config>,
}
impl Client {
pub fn new(config: Rc<Config>) -> Self {
Self { config }
}
}
impl Client {
pub async fn get_details(
&self,
id: impl Into<ShowId>,
language: Option<&str>,
) -> Result<Show, Error> {
Ok(self
.config
.client
.execute(make_request(
&self.config,
&format!("/3/tv/{}", id.into()),
language,
)?)
.await?
.error_for_status()?
.json()
.await?)
}
}