1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Input block.
//!
//! <https://api.slack.com/reference/block-kit/blocks#input>

use crate::BlockId;
use crate::Element;
use crate::TextObject;
use serde::Serialize;

/// Input block.
///
/// <https://api.slack.com/reference/block-kit/blocks#input>
#[derive(Serialize, Debug, Clone)]
#[serde(rename_all = "snake_case")]
pub struct InputBlock {
    /// A label that appears above an input element in the form of a [text object](https://api.slack.com/reference/messaging/composition-objects#text) that must have `type` of `plain_text`.
    pub label: TextObject,

    /// A block element.
    pub element: Element,

    /// A boolean that indicates whether or not the use of elements in this block should dispatch a [`block_actions`](https://api.slack.com/reference/interaction-payloads/block-actions) payload.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dispatch_action: Option<bool>,

    /// A unique identifier for a block.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub block_id: Option<BlockId>,

    /// An optional hint that appears below an input element in a lighter grey.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hint: Option<TextObject>,

    /// A boolean that indicates whether the input element may be empty when a user submits the modal.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub optional: Option<bool>,
}