slack_chat_api/
apps_permissions_resources.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct AppsPermissionsResources {
5    pub client: Client,
6}
7
8impl AppsPermissionsResources {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        AppsPermissionsResources { client }
12    }
13
14    /**
15     * This function performs a `GET` to the `/apps.permissions.resources.list` endpoint.
16     *
17     * Returns list of resource grants this app has on a team.
18     *
19     * FROM: <https://api.slack.com/methods/apps.permissions.resources.list>
20     *
21     * **Parameters:**
22     *
23     * * `token: &str` -- Authentication token. Requires scope: `none`.
24     * * `cursor: &str` -- Paginate through collections of data by setting the `cursor` parameter to a `next_cursor` attribute returned by a previous request's `response_metadata`. Default value fetches the first "page" of the collection. See [pagination](/docs/pagination) for more detail.
25     * * `limit: i64` -- The maximum number of items to return.
26     */
27    pub async fn list(
28        &self,
29        cursor: &str,
30        limit: i64,
31    ) -> ClientResult<crate::Response<crate::types::AppsPermissionsResourcesListSuccessSchema>>
32    {
33        let mut query_args: Vec<(String, String)> = Default::default();
34        if !cursor.is_empty() {
35            query_args.push(("cursor".to_string(), cursor.to_string()));
36        }
37        if limit > 0 {
38            query_args.push(("limit".to_string(), limit.to_string()));
39        }
40        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
41        let url = self.client.url(
42            &format!("/apps.permissions.resources.list?{}", query_),
43            None,
44        );
45        self.client
46            .get(
47                &url,
48                crate::Message {
49                    body: None,
50                    content_type: None,
51                },
52            )
53            .await
54    }
55}