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 = "files.comments.delete")]
15#[derive(Debug, Clone, PartialEq, Serialize)]
16#[non_exhaustive]
17pub struct FilesCommentsDeleteRequest {
18 pub file: String,
20 pub id: String,
22}
23
24impl FilesCommentsDeleteRequest {
25 pub fn new(file: impl Into<String>, id: impl Into<String>) -> Self {
26 Self {
27 file: file.into(),
28 id: id.into(),
29 }
30 }
31}
32
33impl SlackApiMethod for FilesCommentsDeleteRequest {
34 const METHOD: &'static str = "files.comments.delete";
35 type Response = FilesCommentsDeleteResponse;
36}
37
38#[doc(alias = "files.comments.delete")]
40#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
41pub struct FilesCommentsDeleteResponse {
42 #[serde(flatten)]
44 pub extra: serde_json::Map<String, serde_json::Value>,
45 #[serde(
46 default,
47 deserialize_with = "crate::de::opt_object",
48 skip_serializing_if = "Option::is_none"
49 )]
50 pub response_metadata: Option<ResponseMetadata>,
51 #[serde(
52 default,
53 deserialize_with = "crate::de::opt_string",
54 skip_serializing_if = "Option::is_none"
55 )]
56 pub warning: Option<String>,
57}
58
59#[doc(alias = "files.completeUploadExternal")]
63#[derive(Debug, Clone, PartialEq, Serialize)]
64#[non_exhaustive]
65pub struct FilesCompleteUploadExternalRequest {
66 #[serde(serialize_with = "crate::form::as_json")]
68 pub files: Vec<serde_json::Value>,
69 #[serde(skip_serializing_if = "Option::is_none")]
71 pub channel_id: Option<String>,
72 #[serde(skip_serializing_if = "Option::is_none")]
74 pub thread_ts: Option<String>,
75 #[serde(skip_serializing_if = "Option::is_none")]
77 pub channels: Option<String>,
78 #[serde(skip_serializing_if = "Option::is_none")]
80 pub initial_comment: Option<String>,
81 #[serde(
83 skip_serializing_if = "Option::is_none",
84 serialize_with = "crate::form::as_json"
85 )]
86 pub blocks: Option<Vec<crate::blocks::Block>>,
87 #[serde(skip_serializing_if = "Option::is_none")]
89 pub username: Option<String>,
90 #[serde(skip_serializing_if = "Option::is_none")]
92 pub icon_url: Option<String>,
93 #[serde(skip_serializing_if = "Option::is_none")]
95 pub icon_emoji: Option<String>,
96}
97
98impl FilesCompleteUploadExternalRequest {
99 pub fn new(files: Vec<serde_json::Value>) -> Self {
100 Self {
101 files,
102 channel_id: None,
103 thread_ts: None,
104 channels: None,
105 initial_comment: None,
106 blocks: None,
107 username: None,
108 icon_url: None,
109 icon_emoji: None,
110 }
111 }
112
113 pub fn channel_id(mut self, channel_id: impl Into<String>) -> Self {
114 self.channel_id = Some(channel_id.into());
115 self
116 }
117
118 pub fn thread_ts(mut self, thread_ts: impl Into<String>) -> Self {
119 self.thread_ts = Some(thread_ts.into());
120 self
121 }
122
123 pub fn channels(mut self, channels: impl Into<String>) -> Self {
124 self.channels = Some(channels.into());
125 self
126 }
127
128 pub fn initial_comment(mut self, initial_comment: impl Into<String>) -> Self {
129 self.initial_comment = Some(initial_comment.into());
130 self
131 }
132
133 pub fn blocks(mut self, blocks: Vec<crate::blocks::Block>) -> Self {
134 self.blocks = Some(blocks);
135 self
136 }
137
138 pub fn username(mut self, username: impl Into<String>) -> Self {
139 self.username = Some(username.into());
140 self
141 }
142
143 pub fn icon_url(mut self, icon_url: impl Into<String>) -> Self {
144 self.icon_url = Some(icon_url.into());
145 self
146 }
147
148 pub fn icon_emoji(mut self, icon_emoji: impl Into<String>) -> Self {
149 self.icon_emoji = Some(icon_emoji.into());
150 self
151 }
152}
153
154impl SlackApiMethod for FilesCompleteUploadExternalRequest {
155 const METHOD: &'static str = "files.completeUploadExternal";
156 type Response = FilesCompleteUploadExternalResponse;
157}
158
159#[doc(alias = "files.completeUploadExternal")]
161#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
162pub struct FilesCompleteUploadExternalResponse {
163 #[serde(
164 default,
165 deserialize_with = "crate::de::vec",
166 skip_serializing_if = "Vec::is_empty"
167 )]
168 pub files: Vec<FilesCompleteUploadExternalResponseFiles>,
169 #[serde(
170 default,
171 deserialize_with = "crate::de::opt_object",
172 skip_serializing_if = "Option::is_none"
173 )]
174 pub response_metadata: Option<ResponseMetadata>,
175 #[serde(
176 default,
177 deserialize_with = "crate::de::opt_string",
178 skip_serializing_if = "Option::is_none"
179 )]
180 pub warning: Option<String>,
181}
182
183#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
184pub struct FilesCompleteUploadExternalResponseFiles {
185 #[serde(
186 default,
187 deserialize_with = "crate::de::opt_string",
188 skip_serializing_if = "Option::is_none"
189 )]
190 pub id: Option<String>,
191 #[serde(
192 default,
193 deserialize_with = "crate::de::opt_string",
194 skip_serializing_if = "Option::is_none"
195 )]
196 pub title: Option<String>,
197}
198
199#[doc(alias = "files.delete")]
203#[derive(Debug, Clone, PartialEq, Serialize)]
204#[non_exhaustive]
205pub struct FilesDeleteRequest {
206 pub file: String,
208}
209
210impl FilesDeleteRequest {
211 pub fn new(file: impl Into<String>) -> Self {
212 Self { file: file.into() }
213 }
214}
215
216impl SlackApiMethod for FilesDeleteRequest {
217 const METHOD: &'static str = "files.delete";
218 type Response = FilesDeleteResponse;
219}
220
221#[doc(alias = "files.delete")]
223#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
224pub struct FilesDeleteResponse {
225 #[serde(flatten)]
227 pub extra: serde_json::Map<String, serde_json::Value>,
228 #[serde(
229 default,
230 deserialize_with = "crate::de::opt_object",
231 skip_serializing_if = "Option::is_none"
232 )]
233 pub response_metadata: Option<ResponseMetadata>,
234 #[serde(
235 default,
236 deserialize_with = "crate::de::opt_string",
237 skip_serializing_if = "Option::is_none"
238 )]
239 pub warning: Option<String>,
240}
241
242#[doc(alias = "files.getUploadURLExternal")]
246#[derive(Debug, Clone, PartialEq, Serialize)]
247#[non_exhaustive]
248pub struct FilesGetUploadUrlExternalRequest {
249 pub length: i64,
251 pub filename: String,
253 #[serde(skip_serializing_if = "Option::is_none")]
255 pub snippet_type: Option<String>,
256 #[serde(skip_serializing_if = "Option::is_none")]
258 pub alt_txt: Option<String>,
259}
260
261impl FilesGetUploadUrlExternalRequest {
262 pub fn new(length: i64, filename: impl Into<String>) -> Self {
263 Self {
264 length,
265 filename: filename.into(),
266 snippet_type: None,
267 alt_txt: None,
268 }
269 }
270
271 pub fn snippet_type(mut self, snippet_type: impl Into<String>) -> Self {
272 self.snippet_type = Some(snippet_type.into());
273 self
274 }
275
276 pub fn alt_txt(mut self, alt_txt: impl Into<String>) -> Self {
277 self.alt_txt = Some(alt_txt.into());
278 self
279 }
280}
281
282impl SlackApiMethod for FilesGetUploadUrlExternalRequest {
283 const METHOD: &'static str = "files.getUploadURLExternal";
284 type Response = FilesGetUploadUrlExternalResponse;
285}
286
287#[doc(alias = "files.getUploadURLExternal")]
289#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
290pub struct FilesGetUploadUrlExternalResponse {
291 #[serde(
292 default,
293 deserialize_with = "crate::de::opt_string",
294 skip_serializing_if = "Option::is_none"
295 )]
296 pub upload_url: Option<String>,
297 #[serde(
298 default,
299 deserialize_with = "crate::de::opt_string",
300 skip_serializing_if = "Option::is_none"
301 )]
302 pub file_id: Option<String>,
303 #[serde(
304 default,
305 deserialize_with = "crate::de::opt_object",
306 skip_serializing_if = "Option::is_none"
307 )]
308 pub response_metadata: Option<ResponseMetadata>,
309 #[serde(
310 default,
311 deserialize_with = "crate::de::opt_string",
312 skip_serializing_if = "Option::is_none"
313 )]
314 pub warning: Option<String>,
315}
316
317#[doc(alias = "files.info")]
321#[derive(Debug, Clone, PartialEq, Serialize)]
322#[non_exhaustive]
323pub struct FilesInfoRequest {
324 pub file: String,
326 #[serde(skip_serializing_if = "Option::is_none")]
327 pub count: Option<i64>,
328 #[serde(skip_serializing_if = "Option::is_none")]
330 pub cursor: Option<String>,
331 #[serde(skip_serializing_if = "Option::is_none")]
333 pub limit: Option<i64>,
334 #[serde(skip_serializing_if = "Option::is_none")]
335 pub page: Option<i64>,
336}
337
338impl FilesInfoRequest {
339 pub fn new(file: impl Into<String>) -> Self {
340 Self {
341 file: file.into(),
342 count: None,
343 cursor: None,
344 limit: None,
345 page: None,
346 }
347 }
348
349 pub fn count(mut self, count: i64) -> Self {
350 self.count = Some(count);
351 self
352 }
353
354 pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
355 self.cursor = Some(cursor.into());
356 self
357 }
358
359 pub fn limit(mut self, limit: i64) -> Self {
360 self.limit = Some(limit);
361 self
362 }
363
364 pub fn page(mut self, page: i64) -> Self {
365 self.page = Some(page);
366 self
367 }
368}
369
370impl SlackApiMethod for FilesInfoRequest {
371 const METHOD: &'static str = "files.info";
372 type Response = FilesInfoResponse;
373}
374
375impl CursorPaginated for FilesInfoRequest {
376 fn set_cursor(&mut self, cursor: String) {
377 self.cursor = Some(cursor);
378 }
379}
380
381impl NextCursor for FilesInfoResponse {
382 fn next_cursor(&self) -> Option<&str> {
383 self.response_metadata.as_ref()?.next_cursor.as_deref()
384 }
385}
386
387#[doc(alias = "files.info")]
389#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
390pub struct FilesInfoResponse {
391 #[serde(
392 default,
393 deserialize_with = "crate::de::opt_object",
394 skip_serializing_if = "Option::is_none"
395 )]
396 pub file: Option<File>,
397 #[serde(
398 default,
399 deserialize_with = "crate::de::vec",
400 skip_serializing_if = "Vec::is_empty"
401 )]
402 pub comments: Vec<serde_json::Value>,
403 #[serde(
404 default,
405 deserialize_with = "crate::de::opt_object",
406 skip_serializing_if = "Option::is_none"
407 )]
408 pub response_metadata: Option<ResponseMetadata>,
409 #[serde(
410 default,
411 deserialize_with = "crate::de::opt_string",
412 skip_serializing_if = "Option::is_none"
413 )]
414 pub warning: Option<String>,
415}
416
417#[doc(alias = "files.list")]
421#[derive(Debug, Clone, PartialEq, Serialize, Default)]
422#[non_exhaustive]
423pub struct FilesListRequest {
424 #[serde(skip_serializing_if = "Option::is_none")]
426 pub channel: Option<String>,
427 #[serde(skip_serializing_if = "Option::is_none")]
428 pub count: Option<i64>,
429 #[serde(skip_serializing_if = "Option::is_none")]
430 pub page: Option<i64>,
431 #[serde(skip_serializing_if = "Option::is_none")]
433 pub show_files_hidden_by_limit: Option<bool>,
434 #[serde(skip_serializing_if = "Option::is_none")]
436 pub team_id: Option<String>,
437 #[serde(skip_serializing_if = "Option::is_none")]
439 pub ts_from: Option<String>,
440 #[serde(skip_serializing_if = "Option::is_none")]
442 pub ts_to: Option<String>,
443 #[serde(skip_serializing_if = "Option::is_none")]
445 pub types: Option<String>,
446 #[serde(skip_serializing_if = "Option::is_none")]
448 pub user: Option<String>,
449}
450
451impl FilesListRequest {
452 pub fn new() -> Self {
453 Self {
454 channel: None,
455 count: None,
456 page: None,
457 show_files_hidden_by_limit: None,
458 team_id: None,
459 ts_from: None,
460 ts_to: None,
461 types: None,
462 user: None,
463 }
464 }
465
466 pub fn channel(mut self, channel: impl Into<String>) -> Self {
467 self.channel = Some(channel.into());
468 self
469 }
470
471 pub fn count(mut self, count: i64) -> Self {
472 self.count = Some(count);
473 self
474 }
475
476 pub fn page(mut self, page: i64) -> Self {
477 self.page = Some(page);
478 self
479 }
480
481 pub fn show_files_hidden_by_limit(mut self, show_files_hidden_by_limit: bool) -> Self {
482 self.show_files_hidden_by_limit = Some(show_files_hidden_by_limit);
483 self
484 }
485
486 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
487 self.team_id = Some(team_id.into());
488 self
489 }
490
491 pub fn ts_from(mut self, ts_from: impl Into<String>) -> Self {
492 self.ts_from = Some(ts_from.into());
493 self
494 }
495
496 pub fn ts_to(mut self, ts_to: impl Into<String>) -> Self {
497 self.ts_to = Some(ts_to.into());
498 self
499 }
500
501 pub fn types(mut self, types: impl Into<String>) -> Self {
502 self.types = Some(types.into());
503 self
504 }
505
506 pub fn user(mut self, user: impl Into<String>) -> Self {
507 self.user = Some(user.into());
508 self
509 }
510}
511
512impl SlackApiMethod for FilesListRequest {
513 const METHOD: &'static str = "files.list";
514 type Response = FilesListResponse;
515}
516
517#[doc(alias = "files.list")]
519#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
520pub struct FilesListResponse {
521 #[serde(
522 default,
523 deserialize_with = "crate::de::vec",
524 skip_serializing_if = "Vec::is_empty"
525 )]
526 pub files: Vec<File>,
527 #[serde(
528 default,
529 deserialize_with = "crate::de::opt_object",
530 skip_serializing_if = "Option::is_none"
531 )]
532 pub paging: Option<FilesListResponsePaging>,
533 #[serde(
534 default,
535 deserialize_with = "crate::de::opt_object",
536 skip_serializing_if = "Option::is_none"
537 )]
538 pub response_metadata: Option<ResponseMetadata>,
539 #[serde(
540 default,
541 deserialize_with = "crate::de::opt_string",
542 skip_serializing_if = "Option::is_none"
543 )]
544 pub warning: Option<String>,
545}
546
547#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
548pub struct FilesListResponsePaging {
549 #[serde(
550 default,
551 deserialize_with = "crate::de::opt_i64",
552 skip_serializing_if = "Option::is_none"
553 )]
554 pub count: Option<i64>,
555 #[serde(
556 default,
557 deserialize_with = "crate::de::opt_i64",
558 skip_serializing_if = "Option::is_none"
559 )]
560 pub total: Option<i64>,
561 #[serde(
562 default,
563 deserialize_with = "crate::de::opt_i64",
564 skip_serializing_if = "Option::is_none"
565 )]
566 pub page: Option<i64>,
567 #[serde(
568 default,
569 deserialize_with = "crate::de::opt_i64",
570 skip_serializing_if = "Option::is_none"
571 )]
572 pub pages: Option<i64>,
573}
574
575#[doc(alias = "files.remote.add")]
579#[derive(Debug, Clone, PartialEq, Serialize)]
580#[non_exhaustive]
581pub struct FilesRemoteAddRequest {
582 pub external_id: String,
584 pub external_url: String,
586 pub title: String,
588 #[serde(skip_serializing_if = "Option::is_none")]
590 pub filetype: Option<String>,
591 #[serde(skip_serializing_if = "Option::is_none")]
593 pub indexable_file_contents: Option<String>,
594 #[serde(skip_serializing_if = "Option::is_none")]
596 pub preview_image: Option<String>,
597}
598
599impl FilesRemoteAddRequest {
600 pub fn new(
601 external_id: impl Into<String>,
602 external_url: impl Into<String>,
603 title: impl Into<String>,
604 ) -> Self {
605 Self {
606 external_id: external_id.into(),
607 external_url: external_url.into(),
608 title: title.into(),
609 filetype: None,
610 indexable_file_contents: None,
611 preview_image: None,
612 }
613 }
614
615 pub fn filetype(mut self, filetype: impl Into<String>) -> Self {
616 self.filetype = Some(filetype.into());
617 self
618 }
619
620 pub fn indexable_file_contents(mut self, indexable_file_contents: impl Into<String>) -> Self {
621 self.indexable_file_contents = Some(indexable_file_contents.into());
622 self
623 }
624
625 pub fn preview_image(mut self, preview_image: impl Into<String>) -> Self {
626 self.preview_image = Some(preview_image.into());
627 self
628 }
629}
630
631impl SlackApiMethod for FilesRemoteAddRequest {
632 const METHOD: &'static str = "files.remote.add";
633 type Response = FilesRemoteAddResponse;
634}
635
636#[doc(alias = "files.remote.add")]
638#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
639pub struct FilesRemoteAddResponse {
640 #[serde(
641 default,
642 deserialize_with = "crate::de::opt_object",
643 skip_serializing_if = "Option::is_none"
644 )]
645 pub file: Option<File>,
646 #[serde(
647 default,
648 deserialize_with = "crate::de::opt_object",
649 skip_serializing_if = "Option::is_none"
650 )]
651 pub response_metadata: Option<ResponseMetadata>,
652 #[serde(
653 default,
654 deserialize_with = "crate::de::opt_string",
655 skip_serializing_if = "Option::is_none"
656 )]
657 pub warning: Option<String>,
658}
659
660#[doc(alias = "files.remote.info")]
664#[derive(Debug, Clone, PartialEq, Serialize, Default)]
665#[non_exhaustive]
666pub struct FilesRemoteInfoRequest {
667 #[serde(skip_serializing_if = "Option::is_none")]
669 pub external_id: Option<String>,
670 #[serde(skip_serializing_if = "Option::is_none")]
672 pub file: Option<String>,
673}
674
675impl FilesRemoteInfoRequest {
676 pub fn new() -> Self {
677 Self {
678 external_id: None,
679 file: None,
680 }
681 }
682
683 pub fn external_id(mut self, external_id: impl Into<String>) -> Self {
684 self.external_id = Some(external_id.into());
685 self
686 }
687
688 pub fn file(mut self, file: impl Into<String>) -> Self {
689 self.file = Some(file.into());
690 self
691 }
692}
693
694impl SlackApiMethod for FilesRemoteInfoRequest {
695 const METHOD: &'static str = "files.remote.info";
696 type Response = FilesRemoteInfoResponse;
697}
698
699#[doc(alias = "files.remote.info")]
701#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
702pub struct FilesRemoteInfoResponse {
703 #[serde(
704 default,
705 deserialize_with = "crate::de::opt_object",
706 skip_serializing_if = "Option::is_none"
707 )]
708 pub file: Option<File>,
709 #[serde(
710 default,
711 deserialize_with = "crate::de::opt_object",
712 skip_serializing_if = "Option::is_none"
713 )]
714 pub response_metadata: Option<ResponseMetadata>,
715 #[serde(
716 default,
717 deserialize_with = "crate::de::opt_string",
718 skip_serializing_if = "Option::is_none"
719 )]
720 pub warning: Option<String>,
721}
722
723#[doc(alias = "files.remote.list")]
727#[derive(Debug, Clone, PartialEq, Serialize, Default)]
728#[non_exhaustive]
729pub struct FilesRemoteListRequest {
730 #[serde(skip_serializing_if = "Option::is_none")]
732 pub channel: Option<String>,
733 #[serde(skip_serializing_if = "Option::is_none")]
735 pub cursor: Option<String>,
736 #[serde(skip_serializing_if = "Option::is_none")]
738 pub limit: Option<i64>,
739 #[serde(skip_serializing_if = "Option::is_none")]
741 pub ts_from: Option<String>,
742 #[serde(skip_serializing_if = "Option::is_none")]
744 pub ts_to: Option<String>,
745}
746
747impl FilesRemoteListRequest {
748 pub fn new() -> Self {
749 Self {
750 channel: None,
751 cursor: None,
752 limit: None,
753 ts_from: None,
754 ts_to: None,
755 }
756 }
757
758 pub fn channel(mut self, channel: impl Into<String>) -> Self {
759 self.channel = Some(channel.into());
760 self
761 }
762
763 pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
764 self.cursor = Some(cursor.into());
765 self
766 }
767
768 pub fn limit(mut self, limit: i64) -> Self {
769 self.limit = Some(limit);
770 self
771 }
772
773 pub fn ts_from(mut self, ts_from: impl Into<String>) -> Self {
774 self.ts_from = Some(ts_from.into());
775 self
776 }
777
778 pub fn ts_to(mut self, ts_to: impl Into<String>) -> Self {
779 self.ts_to = Some(ts_to.into());
780 self
781 }
782}
783
784impl SlackApiMethod for FilesRemoteListRequest {
785 const METHOD: &'static str = "files.remote.list";
786 type Response = FilesRemoteListResponse;
787}
788
789impl CursorPaginated for FilesRemoteListRequest {
790 fn set_cursor(&mut self, cursor: String) {
791 self.cursor = Some(cursor);
792 }
793}
794
795impl NextCursor for FilesRemoteListResponse {
796 fn next_cursor(&self) -> Option<&str> {
797 self.response_metadata.as_ref()?.next_cursor.as_deref()
798 }
799}
800
801#[doc(alias = "files.remote.list")]
803#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
804pub struct FilesRemoteListResponse {
805 #[serde(
806 default,
807 deserialize_with = "crate::de::vec",
808 skip_serializing_if = "Vec::is_empty"
809 )]
810 pub files: Vec<serde_json::Value>,
811 #[serde(
812 default,
813 deserialize_with = "crate::de::opt_object",
814 skip_serializing_if = "Option::is_none"
815 )]
816 pub response_metadata: Option<ResponseMetadata>,
817 #[serde(
818 default,
819 deserialize_with = "crate::de::opt_string",
820 skip_serializing_if = "Option::is_none"
821 )]
822 pub warning: Option<String>,
823}
824
825#[doc(alias = "files.remote.remove")]
829#[derive(Debug, Clone, PartialEq, Serialize, Default)]
830#[non_exhaustive]
831pub struct FilesRemoteRemoveRequest {
832 #[serde(skip_serializing_if = "Option::is_none")]
834 pub external_id: Option<String>,
835 #[serde(skip_serializing_if = "Option::is_none")]
837 pub file: Option<String>,
838}
839
840impl FilesRemoteRemoveRequest {
841 pub fn new() -> Self {
842 Self {
843 external_id: None,
844 file: None,
845 }
846 }
847
848 pub fn external_id(mut self, external_id: impl Into<String>) -> Self {
849 self.external_id = Some(external_id.into());
850 self
851 }
852
853 pub fn file(mut self, file: impl Into<String>) -> Self {
854 self.file = Some(file.into());
855 self
856 }
857}
858
859impl SlackApiMethod for FilesRemoteRemoveRequest {
860 const METHOD: &'static str = "files.remote.remove";
861 type Response = FilesRemoteRemoveResponse;
862}
863
864#[doc(alias = "files.remote.remove")]
866#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
867pub struct FilesRemoteRemoveResponse {
868 #[serde(flatten)]
870 pub extra: serde_json::Map<String, serde_json::Value>,
871 #[serde(
872 default,
873 deserialize_with = "crate::de::opt_object",
874 skip_serializing_if = "Option::is_none"
875 )]
876 pub response_metadata: Option<ResponseMetadata>,
877 #[serde(
878 default,
879 deserialize_with = "crate::de::opt_string",
880 skip_serializing_if = "Option::is_none"
881 )]
882 pub warning: Option<String>,
883}
884
885#[doc(alias = "files.remote.share")]
889#[derive(Debug, Clone, PartialEq, Serialize)]
890#[non_exhaustive]
891pub struct FilesRemoteShareRequest {
892 pub channels: String,
894 #[serde(skip_serializing_if = "Option::is_none")]
896 pub external_id: Option<String>,
897 #[serde(skip_serializing_if = "Option::is_none")]
899 pub file: Option<String>,
900}
901
902impl FilesRemoteShareRequest {
903 pub fn new(channels: impl Into<String>) -> Self {
904 Self {
905 channels: channels.into(),
906 external_id: None,
907 file: None,
908 }
909 }
910
911 pub fn external_id(mut self, external_id: impl Into<String>) -> Self {
912 self.external_id = Some(external_id.into());
913 self
914 }
915
916 pub fn file(mut self, file: impl Into<String>) -> Self {
917 self.file = Some(file.into());
918 self
919 }
920}
921
922impl SlackApiMethod for FilesRemoteShareRequest {
923 const METHOD: &'static str = "files.remote.share";
924 type Response = FilesRemoteShareResponse;
925}
926
927#[doc(alias = "files.remote.share")]
929#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
930pub struct FilesRemoteShareResponse {
931 #[serde(
932 default,
933 deserialize_with = "crate::de::opt_object",
934 skip_serializing_if = "Option::is_none"
935 )]
936 pub file: Option<File>,
937 #[serde(
938 default,
939 deserialize_with = "crate::de::opt_object",
940 skip_serializing_if = "Option::is_none"
941 )]
942 pub response_metadata: Option<ResponseMetadata>,
943 #[serde(
944 default,
945 deserialize_with = "crate::de::opt_string",
946 skip_serializing_if = "Option::is_none"
947 )]
948 pub warning: Option<String>,
949}
950
951#[doc(alias = "files.remote.update")]
955#[derive(Debug, Clone, PartialEq, Serialize, Default)]
956#[non_exhaustive]
957pub struct FilesRemoteUpdateRequest {
958 #[serde(skip_serializing_if = "Option::is_none")]
960 pub external_id: Option<String>,
961 #[serde(skip_serializing_if = "Option::is_none")]
963 pub external_url: Option<String>,
964 #[serde(skip_serializing_if = "Option::is_none")]
966 pub file: Option<String>,
967 #[serde(skip_serializing_if = "Option::is_none")]
969 pub filetype: Option<String>,
970 #[serde(skip_serializing_if = "Option::is_none")]
972 pub indexable_file_contents: Option<String>,
973 #[serde(skip_serializing_if = "Option::is_none")]
975 pub preview_image: Option<String>,
976 #[serde(skip_serializing_if = "Option::is_none")]
978 pub title: Option<String>,
979}
980
981impl FilesRemoteUpdateRequest {
982 pub fn new() -> Self {
983 Self {
984 external_id: None,
985 external_url: None,
986 file: None,
987 filetype: None,
988 indexable_file_contents: None,
989 preview_image: None,
990 title: None,
991 }
992 }
993
994 pub fn external_id(mut self, external_id: impl Into<String>) -> Self {
995 self.external_id = Some(external_id.into());
996 self
997 }
998
999 pub fn external_url(mut self, external_url: impl Into<String>) -> Self {
1000 self.external_url = Some(external_url.into());
1001 self
1002 }
1003
1004 pub fn file(mut self, file: impl Into<String>) -> Self {
1005 self.file = Some(file.into());
1006 self
1007 }
1008
1009 pub fn filetype(mut self, filetype: impl Into<String>) -> Self {
1010 self.filetype = Some(filetype.into());
1011 self
1012 }
1013
1014 pub fn indexable_file_contents(mut self, indexable_file_contents: impl Into<String>) -> Self {
1015 self.indexable_file_contents = Some(indexable_file_contents.into());
1016 self
1017 }
1018
1019 pub fn preview_image(mut self, preview_image: impl Into<String>) -> Self {
1020 self.preview_image = Some(preview_image.into());
1021 self
1022 }
1023
1024 pub fn title(mut self, title: impl Into<String>) -> Self {
1025 self.title = Some(title.into());
1026 self
1027 }
1028}
1029
1030impl SlackApiMethod for FilesRemoteUpdateRequest {
1031 const METHOD: &'static str = "files.remote.update";
1032 type Response = FilesRemoteUpdateResponse;
1033}
1034
1035#[doc(alias = "files.remote.update")]
1037#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1038pub struct FilesRemoteUpdateResponse {
1039 #[serde(
1040 default,
1041 deserialize_with = "crate::de::opt_object",
1042 skip_serializing_if = "Option::is_none"
1043 )]
1044 pub file: Option<File>,
1045 #[serde(
1046 default,
1047 deserialize_with = "crate::de::opt_object",
1048 skip_serializing_if = "Option::is_none"
1049 )]
1050 pub response_metadata: Option<ResponseMetadata>,
1051 #[serde(
1052 default,
1053 deserialize_with = "crate::de::opt_string",
1054 skip_serializing_if = "Option::is_none"
1055 )]
1056 pub warning: Option<String>,
1057}
1058
1059#[doc(alias = "files.revokePublicURL")]
1063#[derive(Debug, Clone, PartialEq, Serialize)]
1064#[non_exhaustive]
1065pub struct FilesRevokePublicUrlRequest {
1066 pub file: String,
1068}
1069
1070impl FilesRevokePublicUrlRequest {
1071 pub fn new(file: impl Into<String>) -> Self {
1072 Self { file: file.into() }
1073 }
1074}
1075
1076impl SlackApiMethod for FilesRevokePublicUrlRequest {
1077 const METHOD: &'static str = "files.revokePublicURL";
1078 type Response = FilesRevokePublicUrlResponse;
1079}
1080
1081#[doc(alias = "files.revokePublicURL")]
1083#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1084pub struct FilesRevokePublicUrlResponse {
1085 #[serde(flatten)]
1087 pub extra: serde_json::Map<String, serde_json::Value>,
1088 #[serde(
1089 default,
1090 deserialize_with = "crate::de::opt_object",
1091 skip_serializing_if = "Option::is_none"
1092 )]
1093 pub response_metadata: Option<ResponseMetadata>,
1094 #[serde(
1095 default,
1096 deserialize_with = "crate::de::opt_string",
1097 skip_serializing_if = "Option::is_none"
1098 )]
1099 pub warning: Option<String>,
1100}
1101
1102#[doc(alias = "files.sharedPublicURL")]
1106#[derive(Debug, Clone, PartialEq, Serialize)]
1107#[non_exhaustive]
1108pub struct FilesSharedPublicUrlRequest {
1109 pub file: String,
1111}
1112
1113impl FilesSharedPublicUrlRequest {
1114 pub fn new(file: impl Into<String>) -> Self {
1115 Self { file: file.into() }
1116 }
1117}
1118
1119impl SlackApiMethod for FilesSharedPublicUrlRequest {
1120 const METHOD: &'static str = "files.sharedPublicURL";
1121 type Response = FilesSharedPublicUrlResponse;
1122}
1123
1124#[doc(alias = "files.sharedPublicURL")]
1126#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1127pub struct FilesSharedPublicUrlResponse {
1128 #[serde(flatten)]
1130 pub extra: serde_json::Map<String, serde_json::Value>,
1131 #[serde(
1132 default,
1133 deserialize_with = "crate::de::opt_object",
1134 skip_serializing_if = "Option::is_none"
1135 )]
1136 pub response_metadata: Option<ResponseMetadata>,
1137 #[serde(
1138 default,
1139 deserialize_with = "crate::de::opt_string",
1140 skip_serializing_if = "Option::is_none"
1141 )]
1142 pub warning: Option<String>,
1143}
1144
1145impl SlackClient {
1146 #[doc(alias = "files.comments.delete")]
1159 pub async fn files_comments_delete(
1160 &self,
1161 request: &FilesCommentsDeleteRequest,
1162 ) -> Result<FilesCommentsDeleteResponse, SlackError> {
1163 self.call(request).await
1164 }
1165
1166 #[doc(alias = "files.completeUploadExternal")]
1179 pub async fn files_complete_upload_external(
1180 &self,
1181 request: &FilesCompleteUploadExternalRequest,
1182 ) -> Result<FilesCompleteUploadExternalResponse, SlackError> {
1183 self.call(request).await
1184 }
1185
1186 #[doc(alias = "files.delete")]
1199 pub async fn files_delete(
1200 &self,
1201 request: &FilesDeleteRequest,
1202 ) -> Result<FilesDeleteResponse, SlackError> {
1203 self.call(request).await
1204 }
1205
1206 #[doc(alias = "files.getUploadURLExternal")]
1219 pub async fn files_get_upload_url_external(
1220 &self,
1221 request: &FilesGetUploadUrlExternalRequest,
1222 ) -> Result<FilesGetUploadUrlExternalResponse, SlackError> {
1223 self.call(request).await
1224 }
1225
1226 #[doc(alias = "files.info")]
1239 pub async fn files_info(
1240 &self,
1241 request: &FilesInfoRequest,
1242 ) -> Result<FilesInfoResponse, SlackError> {
1243 self.call(request).await
1244 }
1245
1246 #[doc(alias = "files.list")]
1259 pub async fn files_list(
1260 &self,
1261 request: &FilesListRequest,
1262 ) -> Result<FilesListResponse, SlackError> {
1263 self.call(request).await
1264 }
1265
1266 #[doc(alias = "files.remote.add")]
1278 pub async fn files_remote_add(
1279 &self,
1280 request: &FilesRemoteAddRequest,
1281 ) -> Result<FilesRemoteAddResponse, SlackError> {
1282 self.call(request).await
1283 }
1284
1285 #[doc(alias = "files.remote.info")]
1298 pub async fn files_remote_info(
1299 &self,
1300 request: &FilesRemoteInfoRequest,
1301 ) -> Result<FilesRemoteInfoResponse, SlackError> {
1302 self.call(request).await
1303 }
1304
1305 #[doc(alias = "files.remote.list")]
1318 pub async fn files_remote_list(
1319 &self,
1320 request: &FilesRemoteListRequest,
1321 ) -> Result<FilesRemoteListResponse, SlackError> {
1322 self.call(request).await
1323 }
1324
1325 #[doc(alias = "files.remote.remove")]
1337 pub async fn files_remote_remove(
1338 &self,
1339 request: &FilesRemoteRemoveRequest,
1340 ) -> Result<FilesRemoteRemoveResponse, SlackError> {
1341 self.call(request).await
1342 }
1343
1344 #[doc(alias = "files.remote.share")]
1357 pub async fn files_remote_share(
1358 &self,
1359 request: &FilesRemoteShareRequest,
1360 ) -> Result<FilesRemoteShareResponse, SlackError> {
1361 self.call(request).await
1362 }
1363
1364 #[doc(alias = "files.remote.update")]
1376 pub async fn files_remote_update(
1377 &self,
1378 request: &FilesRemoteUpdateRequest,
1379 ) -> Result<FilesRemoteUpdateResponse, SlackError> {
1380 self.call(request).await
1381 }
1382
1383 #[doc(alias = "files.revokePublicURL")]
1396 pub async fn files_revoke_public_url(
1397 &self,
1398 request: &FilesRevokePublicUrlRequest,
1399 ) -> Result<FilesRevokePublicUrlResponse, SlackError> {
1400 self.call(request).await
1401 }
1402
1403 #[doc(alias = "files.sharedPublicURL")]
1415 pub async fn files_shared_public_url(
1416 &self,
1417 request: &FilesSharedPublicUrlRequest,
1418 ) -> Result<FilesSharedPublicUrlResponse, SlackError> {
1419 self.call(request).await
1420 }
1421}