Class Attachment
- java.lang.Object
-
- com.slack.api.model.Attachment
-
public class Attachment extends Object
https://api.slack.com/docs/message-attachments
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Attachment.AttachmentBuilder
static class
Attachment.AttachmentMetadata
static class
Attachment.MessageBlock
static class
Attachment.Preview
static class
Attachment.VideoHtml
-
Constructor Summary
Constructors Constructor Description Attachment()
Attachment(String msgSubtype, String fallback, String callbackId, String color, Boolean hideColor, String pretext, String serviceUrl, String serviceName, String serviceIcon, String authorId, String authorName, String authorLink, String authorIcon, String fromUrl, String originalUrl, String authorSubname, String channelId, String channelName, String channelTeam, Integer id, String appId, String botId, Boolean indent, Boolean msgUnfurl, Boolean replyUnfurl, Boolean threadRootUnfurl, Boolean appUnfurl, String appUnfurlUrl, String title, String titleLink, String text, List<Field> fields, String imageUrl, Integer imageWidth, Integer imageHeight, Integer imageBytes, String thumbUrl, Integer thumbWidth, Integer thumbHeight, String videoUrl, Attachment.VideoHtml videoHtml, Integer videoHtmlWidth, Integer videoHtmlHeight, String footer, String footerIcon, String ts, List<String> mrkdwnIn, List<Action> actions, List<LayoutBlock> blocks, List<Attachment.MessageBlock> messageBlocks, Attachment.Preview preview, List<File> files, String filename, Integer size, String mimetype, String url, Attachment.AttachmentMetadata metadata, Boolean fileAttachment)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Attachment.AttachmentBuilder
builder()
protected boolean
canEqual(Object other)
boolean
equals(Object o)
List<Action>
getActions()
Actions are defined as an array, and hashes contained within it will be displayed in as buttons in the message attachment.String
getAppId()
String
getAppUnfurlUrl()
String
getAuthorIcon()
A valid URL that displays a small 16x16px image to the left of the author_name text.String
getAuthorId()
String
getAuthorLink()
A valid URL that will hyperlink the author_name text mentioned above.String
getAuthorName()
Small text used to display the author's name.String
getAuthorSubname()
List<LayoutBlock>
getBlocks()
String
getBotId()
String
getCallbackId()
This is optional value that specifies callback id when there are buttons.String
getChannelId()
String
getChannelName()
String
getChannelTeam()
String
getColor()
Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.String
getFallback()
A plain-text summary of the attachment.List<Field>
getFields()
Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.String
getFilename()
List<File>
getFiles()
String
getFooter()
Add some brief text to help contextualize and identify an attachment.String
getFooterIcon()
To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field.String
getFromUrl()
Boolean
getHideColor()
Integer
getId()
Integer
getImageBytes()
Integer
getImageHeight()
String
getImageUrl()
A valid URL to an image file that will be displayed inside a message attachment.Integer
getImageWidth()
List<Attachment.MessageBlock>
getMessageBlocks()
Attachment.AttachmentMetadata
getMetadata()
String
getMimetype()
List<String>
getMrkdwnIn()
By default, message text in attachments are not formatted.String
getMsgSubtype()
String
getOriginalUrl()
String
getPretext()
This is optional text that appears above the message attachment block.Attachment.Preview
getPreview()
String
getServiceIcon()
String
getServiceName()
String
getServiceUrl()
Integer
getSize()
String
getText()
This is the main text in a message attachment, and can contain standard message markup (see details below).Integer
getThumbHeight()
String
getThumbUrl()
A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment.Integer
getThumbWidth()
String
getTitle()
The title is displayed as larger, bold text near the top of a message attachment.String
getTitleLink()
The title is displayed as larger, bold text near the top of a message attachment.String
getTs()
ts (timestamp) Does your attachment relate to something happening at a specific time?String
getUrl()
Attachment.VideoHtml
getVideoHtml()
Integer
getVideoHtmlHeight()
Integer
getVideoHtmlWidth()
String
getVideoUrl()
int
hashCode()
Boolean
isAppUnfurl()
Boolean
isFileAttachment()
Boolean
isIndent()
Boolean
isMsgUnfurl()
Boolean
isReplyUnfurl()
Boolean
isThreadRootUnfurl()
void
setActions(List<Action> actions)
Actions are defined as an array, and hashes contained within it will be displayed in as buttons in the message attachment.void
setAppId(String appId)
void
setAppUnfurl(Boolean appUnfurl)
void
setAppUnfurlUrl(String appUnfurlUrl)
void
setAuthorIcon(String authorIcon)
A valid URL that displays a small 16x16px image to the left of the author_name text.void
setAuthorId(String authorId)
void
setAuthorLink(String authorLink)
A valid URL that will hyperlink the author_name text mentioned above.void
setAuthorName(String authorName)
Small text used to display the author's name.void
setAuthorSubname(String authorSubname)
void
setBlocks(List<LayoutBlock> blocks)
void
setBotId(String botId)
void
setCallbackId(String callbackId)
This is optional value that specifies callback id when there are buttons.void
setChannelId(String channelId)
void
setChannelName(String channelName)
void
setChannelTeam(String channelTeam)
void
setColor(String color)
Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.void
setFallback(String fallback)
A plain-text summary of the attachment.void
setFields(List<Field> fields)
Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.void
setFileAttachment(Boolean fileAttachment)
void
setFilename(String filename)
void
setFiles(List<File> files)
void
setFooter(String footer)
Add some brief text to help contextualize and identify an attachment.void
setFooterIcon(String footerIcon)
To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field.void
setFromUrl(String fromUrl)
void
setHideColor(Boolean hideColor)
void
setId(Integer id)
void
setImageBytes(Integer imageBytes)
void
setImageHeight(Integer imageHeight)
void
setImageUrl(String imageUrl)
A valid URL to an image file that will be displayed inside a message attachment.void
setImageWidth(Integer imageWidth)
void
setIndent(Boolean indent)
void
setMessageBlocks(List<Attachment.MessageBlock> messageBlocks)
void
setMetadata(Attachment.AttachmentMetadata metadata)
void
setMimetype(String mimetype)
void
setMrkdwnIn(List<String> mrkdwnIn)
By default, message text in attachments are not formatted.void
setMsgSubtype(String msgSubtype)
void
setMsgUnfurl(Boolean msgUnfurl)
void
setOriginalUrl(String originalUrl)
void
setPretext(String pretext)
This is optional text that appears above the message attachment block.void
setPreview(Attachment.Preview preview)
void
setReplyUnfurl(Boolean replyUnfurl)
void
setServiceIcon(String serviceIcon)
void
setServiceName(String serviceName)
void
setServiceUrl(String serviceUrl)
void
setSize(Integer size)
void
setText(String text)
This is the main text in a message attachment, and can contain standard message markup (see details below).void
setThreadRootUnfurl(Boolean threadRootUnfurl)
void
setThumbHeight(Integer thumbHeight)
void
setThumbUrl(String thumbUrl)
A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment.void
setThumbWidth(Integer thumbWidth)
void
setTitle(String title)
The title is displayed as larger, bold text near the top of a message attachment.void
setTitleLink(String titleLink)
The title is displayed as larger, bold text near the top of a message attachment.void
setTs(String ts)
ts (timestamp) Does your attachment relate to something happening at a specific time?void
setUrl(String url)
void
setVideoHtml(Attachment.VideoHtml videoHtml)
void
setVideoHtmlHeight(Integer videoHtmlHeight)
void
setVideoHtmlWidth(Integer videoHtmlWidth)
void
setVideoUrl(String videoUrl)
String
toString()
-
-
-
Constructor Detail
-
Attachment
public Attachment()
-
Attachment
public Attachment(String msgSubtype, String fallback, String callbackId, String color, Boolean hideColor, String pretext, String serviceUrl, String serviceName, String serviceIcon, String authorId, String authorName, String authorLink, String authorIcon, String fromUrl, String originalUrl, String authorSubname, String channelId, String channelName, String channelTeam, Integer id, String appId, String botId, Boolean indent, Boolean msgUnfurl, Boolean replyUnfurl, Boolean threadRootUnfurl, Boolean appUnfurl, String appUnfurlUrl, String title, String titleLink, String text, List<Field> fields, String imageUrl, Integer imageWidth, Integer imageHeight, Integer imageBytes, String thumbUrl, Integer thumbWidth, Integer thumbHeight, String videoUrl, Attachment.VideoHtml videoHtml, Integer videoHtmlWidth, Integer videoHtmlHeight, String footer, String footerIcon, String ts, List<String> mrkdwnIn, List<Action> actions, List<LayoutBlock> blocks, List<Attachment.MessageBlock> messageBlocks, Attachment.Preview preview, List<File> files, String filename, Integer size, String mimetype, String url, Attachment.AttachmentMetadata metadata, Boolean fileAttachment)
-
-
Method Detail
-
isIndent
public Boolean isIndent()
-
setIndent
public void setIndent(Boolean indent)
-
isMsgUnfurl
public Boolean isMsgUnfurl()
-
setMsgUnfurl
public void setMsgUnfurl(Boolean msgUnfurl)
-
isReplyUnfurl
public Boolean isReplyUnfurl()
-
setReplyUnfurl
public void setReplyUnfurl(Boolean replyUnfurl)
-
isThreadRootUnfurl
public Boolean isThreadRootUnfurl()
-
setThreadRootUnfurl
public void setThreadRootUnfurl(Boolean threadRootUnfurl)
-
isAppUnfurl
public Boolean isAppUnfurl()
-
setAppUnfurl
public void setAppUnfurl(Boolean appUnfurl)
-
isFileAttachment
public Boolean isFileAttachment()
-
setFileAttachment
public void setFileAttachment(Boolean fileAttachment)
-
builder
public static Attachment.AttachmentBuilder builder()
-
getMsgSubtype
public String getMsgSubtype()
-
getFallback
public String getFallback()
A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (e.g. IRC, mobile notifications) and should not contain any markup.
-
getCallbackId
public String getCallbackId()
This is optional value that specifies callback id when there are buttons.
-
getColor
public String getColor()
Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.An optional value that can either be one of good, warning, danger, or any hex color code (eg. #439FE0). This value is used to color the border along the left side of the message attachment.
-
getHideColor
public Boolean getHideColor()
-
getPretext
public String getPretext()
This is optional text that appears above the message attachment block.
-
getServiceUrl
public String getServiceUrl()
-
getServiceName
public String getServiceName()
-
getServiceIcon
public String getServiceIcon()
-
getAuthorId
public String getAuthorId()
-
getAuthorName
public String getAuthorName()
Small text used to display the author's name.
-
getAuthorLink
public String getAuthorLink()
A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present.
-
getAuthorIcon
public String getAuthorIcon()
A valid URL that displays a small 16x16px image to the left of the author_name text. Will only work if author_name is present.
-
getFromUrl
public String getFromUrl()
-
getOriginalUrl
public String getOriginalUrl()
-
getAuthorSubname
public String getAuthorSubname()
-
getChannelId
public String getChannelId()
-
getChannelName
public String getChannelName()
-
getChannelTeam
public String getChannelTeam()
-
getId
public Integer getId()
-
getAppId
public String getAppId()
-
getBotId
public String getBotId()
-
getAppUnfurlUrl
public String getAppUnfurlUrl()
-
getTitle
public String getTitle()
The title is displayed as larger, bold text near the top of a message attachment. By passing a valid URL in the title_link parameter (optional), the title text will be hyperlinked.
-
getTitleLink
public String getTitleLink()
The title is displayed as larger, bold text near the top of a message attachment. By passing a valid URL in the title_link parameter (optional), the title text will be hyperlinked.
-
getText
public String getText()
This is the main text in a message attachment, and can contain standard message markup (see details below). The content will automatically collapse if it contains 700+ characters or 5+ linebreaks, and will display a "Show more..." link to expand the content.https://api.slack.com/docs/message-attachments#message_formatting
-
getFields
public List<Field> getFields()
Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.
-
getImageUrl
public String getImageUrl()
A valid URL to an image file that will be displayed inside a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.Large images will be resized to a maximum width of 400px or a maximum height of 500px, while still maintaining the original aspect ratio.
-
getImageWidth
public Integer getImageWidth()
-
getImageHeight
public Integer getImageHeight()
-
getImageBytes
public Integer getImageBytes()
-
getThumbUrl
public String getThumbUrl()
A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.The thumbnail's longest dimension will be scaled down to 75px while maintaining the aspect ratio of the image. The filesize of the image must also be less than 500 KB.
For best results, please use images that are already 75px by 75px.
-
getThumbWidth
public Integer getThumbWidth()
-
getThumbHeight
public Integer getThumbHeight()
-
getVideoUrl
public String getVideoUrl()
-
getVideoHtml
public Attachment.VideoHtml getVideoHtml()
-
getVideoHtmlWidth
public Integer getVideoHtmlWidth()
-
getVideoHtmlHeight
public Integer getVideoHtmlHeight()
-
getFooter
public String getFooter()
Add some brief text to help contextualize and identify an attachment. Limited to 300 characters, and may be truncated further when displayed to users in environments with limited screen real estate.
-
getFooterIcon
public String getFooterIcon()
To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field. You must also provide a footer for the field to be recognized.We'll render what you provide at 16px by 16px. It's best to use an image that is similarly sized.
-
getTs
public String getTs()
ts (timestamp) Does your attachment relate to something happening at a specific time?By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.
Use ts when referencing articles or happenings. Your message will have its own timestamp when published.
-
getMrkdwnIn
public List<String> getMrkdwnIn()
By default, message text in attachments are not formatted. To enable formatting on attachment fields, add the name of the field (as defined in the API) in this list.
-
getActions
public List<Action> getActions()
Actions are defined as an array, and hashes contained within it will be displayed in as buttons in the message attachment.
-
getBlocks
public List<LayoutBlock> getBlocks()
-
getMessageBlocks
public List<Attachment.MessageBlock> getMessageBlocks()
-
getPreview
public Attachment.Preview getPreview()
-
getFilename
public String getFilename()
-
getSize
public Integer getSize()
-
getMimetype
public String getMimetype()
-
getUrl
public String getUrl()
-
getMetadata
public Attachment.AttachmentMetadata getMetadata()
-
setMsgSubtype
public void setMsgSubtype(String msgSubtype)
-
setFallback
public void setFallback(String fallback)
A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (e.g. IRC, mobile notifications) and should not contain any markup.
-
setCallbackId
public void setCallbackId(String callbackId)
This is optional value that specifies callback id when there are buttons.
-
setColor
public void setColor(String color)
Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.An optional value that can either be one of good, warning, danger, or any hex color code (eg. #439FE0). This value is used to color the border along the left side of the message attachment.
-
setHideColor
public void setHideColor(Boolean hideColor)
-
setPretext
public void setPretext(String pretext)
This is optional text that appears above the message attachment block.
-
setServiceUrl
public void setServiceUrl(String serviceUrl)
-
setServiceName
public void setServiceName(String serviceName)
-
setServiceIcon
public void setServiceIcon(String serviceIcon)
-
setAuthorId
public void setAuthorId(String authorId)
-
setAuthorName
public void setAuthorName(String authorName)
Small text used to display the author's name.
-
setAuthorLink
public void setAuthorLink(String authorLink)
A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present.
-
setAuthorIcon
public void setAuthorIcon(String authorIcon)
A valid URL that displays a small 16x16px image to the left of the author_name text. Will only work if author_name is present.
-
setFromUrl
public void setFromUrl(String fromUrl)
-
setOriginalUrl
public void setOriginalUrl(String originalUrl)
-
setAuthorSubname
public void setAuthorSubname(String authorSubname)
-
setChannelId
public void setChannelId(String channelId)
-
setChannelName
public void setChannelName(String channelName)
-
setChannelTeam
public void setChannelTeam(String channelTeam)
-
setId
public void setId(Integer id)
-
setAppId
public void setAppId(String appId)
-
setBotId
public void setBotId(String botId)
-
setAppUnfurlUrl
public void setAppUnfurlUrl(String appUnfurlUrl)
-
setTitle
public void setTitle(String title)
The title is displayed as larger, bold text near the top of a message attachment. By passing a valid URL in the title_link parameter (optional), the title text will be hyperlinked.
-
setTitleLink
public void setTitleLink(String titleLink)
The title is displayed as larger, bold text near the top of a message attachment. By passing a valid URL in the title_link parameter (optional), the title text will be hyperlinked.
-
setText
public void setText(String text)
This is the main text in a message attachment, and can contain standard message markup (see details below). The content will automatically collapse if it contains 700+ characters or 5+ linebreaks, and will display a "Show more..." link to expand the content.https://api.slack.com/docs/message-attachments#message_formatting
-
setFields
public void setFields(List<Field> fields)
Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.
-
setImageUrl
public void setImageUrl(String imageUrl)
A valid URL to an image file that will be displayed inside a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.Large images will be resized to a maximum width of 400px or a maximum height of 500px, while still maintaining the original aspect ratio.
-
setImageWidth
public void setImageWidth(Integer imageWidth)
-
setImageHeight
public void setImageHeight(Integer imageHeight)
-
setImageBytes
public void setImageBytes(Integer imageBytes)
-
setThumbUrl
public void setThumbUrl(String thumbUrl)
A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.The thumbnail's longest dimension will be scaled down to 75px while maintaining the aspect ratio of the image. The filesize of the image must also be less than 500 KB.
For best results, please use images that are already 75px by 75px.
-
setThumbWidth
public void setThumbWidth(Integer thumbWidth)
-
setThumbHeight
public void setThumbHeight(Integer thumbHeight)
-
setVideoUrl
public void setVideoUrl(String videoUrl)
-
setVideoHtml
public void setVideoHtml(Attachment.VideoHtml videoHtml)
-
setVideoHtmlWidth
public void setVideoHtmlWidth(Integer videoHtmlWidth)
-
setVideoHtmlHeight
public void setVideoHtmlHeight(Integer videoHtmlHeight)
-
setFooter
public void setFooter(String footer)
Add some brief text to help contextualize and identify an attachment. Limited to 300 characters, and may be truncated further when displayed to users in environments with limited screen real estate.
-
setFooterIcon
public void setFooterIcon(String footerIcon)
To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field. You must also provide a footer for the field to be recognized.We'll render what you provide at 16px by 16px. It's best to use an image that is similarly sized.
-
setTs
public void setTs(String ts)
ts (timestamp) Does your attachment relate to something happening at a specific time?By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.
Use ts when referencing articles or happenings. Your message will have its own timestamp when published.
-
setMrkdwnIn
public void setMrkdwnIn(List<String> mrkdwnIn)
By default, message text in attachments are not formatted. To enable formatting on attachment fields, add the name of the field (as defined in the API) in this list.
-
setActions
public void setActions(List<Action> actions)
Actions are defined as an array, and hashes contained within it will be displayed in as buttons in the message attachment.
-
setBlocks
public void setBlocks(List<LayoutBlock> blocks)
-
setMessageBlocks
public void setMessageBlocks(List<Attachment.MessageBlock> messageBlocks)
-
setPreview
public void setPreview(Attachment.Preview preview)
-
setFilename
public void setFilename(String filename)
-
setSize
public void setSize(Integer size)
-
setMimetype
public void setMimetype(String mimetype)
-
setUrl
public void setUrl(String url)
-
setMetadata
public void setMetadata(Attachment.AttachmentMetadata metadata)
-
canEqual
protected boolean canEqual(Object other)
-
-