Skip to main content

slack_web_api/api/
admin_users.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.users.assign`](https://docs.slack.dev/reference/methods/admin.users.assign): Add an Enterprise user to a workspace.
12///
13/// Send it with [`SlackClient::admin_users_assign`].
14#[doc(alias = "admin.users.assign")]
15#[derive(Debug, Clone, PartialEq, Serialize)]
16#[non_exhaustive]
17pub struct AdminUsersAssignRequest {
18    /// The ID (`T1234`) of the workspace.
19    pub team_id: String,
20    /// The ID of the user to add to the workspace.
21    pub user_id: String,
22    /// True if user should be added to the workspace as a guest.
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub is_restricted: Option<bool>,
25    /// True if user should be added to the workspace as a single-channel guest.
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub is_ultra_restricted: Option<bool>,
28    /// Comma separated values of channel IDs to add user in the new workspace.
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub channel_ids: Option<String>,
31}
32
33impl AdminUsersAssignRequest {
34    pub fn new(team_id: impl Into<String>, user_id: impl Into<String>) -> Self {
35        Self {
36            team_id: team_id.into(),
37            user_id: user_id.into(),
38            is_restricted: None,
39            is_ultra_restricted: None,
40            channel_ids: None,
41        }
42    }
43
44    pub fn is_restricted(mut self, is_restricted: bool) -> Self {
45        self.is_restricted = Some(is_restricted);
46        self
47    }
48
49    pub fn is_ultra_restricted(mut self, is_ultra_restricted: bool) -> Self {
50        self.is_ultra_restricted = Some(is_ultra_restricted);
51        self
52    }
53
54    pub fn channel_ids(mut self, channel_ids: impl Into<String>) -> Self {
55        self.channel_ids = Some(channel_ids.into());
56        self
57    }
58}
59
60impl SlackApiMethod for AdminUsersAssignRequest {
61    const METHOD: &'static str = "admin.users.assign";
62    type Response = AdminUsersAssignResponse;
63}
64
65/// Successful response of the Slack Web API method [`admin.users.assign`](https://docs.slack.dev/reference/methods/admin.users.assign).
66#[doc(alias = "admin.users.assign")]
67#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
68pub struct AdminUsersAssignResponse {
69    /// Fields returned by Slack. This method has no documented response example.
70    #[serde(flatten)]
71    pub extra: serde_json::Map<String, serde_json::Value>,
72    #[serde(
73        default,
74        deserialize_with = "crate::de::opt_object",
75        skip_serializing_if = "Option::is_none"
76    )]
77    pub response_metadata: Option<ResponseMetadata>,
78    #[serde(
79        default,
80        deserialize_with = "crate::de::opt_string",
81        skip_serializing_if = "Option::is_none"
82    )]
83    pub warning: Option<String>,
84}
85
86/// Arguments for the Slack Web API method [`admin.users.getExpiration`](https://docs.slack.dev/reference/methods/admin.users.getExpiration): Fetches the expiration timestamp for a guest.
87///
88/// Send it with [`SlackClient::admin_users_get_expiration`].
89#[doc(alias = "admin.users.getExpiration")]
90#[derive(Debug, Clone, PartialEq, Serialize)]
91#[non_exhaustive]
92pub struct AdminUsersGetExpirationRequest {
93    /// The ID of the guest user to get the expiration for.
94    pub user_id: String,
95    /// If an org token is passed in and this team is on the org, it will operate on the workspace level on the specified team. Otherwise it will operate on the org or team in context.
96    #[serde(skip_serializing_if = "Option::is_none")]
97    pub target_team: Option<String>,
98}
99
100impl AdminUsersGetExpirationRequest {
101    pub fn new(user_id: impl Into<String>) -> Self {
102        Self {
103            user_id: user_id.into(),
104            target_team: None,
105        }
106    }
107
108    pub fn target_team(mut self, target_team: impl Into<String>) -> Self {
109        self.target_team = Some(target_team.into());
110        self
111    }
112}
113
114impl SlackApiMethod for AdminUsersGetExpirationRequest {
115    const METHOD: &'static str = "admin.users.getExpiration";
116    type Response = AdminUsersGetExpirationResponse;
117}
118
119/// Successful response of the Slack Web API method [`admin.users.getExpiration`](https://docs.slack.dev/reference/methods/admin.users.getExpiration).
120#[doc(alias = "admin.users.getExpiration")]
121#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
122pub struct AdminUsersGetExpirationResponse {
123    #[serde(
124        default,
125        deserialize_with = "crate::de::opt_object",
126        skip_serializing_if = "Option::is_none"
127    )]
128    pub user: Option<AdminUsersGetExpirationResponseUser>,
129    #[serde(
130        default,
131        deserialize_with = "crate::de::opt_object",
132        skip_serializing_if = "Option::is_none"
133    )]
134    pub response_metadata: Option<ResponseMetadata>,
135    #[serde(
136        default,
137        deserialize_with = "crate::de::opt_string",
138        skip_serializing_if = "Option::is_none"
139    )]
140    pub warning: Option<String>,
141}
142
143#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
144pub struct AdminUsersGetExpirationResponseUser {
145    #[serde(
146        default,
147        deserialize_with = "crate::de::opt_string",
148        skip_serializing_if = "Option::is_none"
149    )]
150    pub id: Option<String>,
151    #[serde(
152        default,
153        deserialize_with = "crate::de::opt_string",
154        skip_serializing_if = "Option::is_none"
155    )]
156    pub email: Option<String>,
157    #[serde(
158        default,
159        deserialize_with = "crate::de::opt_bool",
160        skip_serializing_if = "Option::is_none"
161    )]
162    pub is_restricted: Option<bool>,
163    #[serde(
164        default,
165        deserialize_with = "crate::de::opt_bool",
166        skip_serializing_if = "Option::is_none"
167    )]
168    pub is_ultra_restricted: Option<bool>,
169    #[serde(
170        default,
171        deserialize_with = "crate::de::opt_i64",
172        skip_serializing_if = "Option::is_none"
173    )]
174    pub expiration_ts: Option<i64>,
175}
176
177/// Arguments for the Slack Web API method [`admin.users.invite`](https://docs.slack.dev/reference/methods/admin.users.invite): Invite a user to a workspace.
178///
179/// Send it with [`SlackClient::admin_users_invite`].
180#[doc(alias = "admin.users.invite")]
181#[derive(Debug, Clone, PartialEq, Serialize)]
182#[non_exhaustive]
183pub struct AdminUsersInviteRequest {
184    /// The ID (`T1234`) of the workspace.
185    pub team_id: String,
186    /// The email address of the person to invite.
187    pub email: String,
188    /// A comma-separated list of `channel_id`s for this user to join. At least one channel is required.
189    pub channel_ids: String,
190    /// An optional message to send to the user in the invite email.
191    #[serde(skip_serializing_if = "Option::is_none")]
192    pub custom_message: Option<String>,
193    /// Full name of the user.
194    #[serde(skip_serializing_if = "Option::is_none")]
195    pub real_name: Option<String>,
196    /// Allow this invite to be resent in the future if a user has not signed up yet. Resending can only be done via the UI and has no expiration. (default: false)
197    #[serde(skip_serializing_if = "Option::is_none")]
198    pub resend: Option<bool>,
199    /// Is this user a multi-channel guest user? (default: false)
200    #[serde(skip_serializing_if = "Option::is_none")]
201    pub is_restricted: Option<bool>,
202    /// Is this user a single channel guest user? (default: false)
203    #[serde(skip_serializing_if = "Option::is_none")]
204    pub is_ultra_restricted: Option<bool>,
205    /// Timestamp when guest account should be disabled. Only include this timestamp if you are inviting a guest user and you want their account to expire on a certain date.
206    #[serde(skip_serializing_if = "Option::is_none")]
207    pub guest_expiration_ts: Option<String>,
208    /// Allow invited user to sign in via email and password. Only available for Enterprise org teams via admin invite.
209    #[serde(skip_serializing_if = "Option::is_none")]
210    pub email_password_policy_enabled: Option<bool>,
211}
212
213impl AdminUsersInviteRequest {
214    pub fn new(
215        team_id: impl Into<String>,
216        email: impl Into<String>,
217        channel_ids: impl Into<String>,
218    ) -> Self {
219        Self {
220            team_id: team_id.into(),
221            email: email.into(),
222            channel_ids: channel_ids.into(),
223            custom_message: None,
224            real_name: None,
225            resend: None,
226            is_restricted: None,
227            is_ultra_restricted: None,
228            guest_expiration_ts: None,
229            email_password_policy_enabled: None,
230        }
231    }
232
233    pub fn custom_message(mut self, custom_message: impl Into<String>) -> Self {
234        self.custom_message = Some(custom_message.into());
235        self
236    }
237
238    pub fn real_name(mut self, real_name: impl Into<String>) -> Self {
239        self.real_name = Some(real_name.into());
240        self
241    }
242
243    pub fn resend(mut self, resend: bool) -> Self {
244        self.resend = Some(resend);
245        self
246    }
247
248    pub fn is_restricted(mut self, is_restricted: bool) -> Self {
249        self.is_restricted = Some(is_restricted);
250        self
251    }
252
253    pub fn is_ultra_restricted(mut self, is_ultra_restricted: bool) -> Self {
254        self.is_ultra_restricted = Some(is_ultra_restricted);
255        self
256    }
257
258    pub fn guest_expiration_ts(mut self, guest_expiration_ts: impl Into<String>) -> Self {
259        self.guest_expiration_ts = Some(guest_expiration_ts.into());
260        self
261    }
262
263    pub fn email_password_policy_enabled(mut self, email_password_policy_enabled: bool) -> Self {
264        self.email_password_policy_enabled = Some(email_password_policy_enabled);
265        self
266    }
267}
268
269impl SlackApiMethod for AdminUsersInviteRequest {
270    const METHOD: &'static str = "admin.users.invite";
271    type Response = AdminUsersInviteResponse;
272}
273
274/// Successful response of the Slack Web API method [`admin.users.invite`](https://docs.slack.dev/reference/methods/admin.users.invite).
275#[doc(alias = "admin.users.invite")]
276#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
277pub struct AdminUsersInviteResponse {
278    /// Fields returned by Slack. This method has no documented response example.
279    #[serde(flatten)]
280    pub extra: serde_json::Map<String, serde_json::Value>,
281    #[serde(
282        default,
283        deserialize_with = "crate::de::opt_object",
284        skip_serializing_if = "Option::is_none"
285    )]
286    pub response_metadata: Option<ResponseMetadata>,
287    #[serde(
288        default,
289        deserialize_with = "crate::de::opt_string",
290        skip_serializing_if = "Option::is_none"
291    )]
292    pub warning: Option<String>,
293}
294
295/// Arguments for the Slack Web API method [`admin.users.list`](https://docs.slack.dev/reference/methods/admin.users.list): List users on a workspace
296///
297/// Send it with [`SlackClient::admin_users_list`].
298#[doc(alias = "admin.users.list")]
299#[derive(Debug, Clone, PartialEq, Serialize, Default)]
300#[non_exhaustive]
301pub struct AdminUsersListRequest {
302    /// The ID (T1234) of a workspace. Filters results to just the specified workspace.
303    #[serde(skip_serializing_if = "Option::is_none")]
304    pub team_id: Option<String>,
305    /// Set `cursor` to `next_cursor` returned by the previous call to list items in the next page.
306    #[serde(skip_serializing_if = "Option::is_none")]
307    pub cursor: Option<String>,
308    /// If true, only active users will be returned. If false, only deactivated users will be returned. Default is true.
309    #[serde(skip_serializing_if = "Option::is_none")]
310    pub is_active: Option<bool>,
311    /// Only applies with org token and no team\_id. If true, return `workspaces` for a user even if they may be deactivated on them. If false, return `workspaces` for a user only when user is active on them. Default is false.
312    #[serde(skip_serializing_if = "Option::is_none")]
313    pub include_deactivated_user_workspaces: Option<bool>,
314    /// If true, returns only guests and their expiration dates that belong to the team\_id.
315    #[serde(skip_serializing_if = "Option::is_none")]
316    pub only_guests: Option<bool>,
317    /// If true, only admin users will be returned (excludes owners). Returns all admins and owners when combined with `include_owners`. Cannot be used together with `only_guests`.
318    #[serde(skip_serializing_if = "Option::is_none")]
319    pub include_admins: Option<bool>,
320    /// If true, only owner users will be returned. Cannot be used together with `only_guests`.
321    #[serde(skip_serializing_if = "Option::is_none")]
322    pub include_owners: Option<bool>,
323    /// Limit for how many users to be retrieved per page
324    #[serde(skip_serializing_if = "Option::is_none")]
325    pub limit: Option<i64>,
326}
327
328impl AdminUsersListRequest {
329    pub fn new() -> Self {
330        Self {
331            team_id: None,
332            cursor: None,
333            is_active: None,
334            include_deactivated_user_workspaces: None,
335            only_guests: None,
336            include_admins: None,
337            include_owners: None,
338            limit: None,
339        }
340    }
341
342    pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
343        self.team_id = Some(team_id.into());
344        self
345    }
346
347    pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
348        self.cursor = Some(cursor.into());
349        self
350    }
351
352    pub fn is_active(mut self, is_active: bool) -> Self {
353        self.is_active = Some(is_active);
354        self
355    }
356
357    pub fn include_deactivated_user_workspaces(
358        mut self,
359        include_deactivated_user_workspaces: bool,
360    ) -> Self {
361        self.include_deactivated_user_workspaces = Some(include_deactivated_user_workspaces);
362        self
363    }
364
365    pub fn only_guests(mut self, only_guests: bool) -> Self {
366        self.only_guests = Some(only_guests);
367        self
368    }
369
370    pub fn include_admins(mut self, include_admins: bool) -> Self {
371        self.include_admins = Some(include_admins);
372        self
373    }
374
375    pub fn include_owners(mut self, include_owners: bool) -> Self {
376        self.include_owners = Some(include_owners);
377        self
378    }
379
380    pub fn limit(mut self, limit: i64) -> Self {
381        self.limit = Some(limit);
382        self
383    }
384}
385
386impl SlackApiMethod for AdminUsersListRequest {
387    const METHOD: &'static str = "admin.users.list";
388    type Response = AdminUsersListResponse;
389}
390
391impl CursorPaginated for AdminUsersListRequest {
392    fn set_cursor(&mut self, cursor: String) {
393        self.cursor = Some(cursor);
394    }
395}
396
397impl NextCursor for AdminUsersListResponse {
398    fn next_cursor(&self) -> Option<&str> {
399        self.response_metadata.as_ref()?.next_cursor.as_deref()
400    }
401}
402
403/// Successful response of the Slack Web API method [`admin.users.list`](https://docs.slack.dev/reference/methods/admin.users.list).
404#[doc(alias = "admin.users.list")]
405#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
406pub struct AdminUsersListResponse {
407    #[serde(
408        default,
409        deserialize_with = "crate::de::vec",
410        skip_serializing_if = "Vec::is_empty"
411    )]
412    pub users: Vec<User>,
413    #[serde(
414        default,
415        deserialize_with = "crate::de::opt_object",
416        skip_serializing_if = "Option::is_none"
417    )]
418    pub response_metadata: Option<ResponseMetadata>,
419    #[serde(
420        default,
421        deserialize_with = "crate::de::opt_string",
422        skip_serializing_if = "Option::is_none"
423    )]
424    pub warning: Option<String>,
425}
426
427/// Arguments for the Slack Web API method [`admin.users.remove`](https://docs.slack.dev/reference/methods/admin.users.remove): Remove a user from a workspace.
428///
429/// Send it with [`SlackClient::admin_users_remove`].
430#[doc(alias = "admin.users.remove")]
431#[derive(Debug, Clone, PartialEq, Serialize)]
432#[non_exhaustive]
433pub struct AdminUsersRemoveRequest {
434    /// The ID (`T1234`) of the workspace.
435    pub team_id: String,
436    /// The ID of the user to remove.
437    pub user_id: String,
438}
439
440impl AdminUsersRemoveRequest {
441    pub fn new(team_id: impl Into<String>, user_id: impl Into<String>) -> Self {
442        Self {
443            team_id: team_id.into(),
444            user_id: user_id.into(),
445        }
446    }
447}
448
449impl SlackApiMethod for AdminUsersRemoveRequest {
450    const METHOD: &'static str = "admin.users.remove";
451    type Response = AdminUsersRemoveResponse;
452}
453
454/// Successful response of the Slack Web API method [`admin.users.remove`](https://docs.slack.dev/reference/methods/admin.users.remove).
455#[doc(alias = "admin.users.remove")]
456#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
457pub struct AdminUsersRemoveResponse {
458    /// Fields returned by Slack. This method has no documented response example.
459    #[serde(flatten)]
460    pub extra: serde_json::Map<String, serde_json::Value>,
461    #[serde(
462        default,
463        deserialize_with = "crate::de::opt_object",
464        skip_serializing_if = "Option::is_none"
465    )]
466    pub response_metadata: Option<ResponseMetadata>,
467    #[serde(
468        default,
469        deserialize_with = "crate::de::opt_string",
470        skip_serializing_if = "Option::is_none"
471    )]
472    pub warning: Option<String>,
473}
474
475/// Arguments for the Slack Web API method [`admin.users.session.clearSettings`](https://docs.slack.dev/reference/methods/admin.users.session.clearSettings): Clear user-specific session settings—the session duration and what happens when the client closes—for a list of users.
476///
477/// Send it with [`SlackClient::admin_users_session_clear_settings`].
478#[doc(alias = "admin.users.session.clearSettings")]
479#[derive(Debug, Clone, PartialEq, Serialize)]
480#[non_exhaustive]
481pub struct AdminUsersSessionClearSettingsRequest {
482    /// The IDs of users you'd like to clear session settings for.
483    #[serde(serialize_with = "crate::form::as_json")]
484    pub user_ids: Vec<String>,
485}
486
487impl AdminUsersSessionClearSettingsRequest {
488    pub fn new(user_ids: Vec<String>) -> Self {
489        Self { user_ids }
490    }
491}
492
493impl SlackApiMethod for AdminUsersSessionClearSettingsRequest {
494    const METHOD: &'static str = "admin.users.session.clearSettings";
495    type Response = AdminUsersSessionClearSettingsResponse;
496}
497
498/// Successful response of the Slack Web API method [`admin.users.session.clearSettings`](https://docs.slack.dev/reference/methods/admin.users.session.clearSettings).
499#[doc(alias = "admin.users.session.clearSettings")]
500#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
501pub struct AdminUsersSessionClearSettingsResponse {
502    /// Fields returned by Slack. This method has no documented response example.
503    #[serde(flatten)]
504    pub extra: serde_json::Map<String, serde_json::Value>,
505    #[serde(
506        default,
507        deserialize_with = "crate::de::opt_object",
508        skip_serializing_if = "Option::is_none"
509    )]
510    pub response_metadata: Option<ResponseMetadata>,
511    #[serde(
512        default,
513        deserialize_with = "crate::de::opt_string",
514        skip_serializing_if = "Option::is_none"
515    )]
516    pub warning: Option<String>,
517}
518
519/// Arguments for the Slack Web API method [`admin.users.session.getSettings`](https://docs.slack.dev/reference/methods/admin.users.session.getSettings): Get user-specific session settings—the session duration and what happens when the client closes—given a list of users.
520///
521/// Send it with [`SlackClient::admin_users_session_get_settings`].
522#[doc(alias = "admin.users.session.getSettings")]
523#[derive(Debug, Clone, PartialEq, Serialize)]
524#[non_exhaustive]
525pub struct AdminUsersSessionGetSettingsRequest {
526    /// The IDs of users you'd like to fetch session settings for. Note: if a user does not have any active sessions, they will not be returned in the response.
527    #[serde(serialize_with = "crate::form::as_json")]
528    pub user_ids: Vec<String>,
529}
530
531impl AdminUsersSessionGetSettingsRequest {
532    pub fn new(user_ids: Vec<String>) -> Self {
533        Self { user_ids }
534    }
535}
536
537impl SlackApiMethod for AdminUsersSessionGetSettingsRequest {
538    const METHOD: &'static str = "admin.users.session.getSettings";
539    type Response = AdminUsersSessionGetSettingsResponse;
540}
541
542/// Successful response of the Slack Web API method [`admin.users.session.getSettings`](https://docs.slack.dev/reference/methods/admin.users.session.getSettings).
543#[doc(alias = "admin.users.session.getSettings")]
544#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
545pub struct AdminUsersSessionGetSettingsResponse {
546    #[serde(
547        default,
548        deserialize_with = "crate::de::vec",
549        skip_serializing_if = "Vec::is_empty"
550    )]
551    pub session_settings: Vec<AdminUsersSessionGetSettingsResponseSessionSettings>,
552    #[serde(
553        default,
554        deserialize_with = "crate::de::vec",
555        skip_serializing_if = "Vec::is_empty"
556    )]
557    pub no_settings_applied: Vec<serde_json::Value>,
558    #[serde(
559        default,
560        deserialize_with = "crate::de::opt_object",
561        skip_serializing_if = "Option::is_none"
562    )]
563    pub response_metadata: Option<ResponseMetadata>,
564    #[serde(
565        default,
566        deserialize_with = "crate::de::opt_string",
567        skip_serializing_if = "Option::is_none"
568    )]
569    pub warning: Option<String>,
570}
571
572#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
573pub struct AdminUsersSessionGetSettingsResponseSessionSettings {
574    #[serde(
575        default,
576        deserialize_with = "crate::de::opt_string",
577        skip_serializing_if = "Option::is_none"
578    )]
579    pub user_id: Option<String>,
580    #[serde(
581        default,
582        deserialize_with = "crate::de::opt_bool",
583        skip_serializing_if = "Option::is_none"
584    )]
585    pub desktop_app_browser_quit: Option<bool>,
586    #[serde(
587        default,
588        deserialize_with = "crate::de::opt_i64",
589        skip_serializing_if = "Option::is_none"
590    )]
591    pub duration: Option<i64>,
592}
593
594/// Arguments for the Slack Web API method [`admin.users.session.invalidate`](https://docs.slack.dev/reference/methods/admin.users.session.invalidate): Revoke a single session for a user. The user will be forced to login to Slack.
595///
596/// Send it with [`SlackClient::admin_users_session_invalidate`].
597#[doc(alias = "admin.users.session.invalidate")]
598#[derive(Debug, Clone, PartialEq, Serialize)]
599#[non_exhaustive]
600pub struct AdminUsersSessionInvalidateRequest {
601    /// ID of the user that the session belongs to.
602    pub user_id: String,
603    /// ID of the session to invalidate.
604    pub session_id: i64,
605}
606
607impl AdminUsersSessionInvalidateRequest {
608    pub fn new(user_id: impl Into<String>, session_id: i64) -> Self {
609        Self {
610            user_id: user_id.into(),
611            session_id,
612        }
613    }
614}
615
616impl SlackApiMethod for AdminUsersSessionInvalidateRequest {
617    const METHOD: &'static str = "admin.users.session.invalidate";
618    type Response = AdminUsersSessionInvalidateResponse;
619}
620
621/// Successful response of the Slack Web API method [`admin.users.session.invalidate`](https://docs.slack.dev/reference/methods/admin.users.session.invalidate).
622#[doc(alias = "admin.users.session.invalidate")]
623#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
624pub struct AdminUsersSessionInvalidateResponse {
625    /// Fields returned by Slack. This method has no documented response example.
626    #[serde(flatten)]
627    pub extra: serde_json::Map<String, serde_json::Value>,
628    #[serde(
629        default,
630        deserialize_with = "crate::de::opt_object",
631        skip_serializing_if = "Option::is_none"
632    )]
633    pub response_metadata: Option<ResponseMetadata>,
634    #[serde(
635        default,
636        deserialize_with = "crate::de::opt_string",
637        skip_serializing_if = "Option::is_none"
638    )]
639    pub warning: Option<String>,
640}
641
642/// Arguments for the Slack Web API method [`admin.users.session.list`](https://docs.slack.dev/reference/methods/admin.users.session.list): List active user sessions for an organization
643///
644/// Send it with [`SlackClient::admin_users_session_list`].
645#[doc(alias = "admin.users.session.list")]
646#[derive(Debug, Clone, PartialEq, Serialize, Default)]
647#[non_exhaustive]
648pub struct AdminUsersSessionListRequest {
649    /// The ID of the workspace you'd like active sessions for. If you pass a `team_id`, you'll need to pass a `user_id` as well.
650    #[serde(skip_serializing_if = "Option::is_none")]
651    pub team_id: Option<String>,
652    /// The ID of user you'd like active sessions for. If you pass a `user_id`, you'll need to pass a `team_id` as well.
653    #[serde(skip_serializing_if = "Option::is_none")]
654    pub user_id: Option<String>,
655    /// The maximum number of items to return. Must be between 1 - 1000 both inclusive.
656    #[serde(skip_serializing_if = "Option::is_none")]
657    pub limit: Option<i64>,
658    /// Set `cursor` to `next_cursor` returned by the previous call to list items in the next page.
659    #[serde(skip_serializing_if = "Option::is_none")]
660    pub cursor: Option<String>,
661}
662
663impl AdminUsersSessionListRequest {
664    pub fn new() -> Self {
665        Self {
666            team_id: None,
667            user_id: None,
668            limit: None,
669            cursor: None,
670        }
671    }
672
673    pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
674        self.team_id = Some(team_id.into());
675        self
676    }
677
678    pub fn user_id(mut self, user_id: impl Into<String>) -> Self {
679        self.user_id = Some(user_id.into());
680        self
681    }
682
683    pub fn limit(mut self, limit: i64) -> Self {
684        self.limit = Some(limit);
685        self
686    }
687
688    pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
689        self.cursor = Some(cursor.into());
690        self
691    }
692}
693
694impl SlackApiMethod for AdminUsersSessionListRequest {
695    const METHOD: &'static str = "admin.users.session.list";
696    type Response = AdminUsersSessionListResponse;
697}
698
699impl CursorPaginated for AdminUsersSessionListRequest {
700    fn set_cursor(&mut self, cursor: String) {
701        self.cursor = Some(cursor);
702    }
703}
704
705impl NextCursor for AdminUsersSessionListResponse {
706    fn next_cursor(&self) -> Option<&str> {
707        self.response_metadata.as_ref()?.next_cursor.as_deref()
708    }
709}
710
711/// Successful response of the Slack Web API method [`admin.users.session.list`](https://docs.slack.dev/reference/methods/admin.users.session.list).
712#[doc(alias = "admin.users.session.list")]
713#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
714pub struct AdminUsersSessionListResponse {
715    #[serde(
716        default,
717        deserialize_with = "crate::de::vec",
718        skip_serializing_if = "Vec::is_empty"
719    )]
720    pub active_sessions: Vec<AdminUsersSessionListResponseActiveSessions>,
721    #[serde(
722        default,
723        deserialize_with = "crate::de::opt_object",
724        skip_serializing_if = "Option::is_none"
725    )]
726    pub response_metadata: Option<ResponseMetadata>,
727    #[serde(
728        default,
729        deserialize_with = "crate::de::opt_string",
730        skip_serializing_if = "Option::is_none"
731    )]
732    pub warning: Option<String>,
733}
734
735#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
736pub struct AdminUsersSessionListResponseActiveSessions {
737    #[serde(
738        default,
739        deserialize_with = "crate::de::opt_string",
740        skip_serializing_if = "Option::is_none"
741    )]
742    pub user_id: Option<String>,
743    #[serde(
744        default,
745        deserialize_with = "crate::de::opt_string",
746        skip_serializing_if = "Option::is_none"
747    )]
748    pub team_id: Option<String>,
749    #[serde(
750        default,
751        deserialize_with = "crate::de::opt_i64",
752        skip_serializing_if = "Option::is_none"
753    )]
754    pub session_id: Option<i64>,
755    #[serde(
756        default,
757        deserialize_with = "crate::de::opt_object",
758        skip_serializing_if = "Option::is_none"
759    )]
760    pub recent: Option<AdminUsersSessionListResponseActiveSessionsRecent>,
761    #[serde(
762        default,
763        deserialize_with = "crate::de::opt_object",
764        skip_serializing_if = "Option::is_none"
765    )]
766    pub created: Option<AdminUsersSessionListResponseActiveSessionsCreated>,
767}
768
769#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
770pub struct AdminUsersSessionListResponseActiveSessionsRecent {
771    #[serde(
772        default,
773        deserialize_with = "crate::de::opt_string",
774        skip_serializing_if = "Option::is_none"
775    )]
776    pub device_hardware: Option<String>,
777    #[serde(
778        default,
779        deserialize_with = "crate::de::opt_string",
780        skip_serializing_if = "Option::is_none"
781    )]
782    pub os: Option<String>,
783    #[serde(
784        default,
785        deserialize_with = "crate::de::opt_string",
786        skip_serializing_if = "Option::is_none"
787    )]
788    pub os_version: Option<String>,
789    #[serde(
790        default,
791        deserialize_with = "crate::de::opt_string",
792        skip_serializing_if = "Option::is_none"
793    )]
794    pub slack_client_version: Option<String>,
795    #[serde(
796        default,
797        deserialize_with = "crate::de::opt_string",
798        skip_serializing_if = "Option::is_none"
799    )]
800    pub ip: Option<String>,
801}
802
803#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
804pub struct AdminUsersSessionListResponseActiveSessionsCreated {
805    #[serde(
806        default,
807        deserialize_with = "crate::de::opt_string",
808        skip_serializing_if = "Option::is_none"
809    )]
810    pub device_hardware: Option<String>,
811    #[serde(
812        default,
813        deserialize_with = "crate::de::opt_string",
814        skip_serializing_if = "Option::is_none"
815    )]
816    pub os: Option<String>,
817    #[serde(
818        default,
819        deserialize_with = "crate::de::opt_string",
820        skip_serializing_if = "Option::is_none"
821    )]
822    pub os_version: Option<String>,
823    #[serde(
824        default,
825        deserialize_with = "crate::de::opt_string",
826        skip_serializing_if = "Option::is_none"
827    )]
828    pub slack_client_version: Option<String>,
829    #[serde(
830        default,
831        deserialize_with = "crate::de::opt_string",
832        skip_serializing_if = "Option::is_none"
833    )]
834    pub ip: Option<String>,
835}
836
837/// Arguments for the Slack Web API method [`admin.users.session.reset`](https://docs.slack.dev/reference/methods/admin.users.session.reset): Wipes all valid sessions on all devices for a given user
838///
839/// Send it with [`SlackClient::admin_users_session_reset`].
840#[doc(alias = "admin.users.session.reset")]
841#[derive(Debug, Clone, PartialEq, Serialize)]
842#[non_exhaustive]
843pub struct AdminUsersSessionResetRequest {
844    /// The ID of the user to wipe sessions for
845    pub user_id: String,
846    /// Only expire mobile sessions (default: false)
847    #[serde(skip_serializing_if = "Option::is_none")]
848    pub mobile_only: Option<bool>,
849    /// Only expire web sessions (default: false)
850    #[serde(skip_serializing_if = "Option::is_none")]
851    pub web_only: Option<bool>,
852}
853
854impl AdminUsersSessionResetRequest {
855    pub fn new(user_id: impl Into<String>) -> Self {
856        Self {
857            user_id: user_id.into(),
858            mobile_only: None,
859            web_only: None,
860        }
861    }
862
863    pub fn mobile_only(mut self, mobile_only: bool) -> Self {
864        self.mobile_only = Some(mobile_only);
865        self
866    }
867
868    pub fn web_only(mut self, web_only: bool) -> Self {
869        self.web_only = Some(web_only);
870        self
871    }
872}
873
874impl SlackApiMethod for AdminUsersSessionResetRequest {
875    const METHOD: &'static str = "admin.users.session.reset";
876    type Response = AdminUsersSessionResetResponse;
877}
878
879/// Successful response of the Slack Web API method [`admin.users.session.reset`](https://docs.slack.dev/reference/methods/admin.users.session.reset).
880#[doc(alias = "admin.users.session.reset")]
881#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
882pub struct AdminUsersSessionResetResponse {
883    /// Fields returned by Slack. This method has no documented response example.
884    #[serde(flatten)]
885    pub extra: serde_json::Map<String, serde_json::Value>,
886    #[serde(
887        default,
888        deserialize_with = "crate::de::opt_object",
889        skip_serializing_if = "Option::is_none"
890    )]
891    pub response_metadata: Option<ResponseMetadata>,
892    #[serde(
893        default,
894        deserialize_with = "crate::de::opt_string",
895        skip_serializing_if = "Option::is_none"
896    )]
897    pub warning: Option<String>,
898}
899
900/// Arguments for the Slack Web API method [`admin.users.session.resetBulk`](https://docs.slack.dev/reference/methods/admin.users.session.resetBulk): Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users
901///
902/// Send it with [`SlackClient::admin_users_session_reset_bulk`].
903#[doc(alias = "admin.users.session.resetBulk")]
904#[derive(Debug, Clone, PartialEq, Serialize)]
905#[non_exhaustive]
906pub struct AdminUsersSessionResetBulkRequest {
907    /// The list of up to 1,000 user IDs to wipe sessions for
908    #[serde(serialize_with = "crate::form::as_json")]
909    pub user_ids: Vec<String>,
910    /// Only expire mobile sessions (default: false)
911    #[serde(skip_serializing_if = "Option::is_none")]
912    pub mobile_only: Option<bool>,
913    /// Only expire web sessions (default: false)
914    #[serde(skip_serializing_if = "Option::is_none")]
915    pub web_only: Option<bool>,
916}
917
918impl AdminUsersSessionResetBulkRequest {
919    pub fn new(user_ids: Vec<String>) -> Self {
920        Self {
921            user_ids,
922            mobile_only: None,
923            web_only: None,
924        }
925    }
926
927    pub fn mobile_only(mut self, mobile_only: bool) -> Self {
928        self.mobile_only = Some(mobile_only);
929        self
930    }
931
932    pub fn web_only(mut self, web_only: bool) -> Self {
933        self.web_only = Some(web_only);
934        self
935    }
936}
937
938impl SlackApiMethod for AdminUsersSessionResetBulkRequest {
939    const METHOD: &'static str = "admin.users.session.resetBulk";
940    type Response = AdminUsersSessionResetBulkResponse;
941}
942
943/// Successful response of the Slack Web API method [`admin.users.session.resetBulk`](https://docs.slack.dev/reference/methods/admin.users.session.resetBulk).
944#[doc(alias = "admin.users.session.resetBulk")]
945#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
946pub struct AdminUsersSessionResetBulkResponse {
947    /// Fields returned by Slack. This method has no documented response example.
948    #[serde(flatten)]
949    pub extra: serde_json::Map<String, serde_json::Value>,
950    #[serde(
951        default,
952        deserialize_with = "crate::de::opt_object",
953        skip_serializing_if = "Option::is_none"
954    )]
955    pub response_metadata: Option<ResponseMetadata>,
956    #[serde(
957        default,
958        deserialize_with = "crate::de::opt_string",
959        skip_serializing_if = "Option::is_none"
960    )]
961    pub warning: Option<String>,
962}
963
964/// Arguments for the Slack Web API method [`admin.users.session.setSettings`](https://docs.slack.dev/reference/methods/admin.users.session.setSettings): Configure the user-level session settings—the session duration and what happens when the client closes—for one or more users.
965///
966/// Send it with [`SlackClient::admin_users_session_set_settings`].
967#[doc(alias = "admin.users.session.setSettings")]
968#[derive(Debug, Clone, PartialEq, Serialize)]
969#[non_exhaustive]
970pub struct AdminUsersSessionSetSettingsRequest {
971    /// The list of up to 1,000 user IDs to apply the session settings for
972    #[serde(serialize_with = "crate::form::as_json")]
973    pub user_ids: Vec<String>,
974    /// The session duration, in seconds. The minimum value is 28800, which represents 8 hours; the max value is 315569520 or 10 years (that's a long Slack session).
975    #[serde(skip_serializing_if = "Option::is_none")]
976    pub duration: Option<i64>,
977    /// Terminate the session when the client—either the desktop app or a browser window—is closed.
978    #[serde(skip_serializing_if = "Option::is_none")]
979    pub desktop_app_browser_quit: Option<bool>,
980}
981
982impl AdminUsersSessionSetSettingsRequest {
983    pub fn new(user_ids: Vec<String>) -> Self {
984        Self {
985            user_ids,
986            duration: None,
987            desktop_app_browser_quit: None,
988        }
989    }
990
991    pub fn duration(mut self, duration: i64) -> Self {
992        self.duration = Some(duration);
993        self
994    }
995
996    pub fn desktop_app_browser_quit(mut self, desktop_app_browser_quit: bool) -> Self {
997        self.desktop_app_browser_quit = Some(desktop_app_browser_quit);
998        self
999    }
1000}
1001
1002impl SlackApiMethod for AdminUsersSessionSetSettingsRequest {
1003    const METHOD: &'static str = "admin.users.session.setSettings";
1004    type Response = AdminUsersSessionSetSettingsResponse;
1005}
1006
1007/// Successful response of the Slack Web API method [`admin.users.session.setSettings`](https://docs.slack.dev/reference/methods/admin.users.session.setSettings).
1008#[doc(alias = "admin.users.session.setSettings")]
1009#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1010pub struct AdminUsersSessionSetSettingsResponse {
1011    /// Fields returned by Slack. This method has no documented response example.
1012    #[serde(flatten)]
1013    pub extra: serde_json::Map<String, serde_json::Value>,
1014    #[serde(
1015        default,
1016        deserialize_with = "crate::de::opt_object",
1017        skip_serializing_if = "Option::is_none"
1018    )]
1019    pub response_metadata: Option<ResponseMetadata>,
1020    #[serde(
1021        default,
1022        deserialize_with = "crate::de::opt_string",
1023        skip_serializing_if = "Option::is_none"
1024    )]
1025    pub warning: Option<String>,
1026}
1027
1028/// Arguments for the Slack Web API method [`admin.users.setAdmin`](https://docs.slack.dev/reference/methods/admin.users.setAdmin): Set an existing regular user or owner to be a workspace or org admin.
1029///
1030/// Send it with [`SlackClient::admin_users_set_admin`].
1031#[doc(alias = "admin.users.setAdmin")]
1032#[derive(Debug, Clone, PartialEq, Serialize)]
1033#[non_exhaustive]
1034pub struct AdminUsersSetAdminRequest {
1035    /// The ID of the workspace or organization.
1036    pub team_id: String,
1037    /// The ID of the user to designate as an admin.
1038    pub user_id: String,
1039}
1040
1041impl AdminUsersSetAdminRequest {
1042    pub fn new(team_id: impl Into<String>, user_id: impl Into<String>) -> Self {
1043        Self {
1044            team_id: team_id.into(),
1045            user_id: user_id.into(),
1046        }
1047    }
1048}
1049
1050impl SlackApiMethod for AdminUsersSetAdminRequest {
1051    const METHOD: &'static str = "admin.users.setAdmin";
1052    type Response = AdminUsersSetAdminResponse;
1053}
1054
1055/// Successful response of the Slack Web API method [`admin.users.setAdmin`](https://docs.slack.dev/reference/methods/admin.users.setAdmin).
1056#[doc(alias = "admin.users.setAdmin")]
1057#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1058pub struct AdminUsersSetAdminResponse {
1059    /// Fields returned by Slack. This method has no documented response example.
1060    #[serde(flatten)]
1061    pub extra: serde_json::Map<String, serde_json::Value>,
1062    #[serde(
1063        default,
1064        deserialize_with = "crate::de::opt_object",
1065        skip_serializing_if = "Option::is_none"
1066    )]
1067    pub response_metadata: Option<ResponseMetadata>,
1068    #[serde(
1069        default,
1070        deserialize_with = "crate::de::opt_string",
1071        skip_serializing_if = "Option::is_none"
1072    )]
1073    pub warning: Option<String>,
1074}
1075
1076/// Arguments for the Slack Web API method [`admin.users.setExpiration`](https://docs.slack.dev/reference/methods/admin.users.setExpiration): Set an expiration for a guest user
1077///
1078/// Send it with [`SlackClient::admin_users_set_expiration`].
1079#[doc(alias = "admin.users.setExpiration")]
1080#[derive(Debug, Clone, PartialEq, Serialize)]
1081#[non_exhaustive]
1082pub struct AdminUsersSetExpirationRequest {
1083    /// The ID of the user to set an expiration for.
1084    pub user_id: String,
1085    /// Epoch timestamp in seconds when guest account should be disabled.
1086    pub expiration_ts: i64,
1087    /// The ID (`T1234`) of the workspace.
1088    #[serde(skip_serializing_if = "Option::is_none")]
1089    pub team_id: Option<String>,
1090}
1091
1092impl AdminUsersSetExpirationRequest {
1093    pub fn new(user_id: impl Into<String>, expiration_ts: i64) -> Self {
1094        Self {
1095            user_id: user_id.into(),
1096            expiration_ts,
1097            team_id: None,
1098        }
1099    }
1100
1101    pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
1102        self.team_id = Some(team_id.into());
1103        self
1104    }
1105}
1106
1107impl SlackApiMethod for AdminUsersSetExpirationRequest {
1108    const METHOD: &'static str = "admin.users.setExpiration";
1109    type Response = AdminUsersSetExpirationResponse;
1110}
1111
1112/// Successful response of the Slack Web API method [`admin.users.setExpiration`](https://docs.slack.dev/reference/methods/admin.users.setExpiration).
1113#[doc(alias = "admin.users.setExpiration")]
1114#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1115pub struct AdminUsersSetExpirationResponse {
1116    /// Fields returned by Slack. This method has no documented response example.
1117    #[serde(flatten)]
1118    pub extra: serde_json::Map<String, serde_json::Value>,
1119    #[serde(
1120        default,
1121        deserialize_with = "crate::de::opt_object",
1122        skip_serializing_if = "Option::is_none"
1123    )]
1124    pub response_metadata: Option<ResponseMetadata>,
1125    #[serde(
1126        default,
1127        deserialize_with = "crate::de::opt_string",
1128        skip_serializing_if = "Option::is_none"
1129    )]
1130    pub warning: Option<String>,
1131}
1132
1133/// Arguments for the Slack Web API method [`admin.users.setOwner`](https://docs.slack.dev/reference/methods/admin.users.setOwner): Set an existing regular user or admin to be a workspace or org owner.
1134///
1135/// Send it with [`SlackClient::admin_users_set_owner`].
1136#[doc(alias = "admin.users.setOwner")]
1137#[derive(Debug, Clone, PartialEq, Serialize)]
1138#[non_exhaustive]
1139pub struct AdminUsersSetOwnerRequest {
1140    /// The ID of the workspace or organization.
1141    pub team_id: String,
1142    /// ID of the user to promote to owner.
1143    pub user_id: String,
1144}
1145
1146impl AdminUsersSetOwnerRequest {
1147    pub fn new(team_id: impl Into<String>, user_id: impl Into<String>) -> Self {
1148        Self {
1149            team_id: team_id.into(),
1150            user_id: user_id.into(),
1151        }
1152    }
1153}
1154
1155impl SlackApiMethod for AdminUsersSetOwnerRequest {
1156    const METHOD: &'static str = "admin.users.setOwner";
1157    type Response = AdminUsersSetOwnerResponse;
1158}
1159
1160/// Successful response of the Slack Web API method [`admin.users.setOwner`](https://docs.slack.dev/reference/methods/admin.users.setOwner).
1161#[doc(alias = "admin.users.setOwner")]
1162#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1163pub struct AdminUsersSetOwnerResponse {
1164    /// Fields returned by Slack. This method has no documented response example.
1165    #[serde(flatten)]
1166    pub extra: serde_json::Map<String, serde_json::Value>,
1167    #[serde(
1168        default,
1169        deserialize_with = "crate::de::opt_object",
1170        skip_serializing_if = "Option::is_none"
1171    )]
1172    pub response_metadata: Option<ResponseMetadata>,
1173    #[serde(
1174        default,
1175        deserialize_with = "crate::de::opt_string",
1176        skip_serializing_if = "Option::is_none"
1177    )]
1178    pub warning: Option<String>,
1179}
1180
1181/// Arguments for the Slack Web API method [`admin.users.setRegular`](https://docs.slack.dev/reference/methods/admin.users.setRegular): Set an existing guest user, admin user, or owner to be a regular user.
1182///
1183/// Send it with [`SlackClient::admin_users_set_regular`].
1184#[doc(alias = "admin.users.setRegular")]
1185#[derive(Debug, Clone, PartialEq, Serialize)]
1186#[non_exhaustive]
1187pub struct AdminUsersSetRegularRequest {
1188    /// The ID of the workspace or organization.
1189    pub team_id: String,
1190    /// The ID of the user to designate as a regular user.
1191    pub user_id: String,
1192}
1193
1194impl AdminUsersSetRegularRequest {
1195    pub fn new(team_id: impl Into<String>, user_id: impl Into<String>) -> Self {
1196        Self {
1197            team_id: team_id.into(),
1198            user_id: user_id.into(),
1199        }
1200    }
1201}
1202
1203impl SlackApiMethod for AdminUsersSetRegularRequest {
1204    const METHOD: &'static str = "admin.users.setRegular";
1205    type Response = AdminUsersSetRegularResponse;
1206}
1207
1208/// Successful response of the Slack Web API method [`admin.users.setRegular`](https://docs.slack.dev/reference/methods/admin.users.setRegular).
1209#[doc(alias = "admin.users.setRegular")]
1210#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1211pub struct AdminUsersSetRegularResponse {
1212    /// Fields returned by Slack. This method has no documented response example.
1213    #[serde(flatten)]
1214    pub extra: serde_json::Map<String, serde_json::Value>,
1215    #[serde(
1216        default,
1217        deserialize_with = "crate::de::opt_object",
1218        skip_serializing_if = "Option::is_none"
1219    )]
1220    pub response_metadata: Option<ResponseMetadata>,
1221    #[serde(
1222        default,
1223        deserialize_with = "crate::de::opt_string",
1224        skip_serializing_if = "Option::is_none"
1225    )]
1226    pub warning: Option<String>,
1227}
1228
1229/// Arguments for the Slack Web API method [`admin.users.unsupportedVersions.export`](https://docs.slack.dev/reference/methods/admin.users.unsupportedVersions.export): Ask Slack to send you an export listing all workspace members using unsupported software, presented as a zipped CSV file.
1230///
1231/// Send it with [`SlackClient::admin_users_unsupported_versions_export`].
1232#[doc(alias = "admin.users.unsupportedVersions.export")]
1233#[derive(Debug, Clone, PartialEq, Serialize, Default)]
1234#[non_exhaustive]
1235pub struct AdminUsersUnsupportedVersionsExportRequest {
1236    /// Unix timestamp of a date to start looking for user sessions. If not provided will start six months ago.
1237    #[serde(skip_serializing_if = "Option::is_none")]
1238    pub date_sessions_started: Option<i64>,
1239    /// Unix timestamp of the date of past or upcoming end of support cycles. If not provided will include all announced end of support cycles.
1240    #[serde(skip_serializing_if = "Option::is_none")]
1241    pub date_end_of_support: Option<i64>,
1242}
1243
1244impl AdminUsersUnsupportedVersionsExportRequest {
1245    pub fn new() -> Self {
1246        Self {
1247            date_sessions_started: None,
1248            date_end_of_support: None,
1249        }
1250    }
1251
1252    pub fn date_sessions_started(mut self, date_sessions_started: i64) -> Self {
1253        self.date_sessions_started = Some(date_sessions_started);
1254        self
1255    }
1256
1257    pub fn date_end_of_support(mut self, date_end_of_support: i64) -> Self {
1258        self.date_end_of_support = Some(date_end_of_support);
1259        self
1260    }
1261}
1262
1263impl SlackApiMethod for AdminUsersUnsupportedVersionsExportRequest {
1264    const METHOD: &'static str = "admin.users.unsupportedVersions.export";
1265    type Response = AdminUsersUnsupportedVersionsExportResponse;
1266}
1267
1268/// Successful response of the Slack Web API method [`admin.users.unsupportedVersions.export`](https://docs.slack.dev/reference/methods/admin.users.unsupportedVersions.export).
1269#[doc(alias = "admin.users.unsupportedVersions.export")]
1270#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1271pub struct AdminUsersUnsupportedVersionsExportResponse {
1272    /// Fields returned by Slack. This method has no documented response example.
1273    #[serde(flatten)]
1274    pub extra: serde_json::Map<String, serde_json::Value>,
1275    #[serde(
1276        default,
1277        deserialize_with = "crate::de::opt_object",
1278        skip_serializing_if = "Option::is_none"
1279    )]
1280    pub response_metadata: Option<ResponseMetadata>,
1281    #[serde(
1282        default,
1283        deserialize_with = "crate::de::opt_string",
1284        skip_serializing_if = "Option::is_none"
1285    )]
1286    pub warning: Option<String>,
1287}
1288
1289impl SlackClient {
1290    /// Calls the Slack Web API method [`admin.users.assign`](https://docs.slack.dev/reference/methods/admin.users.assign): Add an Enterprise user to a workspace.
1291    ///
1292    /// Required scopes:
1293    ///
1294    /// - user token: `admin.users:write`
1295    ///
1296    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1297    ///
1298    /// # Errors
1299    ///
1300    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1301    #[doc(alias = "admin.users.assign")]
1302    pub async fn admin_users_assign(
1303        &self,
1304        request: &AdminUsersAssignRequest,
1305    ) -> Result<AdminUsersAssignResponse, SlackError> {
1306        self.call(request).await
1307    }
1308
1309    /// Calls the Slack Web API method [`admin.users.getExpiration`](https://docs.slack.dev/reference/methods/admin.users.getExpiration): Fetches the expiration timestamp for a guest.
1310    ///
1311    /// Required scopes:
1312    ///
1313    /// - user token: `admin.users:read`
1314    ///
1315    /// Rate limit: Tier 4 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1316    ///
1317    /// # Errors
1318    ///
1319    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1320    #[doc(alias = "admin.users.getExpiration")]
1321    pub async fn admin_users_get_expiration(
1322        &self,
1323        request: &AdminUsersGetExpirationRequest,
1324    ) -> Result<AdminUsersGetExpirationResponse, SlackError> {
1325        self.call(request).await
1326    }
1327
1328    /// Calls the Slack Web API method [`admin.users.invite`](https://docs.slack.dev/reference/methods/admin.users.invite): Invite a user to a workspace.
1329    ///
1330    /// Required scopes:
1331    ///
1332    /// - user token: `admin.users:write`
1333    ///
1334    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1335    ///
1336    /// # Errors
1337    ///
1338    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1339    #[doc(alias = "admin.users.invite")]
1340    pub async fn admin_users_invite(
1341        &self,
1342        request: &AdminUsersInviteRequest,
1343    ) -> Result<AdminUsersInviteResponse, SlackError> {
1344        self.call(request).await
1345    }
1346
1347    /// Calls the Slack Web API method [`admin.users.list`](https://docs.slack.dev/reference/methods/admin.users.list): List users on a workspace
1348    ///
1349    /// Required scopes:
1350    ///
1351    /// - user token: `admin.users:read`
1352    ///
1353    /// Rate limit: Tier 4 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1354    ///
1355    /// # Errors
1356    ///
1357    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1358    #[doc(alias = "admin.users.list")]
1359    pub async fn admin_users_list(
1360        &self,
1361        request: &AdminUsersListRequest,
1362    ) -> Result<AdminUsersListResponse, SlackError> {
1363        self.call(request).await
1364    }
1365
1366    /// Calls the Slack Web API method [`admin.users.remove`](https://docs.slack.dev/reference/methods/admin.users.remove): Remove a user from a workspace.
1367    ///
1368    /// Required scopes:
1369    ///
1370    /// - user token: `admin.users:write`
1371    ///
1372    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1373    ///
1374    /// # Errors
1375    ///
1376    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1377    #[doc(alias = "admin.users.remove")]
1378    pub async fn admin_users_remove(
1379        &self,
1380        request: &AdminUsersRemoveRequest,
1381    ) -> Result<AdminUsersRemoveResponse, SlackError> {
1382        self.call(request).await
1383    }
1384
1385    /// Calls the Slack Web API method [`admin.users.session.clearSettings`](https://docs.slack.dev/reference/methods/admin.users.session.clearSettings): Clear user-specific session settings—the session duration and what happens when the client closes—for a list of users.
1386    ///
1387    /// Required scopes:
1388    ///
1389    /// - user token: `admin.users:write`
1390    ///
1391    /// Rate limit: Tier 4 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1392    ///
1393    /// # Errors
1394    ///
1395    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1396    #[doc(alias = "admin.users.session.clearSettings")]
1397    pub async fn admin_users_session_clear_settings(
1398        &self,
1399        request: &AdminUsersSessionClearSettingsRequest,
1400    ) -> Result<AdminUsersSessionClearSettingsResponse, SlackError> {
1401        self.call(request).await
1402    }
1403
1404    /// Calls the Slack Web API method [`admin.users.session.getSettings`](https://docs.slack.dev/reference/methods/admin.users.session.getSettings): Get user-specific session settings—the session duration and what happens when the client closes—given a list of users.
1405    ///
1406    /// Required scopes:
1407    ///
1408    /// - user token: `admin.users:read`
1409    ///
1410    /// Rate limit: Tier 4 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1411    ///
1412    /// # Errors
1413    ///
1414    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1415    #[doc(alias = "admin.users.session.getSettings")]
1416    pub async fn admin_users_session_get_settings(
1417        &self,
1418        request: &AdminUsersSessionGetSettingsRequest,
1419    ) -> Result<AdminUsersSessionGetSettingsResponse, SlackError> {
1420        self.call(request).await
1421    }
1422
1423    /// Calls the Slack Web API method [`admin.users.session.invalidate`](https://docs.slack.dev/reference/methods/admin.users.session.invalidate): Revoke a single session for a user. The user will be forced to login to Slack.
1424    ///
1425    /// Required scopes:
1426    ///
1427    /// - user token: `admin.users:write`
1428    ///
1429    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1430    ///
1431    /// # Errors
1432    ///
1433    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1434    #[doc(alias = "admin.users.session.invalidate")]
1435    pub async fn admin_users_session_invalidate(
1436        &self,
1437        request: &AdminUsersSessionInvalidateRequest,
1438    ) -> Result<AdminUsersSessionInvalidateResponse, SlackError> {
1439        self.call(request).await
1440    }
1441
1442    /// Calls the Slack Web API method [`admin.users.session.list`](https://docs.slack.dev/reference/methods/admin.users.session.list): List active user sessions for an organization
1443    ///
1444    /// Required scopes:
1445    ///
1446    /// - user token: `admin.users:read`
1447    ///
1448    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1449    ///
1450    /// # Errors
1451    ///
1452    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1453    #[doc(alias = "admin.users.session.list")]
1454    pub async fn admin_users_session_list(
1455        &self,
1456        request: &AdminUsersSessionListRequest,
1457    ) -> Result<AdminUsersSessionListResponse, SlackError> {
1458        self.call(request).await
1459    }
1460
1461    /// Calls the Slack Web API method [`admin.users.session.reset`](https://docs.slack.dev/reference/methods/admin.users.session.reset): Wipes all valid sessions on all devices for a given user
1462    ///
1463    /// Required scopes:
1464    ///
1465    /// - user token: `admin.users:write`
1466    ///
1467    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1468    ///
1469    /// # Errors
1470    ///
1471    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1472    #[doc(alias = "admin.users.session.reset")]
1473    pub async fn admin_users_session_reset(
1474        &self,
1475        request: &AdminUsersSessionResetRequest,
1476    ) -> Result<AdminUsersSessionResetResponse, SlackError> {
1477        self.call(request).await
1478    }
1479
1480    /// Calls the Slack Web API method [`admin.users.session.resetBulk`](https://docs.slack.dev/reference/methods/admin.users.session.resetBulk): Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users
1481    ///
1482    /// Required scopes:
1483    ///
1484    /// - user token: `admin.users:write`
1485    ///
1486    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1487    ///
1488    /// # Errors
1489    ///
1490    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1491    #[doc(alias = "admin.users.session.resetBulk")]
1492    pub async fn admin_users_session_reset_bulk(
1493        &self,
1494        request: &AdminUsersSessionResetBulkRequest,
1495    ) -> Result<AdminUsersSessionResetBulkResponse, SlackError> {
1496        self.call(request).await
1497    }
1498
1499    /// Calls the Slack Web API method [`admin.users.session.setSettings`](https://docs.slack.dev/reference/methods/admin.users.session.setSettings): Configure the user-level session settings—the session duration and what happens when the client closes—for one or more users.
1500    ///
1501    /// Required scopes:
1502    ///
1503    /// - user token: `admin.users:write`
1504    ///
1505    /// Rate limit: Tier 4 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1506    ///
1507    /// # Errors
1508    ///
1509    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1510    #[doc(alias = "admin.users.session.setSettings")]
1511    pub async fn admin_users_session_set_settings(
1512        &self,
1513        request: &AdminUsersSessionSetSettingsRequest,
1514    ) -> Result<AdminUsersSessionSetSettingsResponse, SlackError> {
1515        self.call(request).await
1516    }
1517
1518    /// Calls the Slack Web API method [`admin.users.setAdmin`](https://docs.slack.dev/reference/methods/admin.users.setAdmin): Set an existing regular user or owner to be a workspace or org admin.
1519    ///
1520    /// Required scopes:
1521    ///
1522    /// - user token: `admin.users:write`
1523    ///
1524    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1525    ///
1526    /// # Errors
1527    ///
1528    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1529    #[doc(alias = "admin.users.setAdmin")]
1530    pub async fn admin_users_set_admin(
1531        &self,
1532        request: &AdminUsersSetAdminRequest,
1533    ) -> Result<AdminUsersSetAdminResponse, SlackError> {
1534        self.call(request).await
1535    }
1536
1537    /// Calls the Slack Web API method [`admin.users.setExpiration`](https://docs.slack.dev/reference/methods/admin.users.setExpiration): Set an expiration for a guest user
1538    ///
1539    /// Required scopes:
1540    ///
1541    /// - user token: `admin.users:write`
1542    ///
1543    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1544    ///
1545    /// # Errors
1546    ///
1547    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1548    #[doc(alias = "admin.users.setExpiration")]
1549    pub async fn admin_users_set_expiration(
1550        &self,
1551        request: &AdminUsersSetExpirationRequest,
1552    ) -> Result<AdminUsersSetExpirationResponse, SlackError> {
1553        self.call(request).await
1554    }
1555
1556    /// Calls the Slack Web API method [`admin.users.setOwner`](https://docs.slack.dev/reference/methods/admin.users.setOwner): Set an existing regular user or admin to be a workspace or org owner.
1557    ///
1558    /// Required scopes:
1559    ///
1560    /// - user token: `admin.users:write`
1561    ///
1562    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1563    ///
1564    /// # Errors
1565    ///
1566    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1567    #[doc(alias = "admin.users.setOwner")]
1568    pub async fn admin_users_set_owner(
1569        &self,
1570        request: &AdminUsersSetOwnerRequest,
1571    ) -> Result<AdminUsersSetOwnerResponse, SlackError> {
1572        self.call(request).await
1573    }
1574
1575    /// Calls the Slack Web API method [`admin.users.setRegular`](https://docs.slack.dev/reference/methods/admin.users.setRegular): Set an existing guest user, admin user, or owner to be a regular user.
1576    ///
1577    /// Required scopes:
1578    ///
1579    /// - user token: `admin.users:write`
1580    ///
1581    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1582    ///
1583    /// # Errors
1584    ///
1585    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1586    #[doc(alias = "admin.users.setRegular")]
1587    pub async fn admin_users_set_regular(
1588        &self,
1589        request: &AdminUsersSetRegularRequest,
1590    ) -> Result<AdminUsersSetRegularResponse, SlackError> {
1591        self.call(request).await
1592    }
1593
1594    /// Calls the Slack Web API method [`admin.users.unsupportedVersions.export`](https://docs.slack.dev/reference/methods/admin.users.unsupportedVersions.export): Ask Slack to send you an export listing all workspace members using unsupported software, presented as a zipped CSV file.
1595    ///
1596    /// Required scopes:
1597    ///
1598    /// - user token: `admin.users:read`
1599    ///
1600    /// Rate limit: Tier 1 (<https://docs.slack.dev/apis/web-api/rate-limits>).
1601    ///
1602    /// # Errors
1603    ///
1604    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
1605    #[doc(alias = "admin.users.unsupportedVersions.export")]
1606    pub async fn admin_users_unsupported_versions_export(
1607        &self,
1608        request: &AdminUsersUnsupportedVersionsExportRequest,
1609    ) -> Result<AdminUsersUnsupportedVersionsExportResponse, SlackError> {
1610        self.call(request).await
1611    }
1612}