Skip to content

Commit ac33ff6

Browse files
committed
feat(model): add SlackIconObject composition object for CardBlock.slackIcon
The slackIcon field on CardBlock should be a composition object with type "icon" and a name field, not a plain String. https://docs.slack.dev/reference/block-kit/composition-objects/slack-icon-object
1 parent be95843 commit ac33ff6

3 files changed

Lines changed: 38 additions & 2 deletions

File tree

slack-api-model/src/main/java/com/slack/api/model/block/CardBlock.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.slack.api.model.block;
22

3+
import com.slack.api.model.block.composition.SlackIconObject;
34
import com.slack.api.model.block.composition.TextObject;
45
import com.slack.api.model.block.element.BlockElement;
56
import com.slack.api.model.block.element.ImageElement;
@@ -39,10 +40,10 @@ public class CardBlock implements LayoutBlock {
3940
private ImageElement icon;
4041

4142
/**
42-
* The name of a built-in Slack icon displayed next to the title and subtitle.
43+
* A built-in Slack icon displayed next to the title and subtitle.
4344
* Mutually exclusive with {@code icon}.
4445
*/
45-
private String slackIcon;
46+
private SlackIconObject slackIcon;
4647

4748
/**
4849
* The title of the card. Maximum length for the text in this field is 150 characters.

slack-api-model/src/main/java/com/slack/api/model/block/composition/BlockCompositions.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,14 @@ public static FeedbackButtonObject feedbackButton(ModelConfigurator<FeedbackButt
8787
public static SlackFileObject slackFile(ModelConfigurator<SlackFileObject.SlackFileObjectBuilder> configurator) {
8888
return configurator.configure(SlackFileObject.builder()).build();
8989
}
90+
91+
// SlackIconObject
92+
93+
public static SlackIconObject slackIcon(ModelConfigurator<SlackIconObject.SlackIconObjectBuilder> configurator) {
94+
return configurator.configure(SlackIconObject.builder()).build();
95+
}
96+
97+
public static SlackIconObject slackIcon(String name) {
98+
return SlackIconObject.builder().name(name).build();
99+
}
90100
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.slack.api.model.block.composition;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
/**
9+
* Defines a built-in Slack icon that can be displayed next to the title and subtitle of a card block.
10+
*
11+
* @see <a href="https://docs.slack.dev/reference/block-kit/composition-objects/slack-icon-object">document</a>
12+
*/
13+
@Data
14+
@Builder
15+
@NoArgsConstructor
16+
@AllArgsConstructor
17+
public class SlackIconObject {
18+
public static final String TYPE = "icon";
19+
private final String type = TYPE;
20+
21+
/**
22+
* The name of the built-in Slack icon.
23+
*/
24+
private String name;
25+
}

0 commit comments

Comments
 (0)