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