1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use anyhow::Result;

use crate::Client;

pub struct Api {
    pub client: Client,
}

impl Api {
    #[doc(hidden)]
    pub fn new(client: Client) -> Self {
        Api { client }
    }

    /**
     * This function performs a `GET` to the `/api.test` endpoint.
     *
     * Checks API calling code.
     *
     * FROM: <https://api.slack.com/methods/api.test>
     *
     * **Parameters:**
     *
     * * `error: &str` -- Error response to return.
     * * `foo_: &str` -- example property to return.
     */
    pub async fn test(&self, error: &str, foo_: &str) -> Result<crate::types::DndEndSchema> {
        let mut query_args: Vec<(String, String)> = Default::default();
        if !error.is_empty() {
            query_args.push(("error".to_string(), error.to_string()));
        }
        if !foo_.is_empty() {
            query_args.push(("foo".to_string(), foo_.to_string()));
        }
        let query_ = serde_urlencoded::to_string(&query_args).unwrap();
        let url = format!("/api.test?{}", query_);

        self.client.get(&url, None).await
    }
}