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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//!
//! Support for Slack Team API methods
//!

use rsb_derive::Builder;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

use crate::models::*;
use crate::ratectl::*;
use crate::SlackClientSession;
use crate::{ClientResult, SlackClientHttpConnector};

impl<'a, SCHC> SlackClientSession<'a, SCHC>
where
    SCHC: SlackClientHttpConnector + Send,
{
    ///
    /// https://api.slack.com/methods/team.info
    ///
    pub async fn team_info(
        &self,
        req: &SlackApiTeamInfoRequest,
    ) -> ClientResult<SlackApiTeamInfoResponse> {
        self.http_session_api
            .http_get(
                "team.info",
                &vec![("team", req.team.as_ref())],
                Some(&SLACK_TIER3_METHOD_CONFIG),
            )
            .await
    }

    ///
    /// https://api.slack.com/methods/team.profile.get
    ///
    pub async fn team_profile_get(
        &self,
        req: &SlackApiTeamProfileGetRequest,
    ) -> ClientResult<SlackApiTeamProfileGetResponse> {
        self.http_session_api
            .http_get(
                "team.profile.get",
                &vec![("visibility", req.visibility.as_ref())],
                Some(&SLACK_TIER3_METHOD_CONFIG),
            )
            .await
    }
}

#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackApiTeamInfoRequest {
    pub team: Option<SlackTeamId>,
}

#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackApiTeamInfoResponse {
    pub team: SlackTeamInfo,
}

#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackApiTeamProfileGetRequest {
    pub visibility: Option<SlackTeamId>,
}

#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackApiTeamProfileGetResponse {
    pub profile: SlackTeamProfile,
}