• ChatMessagePayload
  • ChatMessagePayload Class

    Represents a single public chat message within the system. More...

    Header: #include <ChatMessagePayload>

    Properties

    Public Functions

    ChatMessagePayload(const QJsonObject &json)
    QDateTime authoredAt() const
    int cacheId() const
    QString channel() const
    int id() const
    QString message() const
    QString ownerId() const
    void setAuthoredAt(const QDateTime &datetime)
    void setCacheId(int id)
    void setChannel(const QString &channel)
    void setId(int id)
    void setMessage(const QString &message)
    void setOwnerId(const QString &id)
    void setUsername(const QString &name)
    QString username() const

    Detailed Description

    ChatMessagePayload encapsulates the properties of a chat message, including sender info, channel name, message body, and timestamp. It can be initialized from a QJsonObject and is exposed to QML via Q_GADGET and QML_VALUE_TYPE.

    Property Documentation

    authoredAt : QDateTime

    Returns the timestamp when the message was authored.

    Access functions:

    QDateTime authoredAt() const
    void setAuthoredAt(const QDateTime &datetime)

    cacheId : int

    Returns the optional client-side cache ID.

    Access functions:

    int cacheId() const
    void setCacheId(int id)

    channel : QString

    Returns the name of the channel this message was posted in.

    Access functions:

    QString channel() const
    void setChannel(const QString &channel)

    id : int

    Returns the server-assigned unique ID for the message.

    Access functions:

    int id() const
    void setId(int id)

    message : QString

    Returns the body text of the chat message.

    Access functions:

    QString message() const
    void setMessage(const QString &message)

    ownerId : QString

    Returns the user ID of the message sender.

    Access functions:

    QString ownerId() const
    void setOwnerId(const QString &id)

    username : QString

    Returns the sender's username name.

    Access functions:

    QString username() const
    void setUsername(const QString &name)

    Member Function Documentation

    [explicit] ChatMessagePayload::ChatMessagePayload(const QJsonObject &json)

    Constructs a ChatMessagePayload from a json object.

    void ChatMessagePayload::setAuthoredAt(const QDateTime &datetime)

    Sets the authored timestamp to datetime.

    datetime is the time the message was authored

    Note: Setter function for property authoredAt.

    See also authoredAt().

    void ChatMessagePayload::setCacheId(int id)

    Sets the cache ID to id.

    id is the message's unique cache id

    Note: Setter function for property cacheId.

    See also cacheId().

    void ChatMessagePayload::setChannel(const QString &channel)

    Sets the message's channel to channel.

    channel is the channel's name

    Note: Setter function for property channel.

    See also channel().

    void ChatMessagePayload::setId(int id)

    Sets the unique message ID to id.

    id is the messages unique id

    Note: Setter function for property id.

    See also id().

    void ChatMessagePayload::setMessage(const QString &message)

    Sets the message body text to message.

    message is the string of text that represents the message content

    Note: Setter function for property message.

    See also message().

    void ChatMessagePayload::setOwnerId(const QString &id)

    Sets the sender's user ID to id.

    id is the sender's unique user id

    Note: Setter function for property ownerId.

    See also ownerId().

    void ChatMessagePayload::setUsername(const QString &name)

    Sets the sender's display name to name.

    name is the senders username

    Note: Setter function for property username.

    See also username().