slack_morphism/api/
auth.rs1use rsb_derive::Builder;
6use serde::{Deserialize, Serialize};
7use serde_with::skip_serializing_none;
8
9use crate::ratectl::*;
10use crate::SlackClientSession;
11use crate::*;
12use crate::{ClientResult, SlackClientHttpConnector};
13use lazy_static::lazy_static;
14
15impl<'a, SCHC> SlackClientSession<'a, SCHC>
16where
17 SCHC: SlackClientHttpConnector + Send,
18{
19 pub async fn auth_test(&self) -> ClientResult<SlackApiAuthTestResponse> {
23 self.http_session_api
24 .http_get(
25 "auth.test",
26 &crate::client::SLACK_HTTP_EMPTY_GET_PARAMS.clone(),
27 Some(&AUTH_TEST_SPECIAL_LIMIT_RATE_CTL),
28 )
29 .await
30 }
31}
32
33lazy_static! {
34 pub static ref AUTH_TEST_SPECIAL_LIMIT_RATE_CTL: SlackApiMethodRateControlConfig =
35 SlackApiMethodRateControlConfig::new().with_special_rate_limit(
36 SlackApiRateControlSpecialLimit::new(
37 "auth.test".into(),
38 SlackApiRateControlLimit::new(100, std::time::Duration::from_secs(1))
39 )
40 );
41}
42
43#[skip_serializing_none]
44#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
45pub struct SlackApiAuthTestResponse {
46 pub user_id: SlackUserId,
47 pub team_id: SlackTeamId,
48 pub user: Option<String>,
49 pub team: String,
50 pub bot_id: Option<SlackBotId>,
51 pub url: SlackTeamUrl,
52}