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
use rsb_derive::Builder;
use rvstruct::ValueStruct;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use slack_morphism_models::SlackTeamId;
#[derive(Eq, PartialEq, Hash, Clone, Serialize, Deserialize, ValueStruct)]
pub struct SlackApiTokenValue(pub String);
impl std::fmt::Debug for SlackApiTokenValue {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "SlackApiTokenValue(len:{})", self.value().len())
}
}
#[derive(Debug, Eq, PartialEq, Hash, Clone, Serialize, Deserialize, ValueStruct)]
pub struct SlackApiTokenScope(pub String);
#[derive(Debug, Eq, PartialEq, Hash, Clone, Serialize, Deserialize)]
pub enum SlackApiTokenType {
#[serde(rename = "bot")]
Bot,
#[serde(rename = "user")]
User,
#[serde(rename = "app")]
App,
}
impl ToString for SlackApiTokenType {
fn to_string(&self) -> String {
match self {
SlackApiTokenType::Bot => "bot".into(),
SlackApiTokenType::User => "user".into(),
SlackApiTokenType::App => "app".into(),
}
}
}
#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackApiToken {
pub token_value: SlackApiTokenValue,
pub team_id: Option<SlackTeamId>,
pub scope: Option<SlackApiTokenScope>,
pub token_type: Option<SlackApiTokenType>,
}