Skip to main content

slack_web_api/api/
admin_usergroups.rs

1// このファイルは codegen/generate.py が生成する。手で編集しない
2
3#![allow(unused_imports)]
4
5use crate::objects::*;
6use crate::{
7    CursorPaginated, NextCursor, ResponseMetadata, SlackApiMethod, SlackClient, SlackError,
8};
9use serde::{Deserialize, Serialize};
10
11/// Arguments for the Slack Web API method [`admin.usergroups.addChannels`](https://docs.slack.dev/reference/methods/admin.usergroups.addChannels): Add up to one hundred default channels to an IDP group.
12///
13/// Send it with [`SlackClient::admin_usergroups_add_channels`].
14#[doc(alias = "admin.usergroups.addChannels")]
15#[derive(Debug, Clone, PartialEq, Serialize)]
16#[non_exhaustive]
17pub struct AdminUsergroupsAddChannelsRequest {
18    /// ID of the IDP group to add default channels for.
19    pub usergroup_id: String,
20    /// Comma separated string of channel IDs.
21    pub channel_ids: Vec<String>,
22    /// The workspace to add default channels in.
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub team_id: Option<String>,
25}
26
27impl AdminUsergroupsAddChannelsRequest {
28    pub fn new(usergroup_id: impl Into<String>, channel_ids: Vec<String>) -> Self {
29        Self {
30            usergroup_id: usergroup_id.into(),
31            channel_ids,
32            team_id: None,
33        }
34    }
35
36    pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
37        self.team_id = Some(team_id.into());
38        self
39    }
40}
41
42impl SlackApiMethod for AdminUsergroupsAddChannelsRequest {
43    const METHOD: &'static str = "admin.usergroups.addChannels";
44    type Response = AdminUsergroupsAddChannelsResponse;
45}
46
47/// Successful response of the Slack Web API method [`admin.usergroups.addChannels`](https://docs.slack.dev/reference/methods/admin.usergroups.addChannels).
48#[doc(alias = "admin.usergroups.addChannels")]
49#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
50pub struct AdminUsergroupsAddChannelsResponse {
51    /// Fields returned by Slack. This method has no documented response example.
52    #[serde(flatten)]
53    pub extra: serde_json::Map<String, serde_json::Value>,
54    #[serde(
55        default,
56        deserialize_with = "crate::de::opt_object",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub response_metadata: Option<ResponseMetadata>,
60    #[serde(
61        default,
62        deserialize_with = "crate::de::opt_string",
63        skip_serializing_if = "Option::is_none"
64    )]
65    pub warning: Option<String>,
66}
67
68/// Arguments for the Slack Web API method [`admin.usergroups.addTeams`](https://docs.slack.dev/reference/methods/admin.usergroups.addTeams): Associate one or more default workspaces with an organization-wide IDP group.
69///
70/// Send it with [`SlackClient::admin_usergroups_add_teams`].
71#[doc(alias = "admin.usergroups.addTeams")]
72#[derive(Debug, Clone, PartialEq, Serialize)]
73#[non_exhaustive]
74pub struct AdminUsergroupsAddTeamsRequest {
75    /// An encoded usergroup (IDP Group) ID.
76    pub usergroup_id: String,
77    /// A comma separated list of encoded team (workspace) IDs. Each workspace _MUST_ belong to the organization associated with the token.
78    pub team_ids: Vec<String>,
79    /// When `true`, this method automatically creates new workspace accounts for the IDP group members.
80    #[serde(skip_serializing_if = "Option::is_none")]
81    pub auto_provision: Option<bool>,
82}
83
84impl AdminUsergroupsAddTeamsRequest {
85    pub fn new(usergroup_id: impl Into<String>, team_ids: Vec<String>) -> Self {
86        Self {
87            usergroup_id: usergroup_id.into(),
88            team_ids,
89            auto_provision: None,
90        }
91    }
92
93    pub fn auto_provision(mut self, auto_provision: bool) -> Self {
94        self.auto_provision = Some(auto_provision);
95        self
96    }
97}
98
99impl SlackApiMethod for AdminUsergroupsAddTeamsRequest {
100    const METHOD: &'static str = "admin.usergroups.addTeams";
101    type Response = AdminUsergroupsAddTeamsResponse;
102}
103
104/// Successful response of the Slack Web API method [`admin.usergroups.addTeams`](https://docs.slack.dev/reference/methods/admin.usergroups.addTeams).
105#[doc(alias = "admin.usergroups.addTeams")]
106#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
107pub struct AdminUsergroupsAddTeamsResponse {
108    /// Fields returned by Slack. This method has no documented response example.
109    #[serde(flatten)]
110    pub extra: serde_json::Map<String, serde_json::Value>,
111    #[serde(
112        default,
113        deserialize_with = "crate::de::opt_object",
114        skip_serializing_if = "Option::is_none"
115    )]
116    pub response_metadata: Option<ResponseMetadata>,
117    #[serde(
118        default,
119        deserialize_with = "crate::de::opt_string",
120        skip_serializing_if = "Option::is_none"
121    )]
122    pub warning: Option<String>,
123}
124
125/// Arguments for the Slack Web API method [`admin.usergroups.addUsers`](https://docs.slack.dev/reference/methods/admin.usergroups.addUsers): Add members to an existing organizational usergroup.
126///
127/// Send it with [`SlackClient::admin_usergroups_add_users`].
128#[doc(alias = "admin.usergroups.addUsers")]
129#[derive(Debug, Clone, PartialEq, Serialize)]
130#[non_exhaustive]
131pub struct AdminUsergroupsAddUsersRequest {
132    /// ID of the usergroup to add users to
133    pub id: String,
134    /// The encoded user IDs to add to the usergroup, provided as a JSON array or a comma-separated string.
135    pub users: Vec<String>,
136}
137
138impl AdminUsergroupsAddUsersRequest {
139    pub fn new(id: impl Into<String>, users: Vec<String>) -> Self {
140        Self {
141            id: id.into(),
142            users,
143        }
144    }
145}
146
147impl SlackApiMethod for AdminUsergroupsAddUsersRequest {
148    const METHOD: &'static str = "admin.usergroups.addUsers";
149    type Response = AdminUsergroupsAddUsersResponse;
150}
151
152/// Successful response of the Slack Web API method [`admin.usergroups.addUsers`](https://docs.slack.dev/reference/methods/admin.usergroups.addUsers).
153#[doc(alias = "admin.usergroups.addUsers")]
154#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
155pub struct AdminUsergroupsAddUsersResponse {
156    #[serde(
157        default,
158        deserialize_with = "crate::de::vec",
159        skip_serializing_if = "Vec::is_empty"
160    )]
161    pub invalid_users: Vec<AdminUsergroupsAddUsersResponseInvalidUsers>,
162    #[serde(
163        default,
164        deserialize_with = "crate::de::opt_object",
165        skip_serializing_if = "Option::is_none"
166    )]
167    pub response_metadata: Option<ResponseMetadata>,
168    #[serde(
169        default,
170        deserialize_with = "crate::de::opt_string",
171        skip_serializing_if = "Option::is_none"
172    )]
173    pub warning: Option<String>,
174}
175
176#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
177pub struct AdminUsergroupsAddUsersResponseInvalidUsers {
178    #[serde(
179        default,
180        deserialize_with = "crate::de::opt_string",
181        skip_serializing_if = "Option::is_none"
182    )]
183    pub user_id: Option<String>,
184    #[serde(
185        default,
186        deserialize_with = "crate::de::opt_string",
187        skip_serializing_if = "Option::is_none"
188    )]
189    pub reason: Option<String>,
190}
191
192/// Arguments for the Slack Web API method [`admin.usergroups.create`](https://docs.slack.dev/reference/methods/admin.usergroups.create): Create a new organizational usergroup.
193///
194/// Send it with [`SlackClient::admin_usergroups_create`].
195#[doc(alias = "admin.usergroups.create")]
196#[derive(Debug, Clone, PartialEq, Serialize)]
197#[non_exhaustive]
198pub struct AdminUsergroupsCreateRequest {
199    /// Unique name for the usergroup
200    pub name: String,
201    /// Optional handle used to mention the usergroup in channel, must be unique
202    #[serde(skip_serializing_if = "Option::is_none")]
203    pub handle: Option<String>,
204    /// Optional purpose that describes what the usergroup is about
205    #[serde(skip_serializing_if = "Option::is_none")]
206    pub purpose: Option<String>,
207    /// Configure whether or not this usergroup should be visible in the client
208    #[serde(skip_serializing_if = "Option::is_none")]
209    pub is_visible: Option<bool>,
210}
211
212impl AdminUsergroupsCreateRequest {
213    pub fn new(name: impl Into<String>) -> Self {
214        Self {
215            name: name.into(),
216            handle: None,
217            purpose: None,
218            is_visible: None,
219        }
220    }
221
222    pub fn handle(mut self, handle: impl Into<String>) -> Self {
223        self.handle = Some(handle.into());
224        self
225    }
226
227    pub fn purpose(mut self, purpose: impl Into<String>) -> Self {
228        self.purpose = Some(purpose.into());
229        self
230    }
231
232    pub fn is_visible(mut self, is_visible: bool) -> Self {
233        self.is_visible = Some(is_visible);
234        self
235    }
236}
237
238impl SlackApiMethod for AdminUsergroupsCreateRequest {
239    const METHOD: &'static str = "admin.usergroups.create";
240    type Response = AdminUsergroupsCreateResponse;
241}
242
243/// Successful response of the Slack Web API method [`admin.usergroups.create`](https://docs.slack.dev/reference/methods/admin.usergroups.create).
244#[doc(alias = "admin.usergroups.create")]
245#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
246pub struct AdminUsergroupsCreateResponse {
247    #[serde(
248        default,
249        deserialize_with = "crate::de::opt_object",
250        skip_serializing_if = "Option::is_none"
251    )]
252    pub subteam: Option<Usergroup>,
253    #[serde(
254        default,
255        deserialize_with = "crate::de::opt_object",
256        skip_serializing_if = "Option::is_none"
257    )]
258    pub response_metadata: Option<ResponseMetadata>,
259    #[serde(
260        default,
261        deserialize_with = "crate::de::opt_string",
262        skip_serializing_if = "Option::is_none"
263    )]
264    pub warning: Option<String>,
265}
266
267/// Arguments for the Slack Web API method [`admin.usergroups.fetch`](https://docs.slack.dev/reference/methods/admin.usergroups.fetch): Fetch an organizational usergroup.
268///
269/// Send it with [`SlackClient::admin_usergroups_fetch`].
270#[doc(alias = "admin.usergroups.fetch")]
271#[derive(Debug, Clone, PartialEq, Serialize)]
272#[non_exhaustive]
273pub struct AdminUsergroupsFetchRequest {
274    /// ID of the usergroup to fetch
275    pub id: String,
276}
277
278impl AdminUsergroupsFetchRequest {
279    pub fn new(id: impl Into<String>) -> Self {
280        Self { id: id.into() }
281    }
282}
283
284impl SlackApiMethod for AdminUsergroupsFetchRequest {
285    const METHOD: &'static str = "admin.usergroups.fetch";
286    type Response = AdminUsergroupsFetchResponse;
287}
288
289/// Successful response of the Slack Web API method [`admin.usergroups.fetch`](https://docs.slack.dev/reference/methods/admin.usergroups.fetch).
290#[doc(alias = "admin.usergroups.fetch")]
291#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
292pub struct AdminUsergroupsFetchResponse {
293    #[serde(
294        default,
295        deserialize_with = "crate::de::opt_object",
296        skip_serializing_if = "Option::is_none"
297    )]
298    pub subteam: Option<Usergroup>,
299    #[serde(
300        default,
301        deserialize_with = "crate::de::opt_object",
302        skip_serializing_if = "Option::is_none"
303    )]
304    pub response_metadata: Option<ResponseMetadata>,
305    #[serde(
306        default,
307        deserialize_with = "crate::de::opt_string",
308        skip_serializing_if = "Option::is_none"
309    )]
310    pub warning: Option<String>,
311}
312
313/// Arguments for the Slack Web API method [`admin.usergroups.listChannels`](https://docs.slack.dev/reference/methods/admin.usergroups.listChannels): List the channels linked to an org-level IDP group (user group).
314///
315/// Send it with [`SlackClient::admin_usergroups_list_channels`].
316#[doc(alias = "admin.usergroups.listChannels")]
317#[derive(Debug, Clone, PartialEq, Serialize)]
318#[non_exhaustive]
319pub struct AdminUsergroupsListChannelsRequest {
320    /// ID of the IDP group to list default channels for.
321    pub usergroup_id: String,
322    /// ID of the the workspace.
323    #[serde(skip_serializing_if = "Option::is_none")]
324    pub team_id: Option<String>,
325    /// Flag to include or exclude the count of members per channel.
326    #[serde(skip_serializing_if = "Option::is_none")]
327    pub include_num_members: Option<bool>,
328}
329
330impl AdminUsergroupsListChannelsRequest {
331    pub fn new(usergroup_id: impl Into<String>) -> Self {
332        Self {
333            usergroup_id: usergroup_id.into(),
334            team_id: None,
335            include_num_members: None,
336        }
337    }
338
339    pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
340        self.team_id = Some(team_id.into());
341        self
342    }
343
344    pub fn include_num_members(mut self, include_num_members: bool) -> Self {
345        self.include_num_members = Some(include_num_members);
346        self
347    }
348}
349
350impl SlackApiMethod for AdminUsergroupsListChannelsRequest {
351    const METHOD: &'static str = "admin.usergroups.listChannels";
352    type Response = AdminUsergroupsListChannelsResponse;
353}
354
355/// Successful response of the Slack Web API method [`admin.usergroups.listChannels`](https://docs.slack.dev/reference/methods/admin.usergroups.listChannels).
356#[doc(alias = "admin.usergroups.listChannels")]
357#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
358pub struct AdminUsergroupsListChannelsResponse {
359    #[serde(
360        default,
361        deserialize_with = "crate::de::vec",
362        skip_serializing_if = "Vec::is_empty"
363    )]
364    pub channels: Vec<AdminUsergroupsListChannelsResponseChannels>,
365    #[serde(
366        default,
367        deserialize_with = "crate::de::opt_object",
368        skip_serializing_if = "Option::is_none"
369    )]
370    pub response_metadata: Option<ResponseMetadata>,
371    #[serde(
372        default,
373        deserialize_with = "crate::de::opt_string",
374        skip_serializing_if = "Option::is_none"
375    )]
376    pub warning: Option<String>,
377}
378
379#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
380pub struct AdminUsergroupsListChannelsResponseChannels {
381    #[serde(
382        default,
383        deserialize_with = "crate::de::opt_string",
384        skip_serializing_if = "Option::is_none"
385    )]
386    pub id: Option<String>,
387    #[serde(
388        default,
389        deserialize_with = "crate::de::opt_string",
390        skip_serializing_if = "Option::is_none"
391    )]
392    pub name: Option<String>,
393    #[serde(
394        default,
395        deserialize_with = "crate::de::opt_string",
396        skip_serializing_if = "Option::is_none"
397    )]
398    pub team_id: Option<String>,
399    #[serde(
400        default,
401        deserialize_with = "crate::de::opt_i64",
402        skip_serializing_if = "Option::is_none"
403    )]
404    pub num_members: Option<i64>,
405    #[serde(
406        default,
407        deserialize_with = "crate::de::opt_bool",
408        skip_serializing_if = "Option::is_none"
409    )]
410    pub is_redacted: Option<bool>,
411}
412
413/// Arguments for the Slack Web API method [`admin.usergroups.removeChannels`](https://docs.slack.dev/reference/methods/admin.usergroups.removeChannels): Remove one or more default channels from an org-level IDP group (user group).
414///
415/// Send it with [`SlackClient::admin_usergroups_remove_channels`].
416#[doc(alias = "admin.usergroups.removeChannels")]
417#[derive(Debug, Clone, PartialEq, Serialize)]
418#[non_exhaustive]
419pub struct AdminUsergroupsRemoveChannelsRequest {
420    /// ID of the IDP Group
421    pub usergroup_id: String,
422    /// Comma-separated string of channel IDs
423    pub channel_ids: Vec<String>,
424}
425
426impl AdminUsergroupsRemoveChannelsRequest {
427    pub fn new(usergroup_id: impl Into<String>, channel_ids: Vec<String>) -> Self {
428        Self {
429            usergroup_id: usergroup_id.into(),
430            channel_ids,
431        }
432    }
433}
434
435impl SlackApiMethod for AdminUsergroupsRemoveChannelsRequest {
436    const METHOD: &'static str = "admin.usergroups.removeChannels";
437    type Response = AdminUsergroupsRemoveChannelsResponse;
438}
439
440/// Successful response of the Slack Web API method [`admin.usergroups.removeChannels`](https://docs.slack.dev/reference/methods/admin.usergroups.removeChannels).
441#[doc(alias = "admin.usergroups.removeChannels")]
442#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
443pub struct AdminUsergroupsRemoveChannelsResponse {
444    /// Fields returned by Slack. This method has no documented response example.
445    #[serde(flatten)]
446    pub extra: serde_json::Map<String, serde_json::Value>,
447    #[serde(
448        default,
449        deserialize_with = "crate::de::opt_object",
450        skip_serializing_if = "Option::is_none"
451    )]
452    pub response_metadata: Option<ResponseMetadata>,
453    #[serde(
454        default,
455        deserialize_with = "crate::de::opt_string",
456        skip_serializing_if = "Option::is_none"
457    )]
458    pub warning: Option<String>,
459}
460
461/// Arguments for the Slack Web API method [`admin.usergroups.removeTeams`](https://docs.slack.dev/reference/methods/admin.usergroups.removeTeams): Remove one or more default workspaces from an organization-wide IDP Group or Admin Group
462///
463/// Send it with [`SlackClient::admin_usergroups_remove_teams`].
464#[doc(alias = "admin.usergroups.removeTeams")]
465#[derive(Debug, Clone, PartialEq, Serialize)]
466#[non_exhaustive]
467pub struct AdminUsergroupsRemoveTeamsRequest {
468    /// An encoded usergroup (IDP Group) ID.
469    pub usergroup_id: String,
470    /// A comma separated list of encoded team (workspace) IDs. Each workspace _MUST_ belong to the organization associated with the token.
471    pub team_ids: Vec<String>,
472}
473
474impl AdminUsergroupsRemoveTeamsRequest {
475    pub fn new(usergroup_id: impl Into<String>, team_ids: Vec<String>) -> Self {
476        Self {
477            usergroup_id: usergroup_id.into(),
478            team_ids,
479        }
480    }
481}
482
483impl SlackApiMethod for AdminUsergroupsRemoveTeamsRequest {
484    const METHOD: &'static str = "admin.usergroups.removeTeams";
485    type Response = AdminUsergroupsRemoveTeamsResponse;
486}
487
488/// Successful response of the Slack Web API method [`admin.usergroups.removeTeams`](https://docs.slack.dev/reference/methods/admin.usergroups.removeTeams).
489#[doc(alias = "admin.usergroups.removeTeams")]
490#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
491pub struct AdminUsergroupsRemoveTeamsResponse {
492    /// Fields returned by Slack. This method has no documented response example.
493    #[serde(flatten)]
494    pub extra: serde_json::Map<String, serde_json::Value>,
495    #[serde(
496        default,
497        deserialize_with = "crate::de::opt_object",
498        skip_serializing_if = "Option::is_none"
499    )]
500    pub response_metadata: Option<ResponseMetadata>,
501    #[serde(
502        default,
503        deserialize_with = "crate::de::opt_string",
504        skip_serializing_if = "Option::is_none"
505    )]
506    pub warning: Option<String>,
507}
508
509/// Arguments for the Slack Web API method [`admin.usergroups.removeUsers`](https://docs.slack.dev/reference/methods/admin.usergroups.removeUsers): Remove members from an existing organizational usergroup.
510///
511/// Send it with [`SlackClient::admin_usergroups_remove_users`].
512#[doc(alias = "admin.usergroups.removeUsers")]
513#[derive(Debug, Clone, PartialEq, Serialize)]
514#[non_exhaustive]
515pub struct AdminUsergroupsRemoveUsersRequest {
516    /// ID of the usergroup to remove users from
517    pub id: String,
518    /// The encoded user IDs to remove from the usergroup, provided as a JSON array or a comma-separated string.
519    pub users: Vec<String>,
520}
521
522impl AdminUsergroupsRemoveUsersRequest {
523    pub fn new(id: impl Into<String>, users: Vec<String>) -> Self {
524        Self {
525            id: id.into(),
526            users,
527        }
528    }
529}
530
531impl SlackApiMethod for AdminUsergroupsRemoveUsersRequest {
532    const METHOD: &'static str = "admin.usergroups.removeUsers";
533    type Response = AdminUsergroupsRemoveUsersResponse;
534}
535
536/// Successful response of the Slack Web API method [`admin.usergroups.removeUsers`](https://docs.slack.dev/reference/methods/admin.usergroups.removeUsers).
537#[doc(alias = "admin.usergroups.removeUsers")]
538#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
539pub struct AdminUsergroupsRemoveUsersResponse {
540    /// Fields returned by Slack. This method has no documented response example.
541    #[serde(flatten)]
542    pub extra: serde_json::Map<String, serde_json::Value>,
543    #[serde(
544        default,
545        deserialize_with = "crate::de::opt_object",
546        skip_serializing_if = "Option::is_none"
547    )]
548    pub response_metadata: Option<ResponseMetadata>,
549    #[serde(
550        default,
551        deserialize_with = "crate::de::opt_string",
552        skip_serializing_if = "Option::is_none"
553    )]
554    pub warning: Option<String>,
555}
556
557/// Arguments for the Slack Web API method [`admin.usergroups.update`](https://docs.slack.dev/reference/methods/admin.usergroups.update): Update one or more properties of an existing organizational usergroup.
558///
559/// Send it with [`SlackClient::admin_usergroups_update`].
560#[doc(alias = "admin.usergroups.update")]
561#[derive(Debug, Clone, PartialEq, Serialize)]
562#[non_exhaustive]
563pub struct AdminUsergroupsUpdateRequest {
564    /// ID of the usergroup to update
565    pub id: String,
566    /// The name of the group.
567    #[serde(skip_serializing_if = "Option::is_none")]
568    pub name: Option<String>,
569    /// The handle used for mentioning the group in a channel, must be unique.
570    #[serde(skip_serializing_if = "Option::is_none")]
571    pub handle: Option<String>,
572    /// The usergroup's purpose or description.
573    #[serde(skip_serializing_if = "Option::is_none")]
574    pub description: Option<String>,
575    /// Configure whether or not this usergroup should be visible in the client.
576    #[serde(skip_serializing_if = "Option::is_none")]
577    pub is_visible: Option<bool>,
578}
579
580impl AdminUsergroupsUpdateRequest {
581    pub fn new(id: impl Into<String>) -> Self {
582        Self {
583            id: id.into(),
584            name: None,
585            handle: None,
586            description: None,
587            is_visible: None,
588        }
589    }
590
591    pub fn name(mut self, name: impl Into<String>) -> Self {
592        self.name = Some(name.into());
593        self
594    }
595
596    pub fn handle(mut self, handle: impl Into<String>) -> Self {
597        self.handle = Some(handle.into());
598        self
599    }
600
601    pub fn description(mut self, description: impl Into<String>) -> Self {
602        self.description = Some(description.into());
603        self
604    }
605
606    pub fn is_visible(mut self, is_visible: bool) -> Self {
607        self.is_visible = Some(is_visible);
608        self
609    }
610}
611
612impl SlackApiMethod for AdminUsergroupsUpdateRequest {
613    const METHOD: &'static str = "admin.usergroups.update";
614    type Response = AdminUsergroupsUpdateResponse;
615}
616
617/// Successful response of the Slack Web API method [`admin.usergroups.update`](https://docs.slack.dev/reference/methods/admin.usergroups.update).
618#[doc(alias = "admin.usergroups.update")]
619#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
620pub struct AdminUsergroupsUpdateResponse {
621    #[serde(
622        default,
623        deserialize_with = "crate::de::opt_object",
624        skip_serializing_if = "Option::is_none"
625    )]
626    pub subteam: Option<Usergroup>,
627    #[serde(
628        default,
629        deserialize_with = "crate::de::opt_object",
630        skip_serializing_if = "Option::is_none"
631    )]
632    pub response_metadata: Option<ResponseMetadata>,
633    #[serde(
634        default,
635        deserialize_with = "crate::de::opt_string",
636        skip_serializing_if = "Option::is_none"
637    )]
638    pub warning: Option<String>,
639}
640
641/// Arguments for the Slack Web API method [`admin.usergroups.uploadUsers`](https://docs.slack.dev/reference/methods/admin.usergroups.uploadUsers): Add members to an existing organizational usergroup in bulk via CSV upload.
642///
643/// Send it with [`SlackClient::admin_usergroups_upload_users`].
644#[doc(alias = "admin.usergroups.uploadUsers")]
645#[derive(Debug, Clone, PartialEq, Serialize)]
646#[non_exhaustive]
647pub struct AdminUsergroupsUploadUsersRequest {
648    /// ID of the usergroup to upload users to
649    pub id: String,
650    /// Csv of users to upload in format member id, email
651    #[serde(skip_serializing_if = "Option::is_none")]
652    pub file: Option<String>,
653}
654
655impl AdminUsergroupsUploadUsersRequest {
656    pub fn new(id: impl Into<String>) -> Self {
657        Self {
658            id: id.into(),
659            file: None,
660        }
661    }
662
663    pub fn file(mut self, file: impl Into<String>) -> Self {
664        self.file = Some(file.into());
665        self
666    }
667}
668
669impl SlackApiMethod for AdminUsergroupsUploadUsersRequest {
670    const METHOD: &'static str = "admin.usergroups.uploadUsers";
671    type Response = AdminUsergroupsUploadUsersResponse;
672}
673
674/// Successful response of the Slack Web API method [`admin.usergroups.uploadUsers`](https://docs.slack.dev/reference/methods/admin.usergroups.uploadUsers).
675#[doc(alias = "admin.usergroups.uploadUsers")]
676#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
677pub struct AdminUsergroupsUploadUsersResponse {
678    #[serde(
679        default,
680        deserialize_with = "crate::de::opt_i64",
681        skip_serializing_if = "Option::is_none"
682    )]
683    pub successful_user_count: Option<i64>,
684    #[serde(
685        default,
686        deserialize_with = "crate::de::vec",
687        skip_serializing_if = "Vec::is_empty"
688    )]
689    pub invalid_users: Vec<AdminUsergroupsUploadUsersResponseInvalidUsers>,
690    #[serde(
691        default,
692        deserialize_with = "crate::de::opt_object",
693        skip_serializing_if = "Option::is_none"
694    )]
695    pub response_metadata: Option<ResponseMetadata>,
696    #[serde(
697        default,
698        deserialize_with = "crate::de::opt_string",
699        skip_serializing_if = "Option::is_none"
700    )]
701    pub warning: Option<String>,
702}
703
704#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
705pub struct AdminUsergroupsUploadUsersResponseInvalidUsers {
706    #[serde(
707        default,
708        deserialize_with = "crate::de::opt_string",
709        skip_serializing_if = "Option::is_none"
710    )]
711    pub user_id: Option<String>,
712    #[serde(
713        default,
714        deserialize_with = "crate::de::opt_string",
715        skip_serializing_if = "Option::is_none"
716    )]
717    pub reason: Option<String>,
718}
719
720impl SlackClient {
721    /// Calls the Slack Web API method [`admin.usergroups.addChannels`](https://docs.slack.dev/reference/methods/admin.usergroups.addChannels): Add up to one hundred default channels to an IDP group.
722    ///
723    /// Required scopes:
724    ///
725    /// - user token: `admin.usergroups:write`
726    ///
727    /// Rate limit: Tier 1 (<https://docs.slack.dev/apis/web-api/rate-limits>).
728    ///
729    /// # Errors
730    ///
731    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
732    #[doc(alias = "admin.usergroups.addChannels")]
733    pub async fn admin_usergroups_add_channels(
734        &self,
735        request: &AdminUsergroupsAddChannelsRequest,
736    ) -> Result<AdminUsergroupsAddChannelsResponse, SlackError> {
737        self.call(request).await
738    }
739
740    /// Calls the Slack Web API method [`admin.usergroups.addTeams`](https://docs.slack.dev/reference/methods/admin.usergroups.addTeams): Associate one or more default workspaces with an organization-wide IDP group.
741    ///
742    /// Required scopes:
743    ///
744    /// - user token: `admin.teams:write`
745    ///
746    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
747    ///
748    /// # Errors
749    ///
750    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
751    #[doc(alias = "admin.usergroups.addTeams")]
752    pub async fn admin_usergroups_add_teams(
753        &self,
754        request: &AdminUsergroupsAddTeamsRequest,
755    ) -> Result<AdminUsergroupsAddTeamsResponse, SlackError> {
756        self.call(request).await
757    }
758
759    /// Calls the Slack Web API method [`admin.usergroups.addUsers`](https://docs.slack.dev/reference/methods/admin.usergroups.addUsers): Add members to an existing organizational usergroup.
760    ///
761    /// Required scopes:
762    ///
763    /// - user token: `admin.usergroups:write`
764    ///
765    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
766    ///
767    /// # Errors
768    ///
769    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
770    #[doc(alias = "admin.usergroups.addUsers")]
771    pub async fn admin_usergroups_add_users(
772        &self,
773        request: &AdminUsergroupsAddUsersRequest,
774    ) -> Result<AdminUsergroupsAddUsersResponse, SlackError> {
775        self.call(request).await
776    }
777
778    /// Calls the Slack Web API method [`admin.usergroups.create`](https://docs.slack.dev/reference/methods/admin.usergroups.create): Create a new organizational usergroup.
779    ///
780    /// Required scopes:
781    ///
782    /// - user token: `admin.usergroups:write`
783    ///
784    /// Rate limit: Tier 1 (<https://docs.slack.dev/apis/web-api/rate-limits>).
785    ///
786    /// # Errors
787    ///
788    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
789    #[doc(alias = "admin.usergroups.create")]
790    pub async fn admin_usergroups_create(
791        &self,
792        request: &AdminUsergroupsCreateRequest,
793    ) -> Result<AdminUsergroupsCreateResponse, SlackError> {
794        self.call(request).await
795    }
796
797    /// Calls the Slack Web API method [`admin.usergroups.fetch`](https://docs.slack.dev/reference/methods/admin.usergroups.fetch): Fetch an organizational usergroup.
798    ///
799    /// Required scopes:
800    ///
801    /// - user token: `admin.usergroups:read`
802    ///
803    /// Rate limit: Tier 1 (<https://docs.slack.dev/apis/web-api/rate-limits>).
804    ///
805    /// # Errors
806    ///
807    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
808    #[doc(alias = "admin.usergroups.fetch")]
809    pub async fn admin_usergroups_fetch(
810        &self,
811        request: &AdminUsergroupsFetchRequest,
812    ) -> Result<AdminUsergroupsFetchResponse, SlackError> {
813        self.call(request).await
814    }
815
816    /// Calls the Slack Web API method [`admin.usergroups.listChannels`](https://docs.slack.dev/reference/methods/admin.usergroups.listChannels): List the channels linked to an org-level IDP group (user group).
817    ///
818    /// Required scopes:
819    ///
820    /// - user token: `admin.usergroups:read`
821    ///
822    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
823    ///
824    /// # Errors
825    ///
826    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
827    #[doc(alias = "admin.usergroups.listChannels")]
828    pub async fn admin_usergroups_list_channels(
829        &self,
830        request: &AdminUsergroupsListChannelsRequest,
831    ) -> Result<AdminUsergroupsListChannelsResponse, SlackError> {
832        self.call(request).await
833    }
834
835    /// Calls the Slack Web API method [`admin.usergroups.removeChannels`](https://docs.slack.dev/reference/methods/admin.usergroups.removeChannels): Remove one or more default channels from an org-level IDP group (user group).
836    ///
837    /// Required scopes:
838    ///
839    /// - user token: `admin.usergroups:write`
840    ///
841    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
842    ///
843    /// # Errors
844    ///
845    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
846    #[doc(alias = "admin.usergroups.removeChannels")]
847    pub async fn admin_usergroups_remove_channels(
848        &self,
849        request: &AdminUsergroupsRemoveChannelsRequest,
850    ) -> Result<AdminUsergroupsRemoveChannelsResponse, SlackError> {
851        self.call(request).await
852    }
853
854    /// Calls the Slack Web API method [`admin.usergroups.removeTeams`](https://docs.slack.dev/reference/methods/admin.usergroups.removeTeams): Remove one or more default workspaces from an organization-wide IDP Group or Admin Group
855    ///
856    /// Required scopes:
857    ///
858    /// - user token: `admin.teams:write`
859    ///
860    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
861    ///
862    /// # Errors
863    ///
864    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
865    #[doc(alias = "admin.usergroups.removeTeams")]
866    pub async fn admin_usergroups_remove_teams(
867        &self,
868        request: &AdminUsergroupsRemoveTeamsRequest,
869    ) -> Result<AdminUsergroupsRemoveTeamsResponse, SlackError> {
870        self.call(request).await
871    }
872
873    /// Calls the Slack Web API method [`admin.usergroups.removeUsers`](https://docs.slack.dev/reference/methods/admin.usergroups.removeUsers): Remove members from an existing organizational usergroup.
874    ///
875    /// Required scopes:
876    ///
877    /// - user token: `admin.usergroups:write`
878    ///
879    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
880    ///
881    /// # Errors
882    ///
883    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
884    #[doc(alias = "admin.usergroups.removeUsers")]
885    pub async fn admin_usergroups_remove_users(
886        &self,
887        request: &AdminUsergroupsRemoveUsersRequest,
888    ) -> Result<AdminUsergroupsRemoveUsersResponse, SlackError> {
889        self.call(request).await
890    }
891
892    /// Calls the Slack Web API method [`admin.usergroups.update`](https://docs.slack.dev/reference/methods/admin.usergroups.update): Update one or more properties of an existing organizational usergroup.
893    ///
894    /// Required scopes:
895    ///
896    /// - user token: `admin.usergroups:write`
897    ///
898    /// Rate limit: Tier 1 (<https://docs.slack.dev/apis/web-api/rate-limits>).
899    ///
900    /// # Errors
901    ///
902    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
903    #[doc(alias = "admin.usergroups.update")]
904    pub async fn admin_usergroups_update(
905        &self,
906        request: &AdminUsergroupsUpdateRequest,
907    ) -> Result<AdminUsergroupsUpdateResponse, SlackError> {
908        self.call(request).await
909    }
910
911    /// Calls the Slack Web API method [`admin.usergroups.uploadUsers`](https://docs.slack.dev/reference/methods/admin.usergroups.uploadUsers): Add members to an existing organizational usergroup in bulk via CSV upload.
912    ///
913    /// Required scopes:
914    ///
915    /// - user token: `admin.usergroups:write`
916    ///
917    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
918    ///
919    /// # Errors
920    ///
921    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
922    #[doc(alias = "admin.usergroups.uploadUsers")]
923    pub async fn admin_usergroups_upload_users(
924        &self,
925        request: &AdminUsergroupsUploadUsersRequest,
926    ) -> Result<AdminUsergroupsUploadUsersResponse, SlackError> {
927        self.call(request).await
928    }
929}