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 = "entity.acknowledgeCommentAction")]
15#[derive(Debug, Clone, PartialEq, Serialize)]
16#[non_exhaustive]
17pub struct EntityAcknowledgeCommentActionRequest {
18 pub trigger_id: String,
20 #[serde(skip_serializing_if = "Option::is_none")]
22 pub comment: Option<serde_json::Value>,
23 #[serde(skip_serializing_if = "Option::is_none")]
25 pub error: Option<String>,
26}
27
28impl EntityAcknowledgeCommentActionRequest {
29 pub fn new(trigger_id: impl Into<String>) -> Self {
30 Self {
31 trigger_id: trigger_id.into(),
32 comment: None,
33 error: None,
34 }
35 }
36
37 pub fn comment(mut self, comment: serde_json::Value) -> Self {
38 self.comment = Some(comment);
39 self
40 }
41
42 pub fn error(mut self, error: impl Into<String>) -> Self {
43 self.error = Some(error.into());
44 self
45 }
46}
47
48impl SlackApiMethod for EntityAcknowledgeCommentActionRequest {
49 const METHOD: &'static str = "entity.acknowledgeCommentAction";
50 type Response = EntityAcknowledgeCommentActionResponse;
51}
52
53#[doc(alias = "entity.acknowledgeCommentAction")]
55#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
56pub struct EntityAcknowledgeCommentActionResponse {
57 #[serde(flatten)]
59 pub extra: serde_json::Map<String, serde_json::Value>,
60 #[serde(
61 default,
62 deserialize_with = "crate::de::opt_object",
63 skip_serializing_if = "Option::is_none"
64 )]
65 pub response_metadata: Option<ResponseMetadata>,
66 #[serde(
67 default,
68 deserialize_with = "crate::de::opt_string",
69 skip_serializing_if = "Option::is_none"
70 )]
71 pub warning: Option<String>,
72}
73
74#[doc(alias = "entity.presentComments")]
78#[derive(Debug, Clone, PartialEq, Serialize)]
79#[non_exhaustive]
80pub struct EntityPresentCommentsRequest {
81 #[serde(serialize_with = "crate::form::as_json")]
83 pub comments: Vec<serde_json::Value>,
84 pub trigger_id: String,
86 #[serde(skip_serializing_if = "Option::is_none")]
88 pub cursor: Option<String>,
89 #[serde(skip_serializing_if = "Option::is_none")]
91 pub can_post_comment: Option<bool>,
92 #[serde(skip_serializing_if = "Option::is_none")]
94 pub delete_action_id: Option<String>,
95 #[serde(skip_serializing_if = "Option::is_none")]
97 pub user_auth_required: Option<bool>,
98 #[serde(skip_serializing_if = "Option::is_none")]
100 pub user_auth_url: Option<String>,
101 #[serde(skip_serializing_if = "Option::is_none")]
102 pub error: Option<String>,
103}
104
105impl EntityPresentCommentsRequest {
106 pub fn new(comments: Vec<serde_json::Value>, trigger_id: impl Into<String>) -> Self {
107 Self {
108 comments,
109 trigger_id: trigger_id.into(),
110 cursor: None,
111 can_post_comment: None,
112 delete_action_id: None,
113 user_auth_required: None,
114 user_auth_url: None,
115 error: None,
116 }
117 }
118
119 pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
120 self.cursor = Some(cursor.into());
121 self
122 }
123
124 pub fn can_post_comment(mut self, can_post_comment: bool) -> Self {
125 self.can_post_comment = Some(can_post_comment);
126 self
127 }
128
129 pub fn delete_action_id(mut self, delete_action_id: impl Into<String>) -> Self {
130 self.delete_action_id = Some(delete_action_id.into());
131 self
132 }
133
134 pub fn user_auth_required(mut self, user_auth_required: bool) -> Self {
135 self.user_auth_required = Some(user_auth_required);
136 self
137 }
138
139 pub fn user_auth_url(mut self, user_auth_url: impl Into<String>) -> Self {
140 self.user_auth_url = Some(user_auth_url.into());
141 self
142 }
143
144 pub fn error(mut self, error: impl Into<String>) -> Self {
145 self.error = Some(error.into());
146 self
147 }
148}
149
150impl SlackApiMethod for EntityPresentCommentsRequest {
151 const METHOD: &'static str = "entity.presentComments";
152 type Response = EntityPresentCommentsResponse;
153}
154
155impl CursorPaginated for EntityPresentCommentsRequest {
156 fn set_cursor(&mut self, cursor: String) {
157 self.cursor = Some(cursor);
158 }
159}
160
161impl NextCursor for EntityPresentCommentsResponse {
162 fn next_cursor(&self) -> Option<&str> {
163 self.response_metadata.as_ref()?.next_cursor.as_deref()
164 }
165}
166
167#[doc(alias = "entity.presentComments")]
169#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
170pub struct EntityPresentCommentsResponse {
171 #[serde(flatten)]
173 pub extra: serde_json::Map<String, serde_json::Value>,
174 #[serde(
175 default,
176 deserialize_with = "crate::de::opt_object",
177 skip_serializing_if = "Option::is_none"
178 )]
179 pub response_metadata: Option<ResponseMetadata>,
180 #[serde(
181 default,
182 deserialize_with = "crate::de::opt_string",
183 skip_serializing_if = "Option::is_none"
184 )]
185 pub warning: Option<String>,
186}
187
188#[doc(alias = "entity.presentDetails")]
192#[derive(Debug, Clone, PartialEq, Serialize)]
193#[non_exhaustive]
194pub struct EntityPresentDetailsRequest {
195 pub trigger_id: String,
197 #[serde(skip_serializing_if = "Option::is_none")]
199 pub metadata: Option<serde_json::Value>,
200 #[serde(skip_serializing_if = "Option::is_none")]
202 pub user_auth_required: Option<bool>,
203 #[serde(skip_serializing_if = "Option::is_none")]
205 pub user_auth_url: Option<String>,
206 #[serde(skip_serializing_if = "Option::is_none")]
207 pub error: Option<String>,
208}
209
210impl EntityPresentDetailsRequest {
211 pub fn new(trigger_id: impl Into<String>) -> Self {
212 Self {
213 trigger_id: trigger_id.into(),
214 metadata: None,
215 user_auth_required: None,
216 user_auth_url: None,
217 error: None,
218 }
219 }
220
221 pub fn metadata(mut self, metadata: serde_json::Value) -> Self {
222 self.metadata = Some(metadata);
223 self
224 }
225
226 pub fn user_auth_required(mut self, user_auth_required: bool) -> Self {
227 self.user_auth_required = Some(user_auth_required);
228 self
229 }
230
231 pub fn user_auth_url(mut self, user_auth_url: impl Into<String>) -> Self {
232 self.user_auth_url = Some(user_auth_url.into());
233 self
234 }
235
236 pub fn error(mut self, error: impl Into<String>) -> Self {
237 self.error = Some(error.into());
238 self
239 }
240}
241
242impl SlackApiMethod for EntityPresentDetailsRequest {
243 const METHOD: &'static str = "entity.presentDetails";
244 type Response = EntityPresentDetailsResponse;
245}
246
247#[doc(alias = "entity.presentDetails")]
249#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
250pub struct EntityPresentDetailsResponse {
251 #[serde(flatten)]
253 pub extra: serde_json::Map<String, serde_json::Value>,
254 #[serde(
255 default,
256 deserialize_with = "crate::de::opt_object",
257 skip_serializing_if = "Option::is_none"
258 )]
259 pub response_metadata: Option<ResponseMetadata>,
260 #[serde(
261 default,
262 deserialize_with = "crate::de::opt_string",
263 skip_serializing_if = "Option::is_none"
264 )]
265 pub warning: Option<String>,
266}
267
268impl SlackClient {
269 #[doc(alias = "entity.acknowledgeCommentAction")]
277 pub async fn entity_acknowledge_comment_action(
278 &self,
279 request: &EntityAcknowledgeCommentActionRequest,
280 ) -> Result<EntityAcknowledgeCommentActionResponse, SlackError> {
281 self.call(request).await
282 }
283
284 #[doc(alias = "entity.presentComments")]
292 pub async fn entity_present_comments(
293 &self,
294 request: &EntityPresentCommentsRequest,
295 ) -> Result<EntityPresentCommentsResponse, SlackError> {
296 self.call(request).await
297 }
298
299 #[doc(alias = "entity.presentDetails")]
307 pub async fn entity_present_details(
308 &self,
309 request: &EntityPresentDetailsRequest,
310 ) -> Result<EntityPresentDetailsResponse, SlackError> {
311 self.call(request).await
312 }
313}