AudioAttachmentPayload
Represents a payload for attachments with .media
type.
public struct AudioAttachmentPayload: AttachmentPayload
Inheritance
AttachmentPayload
, Decodable
, Encodable
Initializers
init(from:)
public init(from decoder: Decoder) throws
Properties
type
An attachment type all MediaAttachmentPayload
instances conform to. Is set to .audio
.
public static let type: AttachmentType = .audio
title
A title, usually the name of the audio.
public var title: String?
audioURL
A link to the audio.
public var audioURL: URL
file
The audio 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