1#[cfg(feature = "ddstats")]
2use crate::api::DDApi;
3#[cfg(feature = "ddstats")]
4use crate::errors::ApiError;
5#[cfg(feature = "ddstats")]
6use crate::scheme::ddstats::*;
7#[cfg(feature = "ddstats")]
8use std::future::Future;
9
10#[cfg(feature = "ddstats")]
11pub trait DDstats {
12 fn s_player(&self, player: &str) -> impl Future<Output = Result<Player, ApiError>> + Send;
13 fn s_map(&self, map: &str) -> impl Future<Output = Result<Map, ApiError>> + Send;
14 fn s_maps(&self) -> impl Future<Output = Result<Vec<StatsMap>, ApiError>> + Send;
15 fn s_profile(&self, player: &str) -> impl Future<Output = Result<Profile, ApiError>> + Send;
16}
17
18#[cfg(feature = "ddstats")]
19impl DDstats for DDApi {
20 async fn s_player(&self, player: &str) -> Result<Player, ApiError> {
21 self._generator(&Player::api(player)).await
22 }
23
24 async fn s_map(&self, map: &str) -> Result<Map, ApiError> {
25 self._generator(&Map::api(map)).await
26 }
27
28 async fn s_maps(&self) -> Result<Vec<StatsMap>, ApiError> {
29 self._generator(&StatsMap::api()).await
30 }
31
32 async fn s_profile(&self, player: &str) -> Result<Profile, ApiError> {
33 self._generator(&Profile::api(player)).await
34 }
35}