slack_chat_api/
admin_invite_requests_approved.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct AdminInviteRequestsApproved {
5    pub client: Client,
6}
7
8impl AdminInviteRequestsApproved {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        AdminInviteRequestsApproved { client }
12    }
13
14    /**
15     * This function performs a `GET` to the `/admin.inviteRequests.approved.list` endpoint.
16     *
17     * List all approved workspace invite requests.
18     *
19     * FROM: <https://api.slack.com/methods/admin.inviteRequests.approved.list>
20     *
21     * **Parameters:**
22     *
23     * * `token: &str` -- Authentication token. Requires scope: `admin.invites:read`.
24     * * `team_id: &str` -- ID for the workspace where the invite requests were made.
25     * * `cursor: &str` -- Value of the `next_cursor` field sent as part of the previous API response.
26     * * `limit: i64` -- The number of results that will be returned by the API on each invocation. Must be between 1 - 1000, both inclusive.
27     */
28    pub async fn list(
29        &self,
30        team_id: &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 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.client.url(
46            &format!("/admin.inviteRequests.approved.list?{}", query_),
47            None,
48        );
49        self.client
50            .get(
51                &url,
52                crate::Message {
53                    body: None,
54                    content_type: None,
55                },
56            )
57            .await
58    }
59}