ImageAttachmentPayload
Represents a payload for attachments with .image
type.
public struct ImageAttachmentPayload: AttachmentPayload
Inheritance
AttachmentPayload
, Decodable
, Encodable
Initializers
init(from:)
public init(from decoder: Decoder) throws
Properties
type
An attachment type all ImageAttachmentPayload
instances conform to. Is set to .image
.
public static let type: AttachmentType = .image
title
A title, usually the name of the image.
public var title: String?
imageURL
A link to the image.
public var imageURL: URL
imagePreviewURL
A link to the image preview.
public var imagePreviewURL: URL
extraData
An extra data.
public var extraData: [String: RawJSON]?
Methods
extraData(ofType:)
Decodes extra data as an instance of the given type.
public func extraData<T: Decodable>(ofType: T.Type = T.self) -> T?
Parameters
ofType
: The type an extra data should be decoded as.
Returns
Extra data of the given type or nil
if decoding fails.
encode(to:)
public func encode(to encoder: Encoder) throws