modio/request/user/
unmute_user.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::UserId;
7
8/// Unmute a previously muted user.
9pub struct UnmuteUser<'a> {
10    http: &'a Client,
11    user_id: UserId,
12}
13
14impl<'a> UnmuteUser<'a> {
15    pub(crate) const fn new(http: &'a Client, user_id: UserId) -> Self {
16        Self { http, user_id }
17    }
18}
19
20impl IntoFuture for UnmuteUser<'_> {
21    type Output = Output<NoContent>;
22    type IntoFuture = ResponseFuture<NoContent>;
23
24    fn into_future(self) -> Self::IntoFuture {
25        let route = Route::UnmuteUser {
26            user_id: self.user_id,
27        };
28        match RequestBuilder::from_route(&route).empty() {
29            Ok(req) => self.http.request(req),
30            Err(err) => ResponseFuture::failed(err),
31        }
32    }
33}