Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add video Slack block #310

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}