modio/request/games/
get_game.rs1use std::future::IntoFuture;
2
3use crate::client::Client;
4use crate::request::{Output, RequestBuilder, Route};
5use crate::response::ResponseFuture;
6use crate::types::games::Game;
7use crate::types::id::GameId;
8
9pub struct GetGame<'a> {
11 http: &'a Client,
12 id: GameId,
13 show_hidden_tags: Option<bool>,
14}
15
16impl<'a> GetGame<'a> {
17 pub(crate) const fn new(http: &'a Client, id: GameId) -> Self {
18 Self {
19 http,
20 id,
21 show_hidden_tags: None,
22 }
23 }
24
25 pub const fn show_hidden_tags(mut self, value: bool) -> Self {
27 self.show_hidden_tags = Some(value);
28 self
29 }
30}
31
32impl IntoFuture for GetGame<'_> {
33 type Output = Output<Game>;
34 type IntoFuture = ResponseFuture<Game>;
35
36 fn into_future(self) -> Self::IntoFuture {
37 let route = Route::GetGame {
38 id: self.id,
39 show_hidden_tags: self.show_hidden_tags,
40 };
41 match RequestBuilder::from_route(&route).empty() {
42 Ok(req) => self.http.request(req),
43 Err(err) => ResponseFuture::failed(err),
44 }
45 }
46}