use crate::error::Error;
use crate::http::Client;
use crate::types::*;
pub struct Game<'a> {
game_id: String,
client: &'a Client,
}
impl<'a> Game<'a> {
pub fn new(game_id: impl Into<String>, client: &'a Client) -> Self {
Self {
game_id: game_id.into(),
client,
}
}
pub fn id(&self) -> &str {
&self.game_id
}
pub async fn get(&self) -> Result<crate::types::Game, Error> {
self.client.get_game(&self.game_id).await
}
pub async fn parent(&self) -> Result<crate::types::Game, Error> {
self.client.get_parent_game(&self.game_id).await
}
pub async fn matchmakings(
&self,
region: Option<&str>,
offset: Option<i64>,
limit: Option<i64>,
) -> Result<MatchmakingList, Error> {
self.client
.get_game_matchmakings(&self.game_id, region, offset, limit)
.await
}
}