Attachment

data class Attachment(    var authorName: String? = null,     var authorLink: String? = null,     var titleLink: String? = null,     var thumbUrl: String? = null,     var imageUrl: String? = null,     var assetUrl: String? = null,     var ogUrl: String? = null,     var mimeType: String? = null,     var fileSize: Int = 0,     var title: String? = null,     var text: String? = null,     var type: String? = null,     var image: String? = null,     var url: String? = null,     var name: String? = null,     var fallback: String? = null,     var originalHeight: Int? = null,     var originalWidth: Int? = null,     var upload: File? = null,     var uploadState: Attachment.UploadState? = null,     var extraData: MutableMap<String, Any> = mutableMapOf()) : 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.

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. is a video, an image, a link to a website or similar.

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. e.g. "image/jpeg"

fileSize

The size of the given attachment.

title

The title of the attachment.

text

The page description.

type

The type of the attachment. e.g "file", "image, "audio".

image

The image attachment.

fallback

Alternative description in the case of an image attachment (img alt in HTML).

originalHeight

The original height of the attachment. Provided if the attachment is of type "image".

originalWidth

The original width of the attachment. Provided if the attachment is of type "image".

upload

The local file that will be uploaded when the attachment is sent.

uploadState

The state of the upload, i.e. the current progress of uploading the file.

extraData

Stores various extra information that can be sent when uploading the attachment or read when downloading it.

Constructors

Link copied to clipboard
fun Attachment(    authorName: String? = null,     authorLink: String? = null,     titleLink: String? = null,     thumbUrl: String? = null,     imageUrl: String? = null,     assetUrl: String? = null,     ogUrl: String? = null,     mimeType: String? = null,     fileSize: Int = 0,     title: String? = null,     text: String? = null,     type: String? = null,     image: String? = null,     url: String? = null,     name: String? = null,     fallback: String? = null,     originalHeight: Int? = null,     originalWidth: Int? = null,     upload: File? = null,     uploadState: Attachment.UploadState? = null,     extraData: MutableMap<String, Any> = mutableMapOf())

Types

Link copied to clipboard
sealed class UploadState

Represents various states in attachment upload lifecycle.

Properties

Link copied to clipboard
var assetUrl: String? = null
Link copied to clipboard
var authorLink: String? = null
Link copied to clipboard
var authorName: String? = null
Link copied to clipboard
open override var extraData: MutableMap<String, Any>
Link copied to clipboard
var fallback: String? = null
Link copied to clipboard
var fileSize: Int = 0
Link copied to clipboard
var image: String? = null
Link copied to clipboard
var imageUrl: String? = null
Link copied to clipboard
var mimeType: String? = null
Link copied to clipboard
var name: String? = null
Link copied to clipboard
var ogUrl: String? = null
Link copied to clipboard
var originalHeight: Int? = null
Link copied to clipboard
var originalWidth: Int? = null
Link copied to clipboard
var text: String? = null
Link copied to clipboard
var thumbUrl: String? = null
Link copied to clipboard
var title: String? = null
Link copied to clipboard
var titleLink: String? = null
Link copied to clipboard
var type: String? = null
Link copied to clipboard
var upload: File? = null

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.

Link copied to clipboard
var uploadState: Attachment.UploadState? = null
Link copied to clipboard
var url: String? = null

Inherited functions

Link copied to clipboard
open fun <T> getExtraValue(key: String, default: T): T
Link copied to clipboard
open fun putExtraValue(key: String, value: Any)

Extensions

Link copied to clipboard
var Attachment.uploadId: String?