sfr_types/block/
input.rs

1//! Input block.
2//!
3//! <https://api.slack.com/reference/block-kit/blocks#input>
4
5use crate::BlockId;
6use crate::Element;
7use crate::TextObject;
8use serde::Serialize;
9
10/// Input block.
11///
12/// <https://api.slack.com/reference/block-kit/blocks#input>
13#[derive(Serialize, Debug, Clone)]
14#[serde(rename_all = "snake_case")]
15pub struct InputBlock {
16    /// 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`.
17    pub label: TextObject,
18
19    /// A block element.
20    pub element: Element,
21
22    /// 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.
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub dispatch_action: Option<bool>,
25
26    /// A unique identifier for a block.
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub block_id: Option<BlockId>,
29
30    /// An optional hint that appears below an input element in a lighter grey.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub hint: Option<TextObject>,
33
34    /// A boolean that indicates whether the input element may be empty when a user submits the modal.
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub optional: Option<bool>,
37}