ChatMessage

public struct ChatMessage : Codable

Chat message.

Properties

  • id

    The id of the message. This id is server generated.

    Declaration

    Swift

    public let id: String
  • The message type.

    Declaration

    Swift

    public let type: ChatMessageType
  • Sequence of the message in the conversation.

    Declaration

    Swift

    public let sequenceId: String
  • Version of the message.

    Declaration

    Swift

    public let version: String
  • Content of the message.

    Declaration

    Swift

    public let content: ChatMessageContent?
  • The display name of the message sender. This property is used to populate sender name for push notifications.

    Declaration

    Swift

    public let senderDisplayName: String?
  • The timestamp when the message arrived at the server. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.

    Declaration

    Swift

    public let createdOn: Iso8601Date
  • The sender of the message.

    Declaration

    Swift

    public let sender: CommunicationIdentifier?
  • The timestamp (if applicable) when the message was deleted. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.

    Declaration

    Swift

    public let deletedOn: Iso8601Date?
  • The last timestamp (if applicable) when the message was edited. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.

    Declaration

    Swift

    public let editedOn: Iso8601Date?
  • Optional metadata provided when sending the ChatMessage, data is stringified.

    Declaration

    Swift

    public let metadata: [String : String?]?

Initializers

  • Initialize a ChatMessage structure.

    Declaration

    Swift

    public init(
        id: String,
        type: ChatMessageType,
        sequenceId: String,
        version: String,
        content: ChatMessageContent? = nil,
        senderDisplayName: String? = nil,
        createdOn: Iso8601Date,
        sender: CommunicationIdentifier? = nil,
        deletedOn: Iso8601Date? = nil,
        editedOn: Iso8601Date? = nil,
        metadata: [String: String?]? = nil
    )

    Parameters

    id

    The id of the message. This id is server generated.

    type

    The chat message type.

    sequenceId

    Sequence of the message in the conversation.

    version

    Version of the message.

    content

    Content of a message.

    senderDisplayName

    The display name of the message sender. This property is used to populate sender name for push notifications.

    createdOn

    The timestamp when the message arrived at the server. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.

    sender

    The sender of the message.

    deletedOn

    The timestamp (if applicable) when the message was deleted. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.

    editedOn

    The last timestamp (if applicable) when the message was edited. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.

Codable

  • Initialize a ChatMessage structure from decoder

    Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Encode a ChatMessage structure

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws