slack_chat_api/
admin_teams_admins.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct AdminTeamsAdmins {
5    pub client: Client,
6}
7
8impl AdminTeamsAdmins {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        AdminTeamsAdmins { client }
12    }
13
14    /**
15     * This function performs a `GET` to the `/admin.teams.admins.list` endpoint.
16     *
17     * List all of the admins on a given workspace.
18     *
19     * FROM: <https://api.slack.com/methods/admin.teams.admins.list>
20     *
21     * **Parameters:**
22     *
23     * * `token: &str` -- Authentication token. Requires scope: `admin.teams:read`.
24     * * `limit: i64` -- The maximum number of items to return.
25     * * `cursor: &str` -- Set `cursor` to `next_cursor` returned by the previous call to list items in the next page.
26     * * `team_id: &str`
27     */
28    pub async fn list(
29        &self,
30        limit: i64,
31        cursor: &str,
32        team_id: &str,
33    ) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
34        let mut query_args: Vec<(String, String)> = Default::default();
35        if !cursor.is_empty() {
36            query_args.push(("cursor".to_string(), cursor.to_string()));
37        }
38        if limit > 0 {
39            query_args.push(("limit".to_string(), limit.to_string()));
40        }
41        if !team_id.is_empty() {
42            query_args.push(("team_id".to_string(), team_id.to_string()));
43        }
44        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
45        let url = self
46            .client
47            .url(&format!("/admin.teams.admins.list?{}", query_), None);
48        self.client
49            .get(
50                &url,
51                crate::Message {
52                    body: None,
53                    content_type: None,
54                },
55            )
56            .await
57    }
58}