amazon_spapi/client_apis/
notifications_v1.rs1use anyhow::Result;
2
3use crate::{client::SpapiClient, models};
4
5impl SpapiClient {
6 pub async fn create_destination(
8 &self,
9 body: models::notifications::CreateDestinationRequest,
10 ) -> Result<models::notifications::CreateDestinationResponse> {
11 let configuration = self.create_configuration().await?;
12 let guard = self
13 .limiter()
14 .wait("notifications_v1/create_destination", 1.0, 5)
15 .await?;
16 let res = crate::apis::notifications_v1::create_destination(
17 &configuration,
18 body,
19 )
20 .await?;
21 guard.mark_response().await;
22 Ok(res)
23 }
24
25 pub async fn create_subscription(
27 &self,
28 notification_type: &str,
29 body: models::notifications::CreateSubscriptionRequest,
30 ) -> Result<models::notifications::CreateSubscriptionResponse> {
31 let configuration = self.create_configuration().await?;
32 let guard = self
33 .limiter()
34 .wait("notifications_v1/create_subscription", 1.0, 5)
35 .await?;
36 let res = crate::apis::notifications_v1::create_subscription(
37 &configuration,
38 notification_type,
39 body,
40 )
41 .await?;
42 guard.mark_response().await;
43 Ok(res)
44 }
45
46 pub async fn delete_destination(
48 &self,
49 destination_id: &str,
50 ) -> Result<models::notifications::DeleteDestinationResponse> {
51 let configuration = self.create_configuration().await?;
52 let guard = self
53 .limiter()
54 .wait("notifications_v1/delete_destination", 1.0, 5)
55 .await?;
56 let res = crate::apis::notifications_v1::delete_destination(
57 &configuration,
58 destination_id,
59 )
60 .await?;
61 guard.mark_response().await;
62 Ok(res)
63 }
64
65 pub async fn delete_subscription_by_id(
67 &self,
68 subscription_id: &str,
69 notification_type: &str,
70 ) -> Result<models::notifications::DeleteSubscriptionByIdResponse> {
71 let configuration = self.create_configuration().await?;
72 let guard = self
73 .limiter()
74 .wait("notifications_v1/delete_subscription_by_id", 1.0, 5)
75 .await?;
76 let res = crate::apis::notifications_v1::delete_subscription_by_id(
77 &configuration,
78 subscription_id,
79 notification_type,
80 )
81 .await?;
82 guard.mark_response().await;
83 Ok(res)
84 }
85
86 pub async fn get_destination(
88 &self,
89 destination_id: &str,
90 ) -> Result<models::notifications::GetDestinationResponse> {
91 let configuration = self.create_configuration().await?;
92 let guard = self
93 .limiter()
94 .wait("notifications_v1/get_destination", 1.0, 5)
95 .await?;
96 let res = crate::apis::notifications_v1::get_destination(
97 &configuration,
98 destination_id,
99 )
100 .await?;
101 guard.mark_response().await;
102 Ok(res)
103 }
104
105 pub async fn get_destinations(
107 &self,
108 ) -> Result<models::notifications::GetDestinationsResponse> {
109 let configuration = self.create_configuration().await?;
110 let guard = self
111 .limiter()
112 .wait("notifications_v1/get_destinations", 1.0, 5)
113 .await?;
114 let res = crate::apis::notifications_v1::get_destinations(
115 &configuration,
116 )
117 .await?;
118 guard.mark_response().await;
119 Ok(res)
120 }
121
122 pub async fn get_subscription(
124 &self,
125 notification_type: &str,
126 payload_version: Option<&str>,
127 ) -> Result<models::notifications::GetSubscriptionResponse> {
128 let configuration = self.create_configuration().await?;
129 let guard = self
130 .limiter()
131 .wait("notifications_v1/get_subscription", 1.0, 5)
132 .await?;
133 let res = crate::apis::notifications_v1::get_subscription(
134 &configuration,
135 notification_type,
136 payload_version,
137 )
138 .await?;
139 guard.mark_response().await;
140 Ok(res)
141 }
142
143 pub async fn get_subscription_by_id(
145 &self,
146 subscription_id: &str,
147 notification_type: &str,
148 ) -> Result<models::notifications::GetSubscriptionByIdResponse> {
149 let configuration = self.create_configuration().await?;
150 let guard = self
151 .limiter()
152 .wait("notifications_v1/get_subscription_by_id", 1.0, 5)
153 .await?;
154 let res = crate::apis::notifications_v1::get_subscription_by_id(
155 &configuration,
156 subscription_id,
157 notification_type,
158 )
159 .await?;
160 guard.mark_response().await;
161 Ok(res)
162 }
163}