sfr_types/block/
section.rs

1//! Section block.
2//!
3//! <https://api.slack.com/reference/block-kit/blocks#section>
4
5use crate::BlockId;
6use crate::Element;
7use crate::TextObject;
8use serde::Serialize;
9
10/// Section block.
11///
12/// <https://api.slack.com/reference/block-kit/blocks#section>
13#[derive(Serialize, Debug, Clone, Default)]
14#[serde(rename_all = "snake_case")]
15pub struct SectionBlock {
16    /// The text for the block, in the form of a [text object](https://api.slack.com/reference/messaging/composition-objects#text).
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub text: Option<TextObject>,
19
20    /// A unique identifier for a block.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub block_id: Option<BlockId>,
23
24    /// Required if no `text` is provided.
25    #[serde(skip_serializing_if = "Vec::is_empty")]
26    pub fields: Vec<TextObject>,
27
28    /// One of the compatible [element objects](https://api.slack.com/reference/block-kit/blocks#section) noted above.
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub accessory: Option<Element>,
31}