Skip to content

Commit

Permalink
fix: Add video Slack block
Browse files Browse the repository at this point in the history
  • Loading branch information
dax committed Feb 4, 2025
1 parent 3d1689f commit b9ab058
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/models/blocks/kit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub enum SlackBlock {
Input(SlackInputBlock),
#[serde(rename = "file")]
File(SlackFileBlock),
#[serde(rename = "video")]
Video(SlackVideoBlock),

// This block is still undocumented, so we don't define any structure yet we can return it back,
#[serde(rename = "rich_text")]
Expand Down Expand Up @@ -999,3 +1001,27 @@ impl From<&str> for SlackBlockPlainTextOnly {
}
}
}

/**
* https://api.slack.com/reference/block-kit/blocks#video
*/
#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackVideoBlock {
pub alt_text: String,
pub author_name: Option<String>,
pub block_id: Option<SlackBlockId>,
pub description: Option<SlackBlockPlainTextOnly>,
pub provider_icon_url: Option<Url>,
pub provider_name: Option<String>,
pub title: SlackBlockPlainTextOnly,
pub title_url: Option<Url>,
pub thumbnail_url: Url,
pub video_url: Url,
}

impl From<SlackVideoBlock> for SlackBlock {
fn from(block: SlackVideoBlock) -> Self {
SlackBlock::Video(block)
}
}

0 comments on commit b9ab058

Please sign in to comment.