ForstaPayloadV1
public struct ForstaPayloadV1 : CustomStringConvertible, Codable
A convenience wrapper for consuming/producing v1 of the Forsta message exchange JSON payload (see https://bit.ly/forsta-payload for details)
-
Initialize with an (optional) JSON payload string
Declaration
Swift
public init(_ jsonString: String? = nil)
-
The Forsta message exchange payload version
Declaration
Swift
public var version: Int? -
The message’s globally-unique ID (required)
Declaration
Swift
public var messageId: UUID? -
A reference to another message, by ID (useful for message replies, or survey responses)
Declaration
Swift
public var messageRef: UUID? -
Optionally override the origin of the message if different from source
Declaration
Swift
public var sender: ForstaPayloadV1.Address? -
The type of payload this is (required)
Declaration
Swift
public var messageType: ForstaPayloadV1.MessageType? -
Any relevant details for this message
Declaration
Swift
public var data: ForstaPayloadV1.DataElement? -
The message’s distribution (required)
Declaration
Swift
public var distribution: ForstaPayloadV1.Distribution? -
The globally-unique thread ID (required)
Declaration
Swift
public var threadId: UUID? -
The thread title (optional)
Declaration
Swift
public var threadTitle: String? -
The thread type
Declaration
Swift
public var threadType: ForstaPayloadV1.ThreadType? -
The user agent sending this message (optional)
Declaration
Swift
public var userAgent: String? -
The identity-key-based signature for the essential parts of this message (useful for trusting forwarded/shared/replayed messages).
The signed text is the concatenation of:
- timestamp message ID from the envelope
- distribution expression (i.e., a universal expression string yielded by Atlas)
- messageId (lowercase UUID string)
- threadId (lowercase UUID string)
- messageRef (lowercase UUID string or empty)
- the values of any body item(s), in order
- the hashes (sha512 in base64) of any attachements, in order
Declaration
Swift
public var signature: Data?
-
Declaration
Swift
public struct DataElement : Codable -
The schema for
See more.data.messages(only relevant for.controlmessges of type.syncResponse)Declaration
Swift
public struct SyncMessage : Codable -
The schema for
See more.data.knownContactsDeclaration
Swift
public struct KnownContact : Codable -
The schema for
See more.data.knownThreadsDeclaration
Swift
public struct KnownThread : Codable -
Declaration
Swift
public struct Address : Codable -
Declaration
Swift
public struct Body : Codable -
Declaration
Swift
public struct ThreadUpdate : Codable -
Declaration
Swift
public struct IceCandidate : Codable -
Declaration
Swift
public struct SDP : Codable -
Declaration
Swift
public struct Attachment : Codable -
The schema for
See more.distributionDeclaration
Swift
public struct Distribution : Codable
-
Directly manipulate the (presumed only) plain-text entry in the
.data.bodyarrayDeclaration
Swift
public var bodyPlain: String? { get set } -
Directly manipulate the (presumed only) HTML entry in the
.data.bodyarrayDeclaration
Swift
public var bodyHtml: String? { get set } -
Alias for
.data.control– the type of this control message (meaningful only for.controlmessages)Declaration
Swift
public var controlType: ControlType? { get set } -
Alias for
.distribution.expression– the tag-math distribution expression for this message (required)Declaration
Swift
public var threadExpression: String? { get set } -
Alias for
.data.readMark(only relevant for.controlmessages of type.readMark)Declaration
Swift
public var readMark: Date? { get set } -
Alias for
.data.threadUpdate.threadTitle(only relevant for.controlmessages of type.threadUpdate)Declaration
Swift
public var threadUpdateTitle: String? { get set } -
Alias for
.data.threadUpdate.expression(only relevant for.controlmessages of type.threadUpdate)Declaration
Swift
public var threadUpdateExpression: String? { get set } -
Declaration
Swift
public var callVersion: Int? { get set } -
Alias for
.data.callId(only relevant for call-related.controlmessages)Declaration
Swift
public var callId: UUID? { get set } -
Alias for
.data.peerId(only relevant for call-related.controlmessages)Declaration
Swift
public var peerId: UUID? { get set } -
Alias for
.data.originator(only relevant for.controlof type.callJoin)Declaration
Swift
public var callOriginator: UUID? { get set } -
Alias for
.data.members(only relevant for.controlof type.callJoin)Declaration
Swift
public var callMembers: [UUID]? { get set } -
Alias for
.data.offer.sdp(only relevant for.controlmessages of type.callOffer)Declaration
Swift
public var sdpOffer: String? { get set } -
Alias for
.data.answer.sdp(only relevant for.controlmessages of type.callAcceptOffer)Declaration
Swift
public var sdpAnswer: String? { get set } -
Alias for
.data.icecandidates(only relevant for.controlmessages of type.callICECandidates)Declaration
Swift
public var iceCandidates: [IceCandidate]? { get set } -
Alias for
.data.sends(only relevant for call-related.controlmessages)Declaration
Swift
public var callSends: [StreamType]? { get set } -
Alias for
.data.receives(only relevant for call-related.controlmessages)Declaration
Swift
public var callReceives: [StreamType]? { get set } -
Alias for
.data.key(only relevant for.controlmessages of type.provisionRequest)Declaration
Swift
public var provisioningKey: Data? { get } -
Alias for
.data.uuid(only relevant for.controlmessages of type.provisionRequest)Declaration
Swift
public var provisioningUuidString: String? { get }
-
A pretty-printed version of this payload’s JSON encoding
Declaration
Swift
public var description: String { get } -
Throw an error if mandatory fields are missing, etc.
Declaration
Swift
public func sanityCheck() throws
-
Types of media a peer could send/receive
See moreDeclaration
Swift
public enum StreamType : String, Codable -
Forsta message types
See moreDeclaration
Swift
public enum MessageType : String, Codable -
Forsta thread types
See moreDeclaration
Swift
public enum ThreadType : String, Codable -
Forsta control message types (used in the Forsta message exchange payload)
See moreDeclaration
Swift
public enum ControlType : String, Codable -
Undocumented
See moreDeclaration
Swift
public enum SyncRequestType : String, Codable
View on GitHub
Install in Dash
ForstaPayloadV1 Structure Reference