Basic support for SlackEnterpriseUser information (#216)

This commit is contained in:
Abdulla Abdurakhmanov 2023-10-24 22:50:06 +02:00 committed by GitHub
parent 0da33a569c
commit 0b44ac657d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View file

@ -29,13 +29,18 @@ async fn test_command_events_function(
.api_test(&SlackApiTestRequest::new().with_foo("Test".into()))
.await?;
let user_info_resp = session
.users_info(&SlackApiUsersInfoRequest::new(event.user_id.clone()))
.await?;
Ok(SlackCommandEventResponse::new(
SlackMessageContent::new()
.with_text("Working on it".into())
.with_text(format!("Working on it: {:?}", user_info_resp.user.team_id).into())
.with_blocks(slack_blocks![
some_into(SlackSectionBlock::new().with_text(md!(
"Working section for {}",
event.user_id.to_slack_format()
"Working section for {}. Team ID: {:?}",
event.user_id.to_slack_format(),
user_info_resp.user.teams
))),
some_into(SlackActionsBlock::new(slack_blocks![
some_into(SlackBlockButtonElement::new(

View file

@ -237,3 +237,6 @@ pub enum SlackShortcutType {
#[derive(Debug, Eq, PartialEq, Hash, Clone, Serialize, Deserialize, ValueStruct)]
pub struct SlackEventType(pub String);
#[derive(Debug, Eq, Hash, PartialEq, Clone, Serialize, Deserialize, ValueStruct)]
pub struct SlackEnterpriseId(pub String);

View file

@ -24,6 +24,7 @@ pub struct SlackUser {
pub deleted: Option<bool>,
pub color: Option<SlackColor>,
pub real_name: Option<String>,
pub enterprise_user: Option<SlackEnterpriseUser>,
}
#[skip_serializing_none]
@ -113,3 +114,14 @@ pub struct SlackUserGroupPrefs {
#[derive(Debug, Eq, PartialEq, Hash, Clone, Serialize, Deserialize, ValueStruct)]
pub struct SlackAvatarHash(pub String);
#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackEnterpriseUser {
pub id: SlackUserId,
pub enterprise_id: SlackEnterpriseId,
pub enterprise_name: Option<String>,
#[serde(flatten)]
pub flags: SlackUserFlags,
pub teams: Option<Vec<SlackTeamId>>,
}