slack_chat_api/
apps.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct Apps {
5    pub client: Client,
6}
7
8impl Apps {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        Apps { client }
12    }
13
14    /**
15     * This function performs a `GET` to the `/apps.uninstall` endpoint.
16     *
17     * Uninstalls your app from a workspace.
18     *
19     * FROM: <https://api.slack.com/methods/apps.uninstall>
20     *
21     * **Parameters:**
22     *
23     * * `token: &str` -- Authentication token. Requires scope: `none`.
24     * * `client_id: &str` -- Issued when you created your application.
25     * * `client_secret: &str` -- Issued when you created your application.
26     */
27    pub async fn uninstall(
28        &self,
29        client_id: &str,
30        client_secret: &str,
31    ) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
32        let mut query_args: Vec<(String, String)> = Default::default();
33        if !client_id.is_empty() {
34            query_args.push(("client_id".to_string(), client_id.to_string()));
35        }
36        if !client_secret.is_empty() {
37            query_args.push(("client_secret".to_string(), client_secret.to_string()));
38        }
39        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
40        let url = self
41            .client
42            .url(&format!("/apps.uninstall?{}", query_), None);
43        self.client
44            .get(
45                &url,
46                crate::Message {
47                    body: None,
48                    content_type: None,
49                },
50            )
51            .await
52    }
53}