slack_chat_api/
admin_apps_restricted.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct AdminAppsRestricted {
5    pub client: Client,
6}
7
8impl AdminAppsRestricted {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        AdminAppsRestricted { client }
12    }
13
14    /**
15     * This function performs a `GET` to the `/admin.apps.restricted.list` endpoint.
16     *
17     * List restricted apps for an org or workspace.
18     *
19     * FROM: <https://api.slack.com/methods/admin.apps.restricted.list>
20     *
21     * **Parameters:**
22     *
23     * * `token: &str` -- Authentication token. Requires scope: `admin.apps:read`.
24     * * `limit: i64` -- The maximum number of items to return. Must be between 1 - 1000 both inclusive.
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     * * `enterprise_id: &str`
28     */
29    pub async fn list(
30        &self,
31        limit: i64,
32        cursor: &str,
33        team_id: &str,
34        enterprise_id: &str,
35    ) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
36        let mut query_args: Vec<(String, String)> = Default::default();
37        if !cursor.is_empty() {
38            query_args.push(("cursor".to_string(), cursor.to_string()));
39        }
40        if !enterprise_id.is_empty() {
41            query_args.push(("enterprise_id".to_string(), enterprise_id.to_string()));
42        }
43        if limit > 0 {
44            query_args.push(("limit".to_string(), limit.to_string()));
45        }
46        if !team_id.is_empty() {
47            query_args.push(("team_id".to_string(), team_id.to_string()));
48        }
49        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
50        let url = self
51            .client
52            .url(&format!("/admin.apps.restricted.list?{}", query_), None);
53        self.client
54            .get(
55                &url,
56                crate::Message {
57                    body: None,
58                    content_type: None,
59                },
60            )
61            .await
62    }
63}