sfr_types/
block.rs

1//! The type that represents a block.
2//!
3//! <https://api.slack.com/reference/block-kit/blocks>
4
5pub mod actions;
6pub mod context;
7pub mod divider;
8pub mod file;
9pub mod header;
10pub mod image;
11pub mod input;
12pub mod rich_text;
13pub mod section;
14
15use crate::{
16    ActionsBlock, ContextBlock, DividerBlock, FileBlock, HeaderBlock, ImageBlock, InputBlock,
17    RichTextBlock, SectionBlock,
18};
19use serde::Serialize;
20
21/// A unique identifier for a block.
22#[derive(Serialize, Debug, Clone)]
23pub struct BlockId(pub String);
24
25/// The external unique ID for the file. in <https://api.slack.com/reference/block-kit/blocks#file_fields>.
26#[derive(Serialize, Debug, Clone)]
27pub struct ExternalId(pub String);
28
29/// The type that represents a block.
30///
31/// <https://api.slack.com/reference/block-kit/blocks>
32#[derive(Serialize, Debug, Clone)]
33#[serde(tag = "type", rename_all = "snake_case")]
34pub enum Block {
35    /// Actions block.
36    ///
37    /// <https://api.slack.com/reference/block-kit/blocks#actions>
38    Actions(ActionsBlock),
39
40    /// Context block.
41    ///
42    /// <https://api.slack.com/reference/block-kit/blocks#context>
43    Context(ContextBlock),
44
45    /// Divider block.
46    ///
47    /// <https://api.slack.com/reference/block-kit/blocks#divider>
48    Divider(DividerBlock),
49
50    /// File block.
51    ///
52    /// <https://api.slack.com/reference/block-kit/blocks#file>
53    File(FileBlock),
54
55    /// Header block.
56    ///
57    /// <https://api.slack.com/reference/block-kit/blocks#header>
58    Header(HeaderBlock),
59
60    /// Image block.
61    ///
62    /// <https://api.slack.com/reference/block-kit/blocks#image>
63    Image(ImageBlock),
64
65    /// Rich text block.
66    ///
67    /// <https://api.slack.com/reference/block-kit/blocks#rich_text>
68    RichText(RichTextBlock),
69
70    /// Input block.
71    ///
72    /// <https://api.slack.com/reference/block-kit/blocks#input>
73    Input(InputBlock),
74
75    /// Section block.
76    ///
77    /// <https://api.slack.com/reference/block-kit/blocks#section>
78    Section(SectionBlock),
79    // Video(VideoBlock),
80}