twilight_http/request/guild/sticker/
delete_guild_sticker.rs1#[cfg(not(target_os = "wasi"))]
2use crate::response::{Response, ResponseFuture, marker::EmptyBody};
3use crate::{
4 client::Client,
5 error::Error,
6 request::{Request, TryIntoRequest},
7 routing::Route,
8};
9use std::future::IntoFuture;
10use twilight_model::id::{
11 Id,
12 marker::{GuildMarker, StickerMarker},
13};
14
15pub struct DeleteGuildSticker<'a> {
34 guild_id: Id<GuildMarker>,
35 http: &'a Client,
36 sticker_id: Id<StickerMarker>,
37}
38
39impl<'a> DeleteGuildSticker<'a> {
40 pub(crate) const fn new(
41 http: &'a Client,
42 guild_id: Id<GuildMarker>,
43 sticker_id: Id<StickerMarker>,
44 ) -> Self {
45 Self {
46 guild_id,
47 http,
48 sticker_id,
49 }
50 }
51}
52
53#[cfg(not(target_os = "wasi"))]
54impl IntoFuture for DeleteGuildSticker<'_> {
55 type Output = Result<Response<EmptyBody>, Error>;
56
57 type IntoFuture = ResponseFuture<EmptyBody>;
58
59 fn into_future(self) -> Self::IntoFuture {
60 let http = self.http;
61
62 match self.try_into_request() {
63 Ok(request) => http.request(request),
64 Err(source) => ResponseFuture::error(source),
65 }
66 }
67}
68
69impl TryIntoRequest for DeleteGuildSticker<'_> {
70 fn try_into_request(self) -> Result<Request, Error> {
71 Ok(Request::from_route(&Route::DeleteGuildSticker {
72 guild_id: self.guild_id.get(),
73 sticker_id: self.sticker_id.get(),
74 }))
75 }
76}