-
- All Implemented Interfaces:
-
io.getstream.chat.android.models.CustomObject
public final class Attachment implements CustomObject
Represents an attachment. Most commonly these are files, images, videos and audio recordings, but the class is flexible enough that it can represent other things as well such as a date, a given location or other things.
If you want to create a custom attachment we suggest you use extraData to store the information you need.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classAttachment.UploadStateRepresents various states in attachment upload lifecycle.
-
Field Summary
Fields Modifier and Type Field Description private StringauthorNameprivate StringauthorLinkprivate StringtitleLinkprivate StringthumbUrlprivate StringimageUrlprivate StringassetUrlprivate StringogUrlprivate StringmimeTypeprivate IntegerfileSizeprivate Stringtitleprivate Stringtextprivate Stringtypeprivate Stringimageprivate Stringurlprivate Stringnameprivate Stringfallbackprivate IntegeroriginalHeightprivate IntegeroriginalWidthprivate Fileuploadprivate Attachment.UploadStateuploadStateprivate Map<String, Object>extraData
-
Constructor Summary
Constructors Constructor Description Attachment(String authorName, String authorLink, String titleLink, String thumbUrl, String imageUrl, String assetUrl, String ogUrl, String mimeType, Integer fileSize, String title, String text, String type, String image, String url, String name, String fallback, Integer originalHeight, Integer originalWidth, File upload, Attachment.UploadState uploadState, Map<String, Object> extraData)
-
Method Summary
-
-
Constructor Detail
-
Attachment
Attachment(String authorName, String authorLink, String titleLink, String thumbUrl, String imageUrl, String assetUrl, String ogUrl, String mimeType, Integer fileSize, String title, String text, String type, String image, String url, String name, String fallback, Integer originalHeight, Integer originalWidth, File upload, Attachment.UploadState uploadState, Map<String, Object> extraData)
- Parameters:
authorName- The name of the site the URL leads to.authorLink- The link to the website.titleLink- The link to the URL or the resource linked.thumbUrl- The URL for the thumbnail version of the attachment, given the attachment has a visual quality, e.g.imageUrl- The URL for the raw version of the attachment.assetUrl- The URL for the asset.ogUrl- The original link that was enriched.mimeType- The mime type of the given attachment.fileSize- The size of the given attachment.title- The title of the attachment.text- The page description.type- The type of the attachment.image- The image attachment.fallback- Alternative description in the case on an image attachment (img alt in HTML).originalHeight- The original height of the attachment.originalWidth- The original width of the attachment.uploadState- The state of the upload, i.e.extraData- Stores various extra information that can be sent when uploading the attachment or read when downloading it.
-
-
Method Detail
-
getAuthorName
final String getAuthorName()
-
setAuthorName
final Unit setAuthorName(String authorName)
- Parameters:
authorName- The name of the site the URL leads to.
-
getAuthorLink
final String getAuthorLink()
-
setAuthorLink
final Unit setAuthorLink(String authorLink)
- Parameters:
authorLink- The link to the website.
-
getTitleLink
final String getTitleLink()
-
setTitleLink
final Unit setTitleLink(String titleLink)
- Parameters:
titleLink- The link to the URL or the resource linked.
-
getThumbUrl
final String getThumbUrl()
-
setThumbUrl
final Unit setThumbUrl(String thumbUrl)
- Parameters:
thumbUrl- The URL for the thumbnail version of the attachment, given the attachment has a visual quality, e.g.
-
getImageUrl
final String getImageUrl()
-
setImageUrl
final Unit setImageUrl(String imageUrl)
- Parameters:
imageUrl- The URL for the raw version of the attachment.
-
getAssetUrl
final String getAssetUrl()
-
setAssetUrl
final Unit setAssetUrl(String assetUrl)
- Parameters:
assetUrl- The URL for the asset.
-
getMimeType
final String getMimeType()
-
setMimeType
final Unit setMimeType(String mimeType)
- Parameters:
mimeType- The mime type of the given attachment.
-
getFileSize
final Integer getFileSize()
-
setFileSize
final Unit setFileSize(Integer fileSize)
- Parameters:
fileSize- The size of the given attachment.
-
getFallback
final String getFallback()
-
setFallback
final Unit setFallback(String fallback)
- Parameters:
fallback- Alternative description in the case on an image attachment (img alt in HTML).
-
getOriginalHeight
final Integer getOriginalHeight()
-
setOriginalHeight
final Unit setOriginalHeight(Integer originalHeight)
- Parameters:
originalHeight- The original height of the attachment.
-
getOriginalWidth
final Integer getOriginalWidth()
-
setOriginalWidth
final Unit setOriginalWidth(Integer originalWidth)
- Parameters:
originalWidth- The original width of the attachment.
-
getUpload
final File getUpload()
The local file to upload when the attachment is sent. The url property will be populated with the URL of the uploaded file when done.
Leaving this property empty means that there is no file to upload for this attachment.
-
setUpload
final Unit setUpload(File upload)
The local file to upload when the attachment is sent. The url property will be populated with the URL of the uploaded file when done.
Leaving this property empty means that there is no file to upload for this attachment.
-
getUploadState
final Attachment.UploadState getUploadState()
-
setUploadState
final Unit setUploadState(Attachment.UploadState uploadState)
- Parameters:
uploadState- The state of the upload, i.e.
-
getExtraData
Map<String, Object> getExtraData()
-
setExtraData
Unit setExtraData(Map<String, Object> extraData)
- Parameters:
extraData- Stores various extra information that can be sent when uploading the attachment or read when downloading it.
-
-
-
-