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 = "usergroups.create")]
15#[derive(Debug, Clone, PartialEq, Serialize)]
16#[non_exhaustive]
17pub struct UsergroupsCreateRequest {
18 pub name: String,
20 #[serde(skip_serializing_if = "Option::is_none")]
22 pub channels: Option<Vec<String>>,
23 #[serde(skip_serializing_if = "Option::is_none")]
25 pub additional_channels: Option<Vec<String>>,
26 #[serde(skip_serializing_if = "Option::is_none")]
28 pub description: Option<String>,
29 #[serde(skip_serializing_if = "Option::is_none")]
31 pub handle: Option<String>,
32 #[serde(skip_serializing_if = "Option::is_none")]
34 pub include_count: Option<bool>,
35 #[serde(skip_serializing_if = "Option::is_none")]
37 pub team_id: Option<String>,
38 #[serde(skip_serializing_if = "Option::is_none")]
40 pub enable_section: Option<bool>,
41}
42
43impl UsergroupsCreateRequest {
44 pub fn new(name: impl Into<String>) -> Self {
45 Self {
46 name: name.into(),
47 channels: None,
48 additional_channels: None,
49 description: None,
50 handle: None,
51 include_count: None,
52 team_id: None,
53 enable_section: None,
54 }
55 }
56
57 pub fn channels(mut self, channels: Vec<String>) -> Self {
58 self.channels = Some(channels);
59 self
60 }
61
62 pub fn additional_channels(mut self, additional_channels: Vec<String>) -> Self {
63 self.additional_channels = Some(additional_channels);
64 self
65 }
66
67 pub fn description(mut self, description: impl Into<String>) -> Self {
68 self.description = Some(description.into());
69 self
70 }
71
72 pub fn handle(mut self, handle: impl Into<String>) -> Self {
73 self.handle = Some(handle.into());
74 self
75 }
76
77 pub fn include_count(mut self, include_count: bool) -> Self {
78 self.include_count = Some(include_count);
79 self
80 }
81
82 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
83 self.team_id = Some(team_id.into());
84 self
85 }
86
87 pub fn enable_section(mut self, enable_section: bool) -> Self {
88 self.enable_section = Some(enable_section);
89 self
90 }
91}
92
93impl SlackApiMethod for UsergroupsCreateRequest {
94 const METHOD: &'static str = "usergroups.create";
95 type Response = UsergroupsCreateResponse;
96}
97
98#[doc(alias = "usergroups.create")]
100#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
101pub struct UsergroupsCreateResponse {
102 #[serde(
103 default,
104 deserialize_with = "crate::de::opt_object",
105 skip_serializing_if = "Option::is_none"
106 )]
107 pub usergroup: Option<Usergroup>,
108 #[serde(
109 default,
110 deserialize_with = "crate::de::opt_object",
111 skip_serializing_if = "Option::is_none"
112 )]
113 pub response_metadata: Option<ResponseMetadata>,
114 #[serde(
115 default,
116 deserialize_with = "crate::de::opt_string",
117 skip_serializing_if = "Option::is_none"
118 )]
119 pub warning: Option<String>,
120}
121
122#[doc(alias = "usergroups.disable")]
126#[derive(Debug, Clone, PartialEq, Serialize)]
127#[non_exhaustive]
128pub struct UsergroupsDisableRequest {
129 pub usergroup: String,
131 #[serde(skip_serializing_if = "Option::is_none")]
133 pub include_count: Option<bool>,
134 #[serde(skip_serializing_if = "Option::is_none")]
136 pub team_id: Option<String>,
137}
138
139impl UsergroupsDisableRequest {
140 pub fn new(usergroup: impl Into<String>) -> Self {
141 Self {
142 usergroup: usergroup.into(),
143 include_count: None,
144 team_id: None,
145 }
146 }
147
148 pub fn include_count(mut self, include_count: bool) -> Self {
149 self.include_count = Some(include_count);
150 self
151 }
152
153 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
154 self.team_id = Some(team_id.into());
155 self
156 }
157}
158
159impl SlackApiMethod for UsergroupsDisableRequest {
160 const METHOD: &'static str = "usergroups.disable";
161 type Response = UsergroupsDisableResponse;
162}
163
164#[doc(alias = "usergroups.disable")]
166#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
167pub struct UsergroupsDisableResponse {
168 #[serde(
169 default,
170 deserialize_with = "crate::de::opt_object",
171 skip_serializing_if = "Option::is_none"
172 )]
173 pub usergroup: Option<Usergroup>,
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 = "usergroups.enable")]
192#[derive(Debug, Clone, PartialEq, Serialize)]
193#[non_exhaustive]
194pub struct UsergroupsEnableRequest {
195 pub usergroup: String,
197 #[serde(skip_serializing_if = "Option::is_none")]
199 pub include_count: Option<bool>,
200 #[serde(skip_serializing_if = "Option::is_none")]
202 pub team_id: Option<String>,
203}
204
205impl UsergroupsEnableRequest {
206 pub fn new(usergroup: impl Into<String>) -> Self {
207 Self {
208 usergroup: usergroup.into(),
209 include_count: None,
210 team_id: None,
211 }
212 }
213
214 pub fn include_count(mut self, include_count: bool) -> Self {
215 self.include_count = Some(include_count);
216 self
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 UsergroupsEnableRequest {
226 const METHOD: &'static str = "usergroups.enable";
227 type Response = UsergroupsEnableResponse;
228}
229
230#[doc(alias = "usergroups.enable")]
232#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
233pub struct UsergroupsEnableResponse {
234 #[serde(
235 default,
236 deserialize_with = "crate::de::opt_object",
237 skip_serializing_if = "Option::is_none"
238 )]
239 pub usergroup: Option<Usergroup>,
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 = "usergroups.list")]
258#[derive(Debug, Clone, PartialEq, Serialize, Default)]
259#[non_exhaustive]
260pub struct UsergroupsListRequest {
261 #[serde(skip_serializing_if = "Option::is_none")]
263 pub include_count: Option<bool>,
264 #[serde(skip_serializing_if = "Option::is_none")]
266 pub include_disabled: Option<bool>,
267 #[serde(skip_serializing_if = "Option::is_none")]
269 pub include_users: Option<bool>,
270 #[serde(skip_serializing_if = "Option::is_none")]
272 pub team_id: Option<String>,
273}
274
275impl UsergroupsListRequest {
276 pub fn new() -> Self {
277 Self {
278 include_count: None,
279 include_disabled: None,
280 include_users: None,
281 team_id: None,
282 }
283 }
284
285 pub fn include_count(mut self, include_count: bool) -> Self {
286 self.include_count = Some(include_count);
287 self
288 }
289
290 pub fn include_disabled(mut self, include_disabled: bool) -> Self {
291 self.include_disabled = Some(include_disabled);
292 self
293 }
294
295 pub fn include_users(mut self, include_users: bool) -> Self {
296 self.include_users = Some(include_users);
297 self
298 }
299
300 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
301 self.team_id = Some(team_id.into());
302 self
303 }
304}
305
306impl SlackApiMethod for UsergroupsListRequest {
307 const METHOD: &'static str = "usergroups.list";
308 type Response = UsergroupsListResponse;
309}
310
311#[doc(alias = "usergroups.list")]
313#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
314pub struct UsergroupsListResponse {
315 #[serde(
316 default,
317 deserialize_with = "crate::de::vec",
318 skip_serializing_if = "Vec::is_empty"
319 )]
320 pub usergroups: Vec<Usergroup>,
321 #[serde(
322 default,
323 deserialize_with = "crate::de::opt_object",
324 skip_serializing_if = "Option::is_none"
325 )]
326 pub response_metadata: Option<ResponseMetadata>,
327 #[serde(
328 default,
329 deserialize_with = "crate::de::opt_string",
330 skip_serializing_if = "Option::is_none"
331 )]
332 pub warning: Option<String>,
333}
334
335#[doc(alias = "usergroups.update")]
339#[derive(Debug, Clone, PartialEq, Serialize)]
340#[non_exhaustive]
341pub struct UsergroupsUpdateRequest {
342 pub usergroup: String,
344 #[serde(skip_serializing_if = "Option::is_none")]
346 pub channels: Option<Vec<String>>,
347 #[serde(skip_serializing_if = "Option::is_none")]
349 pub additional_channels: Option<Vec<String>>,
350 #[serde(skip_serializing_if = "Option::is_none")]
352 pub description: Option<String>,
353 #[serde(skip_serializing_if = "Option::is_none")]
355 pub handle: Option<String>,
356 #[serde(skip_serializing_if = "Option::is_none")]
358 pub include_count: Option<bool>,
359 #[serde(skip_serializing_if = "Option::is_none")]
361 pub name: Option<String>,
362 #[serde(skip_serializing_if = "Option::is_none")]
364 pub team_id: Option<String>,
365 #[serde(skip_serializing_if = "Option::is_none")]
367 pub enable_section: Option<bool>,
368}
369
370impl UsergroupsUpdateRequest {
371 pub fn new(usergroup: impl Into<String>) -> Self {
372 Self {
373 usergroup: usergroup.into(),
374 channels: None,
375 additional_channels: None,
376 description: None,
377 handle: None,
378 include_count: None,
379 name: None,
380 team_id: None,
381 enable_section: None,
382 }
383 }
384
385 pub fn channels(mut self, channels: Vec<String>) -> Self {
386 self.channels = Some(channels);
387 self
388 }
389
390 pub fn additional_channels(mut self, additional_channels: Vec<String>) -> Self {
391 self.additional_channels = Some(additional_channels);
392 self
393 }
394
395 pub fn description(mut self, description: impl Into<String>) -> Self {
396 self.description = Some(description.into());
397 self
398 }
399
400 pub fn handle(mut self, handle: impl Into<String>) -> Self {
401 self.handle = Some(handle.into());
402 self
403 }
404
405 pub fn include_count(mut self, include_count: bool) -> Self {
406 self.include_count = Some(include_count);
407 self
408 }
409
410 pub fn name(mut self, name: impl Into<String>) -> Self {
411 self.name = Some(name.into());
412 self
413 }
414
415 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
416 self.team_id = Some(team_id.into());
417 self
418 }
419
420 pub fn enable_section(mut self, enable_section: bool) -> Self {
421 self.enable_section = Some(enable_section);
422 self
423 }
424}
425
426impl SlackApiMethod for UsergroupsUpdateRequest {
427 const METHOD: &'static str = "usergroups.update";
428 type Response = UsergroupsUpdateResponse;
429}
430
431#[doc(alias = "usergroups.update")]
433#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
434pub struct UsergroupsUpdateResponse {
435 #[serde(
436 default,
437 deserialize_with = "crate::de::opt_object",
438 skip_serializing_if = "Option::is_none"
439 )]
440 pub usergroup: Option<Usergroup>,
441 #[serde(
442 default,
443 deserialize_with = "crate::de::opt_object",
444 skip_serializing_if = "Option::is_none"
445 )]
446 pub response_metadata: Option<ResponseMetadata>,
447 #[serde(
448 default,
449 deserialize_with = "crate::de::opt_string",
450 skip_serializing_if = "Option::is_none"
451 )]
452 pub warning: Option<String>,
453}
454
455#[doc(alias = "usergroups.users.list")]
459#[derive(Debug, Clone, PartialEq, Serialize)]
460#[non_exhaustive]
461pub struct UsergroupsUsersListRequest {
462 pub usergroup: String,
464 #[serde(skip_serializing_if = "Option::is_none")]
466 pub include_disabled: Option<bool>,
467 #[serde(skip_serializing_if = "Option::is_none")]
469 pub team_id: Option<String>,
470}
471
472impl UsergroupsUsersListRequest {
473 pub fn new(usergroup: impl Into<String>) -> Self {
474 Self {
475 usergroup: usergroup.into(),
476 include_disabled: None,
477 team_id: None,
478 }
479 }
480
481 pub fn include_disabled(mut self, include_disabled: bool) -> Self {
482 self.include_disabled = Some(include_disabled);
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
492impl SlackApiMethod for UsergroupsUsersListRequest {
493 const METHOD: &'static str = "usergroups.users.list";
494 type Response = UsergroupsUsersListResponse;
495}
496
497#[doc(alias = "usergroups.users.list")]
499#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
500pub struct UsergroupsUsersListResponse {
501 #[serde(
502 default,
503 deserialize_with = "crate::de::vec",
504 skip_serializing_if = "Vec::is_empty"
505 )]
506 pub users: Vec<String>,
507 #[serde(
508 default,
509 deserialize_with = "crate::de::opt_object",
510 skip_serializing_if = "Option::is_none"
511 )]
512 pub response_metadata: Option<ResponseMetadata>,
513 #[serde(
514 default,
515 deserialize_with = "crate::de::opt_string",
516 skip_serializing_if = "Option::is_none"
517 )]
518 pub warning: Option<String>,
519}
520
521#[doc(alias = "usergroups.users.update")]
525#[derive(Debug, Clone, PartialEq, Serialize)]
526#[non_exhaustive]
527pub struct UsergroupsUsersUpdateRequest {
528 pub usergroup: String,
530 pub users: Vec<String>,
532 #[serde(skip_serializing_if = "Option::is_none")]
534 pub include_count: Option<bool>,
535 #[serde(skip_serializing_if = "Option::is_none")]
537 pub team_id: Option<String>,
538 #[serde(skip_serializing_if = "Option::is_none")]
540 pub additional_channels: Option<Vec<String>>,
541 #[serde(skip_serializing_if = "Option::is_none")]
543 pub is_shared: Option<bool>,
544}
545
546impl UsergroupsUsersUpdateRequest {
547 pub fn new(usergroup: impl Into<String>, users: Vec<String>) -> Self {
548 Self {
549 usergroup: usergroup.into(),
550 users,
551 include_count: None,
552 team_id: None,
553 additional_channels: None,
554 is_shared: None,
555 }
556 }
557
558 pub fn include_count(mut self, include_count: bool) -> Self {
559 self.include_count = Some(include_count);
560 self
561 }
562
563 pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
564 self.team_id = Some(team_id.into());
565 self
566 }
567
568 pub fn additional_channels(mut self, additional_channels: Vec<String>) -> Self {
569 self.additional_channels = Some(additional_channels);
570 self
571 }
572
573 pub fn is_shared(mut self, is_shared: bool) -> Self {
574 self.is_shared = Some(is_shared);
575 self
576 }
577}
578
579impl SlackApiMethod for UsergroupsUsersUpdateRequest {
580 const METHOD: &'static str = "usergroups.users.update";
581 type Response = UsergroupsUsersUpdateResponse;
582}
583
584#[doc(alias = "usergroups.users.update")]
586#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
587pub struct UsergroupsUsersUpdateResponse {
588 #[serde(
589 default,
590 deserialize_with = "crate::de::opt_object",
591 skip_serializing_if = "Option::is_none"
592 )]
593 pub usergroup: Option<Usergroup>,
594 #[serde(
595 default,
596 deserialize_with = "crate::de::opt_object",
597 skip_serializing_if = "Option::is_none"
598 )]
599 pub response_metadata: Option<ResponseMetadata>,
600 #[serde(
601 default,
602 deserialize_with = "crate::de::opt_string",
603 skip_serializing_if = "Option::is_none"
604 )]
605 pub warning: Option<String>,
606}
607
608impl SlackClient {
609 #[doc(alias = "usergroups.create")]
622 pub async fn usergroups_create(
623 &self,
624 request: &UsergroupsCreateRequest,
625 ) -> Result<UsergroupsCreateResponse, SlackError> {
626 self.call(request).await
627 }
628
629 #[doc(alias = "usergroups.disable")]
642 pub async fn usergroups_disable(
643 &self,
644 request: &UsergroupsDisableRequest,
645 ) -> Result<UsergroupsDisableResponse, SlackError> {
646 self.call(request).await
647 }
648
649 #[doc(alias = "usergroups.enable")]
662 pub async fn usergroups_enable(
663 &self,
664 request: &UsergroupsEnableRequest,
665 ) -> Result<UsergroupsEnableResponse, SlackError> {
666 self.call(request).await
667 }
668
669 #[doc(alias = "usergroups.list")]
682 pub async fn usergroups_list(
683 &self,
684 request: &UsergroupsListRequest,
685 ) -> Result<UsergroupsListResponse, SlackError> {
686 self.call(request).await
687 }
688
689 #[doc(alias = "usergroups.update")]
702 pub async fn usergroups_update(
703 &self,
704 request: &UsergroupsUpdateRequest,
705 ) -> Result<UsergroupsUpdateResponse, SlackError> {
706 self.call(request).await
707 }
708
709 #[doc(alias = "usergroups.users.list")]
722 pub async fn usergroups_users_list(
723 &self,
724 request: &UsergroupsUsersListRequest,
725 ) -> Result<UsergroupsUsersListResponse, SlackError> {
726 self.call(request).await
727 }
728
729 #[doc(alias = "usergroups.users.update")]
742 pub async fn usergroups_users_update(
743 &self,
744 request: &UsergroupsUsersUpdateRequest,
745 ) -> Result<UsergroupsUsersUpdateResponse, SlackError> {
746 self.call(request).await
747 }
748}