Skip to content

Commit baaddb7

Browse files
zimegClaude
andcommitted
refactor(block-kit): build data_table cells via BlockCompositions.rawText
Use the BlockCompositions.rawText(...) helper for the raw_text cells instead of RawTextObject.builder(), per the block-kit AGENTS.md guidance to build composition objects through BlockCompositions.* rather than raw builders. Depends on the rawText/rawNumber helpers added in slackapi/java-slack-sdk#1613. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 6c10e36 commit baaddb7

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

‎block-kit/src/main/java/blocks/DataTable.java‎

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import com.slack.api.model.block.Blocks;
44
import com.slack.api.model.block.DataTableBlock;
5-
import com.slack.api.model.block.composition.RawTextObject;
5+
import com.slack.api.model.block.composition.BlockCompositions;
66
import com.slack.api.model.block.element.RichTextSectionElement;
77
import com.slack.api.model.block.element.RichTextSectionElement.TextStyle;
88
import java.util.List;
@@ -19,14 +19,12 @@ public static DataTableBlock example01() {
1919
DataTableBlock block = Blocks.dataTable(t -> t.caption("A Fabulous Table")
2020
.rows(List.of(
2121
List.of(
22-
RawTextObject.builder().text("Name").build(),
23-
RawTextObject.builder().text("Department").build(),
24-
RawTextObject.builder().text("Badge").build()),
22+
BlockCompositions.rawText("Name"),
23+
BlockCompositions.rawText("Department"),
24+
BlockCompositions.rawText("Badge")),
2525
List.of(
26-
RawTextObject.builder()
27-
.text("Data Refinement Department")
28-
.build(),
29-
RawTextObject.builder().text("MDR").build(),
26+
BlockCompositions.rawText("Data Refinement Department"),
27+
BlockCompositions.rawText("MDR"),
3028
Blocks.richText(rt -> rt.elements(List.of(RichTextSectionElement.builder()
3129
.elements(List.of(RichTextSectionElement.Text.builder()
3230
.text("Blue")
@@ -36,10 +34,8 @@ public static DataTableBlock example01() {
3634
.build()))
3735
.build())))),
3836
List.of(
39-
RawTextObject.builder()
40-
.text("Art Sourcing Department")
41-
.build(),
42-
RawTextObject.builder().text("O&D").build(),
37+
BlockCompositions.rawText("Art Sourcing Department"),
38+
BlockCompositions.rawText("O&D"),
4339
Blocks.richText(rt -> rt.elements(List.of(RichTextSectionElement.builder()
4440
.elements(List.of(
4541
RichTextSectionElement.Text.builder()
@@ -54,10 +50,8 @@ public static DataTableBlock example01() {
5450
.build()))
5551
.build())))),
5652
List.of(
57-
RawTextObject.builder()
58-
.text("Wellness Department")
59-
.build(),
60-
RawTextObject.builder().text("Wellness Center").build(),
53+
BlockCompositions.rawText("Wellness Department"),
54+
BlockCompositions.rawText("Wellness Center"),
6155
Blocks.richText(rt -> rt.elements(List.of(RichTextSectionElement.builder()
6256
.elements(List.of(RichTextSectionElement.Text.builder()
6357
.text("Limited")

0 commit comments

Comments
 (0)