slack_chat_api/
api.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct Api {
5    pub client: Client,
6}
7
8impl Api {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        Api { client }
12    }
13
14    /**
15     * This function performs a `GET` to the `/api.test` endpoint.
16     *
17     * Checks API calling code.
18     *
19     * FROM: <https://api.slack.com/methods/api.test>
20     *
21     * **Parameters:**
22     *
23     * * `error: &str` -- Error response to return.
24     * * `foo_: &str` -- example property to return.
25     */
26    pub async fn test(
27        &self,
28        error: &str,
29        foo_: &str,
30    ) -> ClientResult<crate::Response<crate::types::DndEndSchema>> {
31        let mut query_args: Vec<(String, String)> = Default::default();
32        if !error.is_empty() {
33            query_args.push(("error".to_string(), error.to_string()));
34        }
35        if !foo_.is_empty() {
36            query_args.push(("foo".to_string(), foo_.to_string()));
37        }
38        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
39        let url = self.client.url(&format!("/api.test?{}", query_), None);
40        self.client
41            .get(
42                &url,
43                crate::Message {
44                    body: None,
45                    content_type: None,
46                },
47            )
48            .await
49    }
50}