All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.seratch.jslack.api.model.block.Blocks Maven / Gradle / Ivy

The newest version!
package com.github.seratch.jslack.api.model.block;

import com.github.seratch.jslack.api.model.ModelConfigurator;
import com.github.seratch.jslack.api.model.block.element.BlockElement;

import java.util.Arrays;
import java.util.List;

public class Blocks {

    private Blocks() {
    }

    public static List asBlocks(LayoutBlock... blocks) {
        return Arrays.asList(blocks);
    }

    // ActionsBlock

    public static ActionsBlock actions(ModelConfigurator configurator) {
        return configurator.configure(ActionsBlock.builder()).build();
    }

    public static ActionsBlock actions(List elements) {
        return ActionsBlock.builder().elements(elements).build();
    }

    public static ActionsBlock actions(String blockId, List elements) {
        return ActionsBlock.builder().blockId(blockId).elements(elements).build();
    }

    // ContextBlock

    public static ContextBlock context(ModelConfigurator configurator) {
        return configurator.configure(ContextBlock.builder()).build();
    }

    public static ContextBlock context(List elements) {
        return ContextBlock.builder().elements(elements).build();
    }

    public static ContextBlock context(String blockId, List elements) {
        return ContextBlock.builder().blockId(blockId).elements(elements).build();
    }

    // DividerBlock

    public static DividerBlock divider(ModelConfigurator configurator) {
        return configurator.configure(DividerBlock.builder()).build();
    }

    public static DividerBlock divider(String blockId) {
        return DividerBlock.builder().blockId(blockId).build();
    }

    public static DividerBlock divider() {
        return DividerBlock.builder().build();
    }

    // FileBlock

    public static FileBlock file(ModelConfigurator configurator) {
        return configurator.configure(FileBlock.builder()).build();
    }

    // ImageBlock

    public static ImageBlock image(ModelConfigurator configurator) {
        return configurator.configure(ImageBlock.builder()).build();
    }

    // InputBlock

    public static InputBlock input(ModelConfigurator configurator) {
        return configurator.configure(InputBlock.builder()).build();
    }

    // RichTextBlock

    public static RichTextBlock richText(ModelConfigurator configurator) {
        return configurator.configure(RichTextBlock.builder()).build();
    }

    // SectionBlock

    public static SectionBlock section(ModelConfigurator configurator) {
        return configurator.configure(SectionBlock.builder()).build();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy