use crate::api::{DDApi, DDstatsClient, HasApiCore};
use crate::error::Result;
use crate::scheme::ddstats::*;
use std::future::Future;
pub trait DDstats {
fn player(&self, player: &str) -> impl Future<Output = Result<Player>> + Send;
fn map(&self, map: &str) -> impl Future<Output = Result<Map>> + Send;
fn maps(&self) -> impl Future<Output = Result<Vec<StatsMap>>> + Send;
fn profile(&self, player: &str) -> impl Future<Output = Result<Profile>> + Send;
}
impl DDstats for DDApi {
async fn player(&self, player: &str) -> Result<Player> {
self._generator(&Player::api(player)).await
}
async fn map(&self, map: &str) -> Result<Map> {
self._generator(&Map::api(map)).await
}
async fn maps(&self) -> Result<Vec<StatsMap>> {
self._generator(&StatsMap::api()).await
}
async fn profile(&self, player: &str) -> Result<Profile> {
self._generator(&Profile::api(player)).await
}
}
impl DDstats for DDstatsClient {
async fn player(&self, player: &str) -> Result<Player> {
self.core()._generator(&Player::api(player)).await
}
async fn map(&self, map: &str) -> Result<Map> {
self.core()._generator(&Map::api(map)).await
}
async fn maps(&self) -> Result<Vec<StatsMap>> {
self.core()._generator(&StatsMap::api()).await
}
async fn profile(&self, player: &str) -> Result<Profile> {
self.core()._generator(&Profile::api(player)).await
}
}