Skip to main content

slack_chat_api/
team_profile.rs

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