twilight_http/request/application/emoji/
delete_emoji.rs1use std::future::IntoFuture;
2use twilight_model::id::{
3 Id,
4 marker::{ApplicationMarker, EmojiMarker},
5};
6
7#[cfg(not(target_os = "wasi"))]
8use crate::response::{Response, ResponseFuture};
9use crate::{
10 Client, Error,
11 request::{Request, TryIntoRequest},
12 routing::Route,
13};
14
15pub struct DeleteApplicationEmoji<'a> {
16 application_id: Id<ApplicationMarker>,
17 emoji_id: Id<EmojiMarker>,
18 http: &'a Client,
19}
20
21impl<'a> DeleteApplicationEmoji<'a> {
22 pub(crate) const fn new(
23 http: &'a Client,
24 application_id: Id<ApplicationMarker>,
25 emoji_id: Id<EmojiMarker>,
26 ) -> Self {
27 Self {
28 application_id,
29 emoji_id,
30 http,
31 }
32 }
33}
34
35#[cfg(not(target_os = "wasi"))]
36impl IntoFuture for DeleteApplicationEmoji<'_> {
37 type Output = Result<Response<()>, Error>;
38
39 type IntoFuture = ResponseFuture<()>;
40
41 fn into_future(self) -> Self::IntoFuture {
42 let http = self.http;
43
44 match self.try_into_request() {
45 Ok(request) => http.request(request),
46 Err(source) => ResponseFuture::error(source),
47 }
48 }
49}
50
51impl TryIntoRequest for DeleteApplicationEmoji<'_> {
52 fn try_into_request(self) -> Result<Request, Error> {
53 Ok(Request::from_route(&Route::DeleteApplicationEmoji {
54 application_id: self.application_id.get(),
55 emoji_id: self.emoji_id.get(),
56 }))
57 }
58}