1#![allow(unused_imports)]
4
5use crate::objects::*;
6use crate::{
7 CursorPaginated, NextCursor, ResponseMetadata, SlackApiMethod, SlackClient, SlackError,
8};
9use serde::{Deserialize, Serialize};
10
11#[doc(alias = "reminders.add")]
15#[derive(Debug, Clone, PartialEq, Serialize)]
16#[non_exhaustive]
17pub struct RemindersAddRequest {
18 pub text: String,
20 pub time: String,
22 #[serde(skip_serializing_if = "Option::is_none")]
24 pub user: Option<String>,
25 #[serde(skip_serializing_if = "Option::is_none")]
27 pub team_id: Option<String>,
28 #[serde(skip_serializing_if = "Option::is_none")]
30 pub recurrence: Option<serde_json::Value>,
31}
32
33impl RemindersAddRequest {
34 pub fn new(text: impl Into<String>, time: impl Into<String>) -> Self {
35 Self {
36 text: text.into(),
37 time: time.into(),
38 user: None,
39 team_id: None,
40 recurrence: None,
41 }
42 }
43
44 pub fn user(mut self, user: impl Into<String>) -> Self {
45 self.user = Some(user.into());
46 self
47 }
48
49 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
50 self.team_id = Some(team_id.into());
51 self
52 }
53
54 pub fn recurrence(mut self, recurrence: serde_json::Value) -> Self {
55 self.recurrence = Some(recurrence);
56 self
57 }
58}
59
60impl SlackApiMethod for RemindersAddRequest {
61 const METHOD: &'static str = "reminders.add";
62 type Response = RemindersAddResponse;
63}
64
65#[doc(alias = "reminders.add")]
67#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
68pub struct RemindersAddResponse {
69 #[serde(
70 default,
71 deserialize_with = "crate::de::opt_object",
72 skip_serializing_if = "Option::is_none"
73 )]
74 pub reminder: Option<Reminder>,
75 #[serde(
76 default,
77 deserialize_with = "crate::de::opt_object",
78 skip_serializing_if = "Option::is_none"
79 )]
80 pub response_metadata: Option<ResponseMetadata>,
81 #[serde(
82 default,
83 deserialize_with = "crate::de::opt_string",
84 skip_serializing_if = "Option::is_none"
85 )]
86 pub warning: Option<String>,
87}
88
89#[doc(alias = "reminders.complete")]
93#[derive(Debug, Clone, PartialEq, Serialize)]
94#[non_exhaustive]
95pub struct RemindersCompleteRequest {
96 pub reminder: String,
98 #[serde(skip_serializing_if = "Option::is_none")]
100 pub team_id: Option<String>,
101}
102
103impl RemindersCompleteRequest {
104 pub fn new(reminder: impl Into<String>) -> Self {
105 Self {
106 reminder: reminder.into(),
107 team_id: None,
108 }
109 }
110
111 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
112 self.team_id = Some(team_id.into());
113 self
114 }
115}
116
117impl SlackApiMethod for RemindersCompleteRequest {
118 const METHOD: &'static str = "reminders.complete";
119 type Response = RemindersCompleteResponse;
120}
121
122#[doc(alias = "reminders.complete")]
124#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
125pub struct RemindersCompleteResponse {
126 #[serde(flatten)]
128 pub extra: serde_json::Map<String, serde_json::Value>,
129 #[serde(
130 default,
131 deserialize_with = "crate::de::opt_object",
132 skip_serializing_if = "Option::is_none"
133 )]
134 pub response_metadata: Option<ResponseMetadata>,
135 #[serde(
136 default,
137 deserialize_with = "crate::de::opt_string",
138 skip_serializing_if = "Option::is_none"
139 )]
140 pub warning: Option<String>,
141}
142
143#[doc(alias = "reminders.delete")]
147#[derive(Debug, Clone, PartialEq, Serialize)]
148#[non_exhaustive]
149pub struct RemindersDeleteRequest {
150 pub reminder: String,
152 #[serde(skip_serializing_if = "Option::is_none")]
154 pub team_id: Option<String>,
155}
156
157impl RemindersDeleteRequest {
158 pub fn new(reminder: impl Into<String>) -> Self {
159 Self {
160 reminder: reminder.into(),
161 team_id: None,
162 }
163 }
164
165 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
166 self.team_id = Some(team_id.into());
167 self
168 }
169}
170
171impl SlackApiMethod for RemindersDeleteRequest {
172 const METHOD: &'static str = "reminders.delete";
173 type Response = RemindersDeleteResponse;
174}
175
176#[doc(alias = "reminders.delete")]
178#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
179pub struct RemindersDeleteResponse {
180 #[serde(flatten)]
182 pub extra: serde_json::Map<String, serde_json::Value>,
183 #[serde(
184 default,
185 deserialize_with = "crate::de::opt_object",
186 skip_serializing_if = "Option::is_none"
187 )]
188 pub response_metadata: Option<ResponseMetadata>,
189 #[serde(
190 default,
191 deserialize_with = "crate::de::opt_string",
192 skip_serializing_if = "Option::is_none"
193 )]
194 pub warning: Option<String>,
195}
196
197#[doc(alias = "reminders.info")]
201#[derive(Debug, Clone, PartialEq, Serialize)]
202#[non_exhaustive]
203pub struct RemindersInfoRequest {
204 pub reminder: String,
206 #[serde(skip_serializing_if = "Option::is_none")]
208 pub team_id: Option<String>,
209}
210
211impl RemindersInfoRequest {
212 pub fn new(reminder: impl Into<String>) -> Self {
213 Self {
214 reminder: reminder.into(),
215 team_id: None,
216 }
217 }
218
219 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
220 self.team_id = Some(team_id.into());
221 self
222 }
223}
224
225impl SlackApiMethod for RemindersInfoRequest {
226 const METHOD: &'static str = "reminders.info";
227 type Response = RemindersInfoResponse;
228}
229
230#[doc(alias = "reminders.info")]
232#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
233pub struct RemindersInfoResponse {
234 #[serde(
235 default,
236 deserialize_with = "crate::de::opt_object",
237 skip_serializing_if = "Option::is_none"
238 )]
239 pub reminder: Option<Reminder>,
240 #[serde(
241 default,
242 deserialize_with = "crate::de::opt_object",
243 skip_serializing_if = "Option::is_none"
244 )]
245 pub response_metadata: Option<ResponseMetadata>,
246 #[serde(
247 default,
248 deserialize_with = "crate::de::opt_string",
249 skip_serializing_if = "Option::is_none"
250 )]
251 pub warning: Option<String>,
252}
253
254#[doc(alias = "reminders.list")]
258#[derive(Debug, Clone, PartialEq, Serialize, Default)]
259#[non_exhaustive]
260pub struct RemindersListRequest {
261 #[serde(skip_serializing_if = "Option::is_none")]
263 pub team_id: Option<String>,
264}
265
266impl RemindersListRequest {
267 pub fn new() -> Self {
268 Self { team_id: None }
269 }
270
271 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
272 self.team_id = Some(team_id.into());
273 self
274 }
275}
276
277impl SlackApiMethod for RemindersListRequest {
278 const METHOD: &'static str = "reminders.list";
279 type Response = RemindersListResponse;
280}
281
282#[doc(alias = "reminders.list")]
284#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
285pub struct RemindersListResponse {
286 #[serde(
287 default,
288 deserialize_with = "crate::de::vec",
289 skip_serializing_if = "Vec::is_empty"
290 )]
291 pub reminders: Vec<Reminder>,
292 #[serde(
293 default,
294 deserialize_with = "crate::de::opt_object",
295 skip_serializing_if = "Option::is_none"
296 )]
297 pub response_metadata: Option<ResponseMetadata>,
298 #[serde(
299 default,
300 deserialize_with = "crate::de::opt_string",
301 skip_serializing_if = "Option::is_none"
302 )]
303 pub warning: Option<String>,
304}
305
306impl SlackClient {
307 #[doc(alias = "reminders.add")]
319 pub async fn reminders_add(
320 &self,
321 request: &RemindersAddRequest,
322 ) -> Result<RemindersAddResponse, SlackError> {
323 self.call(request).await
324 }
325
326 #[doc(alias = "reminders.complete")]
338 pub async fn reminders_complete(
339 &self,
340 request: &RemindersCompleteRequest,
341 ) -> Result<RemindersCompleteResponse, SlackError> {
342 self.call(request).await
343 }
344
345 #[doc(alias = "reminders.delete")]
357 pub async fn reminders_delete(
358 &self,
359 request: &RemindersDeleteRequest,
360 ) -> Result<RemindersDeleteResponse, SlackError> {
361 self.call(request).await
362 }
363
364 #[doc(alias = "reminders.info")]
376 pub async fn reminders_info(
377 &self,
378 request: &RemindersInfoRequest,
379 ) -> Result<RemindersInfoResponse, SlackError> {
380 self.call(request).await
381 }
382
383 #[doc(alias = "reminders.list")]
395 pub async fn reminders_list(
396 &self,
397 request: &RemindersListRequest,
398 ) -> Result<RemindersListResponse, SlackError> {
399 self.call(request).await
400 }
401}