marianoguerra/slack/blocks does not have a README file

    BlockParseError

    pub(all) suberror BlockParseError {
    UnsupportedLayoutBlock(String)
    UnknownBlockElement(String)
    UnknownContextBlockElement(String)
    UnknownTextObject(String)
    UnknownRichTextElement(String)
    } derive(Eq,
    Debug
    )

    Why a strict parse refused a payload.

    The message text is java-slack-sdk's, verbatim, so its BlockKitTest assertions port literally and so that an operator who has seen one SDK's message recognises the other's.

    BlockParseError::describe_error

    fn BlockParseError::describe_error(self : BlockParseError) -> String

    ActionsBlock

    pub(all) struct ActionsBlock {
    block_id : String?
    elements : Array[BlockElement]?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    AlertBlock

    pub(all) struct AlertBlock {
    block_id : String?
    text : TextObject?
    level : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    An inline alert. Modals only.

    https://docs.slack.dev/reference/block-kit/blocks/alert-block

    BlockElement

    pub(all) enum BlockElement {
    Button(ButtonElement)
    WorkflowButton(WorkflowButtonElement)
    Image(ImageElement)
    Select(SelectElement)
    Picker(PickerElement)
    Options(OptionsElement)
    PlainTextInput(PlainTextInputElement)
    RichTextInput(RichTextInputElement)
    Text(TextObject)
    Unknown(type_~ : String, raw~ : Json)
    } derive(Eq,
    Debug
    )

    Anything that can sit in an accessory, an element or an elements list.

    BlockElement::from_json

    fn BlockElement::from_json(j : Json) -> BlockElement

    Always succeeds: an unrecognised element becomes Unknown.

    BlockElement::to_json

    fn BlockElement::to_json(self : BlockElement) -> Json

    BlockElement::type_name

    fn BlockElement::type_name(self : BlockElement) -> String

    BlockElement::validate

    fn BlockElement::validate(self : BlockElement, in_context? : Bool) -> Unit raise BlockParseError

    Raise on anything unmodelled inside this element.

    in_context picks the message java-slack-sdk would produce: an unknown element inside a context block reports differently from one in an element slot, and its BlockKitTest asserts on both strings.

    ButtonElement

    pub(all) struct ButtonElement {
    text : TextObject?
    action_id : String?
    url : String?
    value : String?
    style : String?
    confirm : ConfirmationDialogObject?
    accessibility_label : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A button.

    ButtonElement::to_json

    fn ButtonElement::to_json(self : ButtonElement) -> Json

    CallBlock

    pub(all) struct CallBlock {
    block_id : String?
    call_id : String?
    call : Json?
    api_decoration_available : Bool?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A Slack call, from the Calls API.

    CardBlock

    pub(all) struct CardBlock {
    block_id : String?
    hero_image : BlockElement?
    icon : BlockElement?
    slack_icon : Json?
    title : TextObject?
    subtitle : TextObject?
    body : TextObject?
    subtext : TextObject?
    actions : Array[BlockElement]?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A compact structured summary, on its own or inside a carousel.

    https://docs.slack.dev/reference/block-kit/blocks/card-block

    CarouselBlock

    pub(all) struct CarouselBlock {
    block_id : String?
    elements : Array[LayoutBlock]?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A horizontally scrollable row of cards.

    ConfirmationDialogObject

    pub(all) struct ConfirmationDialogObject {
    title : TextObject?
    text : TextObject?
    confirm : TextObject?
    deny : TextObject?
    style : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    The "are you sure?" dialog an element can show before acting.

    ConfirmationDialogObject::from_json

    ConfirmationDialogObject::to_json

    ConfirmationDialogObject::validate

    ContextActionsBlock

    pub(all) struct ContextActionsBlock {
    block_id : String?
    elements : Array[BlockElement]?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Actions attached to the context of a message rather than to its body.

    ContextBlock

    pub(all) struct ContextBlock {
    block_id : String?
    elements : Array[BlockElement]?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Small context lines under a message: a mix of images and text objects, which is why its elements are BlockElement and include the Text variant.

    ConversationFilterObject

    pub(all) struct ConversationFilterObject {
    include_ : Array[String]?
    exclude_external_shared_channels : Bool?
    exclude_bot_users : Bool?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Which conversations a conversation select will offer.

    slack-morphism's test_conversation_filter_none_omitted pins the part that matters: an absent filter must not serialise as "filter": {}, because Slack reads an empty filter as "offer nothing".

    ConversationFilterObject::from_json

    ConversationFilterObject::new

    fn ConversationFilterObject::new(include_? : Array[String], exclude_external_shared_channels? : Bool, exclude_bot_users? : Bool) -> ConversationFilterObject

    ConversationFilterObject::to_json

    DispatchActionConfigObject

    pub(all) struct DispatchActionConfigObject {
    trigger_actions_on : Array[String]?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    When a plain-text input should fire its action.

    DispatchActionConfigObject::from_json

    DispatchActionConfigObject::to_json

    DividerBlock

    pub(all) struct DividerBlock {
    block_id : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    FileBlock

    pub(all) struct FileBlock {
    block_id : String?
    external_id : String?
    source : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    HeaderBlock

    pub(all) struct HeaderBlock {
    block_id : String?
    text : TextObject?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ImageBlock

    pub(all) struct ImageBlock {
    block_id : String?
    image_url : String?
    slack_file : SlackFileObject?
    alt_text : String?
    title : TextObject?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ImageElement

    pub(all) struct ImageElement {
    image_url : String?
    slack_file : SlackFileObject?
    alt_text : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    An image, as an element rather than as a whole block.

    ImageElement::to_json

    fn ImageElement::to_json(self : ImageElement) -> Json

    InputBlock

    pub(all) struct InputBlock {
    block_id : String?
    label : TextObject?
    element : BlockElement?
    hint : TextObject?
    optional : Bool?
    dispatch_action : Bool?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    LayoutBlock

    pub(all) enum LayoutBlock {
    Section(SectionBlock)
    Divider(DividerBlock)
    Image(ImageBlock)
    Actions(ActionsBlock)
    Context(ContextBlock)
    Input(InputBlock)
    Header(HeaderBlock)
    File(FileBlock)
    Video(VideoBlock)
    Markdown(MarkdownBlock)
    RichText(RichTextBlock)
    Call(CallBlock)
    Alert(AlertBlock)
    Card(CardBlock)
    Carousel(CarouselBlock)
    ContextActions(ContextActionsBlock)
    Table(TableBlock)
    TaskCard(TaskCardBlock)
    ShareShortcut(ShareShortcutBlock)
    Unknown(type_~ : String, raw~ : Json)
    } derive(Eq,
    Debug
    )

    One block in a message, modal or App Home tab.

    LayoutBlock::block_id

    fn LayoutBlock::block_id(self : LayoutBlock) -> String?

    LayoutBlock::from_json

    fn LayoutBlock::from_json(j : Json) -> LayoutBlock

    Always succeeds: an unrecognised block becomes Unknown.

    Total on purpose. Strictness is validate, run afterwards, so that there is one parser rather than a lenient one and a strict one that can drift.

    LayoutBlock::to_json

    fn LayoutBlock::to_json(self : LayoutBlock) -> Json

    LayoutBlock::type_name

    fn LayoutBlock::type_name(self : LayoutBlock) -> String

    LayoutBlock::validate

    fn LayoutBlock::validate(self : LayoutBlock) -> Unit raise BlockParseError

    Raise on the first unmodelled thing anywhere inside this block.

    Outside in, so an unknown block reports as an unknown block even when it also contains an unknown element -- which is what java-slack-sdk does, and what its parse_fail_on_unknown_blocks test asserts.

    MarkdownBlock

    pub(all) struct MarkdownBlock {
    block_id : String?
    text : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Markdown as a single string, rather than as a text object.

    Added for AI apps, which produce markdown and should not have to convert it to Slack's mrkdwn dialect. java-slack-sdk's parseMarkdownBlock test is the whole of its coverage.

    OptionGroupObject

    pub(all) struct OptionGroupObject {
    label : TextObject
    options : Array[OptionObject]
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A labelled group of options, for the select menus that support grouping.

    OptionGroupObject::from_json

    OptionGroupObject::new

    OptionGroupObject::to_json

    OptionGroupObject::validate

    fn OptionGroupObject::validate(self : OptionGroupObject) -> Unit raise BlockParseError

    OptionObject

    pub(all) struct OptionObject {
    text : TextObject
    value : String?
    description : TextObject?
    url : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    One choice in a select, radio group, checkbox group or overflow menu.

    OptionObject::from_json

    fn OptionObject::from_json(j : Json) -> OptionObject?

    OptionObject::new

    fn OptionObject::new(text : TextObject, value? : String, description? : TextObject, url? : String) -> OptionObject

    OptionObject::plain

    fn OptionObject::plain(text : String, value : String) -> OptionObject

    A plain-text option, the shape nine callers in ten want.

    OptionObject::to_json

    fn OptionObject::to_json(self : OptionObject) -> Json

    OptionObject::validate

    fn OptionObject::validate(self : OptionObject) -> Unit raise BlockParseError

    OptionsElement

    pub(all) struct OptionsElement {
    kind : OptionsKind
    action_id : String?
    options : Array[OptionObject]?
    initial_option : OptionObject?
    initial_options : Array[OptionObject]?
    confirm : ConfirmationDialogObject?
    focus_on_load : Bool?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Radio buttons, checkboxes and overflow menus: an inline list of options.

    One struct because they differ only in whether one option or several may be initially selected -- and an overflow menu, which is a menu rather than an input, has neither.

    OptionsElement::to_json

    fn OptionsElement::to_json(self : OptionsElement) -> Json

    OptionsKind

    pub(all) enum OptionsKind {
    RadioButtons
    Checkboxes
    Overflow
    } derive(Eq,
    Debug
    )

    Which option-list element this is.

    OptionsKind::of_name

    fn OptionsKind::of_name(name : String) -> OptionsKind?

    OptionsKind::type_name

    fn OptionsKind::type_name(self : OptionsKind) -> String

    PickerElement

    pub(all) struct PickerElement {
    kind : PickerKind
    action_id : String?
    placeholder : TextObject?
    confirm : ConfirmationDialogObject?
    focus_on_load : Bool?
    initial_date : String?
    initial_time : String?
    initial_date_time : Int?
    timezone : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    PickerElement::to_json

    fn PickerElement::to_json(self : PickerElement) -> Json

    PickerKind

    pub(all) enum PickerKind {
    Date
    Time
    DateTime
    } derive(Eq,
    Debug
    )

    Which date or time picker this is.

    PickerKind::of_name

    fn PickerKind::of_name(name : String) -> PickerKind?

    PickerKind::type_name

    fn PickerKind::type_name(self : PickerKind) -> String

    PlainTextInputElement

    pub(all) struct PlainTextInputElement {
    action_id : String?
    placeholder : TextObject?
    initial_value : String?
    multiline : Bool?
    min_length : Int?
    max_length : Int?
    dispatch_action_config : DispatchActionConfigObject?
    focus_on_load : Bool?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A free-text input.

    PlainTextInputElement::to_json

    RichTextBlock

    pub(all) struct RichTextBlock {
    block_id : String?
    elements : Array[RichTextBlockElement]?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    RichTextBlockElement

    pub(all) enum RichTextBlockElement {
    Section(elements~ : Array[RichTextItem], extra~ : Map[String, Json])
    List(style~ : String?, indent~ : Int?, offset~ : Int?, border~ : Int?, elements~ : Array[RichTextBlockElement], extra~ : Map[String, Json])
    Preformatted(border~ : Int?, elements~ : Array[RichTextItem], extra~ : Map[String, Json])
    Quote(border~ : Int?, elements~ : Array[RichTextItem], extra~ : Map[String, Json])
    Unknown(type_~ : String, raw~ : Json)
    } derive(Eq,
    Debug
    )

    One section of a rich-text block: a paragraph, a list, a quote or a code block.

    RichTextBlockElement::from_json

    RichTextBlockElement::to_json

    RichTextBlockElement::type_name

    fn RichTextBlockElement::type_name(self : RichTextBlockElement) -> String

    RichTextBlockElement::validate

    fn RichTextBlockElement::validate(self : RichTextBlockElement) -> Unit raise BlockParseError

    RichTextInputElement

    pub(all) struct RichTextInputElement {
    action_id : String?
    placeholder : TextObject?
    initial_value : Json?
    dispatch_action_config : DispatchActionConfigObject?
    focus_on_load : Bool?
    min_lines : Int?
    max_lines : Int?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A rich-text input: the composer, embedded in a modal.

    RichTextInputElement::to_json

    RichTextItem

    pub(all) enum RichTextItem {
    Text(text~ : String?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    Link(url~ : String?, text~ : String?, unsafe_~ : Bool?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    Emoji(name~ : String?, unicode~ : String?, skin_tone~ : Int?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    User(user_id~ : String?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    UserGroup(usergroup_id~ : String?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    Channel(channel_id~ : String?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    Team(team_id~ : String?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    Broadcast(range~ : String?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    Color(value~ : String?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    Date(timestamp~ : Int?, format~ : String?, url~ : String?, fallback~ : String?, style~ : RichTextStyle?, extra~ : Map[String, Json])
    Unknown(type_~ : String, raw~ : Json)
    } derive(Eq,
    Debug
    )

    One run inside a rich-text section.

    RichTextItem::from_json

    fn RichTextItem::from_json(j : Json) -> RichTextItem

    Always succeeds: an unrecognised item becomes Unknown.

    RichTextItem::to_json

    fn RichTextItem::to_json(self : RichTextItem) -> Json

    RichTextItem::type_name

    fn RichTextItem::type_name(self : RichTextItem) -> String

    RichTextItem::validate

    fn RichTextItem::validate(self : RichTextItem) -> Unit raise BlockParseError

    RichTextStyle

    pub(all) struct RichTextStyle {
    bold : Bool?
    italic : Bool?
    strike : Bool?
    code : Bool?
    highlight : Bool?
    client_highlight : Bool?
    unlink : Bool?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Character styling on a run of text.

    highlight, client_highlight and unlink only appear on mentions -- they are how Slack marks a mention of you, specifically -- but they live here rather than in a second struct because Slack sends them in the same style object.

    RichTextStyle::from_json

    fn RichTextStyle::from_json(j : Json) -> RichTextStyle?

    RichTextStyle::to_json

    fn RichTextStyle::to_json(self : RichTextStyle) -> Json

    SectionBlock

    pub(all) struct SectionBlock {
    block_id : String?
    text : TextObject?
    fields : Array[TextObject]?
    accessory : BlockElement?
    expand : Bool?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    SelectElement

    pub(all) struct SelectElement {
    kind : SelectKind
    action_id : String?
    placeholder : TextObject?
    confirm : ConfirmationDialogObject?
    focus_on_load : Bool?
    options : Array[OptionObject]?
    option_groups : Array[OptionGroupObject]?
    initial_option : OptionObject?
    initial_options : Array[OptionObject]?
    initial_user : String?
    initial_users : Array[String]?
    initial_conversation : String?
    initial_conversations : Array[String]?
    initial_channel : String?
    initial_channels : Array[String]?
    min_query_length : Int?
    max_selected_items : Int?
    default_to_current_conversation : Bool?
    response_url_enabled : Bool?
    filter : ConversationFilterObject?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Any of the ten select menus.

    SelectElement::to_json

    fn SelectElement::to_json(self : SelectElement) -> Json

    SelectKind

    pub(all) enum SelectKind {
    Static
    MultiStatic
    External
    MultiExternal
    Users
    MultiUsers
    Conversations
    MultiConversations
    Channels
    MultiChannels
    } derive(Eq,
    Debug
    )

    Which select menu this is.

    SelectKind::of_name

    fn SelectKind::of_name(name : String) -> SelectKind?

    SelectKind::type_name

    fn SelectKind::type_name(self : SelectKind) -> String

    ShareShortcutBlock

    pub(all) struct ShareShortcutBlock {
    block_id : String?
    function_trigger_id : String?
    app_id : String?
    is_workflow_app : Bool?
    sales_home_workflow_app_type : Int?
    app_collaborators : Array[String]?
    button_label : String?
    title : String?
    description : String?
    bot_user_id : String?
    url : String?
    owning_team_id : String?
    workflow_id : String?
    developer_trace_id : String?
    trigger_type : String?
    trigger_subtype : String?
    share_url : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    The block Slack uses to offer a workflow for sharing.

    Not in the Block Kit reference -- it is internal -- but it is 88 of the blocks in the vendored corpus, so it is modelled from java-slack-sdk's ShareShortcutBlock rather than left to Unknown.

    SlackFileObject

    pub(all) struct SlackFileObject {
    id : String?
    url : String?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A reference to a file already hosted by Slack, as an alternative to an image_url.

    SlackFileObject::from_json

    fn SlackFileObject::from_json(j : Json) -> SlackFileObject?

    SlackFileObject::to_json

    fn SlackFileObject::to_json(self : SlackFileObject) -> Json

    TableBlock

    pub(all) struct TableBlock {
    block_id : String?
    column_settings : Json?
    rows : Json?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A table.

    rows and column_settings stay raw: a cell is either a raw_text or a rich_text, the shape is not in the Block Kit reference, and inventing a model from one fixture would be guessing. They round-trip exactly.

    TaskCardBlock

    pub(all) struct TaskCardBlock {
    block_id : String?
    task_id : String?
    title : String?
    status : String?
    output : Json?
    sources : Json?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Progress on a long-running task, for AI apps.

    TextKind

    pub(all) enum TextKind {
    PlainText
    Mrkdwn
    Other(String)
    } derive(Eq,
    Debug
    )

    Which kind of text object this is.

    Other exists so that an unrecognised text type is representable rather than silently dropped. java-slack-sdk raises on one immediately; here it is parsed, kept, and raised on by validate under Strict -- which round-trips and still refuses when refusing is what you asked for.

    TextKind::of_name

    fn TextKind::of_name(name : String) -> TextKind

    TextKind::type_name

    fn TextKind::type_name(self : TextKind) -> String

    TextObject

    pub(all) struct TextObject {
    kind : TextKind
    text : String
    emoji : Bool?
    verbatim : Bool?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A plain_text or mrkdwn text object.

    One struct with a kind rather than two variants: the two differ only in which of emoji and verbatim is meaningful, the schema accepts either wherever text is allowed, and code that handles "some text" would otherwise have to match twice everywhere.

    TextObject::from_json

    fn TextObject::from_json(j : Json) -> TextObject?

    None when this is not a text object at all: not an object, or with no type or no text string.

    An unknown type is NOT a reason to refuse -- that is what Other is for. An empty type or an empty text is not a reason either: Slack's own scrubbed fixtures contain both, and a parser that refused them could not read the corpus it is validated against.

    TextObject::mrkdwn

    fn TextObject::mrkdwn(text : String, verbatim? : Bool) -> TextObject

    TextObject::plain

    fn TextObject::plain(text : String, emoji? : Bool) -> TextObject

    TextObject::to_json

    fn TextObject::to_json(self : TextObject) -> Json

    TextObject::type_name

    fn TextObject::type_name(self : TextObject) -> String

    TextObject::validate

    fn TextObject::validate(self : TextObject) -> Unit raise BlockParseError

    Raise if this text object's type is one Slack does not define.

    UnknownPolicy

    pub(all) enum UnknownPolicy {
    Lenient
    Strict
    } derive(Eq,
    Debug
    )

    What to do with a "type" this version does not model.

    Slack ships new block types faster than any SDK adopts them, and a bot that breaks because a coworker used a block released last Tuesday is a worse outcome than one that renders it as an opaque payload. So the default is lenient, and strict is opt-in for the cases where refusing is the point: a linter, a test, a validating endpoint.

    java-slack-sdk offers the same choice as createSnakeCaseWithoutUnknownPropertyDetection(true|false), and its BlockKitTest tests every unknown-type payload twice, once per policy. So does unknown_test.mbt here.

    VideoBlock

    pub(all) struct VideoBlock {
    block_id : String?
    video_url : String?
    thumbnail_url : String?
    alt_text : String?
    title : TextObject?
    title_url : String?
    author_name : String?
    provider_name : String?
    provider_icon_url : String?
    description : TextObject?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    WorkflowButtonElement

    pub(all) struct WorkflowButtonElement {
    text : TextObject?
    action_id : String?
    style : String?
    accessibility_label : String?
    workflow : Json?
    extra : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A button that runs a workflow directly, without a round trip to an app.

    WorkflowButtonElement::to_json

    actions

    fn actions(elements : Array[BlockElement], block_id? : String) -> LayoutBlock

    blocks_to_json

    fn blocks_to_json(blocks : Array[LayoutBlock]) -> Json

    Serialise a block list, ready for Params::put_json("blocks", ...).

    button

    fn button(text : String, action_id? : String, value? : String, url? : String, style? : String, confirm? : ConfirmationDialogObject, accessibility_label? : String) -> BlockElement

    channels_select

    fn channels_select(action_id? : String, placeholder? : TextObject, initial_channel? : String, response_url_enabled? : Bool) -> BlockElement

    checkboxes

    fn checkboxes(options : Array[OptionObject], action_id? : String, initial_options? : Array[OptionObject]) -> BlockElement

    confirm

    fn confirm(title? : String, text? : String, confirm_label? : String, deny_label? : String, style? : String) -> ConfirmationDialogObject

    context

    fn context(elements : Array[BlockElement], block_id? : String) -> LayoutBlock

    context_text

    fn context_text(text : String) -> BlockElement

    A plain-text run inside a context block.

    conversations_select

    fn conversations_select(action_id? : String, placeholder? : TextObject, initial_conversation? : String, default_to_current_conversation? : Bool, filter? : ConversationFilterObject, response_url_enabled? : Bool) -> BlockElement

    datepicker

    fn datepicker(action_id? : String, placeholder? : TextObject, initial_date? : String) -> BlockElement

    datetimepicker

    fn datetimepicker(action_id? : String, initial_date_time? : Int) -> BlockElement

    No placeholder: datetimepicker does not take one, which is the only reason Slack keeps it a separate type from datepicker.

    divider

    fn divider(block_id? : String) -> LayoutBlock

    external_select

    fn external_select(action_id? : String, placeholder? : TextObject, min_query_length? : Int, initial_option? : OptionObject) -> BlockElement

    fn header(text : String, block_id? : String) -> LayoutBlock

    image

    fn image(image_url : String, alt_text : String, title? : TextObject, block_id? : String) -> LayoutBlock

    alt_text is not optional here even though the parser tolerates its absence: an image with no alternative text is unreadable to anyone using a screen reader, and Slack rejects it anyway.

    image_element

    fn image_element(image_url : String, alt_text : String) -> BlockElement

    input

    fn input(label : TextObject, element : BlockElement, hint? : TextObject, optional? : Bool, dispatch_action? : Bool, block_id? : String) -> LayoutBlock

    known_block_types

    let known_block_types : Array[String]

    Every block type name this version models. For tests, and for anyone checking what a payload will survive.

    known_element_types

    let known_element_types : Array[String]

    Every element type name this version models.

    markdown

    fn markdown(text : String, block_id? : String) -> LayoutBlock

    multi_conversations_select

    fn multi_conversations_select(action_id? : String, placeholder? : TextObject, initial_conversations? : Array[String], default_to_current_conversation? : Bool, filter? : ConversationFilterObject, max_selected_items? : Int) -> BlockElement

    multi_static_select

    fn multi_static_select(options : Array[OptionObject], action_id? : String, placeholder? : TextObject, initial_options? : Array[OptionObject], max_selected_items? : Int) -> BlockElement

    multi_users_select

    fn multi_users_select(action_id? : String, placeholder? : TextObject, initial_users? : Array[String], max_selected_items? : Int) -> BlockElement

    overflow

    fn overflow(options : Array[OptionObject], action_id? : String, confirm? : ConfirmationDialogObject) -> BlockElement

    parse_blocks

    fn parse_blocks(j : Json, policy? : UnknownPolicy) -> Array[LayoutBlock]? raise BlockParseError

    Parse a blocks array.

    Under Lenient -- the default -- this never fails: anything unmodelled becomes an Unknown variant carrying its original JSON, which renders as nothing but round-trips exactly. Under Strict the first unmodelled thing raises, naming it.

    A value that is not an array is not "no blocks", it is a caller mistake, so it is None rather than an empty list.

    parse_message_blocks

    fn parse_message_blocks(message : Json, policy? : UnknownPolicy) -> Array[LayoutBlock]? raise BlockParseError

    Parse the blocks field of a message, view or payload object.

    None when there is no blocks field at all, which is different from an empty one -- see the blocks: [] case in @api's form encoder.

    plain_text_input

    fn plain_text_input(action_id? : String, placeholder? : TextObject, initial_value? : String, multiline? : Bool, min_length? : Int, max_length? : Int) -> BlockElement

    radio_buttons

    fn radio_buttons(options : Array[OptionObject], action_id? : String, initial_option? : OptionObject) -> BlockElement

    rich_text

    fn rich_text(elements : Array[RichTextBlockElement], block_id? : String) -> LayoutBlock

    rich_text_emoji

    fn rich_text_emoji(name : String, unicode? : String) -> RichTextItem

    fn rich_text_link(url : String, text? : String, style? : RichTextStyle) -> RichTextItem

    rich_text_section

    fn rich_text_section(elements : Array[RichTextItem]) -> RichTextBlockElement

    A rich-text paragraph.

    rich_text_style

    fn rich_text_style(bold? : Bool, italic? : Bool, strike? : Bool, code? : Bool) -> RichTextStyle

    rich_text_text

    fn rich_text_text(text : String, style? : RichTextStyle) -> RichTextItem

    rich_text_user

    fn rich_text_user(user_id : String) -> RichTextItem

    section

    fn section(text? : TextObject, fields? : Array[TextObject], accessory? : BlockElement, block_id? : String, expand? : Bool) -> LayoutBlock

    section_text

    fn section_text(text : String, block_id? : String) -> LayoutBlock

    A section holding one mrkdwn string -- by far the most common block.

    static_select

    fn static_select(options : Array[OptionObject], action_id? : String, placeholder? : TextObject, initial_option? : OptionObject, confirm? : ConfirmationDialogObject) -> BlockElement

    timepicker

    fn timepicker(action_id? : String, placeholder? : TextObject, initial_time? : String, timezone? : String) -> BlockElement

    users_select

    fn users_select(action_id? : String, placeholder? : TextObject, initial_user? : String) -> BlockElement

    validate_blocks

    fn validate_blocks(blocks : Array[LayoutBlock]) -> Unit raise BlockParseError

    Raise on the first unmodelled thing in a block list.