Skip to main content

FileAttachmentPayload

Represents a payload for attachments with .file type.

public struct FileAttachmentPayload: AttachmentPayload 

Inheritance

AttachmentPayload, Decodable, Encodable

Initializers

init(from:)

public init(from decoder: Decoder) throws 

Properties

type

An attachment type all FileAttachmentPayload instances conform to. Is set to .file.

public static let type: AttachmentType = .file

title

A title, usually the name of the file.

public var title: String?

assetURL

A link to the file.

public var assetURL: URL

file

The file itself.

public var file: AttachmentFile

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 

Did you find this page helpful?