|
| 1 | +package com.slack.api.model.block; |
| 2 | + |
| 3 | +import com.slack.api.model.block.composition.SlackIconObject; |
| 4 | +import com.slack.api.model.block.composition.TextObject; |
| 5 | +import com.slack.api.model.block.element.BlockElement; |
| 6 | +import com.slack.api.model.block.element.ImageElement; |
| 7 | +import lombok.AllArgsConstructor; |
| 8 | +import lombok.Builder; |
| 9 | +import lombok.Data; |
| 10 | +import lombok.NoArgsConstructor; |
| 11 | + |
| 12 | +import java.util.List; |
| 13 | + |
| 14 | +/** |
| 15 | + * A card is a layout block used to display a compact, structured summary of content. It can be used on |
| 16 | + * its own or grouped together inside a {@link CarouselBlock carousel}. At least one of {@code heroImage}, |
| 17 | + * {@code title}, {@code actions}, or {@code body} must be provided. |
| 18 | + * |
| 19 | + * https://docs.slack.dev/reference/block-kit/blocks/card-block |
| 20 | + */ |
| 21 | +@Data |
| 22 | +@Builder |
| 23 | +@NoArgsConstructor |
| 24 | +@AllArgsConstructor |
| 25 | +public class CardBlock implements LayoutBlock { |
| 26 | + public static final String TYPE = "card"; |
| 27 | + private final String type = TYPE; |
| 28 | + |
| 29 | + /** |
| 30 | + * A top banner image for the card in the form of an image element. |
| 31 | + * The image URL may be up to 3000 characters and the alt text up to 2000 characters. |
| 32 | + */ |
| 33 | + private ImageElement heroImage; |
| 34 | + |
| 35 | + /** |
| 36 | + * A small icon displayed next to the title and subtitle in the form of an image element. |
| 37 | + * The image URL may be up to 3000 characters and the alt text up to 2000 characters. |
| 38 | + * Mutually exclusive with {@code slackIcon}. |
| 39 | + */ |
| 40 | + private ImageElement icon; |
| 41 | + |
| 42 | + /** |
| 43 | + * A built-in Slack icon displayed next to the title and subtitle. |
| 44 | + * Mutually exclusive with {@code icon}. |
| 45 | + */ |
| 46 | + private SlackIconObject slackIcon; |
| 47 | + |
| 48 | + /** |
| 49 | + * The title of the card. Maximum length for the text in this field is 150 characters. |
| 50 | + */ |
| 51 | + private TextObject title; |
| 52 | + |
| 53 | + /** |
| 54 | + * The subtitle of the card. Maximum length for the text in this field is 150 characters. |
| 55 | + */ |
| 56 | + private TextObject subtitle; |
| 57 | + |
| 58 | + /** |
| 59 | + * The body text of the card. Maximum length for the text in this field is 200 characters. |
| 60 | + */ |
| 61 | + private TextObject body; |
| 62 | + |
| 63 | + /** |
| 64 | + * Secondary text displayed beneath the body of the card. Maximum length for the text in this field |
| 65 | + * is 200 characters. |
| 66 | + */ |
| 67 | + private TextObject subtext; |
| 68 | + |
| 69 | + /** |
| 70 | + * Interactive elements (such as buttons) displayed at the bottom of the card. Up to 3 buttons. |
| 71 | + */ |
| 72 | + private List<BlockElement> actions; |
| 73 | + |
| 74 | + private String blockId; |
| 75 | +} |
0 commit comments