slack_chat_api/reminders.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct Reminders {
5 pub client: Client,
6}
7
8impl Reminders {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 Reminders { client }
12 }
13
14 /**
15 * This function performs a `POST` to the `/reminders.add` endpoint.
16 *
17 * Creates a reminder.
18 *
19 * FROM: <https://api.slack.com/methods/reminders.add>
20 *
21 * **Parameters:**
22 *
23 * * `token: &str` -- Authentication token. Requires scope: `reminders:write`.
24 */
25 pub async fn add(&self) -> ClientResult<crate::Response<crate::types::RemindersAddSchema>> {
26 let url = self.client.url("/reminders.add", None);
27 self.client
28 .post(
29 &url,
30 crate::Message {
31 body: None,
32 content_type: Some("application/x-www-form-urlencoded".to_string()),
33 },
34 )
35 .await
36 }
37 /**
38 * This function performs a `POST` to the `/reminders.complete` endpoint.
39 *
40 * Marks a reminder as complete.
41 *
42 * FROM: <https://api.slack.com/methods/reminders.complete>
43 *
44 * **Parameters:**
45 *
46 * * `token: &str` -- Authentication token. Requires scope: `reminders:write`.
47 */
48 pub async fn complete(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
49 let url = self.client.url("/reminders.complete", None);
50 self.client
51 .post(
52 &url,
53 crate::Message {
54 body: None,
55 content_type: Some("application/x-www-form-urlencoded".to_string()),
56 },
57 )
58 .await
59 }
60 /**
61 * This function performs a `POST` to the `/reminders.delete` endpoint.
62 *
63 * Deletes a reminder.
64 *
65 * FROM: <https://api.slack.com/methods/reminders.delete>
66 *
67 * **Parameters:**
68 *
69 * * `token: &str` -- Authentication token. Requires scope: `reminders:write`.
70 */
71 pub async fn delete(&self) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
72 let url = self.client.url("/reminders.delete", None);
73 self.client
74 .post(
75 &url,
76 crate::Message {
77 body: None,
78 content_type: Some("application/x-www-form-urlencoded".to_string()),
79 },
80 )
81 .await
82 }
83 /**
84 * This function performs a `GET` to the `/reminders.info` endpoint.
85 *
86 * Gets information about a reminder.
87 *
88 * FROM: <https://api.slack.com/methods/reminders.info>
89 *
90 * **Parameters:**
91 *
92 * * `token: &str` -- Authentication token. Requires scope: `reminders:read`.
93 * * `reminder: &str` -- The ID of the reminder.
94 */
95 pub async fn info(
96 &self,
97 reminder: &str,
98 ) -> ClientResult<crate::Response<crate::types::RemindersAddSchema>> {
99 let mut query_args: Vec<(String, String)> = Default::default();
100 if !reminder.is_empty() {
101 query_args.push(("reminder".to_string(), reminder.to_string()));
102 }
103 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
104 let url = self
105 .client
106 .url(&format!("/reminders.info?{}", query_), None);
107 self.client
108 .get(
109 &url,
110 crate::Message {
111 body: None,
112 content_type: None,
113 },
114 )
115 .await
116 }
117 /**
118 * This function performs a `GET` to the `/reminders.list` endpoint.
119 *
120 * Lists all reminders created by or for a given user.
121 *
122 * FROM: <https://api.slack.com/methods/reminders.list>
123 *
124 * **Parameters:**
125 *
126 * * `token: &str` -- Authentication token. Requires scope: `reminders:read`.
127 */
128 pub async fn list(&self) -> ClientResult<crate::Response<crate::types::RemindersListSchema>> {
129 let url = self.client.url("/reminders.list", None);
130 self.client
131 .get(
132 &url,
133 crate::Message {
134 body: None,
135 content_type: None,
136 },
137 )
138 .await
139 }
140}