slack_chat_api/
bots.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct Bots {
5    pub client: Client,
6}
7
8impl Bots {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        Bots { client }
12    }
13
14    /**
15     * This function performs a `GET` to the `/bots.info` endpoint.
16     *
17     * Gets information about a bot user.
18     *
19     * FROM: <https://api.slack.com/methods/bots.info>
20     *
21     * **Parameters:**
22     *
23     * * `token: &str` -- Authentication token. Requires scope: `users:read`.
24     * * `bot: &str` -- Bot user to get info on.
25     */
26    pub async fn info(
27        &self,
28        bot: &str,
29    ) -> ClientResult<crate::Response<crate::types::BotsInfoSchema>> {
30        let mut query_args: Vec<(String, String)> = Default::default();
31        if !bot.is_empty() {
32            query_args.push(("bot".to_string(), bot.to_string()));
33        }
34        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
35        let url = self.client.url(&format!("/bots.info?{}", query_), None);
36        self.client
37            .get(
38                &url,
39                crate::Message {
40                    body: None,
41                    content_type: None,
42                },
43            )
44            .await
45    }
46}