use crate::error::Error;
use crate::http::Client;
use crate::types::*;
pub struct Championship<'a> {
championship_id: String,
client: &'a Client,
}
impl<'a> Championship<'a> {
pub fn new(championship_id: impl Into<String>, client: &'a Client) -> Self {
Self {
championship_id: championship_id.into(),
client,
}
}
pub fn id(&self) -> &str {
&self.championship_id
}
pub async fn get(
&self,
expanded: Option<&[&str]>,
) -> Result<crate::types::Championship, Error> {
self.client
.get_championship(&self.championship_id, expanded)
.await
}
pub async fn matches(
&self,
match_type: Option<&str>,
offset: Option<i64>,
limit: Option<i64>,
) -> Result<MatchesList, Error> {
self.client
.get_championship_matches(&self.championship_id, match_type, offset, limit)
.await
}
}