slack_chat_api/
apps_event_authorizations.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct AppsEventAuthorizations {
5    pub client: Client,
6}
7
8impl AppsEventAuthorizations {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        AppsEventAuthorizations { client }
12    }
13
14    /**
15     * This function performs a `GET` to the `/apps.event.authorizations.list` endpoint.
16     *
17     * Get a list of authorizations for the given event context. Each authorization represents an app installation that the event is visible to.
18     *
19     * FROM: <https://api.slack.com/methods/apps.event.authorizations.list>
20     *
21     * **Parameters:**
22     *
23     * * `token: &str` -- Authentication token. Requires scope: `authorizations:read`.
24     * * `event_context: &str`
25     * * `cursor: &str`
26     * * `limit: i64`
27     */
28    pub async fn list(
29        &self,
30        event_context: &str,
31        cursor: &str,
32        limit: i64,
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 !event_context.is_empty() {
39            query_args.push(("event_context".to_string(), event_context.to_string()));
40        }
41        if limit > 0 {
42            query_args.push(("limit".to_string(), limit.to_string()));
43        }
44        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
45        let url = self
46            .client
47            .url(&format!("/apps.event.authorizations.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}