modio/request/mods/stats/
get_mod_stats.rs1use std::future::IntoFuture;
2
3use crate::client::Client;
4use crate::request::{Output, RequestBuilder, Route};
5use crate::response::ResponseFuture;
6use crate::types::id::{GameId, ModId};
7use crate::types::mods::Statistics;
8
9pub struct GetModStats<'a> {
11 http: &'a Client,
12 game_id: GameId,
13 mod_id: ModId,
14}
15
16impl<'a> GetModStats<'a> {
17 pub(crate) const fn new(http: &'a Client, game_id: GameId, mod_id: ModId) -> Self {
18 Self {
19 http,
20 game_id,
21 mod_id,
22 }
23 }
24}
25
26impl IntoFuture for GetModStats<'_> {
27 type Output = Output<Statistics>;
28 type IntoFuture = ResponseFuture<Statistics>;
29
30 fn into_future(self) -> Self::IntoFuture {
31 let route = Route::GetModStats {
32 game_id: self.game_id,
33 mod_id: self.mod_id,
34 };
35 match RequestBuilder::from_route(&route).empty() {
36 Ok(req) => self.http.request(req),
37 Err(err) => ResponseFuture::failed(err),
38 }
39 }
40}