|
| 1 | +package blocks; |
| 2 | + |
| 3 | +import com.slack.api.model.block.Blocks; |
| 4 | +import com.slack.api.model.block.PlanBlock; |
| 5 | +import com.slack.api.model.block.RichTextBlock; |
| 6 | +import com.slack.api.model.block.element.RichTextSectionElement; |
| 7 | +import java.util.List; |
| 8 | + |
| 9 | +/** |
| 10 | + * Displays a collection of related tasks. |
| 11 | + * {@link https://docs.slack.dev/reference/block-kit/blocks/plan-block/} |
| 12 | + */ |
| 13 | +public class Plan { |
| 14 | + /** |
| 15 | + * A plan block with multiple task cards in various states. |
| 16 | + */ |
| 17 | + public static PlanBlock example01() { |
| 18 | + PlanBlock block = Blocks.plan(p -> p.title("Thinking completed") |
| 19 | + .tasks(List.of( |
| 20 | + Blocks.taskCard(t -> t.taskId("call_001") |
| 21 | + .title("Fetched user profile information") |
| 22 | + .status("in_progress") |
| 23 | + .details(RichTextBlock.builder() |
| 24 | + .blockId("viMWO") |
| 25 | + .elements(List.of(RichTextSectionElement.builder() |
| 26 | + .elements(List.of(RichTextSectionElement.Text.builder() |
| 27 | + .text("Searched database...") |
| 28 | + .build())) |
| 29 | + .build())) |
| 30 | + .build()) |
| 31 | + .output(RichTextBlock.builder() |
| 32 | + .blockId("viMWO") |
| 33 | + .elements(List.of(RichTextSectionElement.builder() |
| 34 | + .elements(List.of(RichTextSectionElement.Text.builder() |
| 35 | + .text("Profile data loaded") |
| 36 | + .build())) |
| 37 | + .build())) |
| 38 | + .build())), |
| 39 | + Blocks.taskCard(t -> t.taskId("call_002") |
| 40 | + .title("Checked user permissions") |
| 41 | + .status("in_progress")), |
| 42 | + Blocks.taskCard(t -> t.taskId("call_003") |
| 43 | + .title("Generated comprehensive user report") |
| 44 | + .status("complete") |
| 45 | + .output(RichTextBlock.builder() |
| 46 | + .blockId("crsk") |
| 47 | + .elements(List.of(RichTextSectionElement.builder() |
| 48 | + .elements(List.of(RichTextSectionElement.Text.builder() |
| 49 | + .text("15 data points compiled") |
| 50 | + .build())) |
| 51 | + .build())) |
| 52 | + .build()))))); |
| 53 | + return block; |
| 54 | + } |
| 55 | +} |
0 commit comments