LinkAttachmentPayload
Represents a payload for attachments with .linkPreview
type.
public struct LinkAttachmentPayload: AttachmentPayload
Inheritance
AttachmentPayload
, Decodable
, Encodable
Initializers
init(from:)
public init(from decoder: Decoder) throws
Properties
type
An attachment type all LinkAttachmentPayload
instances conform to. Is set to .linkPreview
.
public static let type: AttachmentType = .linkPreview
originalURL
An original URL
that was included into the message text and then enriched.
public var originalURL: URL
title
A title (e.g video name in case of enriched YouTube
link or song name in case of Spotify
link).
public var title: String?
text
A text, usually description of the link content.
public var text: String?
author
An author, usually the link origin. (for example YouTube
, Spotify
)
public var author: String?
titleLink
A link for displaying an attachment. Can be different from the original link, depends on the enriching rules.
public var titleLink: URL?
assetURL
An image.
public var assetURL: URL?
previewURL
A preview image URL.
public var previewURL: URL?
Methods
encode(to:)
public func encode(to encoder: Encoder) throws