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