modio/request/mods/
delete_mod.rs

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