Skip to main content

slack_web_api/api/
admin_teams.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.teams.admins.list`](https://docs.slack.dev/reference/methods/admin.teams.admins.list): List all of the admins on a given workspace.
12///
13/// Send it with [`SlackClient::admin_teams_admins_list`].
14#[doc(alias = "admin.teams.admins.list")]
15#[derive(Debug, Clone, PartialEq, Serialize)]
16#[non_exhaustive]
17pub struct AdminTeamsAdminsListRequest {
18    pub team_id: String,
19    /// The maximum number of items to return.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub limit: Option<i64>,
22    /// Set `cursor` to `next_cursor` returned by the previous call to list items in the next page.
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub cursor: Option<String>,
25}
26
27impl AdminTeamsAdminsListRequest {
28    pub fn new(team_id: impl Into<String>) -> Self {
29        Self {
30            team_id: team_id.into(),
31            limit: None,
32            cursor: None,
33        }
34    }
35
36    pub fn limit(mut self, limit: i64) -> Self {
37        self.limit = Some(limit);
38        self
39    }
40
41    pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
42        self.cursor = Some(cursor.into());
43        self
44    }
45}
46
47impl SlackApiMethod for AdminTeamsAdminsListRequest {
48    const METHOD: &'static str = "admin.teams.admins.list";
49    type Response = AdminTeamsAdminsListResponse;
50}
51
52impl CursorPaginated for AdminTeamsAdminsListRequest {
53    fn set_cursor(&mut self, cursor: String) {
54        self.cursor = Some(cursor);
55    }
56}
57
58impl NextCursor for AdminTeamsAdminsListResponse {
59    fn next_cursor(&self) -> Option<&str> {
60        self.response_metadata.as_ref()?.next_cursor.as_deref()
61    }
62}
63
64/// Successful response of the Slack Web API method [`admin.teams.admins.list`](https://docs.slack.dev/reference/methods/admin.teams.admins.list).
65#[doc(alias = "admin.teams.admins.list")]
66#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
67pub struct AdminTeamsAdminsListResponse {
68    #[serde(
69        default,
70        deserialize_with = "crate::de::vec",
71        skip_serializing_if = "Vec::is_empty"
72    )]
73    pub admin_ids: Vec<String>,
74    #[serde(
75        default,
76        deserialize_with = "crate::de::opt_object",
77        skip_serializing_if = "Option::is_none"
78    )]
79    pub response_metadata: Option<ResponseMetadata>,
80    #[serde(
81        default,
82        deserialize_with = "crate::de::opt_string",
83        skip_serializing_if = "Option::is_none"
84    )]
85    pub warning: Option<String>,
86}
87
88/// Arguments for the Slack Web API method [`admin.teams.create`](https://docs.slack.dev/reference/methods/admin.teams.create): Create an Enterprise team.
89///
90/// Send it with [`SlackClient::admin_teams_create`].
91#[doc(alias = "admin.teams.create")]
92#[derive(Debug, Clone, PartialEq, Serialize)]
93#[non_exhaustive]
94pub struct AdminTeamsCreateRequest {
95    /// Team domain (for example, slacksoftballteam). Domains are limited to 21 characters.
96    pub team_domain: String,
97    /// Team name (for example, Slack Softball Team).
98    pub team_name: String,
99    /// Description for the team.
100    #[serde(skip_serializing_if = "Option::is_none")]
101    pub team_description: Option<String>,
102    /// Who can join the team. A team's discoverability can be `open`, `closed`, `invite_only`, or `unlisted`.
103    #[serde(skip_serializing_if = "Option::is_none")]
104    pub team_discoverability: Option<String>,
105}
106
107impl AdminTeamsCreateRequest {
108    pub fn new(team_domain: impl Into<String>, team_name: impl Into<String>) -> Self {
109        Self {
110            team_domain: team_domain.into(),
111            team_name: team_name.into(),
112            team_description: None,
113            team_discoverability: None,
114        }
115    }
116
117    pub fn team_description(mut self, team_description: impl Into<String>) -> Self {
118        self.team_description = Some(team_description.into());
119        self
120    }
121
122    pub fn team_discoverability(mut self, team_discoverability: impl Into<String>) -> Self {
123        self.team_discoverability = Some(team_discoverability.into());
124        self
125    }
126}
127
128impl SlackApiMethod for AdminTeamsCreateRequest {
129    const METHOD: &'static str = "admin.teams.create";
130    type Response = AdminTeamsCreateResponse;
131}
132
133/// Successful response of the Slack Web API method [`admin.teams.create`](https://docs.slack.dev/reference/methods/admin.teams.create).
134#[doc(alias = "admin.teams.create")]
135#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
136pub struct AdminTeamsCreateResponse {
137    #[serde(
138        default,
139        deserialize_with = "crate::de::opt_string",
140        skip_serializing_if = "Option::is_none"
141    )]
142    pub team: Option<String>,
143    #[serde(
144        default,
145        deserialize_with = "crate::de::opt_object",
146        skip_serializing_if = "Option::is_none"
147    )]
148    pub response_metadata: Option<ResponseMetadata>,
149    #[serde(
150        default,
151        deserialize_with = "crate::de::opt_string",
152        skip_serializing_if = "Option::is_none"
153    )]
154    pub warning: Option<String>,
155}
156
157/// Arguments for the Slack Web API method [`admin.teams.list`](https://docs.slack.dev/reference/methods/admin.teams.list): List all teams in an Enterprise organization
158///
159/// Send it with [`SlackClient::admin_teams_list`].
160#[doc(alias = "admin.teams.list")]
161#[derive(Debug, Clone, PartialEq, Serialize, Default)]
162#[non_exhaustive]
163pub struct AdminTeamsListRequest {
164    /// The maximum number of items to return. Must be a positive integer no larger than 1000.
165    #[serde(skip_serializing_if = "Option::is_none")]
166    pub limit: Option<i64>,
167    /// Set `cursor` to `next_cursor` returned by the previous call to list items in the next page.
168    #[serde(skip_serializing_if = "Option::is_none")]
169    pub cursor: Option<String>,
170}
171
172impl AdminTeamsListRequest {
173    pub fn new() -> Self {
174        Self {
175            limit: None,
176            cursor: None,
177        }
178    }
179
180    pub fn limit(mut self, limit: i64) -> Self {
181        self.limit = Some(limit);
182        self
183    }
184
185    pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
186        self.cursor = Some(cursor.into());
187        self
188    }
189}
190
191impl SlackApiMethod for AdminTeamsListRequest {
192    const METHOD: &'static str = "admin.teams.list";
193    type Response = AdminTeamsListResponse;
194}
195
196impl CursorPaginated for AdminTeamsListRequest {
197    fn set_cursor(&mut self, cursor: String) {
198        self.cursor = Some(cursor);
199    }
200}
201
202impl NextCursor for AdminTeamsListResponse {
203    fn next_cursor(&self) -> Option<&str> {
204        self.response_metadata.as_ref()?.next_cursor.as_deref()
205    }
206}
207
208/// Successful response of the Slack Web API method [`admin.teams.list`](https://docs.slack.dev/reference/methods/admin.teams.list).
209#[doc(alias = "admin.teams.list")]
210#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
211pub struct AdminTeamsListResponse {
212    #[serde(
213        default,
214        deserialize_with = "crate::de::vec",
215        skip_serializing_if = "Vec::is_empty"
216    )]
217    pub teams: Vec<AdminTeamsListResponseTeams>,
218    #[serde(
219        default,
220        deserialize_with = "crate::de::opt_object",
221        skip_serializing_if = "Option::is_none"
222    )]
223    pub response_metadata: Option<ResponseMetadata>,
224    #[serde(
225        default,
226        deserialize_with = "crate::de::opt_string",
227        skip_serializing_if = "Option::is_none"
228    )]
229    pub warning: Option<String>,
230}
231
232#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
233pub struct AdminTeamsListResponseTeams {
234    #[serde(
235        default,
236        deserialize_with = "crate::de::opt_string",
237        skip_serializing_if = "Option::is_none"
238    )]
239    pub id: Option<String>,
240    #[serde(
241        default,
242        deserialize_with = "crate::de::opt_string",
243        skip_serializing_if = "Option::is_none"
244    )]
245    pub name: Option<String>,
246    #[serde(
247        default,
248        deserialize_with = "crate::de::opt_string",
249        skip_serializing_if = "Option::is_none"
250    )]
251    pub discoverability: Option<String>,
252    #[serde(
253        default,
254        deserialize_with = "crate::de::opt_object",
255        skip_serializing_if = "Option::is_none"
256    )]
257    pub primary_owner: Option<AdminTeamsListResponseTeamsPrimaryOwner>,
258    #[serde(
259        default,
260        deserialize_with = "crate::de::opt_string",
261        skip_serializing_if = "Option::is_none"
262    )]
263    pub team_url: Option<String>,
264}
265
266#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
267pub struct AdminTeamsListResponseTeamsPrimaryOwner {
268    #[serde(
269        default,
270        deserialize_with = "crate::de::opt_string",
271        skip_serializing_if = "Option::is_none"
272    )]
273    pub user_id: Option<String>,
274    #[serde(
275        default,
276        deserialize_with = "crate::de::opt_string",
277        skip_serializing_if = "Option::is_none"
278    )]
279    pub email: Option<String>,
280}
281
282/// Arguments for the Slack Web API method [`admin.teams.owners.list`](https://docs.slack.dev/reference/methods/admin.teams.owners.list): List all of the owners on a given workspace.
283///
284/// Send it with [`SlackClient::admin_teams_owners_list`].
285#[doc(alias = "admin.teams.owners.list")]
286#[derive(Debug, Clone, PartialEq, Serialize)]
287#[non_exhaustive]
288pub struct AdminTeamsOwnersListRequest {
289    pub team_id: String,
290    /// The maximum number of items to return. Must be between 1 - 1000 both inclusive.
291    #[serde(skip_serializing_if = "Option::is_none")]
292    pub limit: Option<i64>,
293    /// Set `cursor` to `next_cursor` returned by the previous call to list items in the next page.
294    #[serde(skip_serializing_if = "Option::is_none")]
295    pub cursor: Option<String>,
296}
297
298impl AdminTeamsOwnersListRequest {
299    pub fn new(team_id: impl Into<String>) -> Self {
300        Self {
301            team_id: team_id.into(),
302            limit: None,
303            cursor: None,
304        }
305    }
306
307    pub fn limit(mut self, limit: i64) -> Self {
308        self.limit = Some(limit);
309        self
310    }
311
312    pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
313        self.cursor = Some(cursor.into());
314        self
315    }
316}
317
318impl SlackApiMethod for AdminTeamsOwnersListRequest {
319    const METHOD: &'static str = "admin.teams.owners.list";
320    type Response = AdminTeamsOwnersListResponse;
321}
322
323impl CursorPaginated for AdminTeamsOwnersListRequest {
324    fn set_cursor(&mut self, cursor: String) {
325        self.cursor = Some(cursor);
326    }
327}
328
329impl NextCursor for AdminTeamsOwnersListResponse {
330    fn next_cursor(&self) -> Option<&str> {
331        self.response_metadata.as_ref()?.next_cursor.as_deref()
332    }
333}
334
335/// Successful response of the Slack Web API method [`admin.teams.owners.list`](https://docs.slack.dev/reference/methods/admin.teams.owners.list).
336#[doc(alias = "admin.teams.owners.list")]
337#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
338pub struct AdminTeamsOwnersListResponse {
339    #[serde(
340        default,
341        deserialize_with = "crate::de::vec",
342        skip_serializing_if = "Vec::is_empty"
343    )]
344    pub owner_ids: Vec<String>,
345    #[serde(
346        default,
347        deserialize_with = "crate::de::opt_object",
348        skip_serializing_if = "Option::is_none"
349    )]
350    pub response_metadata: Option<ResponseMetadata>,
351    #[serde(
352        default,
353        deserialize_with = "crate::de::opt_string",
354        skip_serializing_if = "Option::is_none"
355    )]
356    pub warning: Option<String>,
357}
358
359/// Arguments for the Slack Web API method [`admin.teams.settings.info`](https://docs.slack.dev/reference/methods/admin.teams.settings.info): Fetch information about settings in a workspace
360///
361/// Send it with [`SlackClient::admin_teams_settings_info`].
362#[doc(alias = "admin.teams.settings.info")]
363#[derive(Debug, Clone, PartialEq, Serialize)]
364#[non_exhaustive]
365pub struct AdminTeamsSettingsInfoRequest {
366    pub team_id: String,
367}
368
369impl AdminTeamsSettingsInfoRequest {
370    pub fn new(team_id: impl Into<String>) -> Self {
371        Self {
372            team_id: team_id.into(),
373        }
374    }
375}
376
377impl SlackApiMethod for AdminTeamsSettingsInfoRequest {
378    const METHOD: &'static str = "admin.teams.settings.info";
379    type Response = AdminTeamsSettingsInfoResponse;
380}
381
382/// Successful response of the Slack Web API method [`admin.teams.settings.info`](https://docs.slack.dev/reference/methods/admin.teams.settings.info).
383#[doc(alias = "admin.teams.settings.info")]
384#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
385pub struct AdminTeamsSettingsInfoResponse {
386    #[serde(
387        default,
388        deserialize_with = "crate::de::opt_object",
389        skip_serializing_if = "Option::is_none"
390    )]
391    pub team: Option<AdminTeamsSettingsInfoResponseTeam>,
392    #[serde(
393        default,
394        deserialize_with = "crate::de::opt_object",
395        skip_serializing_if = "Option::is_none"
396    )]
397    pub response_metadata: Option<ResponseMetadata>,
398    #[serde(
399        default,
400        deserialize_with = "crate::de::opt_string",
401        skip_serializing_if = "Option::is_none"
402    )]
403    pub warning: Option<String>,
404}
405
406#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
407pub struct AdminTeamsSettingsInfoResponseTeam {
408    #[serde(
409        default,
410        deserialize_with = "crate::de::opt_string",
411        skip_serializing_if = "Option::is_none"
412    )]
413    pub id: Option<String>,
414    #[serde(
415        default,
416        deserialize_with = "crate::de::opt_string",
417        skip_serializing_if = "Option::is_none"
418    )]
419    pub name: Option<String>,
420    #[serde(
421        default,
422        deserialize_with = "crate::de::opt_string",
423        skip_serializing_if = "Option::is_none"
424    )]
425    pub domain: Option<String>,
426    #[serde(
427        default,
428        deserialize_with = "crate::de::opt_string",
429        skip_serializing_if = "Option::is_none"
430    )]
431    pub email_domain: Option<String>,
432    #[serde(
433        default,
434        deserialize_with = "crate::de::opt_string",
435        skip_serializing_if = "Option::is_none"
436    )]
437    pub icon: Option<String>,
438    #[serde(
439        default,
440        deserialize_with = "crate::de::opt_string",
441        skip_serializing_if = "Option::is_none"
442    )]
443    pub enterprise_id: Option<String>,
444    #[serde(
445        default,
446        deserialize_with = "crate::de::opt_string",
447        skip_serializing_if = "Option::is_none"
448    )]
449    pub enterprise_name: Option<String>,
450    #[serde(
451        default,
452        deserialize_with = "crate::de::opt_string",
453        skip_serializing_if = "Option::is_none"
454    )]
455    pub default_channels: Option<String>,
456}
457
458/// Arguments for the Slack Web API method [`admin.teams.settings.setDefaultChannels`](https://docs.slack.dev/reference/methods/admin.teams.settings.setDefaultChannels): Set the default channels of a workspace.
459///
460/// Send it with [`SlackClient::admin_teams_settings_set_default_channels`].
461#[doc(alias = "admin.teams.settings.setDefaultChannels")]
462#[derive(Debug, Clone, PartialEq, Serialize)]
463#[non_exhaustive]
464pub struct AdminTeamsSettingsSetDefaultChannelsRequest {
465    /// ID for the workspace to set the default channel for.
466    pub team_id: String,
467    /// An array of channel IDs.
468    pub channel_ids: Vec<String>,
469}
470
471impl AdminTeamsSettingsSetDefaultChannelsRequest {
472    pub fn new(team_id: impl Into<String>, channel_ids: Vec<String>) -> Self {
473        Self {
474            team_id: team_id.into(),
475            channel_ids,
476        }
477    }
478}
479
480impl SlackApiMethod for AdminTeamsSettingsSetDefaultChannelsRequest {
481    const METHOD: &'static str = "admin.teams.settings.setDefaultChannels";
482    type Response = AdminTeamsSettingsSetDefaultChannelsResponse;
483}
484
485/// Successful response of the Slack Web API method [`admin.teams.settings.setDefaultChannels`](https://docs.slack.dev/reference/methods/admin.teams.settings.setDefaultChannels).
486#[doc(alias = "admin.teams.settings.setDefaultChannels")]
487#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
488pub struct AdminTeamsSettingsSetDefaultChannelsResponse {
489    /// Fields returned by Slack. This method has no documented response example.
490    #[serde(flatten)]
491    pub extra: serde_json::Map<String, serde_json::Value>,
492    #[serde(
493        default,
494        deserialize_with = "crate::de::opt_object",
495        skip_serializing_if = "Option::is_none"
496    )]
497    pub response_metadata: Option<ResponseMetadata>,
498    #[serde(
499        default,
500        deserialize_with = "crate::de::opt_string",
501        skip_serializing_if = "Option::is_none"
502    )]
503    pub warning: Option<String>,
504}
505
506/// Arguments for the Slack Web API method [`admin.teams.settings.setDescription`](https://docs.slack.dev/reference/methods/admin.teams.settings.setDescription): Set the description of a given workspace.
507///
508/// Send it with [`SlackClient::admin_teams_settings_set_description`].
509#[doc(alias = "admin.teams.settings.setDescription")]
510#[derive(Debug, Clone, PartialEq, Serialize)]
511#[non_exhaustive]
512pub struct AdminTeamsSettingsSetDescriptionRequest {
513    /// ID for the workspace to set the description for.
514    pub team_id: String,
515    /// The new description for the workspace.
516    pub description: String,
517}
518
519impl AdminTeamsSettingsSetDescriptionRequest {
520    pub fn new(team_id: impl Into<String>, description: impl Into<String>) -> Self {
521        Self {
522            team_id: team_id.into(),
523            description: description.into(),
524        }
525    }
526}
527
528impl SlackApiMethod for AdminTeamsSettingsSetDescriptionRequest {
529    const METHOD: &'static str = "admin.teams.settings.setDescription";
530    type Response = AdminTeamsSettingsSetDescriptionResponse;
531}
532
533/// Successful response of the Slack Web API method [`admin.teams.settings.setDescription`](https://docs.slack.dev/reference/methods/admin.teams.settings.setDescription).
534#[doc(alias = "admin.teams.settings.setDescription")]
535#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
536pub struct AdminTeamsSettingsSetDescriptionResponse {
537    /// Fields returned by Slack. This method has no documented response example.
538    #[serde(flatten)]
539    pub extra: serde_json::Map<String, serde_json::Value>,
540    #[serde(
541        default,
542        deserialize_with = "crate::de::opt_object",
543        skip_serializing_if = "Option::is_none"
544    )]
545    pub response_metadata: Option<ResponseMetadata>,
546    #[serde(
547        default,
548        deserialize_with = "crate::de::opt_string",
549        skip_serializing_if = "Option::is_none"
550    )]
551    pub warning: Option<String>,
552}
553
554/// Arguments for the Slack Web API method [`admin.teams.settings.setDiscoverability`](https://docs.slack.dev/reference/methods/admin.teams.settings.setDiscoverability): An API method that allows admins to set the discoverability of a given workspace
555///
556/// Send it with [`SlackClient::admin_teams_settings_set_discoverability`].
557#[doc(alias = "admin.teams.settings.setDiscoverability")]
558#[derive(Debug, Clone, PartialEq, Serialize)]
559#[non_exhaustive]
560pub struct AdminTeamsSettingsSetDiscoverabilityRequest {
561    /// The ID of the workspace to set discoverability on.
562    pub team_id: String,
563    /// This workspace's discovery setting. It must be set to one of `open`, `invite_only`, `closed`, or `unlisted`.
564    pub discoverability: String,
565}
566
567impl AdminTeamsSettingsSetDiscoverabilityRequest {
568    pub fn new(team_id: impl Into<String>, discoverability: impl Into<String>) -> Self {
569        Self {
570            team_id: team_id.into(),
571            discoverability: discoverability.into(),
572        }
573    }
574}
575
576impl SlackApiMethod for AdminTeamsSettingsSetDiscoverabilityRequest {
577    const METHOD: &'static str = "admin.teams.settings.setDiscoverability";
578    type Response = AdminTeamsSettingsSetDiscoverabilityResponse;
579}
580
581/// Successful response of the Slack Web API method [`admin.teams.settings.setDiscoverability`](https://docs.slack.dev/reference/methods/admin.teams.settings.setDiscoverability).
582#[doc(alias = "admin.teams.settings.setDiscoverability")]
583#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
584pub struct AdminTeamsSettingsSetDiscoverabilityResponse {
585    /// Fields returned by Slack. This method has no documented response example.
586    #[serde(flatten)]
587    pub extra: serde_json::Map<String, serde_json::Value>,
588    #[serde(
589        default,
590        deserialize_with = "crate::de::opt_object",
591        skip_serializing_if = "Option::is_none"
592    )]
593    pub response_metadata: Option<ResponseMetadata>,
594    #[serde(
595        default,
596        deserialize_with = "crate::de::opt_string",
597        skip_serializing_if = "Option::is_none"
598    )]
599    pub warning: Option<String>,
600}
601
602/// Arguments for the Slack Web API method [`admin.teams.settings.setIcon`](https://docs.slack.dev/reference/methods/admin.teams.settings.setIcon): Sets the icon of a workspace.
603///
604/// Send it with [`SlackClient::admin_teams_settings_set_icon`].
605#[doc(alias = "admin.teams.settings.setIcon")]
606#[derive(Debug, Clone, PartialEq, Serialize)]
607#[non_exhaustive]
608pub struct AdminTeamsSettingsSetIconRequest {
609    /// Image URL for the icon
610    pub image_url: String,
611    /// ID for the workspace to set the icon for.
612    pub team_id: String,
613}
614
615impl AdminTeamsSettingsSetIconRequest {
616    pub fn new(image_url: impl Into<String>, team_id: impl Into<String>) -> Self {
617        Self {
618            image_url: image_url.into(),
619            team_id: team_id.into(),
620        }
621    }
622}
623
624impl SlackApiMethod for AdminTeamsSettingsSetIconRequest {
625    const METHOD: &'static str = "admin.teams.settings.setIcon";
626    type Response = AdminTeamsSettingsSetIconResponse;
627}
628
629/// Successful response of the Slack Web API method [`admin.teams.settings.setIcon`](https://docs.slack.dev/reference/methods/admin.teams.settings.setIcon).
630#[doc(alias = "admin.teams.settings.setIcon")]
631#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
632pub struct AdminTeamsSettingsSetIconResponse {
633    /// Fields returned by Slack. This method has no documented response example.
634    #[serde(flatten)]
635    pub extra: serde_json::Map<String, serde_json::Value>,
636    #[serde(
637        default,
638        deserialize_with = "crate::de::opt_object",
639        skip_serializing_if = "Option::is_none"
640    )]
641    pub response_metadata: Option<ResponseMetadata>,
642    #[serde(
643        default,
644        deserialize_with = "crate::de::opt_string",
645        skip_serializing_if = "Option::is_none"
646    )]
647    pub warning: Option<String>,
648}
649
650/// Arguments for the Slack Web API method [`admin.teams.settings.setName`](https://docs.slack.dev/reference/methods/admin.teams.settings.setName): Set the name of a given workspace.
651///
652/// Send it with [`SlackClient::admin_teams_settings_set_name`].
653#[doc(alias = "admin.teams.settings.setName")]
654#[derive(Debug, Clone, PartialEq, Serialize)]
655#[non_exhaustive]
656pub struct AdminTeamsSettingsSetNameRequest {
657    /// ID for the workspace to set the name for.
658    pub team_id: String,
659    /// The new name of the workspace.
660    pub name: String,
661}
662
663impl AdminTeamsSettingsSetNameRequest {
664    pub fn new(team_id: impl Into<String>, name: impl Into<String>) -> Self {
665        Self {
666            team_id: team_id.into(),
667            name: name.into(),
668        }
669    }
670}
671
672impl SlackApiMethod for AdminTeamsSettingsSetNameRequest {
673    const METHOD: &'static str = "admin.teams.settings.setName";
674    type Response = AdminTeamsSettingsSetNameResponse;
675}
676
677/// Successful response of the Slack Web API method [`admin.teams.settings.setName`](https://docs.slack.dev/reference/methods/admin.teams.settings.setName).
678#[doc(alias = "admin.teams.settings.setName")]
679#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
680pub struct AdminTeamsSettingsSetNameResponse {
681    /// Fields returned by Slack. This method has no documented response example.
682    #[serde(flatten)]
683    pub extra: serde_json::Map<String, serde_json::Value>,
684    #[serde(
685        default,
686        deserialize_with = "crate::de::opt_object",
687        skip_serializing_if = "Option::is_none"
688    )]
689    pub response_metadata: Option<ResponseMetadata>,
690    #[serde(
691        default,
692        deserialize_with = "crate::de::opt_string",
693        skip_serializing_if = "Option::is_none"
694    )]
695    pub warning: Option<String>,
696}
697
698impl SlackClient {
699    /// Calls the Slack Web API method [`admin.teams.admins.list`](https://docs.slack.dev/reference/methods/admin.teams.admins.list): List all of the admins on a given workspace.
700    ///
701    /// Required scopes:
702    ///
703    /// - user token: `admin.teams:read`
704    ///
705    /// Rate limit: Tier 3 (<https://docs.slack.dev/apis/web-api/rate-limits>).
706    ///
707    /// # Errors
708    ///
709    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
710    #[doc(alias = "admin.teams.admins.list")]
711    pub async fn admin_teams_admins_list(
712        &self,
713        request: &AdminTeamsAdminsListRequest,
714    ) -> Result<AdminTeamsAdminsListResponse, SlackError> {
715        self.call(request).await
716    }
717
718    /// Calls the Slack Web API method [`admin.teams.create`](https://docs.slack.dev/reference/methods/admin.teams.create): Create an Enterprise team.
719    ///
720    /// Required scopes:
721    ///
722    /// - user token: `admin.teams:write`
723    ///
724    /// Rate limit: Tier 1 (<https://docs.slack.dev/apis/web-api/rate-limits>).
725    ///
726    /// # Errors
727    ///
728    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
729    #[doc(alias = "admin.teams.create")]
730    pub async fn admin_teams_create(
731        &self,
732        request: &AdminTeamsCreateRequest,
733    ) -> Result<AdminTeamsCreateResponse, SlackError> {
734        self.call(request).await
735    }
736
737    /// Calls the Slack Web API method [`admin.teams.list`](https://docs.slack.dev/reference/methods/admin.teams.list): List all teams in an Enterprise organization
738    ///
739    /// Required scopes:
740    ///
741    /// - user token: `admin.teams:read`
742    ///
743    /// Rate limit: Tier 3 (<https://docs.slack.dev/apis/web-api/rate-limits>).
744    ///
745    /// # Errors
746    ///
747    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
748    #[doc(alias = "admin.teams.list")]
749    pub async fn admin_teams_list(
750        &self,
751        request: &AdminTeamsListRequest,
752    ) -> Result<AdminTeamsListResponse, SlackError> {
753        self.call(request).await
754    }
755
756    /// Calls the Slack Web API method [`admin.teams.owners.list`](https://docs.slack.dev/reference/methods/admin.teams.owners.list): List all of the owners on a given workspace.
757    ///
758    /// Required scopes:
759    ///
760    /// - user token: `admin.teams:read`
761    ///
762    /// Rate limit: Tier 3 (<https://docs.slack.dev/apis/web-api/rate-limits>).
763    ///
764    /// # Errors
765    ///
766    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
767    #[doc(alias = "admin.teams.owners.list")]
768    pub async fn admin_teams_owners_list(
769        &self,
770        request: &AdminTeamsOwnersListRequest,
771    ) -> Result<AdminTeamsOwnersListResponse, SlackError> {
772        self.call(request).await
773    }
774
775    /// Calls the Slack Web API method [`admin.teams.settings.info`](https://docs.slack.dev/reference/methods/admin.teams.settings.info): Fetch information about settings in a workspace
776    ///
777    /// Required scopes:
778    ///
779    /// - user token: `admin.teams:read`
780    ///
781    /// Rate limit: Tier 3 (<https://docs.slack.dev/apis/web-api/rate-limits>).
782    ///
783    /// # Errors
784    ///
785    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
786    #[doc(alias = "admin.teams.settings.info")]
787    pub async fn admin_teams_settings_info(
788        &self,
789        request: &AdminTeamsSettingsInfoRequest,
790    ) -> Result<AdminTeamsSettingsInfoResponse, SlackError> {
791        self.call(request).await
792    }
793
794    /// Calls the Slack Web API method [`admin.teams.settings.setDefaultChannels`](https://docs.slack.dev/reference/methods/admin.teams.settings.setDefaultChannels): Set the default channels of a workspace.
795    ///
796    /// Required scopes:
797    ///
798    /// - user token: `admin.teams:write`
799    ///
800    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
801    ///
802    /// # Errors
803    ///
804    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
805    #[doc(alias = "admin.teams.settings.setDefaultChannels")]
806    pub async fn admin_teams_settings_set_default_channels(
807        &self,
808        request: &AdminTeamsSettingsSetDefaultChannelsRequest,
809    ) -> Result<AdminTeamsSettingsSetDefaultChannelsResponse, SlackError> {
810        self.call(request).await
811    }
812
813    /// Calls the Slack Web API method [`admin.teams.settings.setDescription`](https://docs.slack.dev/reference/methods/admin.teams.settings.setDescription): Set the description of a given workspace.
814    ///
815    /// Required scopes:
816    ///
817    /// - user token: `admin.teams:write`
818    ///
819    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
820    ///
821    /// # Errors
822    ///
823    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
824    #[doc(alias = "admin.teams.settings.setDescription")]
825    pub async fn admin_teams_settings_set_description(
826        &self,
827        request: &AdminTeamsSettingsSetDescriptionRequest,
828    ) -> Result<AdminTeamsSettingsSetDescriptionResponse, SlackError> {
829        self.call(request).await
830    }
831
832    /// Calls the Slack Web API method [`admin.teams.settings.setDiscoverability`](https://docs.slack.dev/reference/methods/admin.teams.settings.setDiscoverability): An API method that allows admins to set the discoverability of a given workspace
833    ///
834    /// Required scopes:
835    ///
836    /// - user token: `admin.teams:write`
837    ///
838    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
839    ///
840    /// # Errors
841    ///
842    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
843    #[doc(alias = "admin.teams.settings.setDiscoverability")]
844    pub async fn admin_teams_settings_set_discoverability(
845        &self,
846        request: &AdminTeamsSettingsSetDiscoverabilityRequest,
847    ) -> Result<AdminTeamsSettingsSetDiscoverabilityResponse, SlackError> {
848        self.call(request).await
849    }
850
851    /// Calls the Slack Web API method [`admin.teams.settings.setIcon`](https://docs.slack.dev/reference/methods/admin.teams.settings.setIcon): Sets the icon of a workspace.
852    ///
853    /// Required scopes:
854    ///
855    /// - user token: `admin.teams:write`
856    ///
857    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
858    ///
859    /// # Errors
860    ///
861    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
862    #[doc(alias = "admin.teams.settings.setIcon")]
863    pub async fn admin_teams_settings_set_icon(
864        &self,
865        request: &AdminTeamsSettingsSetIconRequest,
866    ) -> Result<AdminTeamsSettingsSetIconResponse, SlackError> {
867        self.call(request).await
868    }
869
870    /// Calls the Slack Web API method [`admin.teams.settings.setName`](https://docs.slack.dev/reference/methods/admin.teams.settings.setName): Set the name of a given workspace.
871    ///
872    /// Required scopes:
873    ///
874    /// - user token: `admin.teams:write`
875    ///
876    /// Rate limit: Tier 3 (<https://docs.slack.dev/apis/web-api/rate-limits>).
877    ///
878    /// # Errors
879    ///
880    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
881    #[doc(alias = "admin.teams.settings.setName")]
882    pub async fn admin_teams_settings_set_name(
883        &self,
884        request: &AdminTeamsSettingsSetNameRequest,
885    ) -> Result<AdminTeamsSettingsSetNameResponse, SlackError> {
886        self.call(request).await
887    }
888}