ShoppingCrawler/sender/src/main/java/com/myoa/engineering/crawl/ppomppu/sender/dto/SlackSectionMessageBlock.java

50 lines
1.4 KiB
Java

package com.myoa.engineering.crawl.ppomppu.sender.dto;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
/**
* SectionBlock
* @author Shin Woo-jin (woo-jin.shin@linecorp.com)
* @since 2021-11-30
*
*/
@Getter
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SlackSectionBlock implements Serializable {
private static final long serialVersionUID = -7600944576753160168L;
private SlackMessageBlockType type;
private SlackMessageBlock text;
@Builder
private SlackSectionBlock(SlackMessageBlockType type, SlackMessageBlock text) {
this.type = type;
this.text = text;
}
public static SlackSectionBlock ofMarkDown(String message) {
return SlackSectionBlock.builder()
.type(SlackMessageBlockType.SECTION)
.text(SlackMessageBlock.ofMarkDown(message))
.build();
}
public static SlackSectionBlock ofDivider() {
return SlackSectionBlock.builder()
.type(SlackMessageBlockType.SECTION)
.text(SlackMessageBlock.ofDivider())
.build();
}
public String getType() {
return type.getType();
}
}