Class Conversation

  • All Implemented Interfaces:

    
    public class Conversation
    
                        

    The entity of a conversation, used to contain and store the client's conversation information, corresponding to the conversation in the conversation list.

    Author:

    rongcloud

    • Constructor Detail

      • Conversation

        Conversation()
        Default constructor.
      • Conversation

        Conversation(Parcel in)
    • Method Detail

      • getTargetId

         String getTargetId()

        Retrieves the conversation ID.

        Depending on the conversationType, it could be a chat ID, discussion group ID, group ID, or chatroom ID.

        Returns:

        The conversation ID.

      • setTargetId

         void setTargetId(String targetId)

        Sets the conversation ID.

        Depending on the conversationType, this could be a chat ID, discussion group ID, group ID, or chatroom ID.

        Parameters:
        targetId - The conversation ID.
      • getChannelId

         String getChannelId()

        The business identifier of the conversation to which the message belongs.

        Returns:

        The business identifier of the conversation to which the message belongs.

      • setChannelId

         void setChannelId(String channelId)

        Sets the business identifier of the conversation to which the message belongs. The maximum length is 20 characters.

        Parameters:
        channelId - The business identifier of the conversation to which the message belongs.
      • getConversationTitle

         String getConversationTitle()

        Get the conversation title.

        Returns:

        The conversation title.

      • setConversationTitle

         void setConversationTitle(String conversationTitle)

        Sets the conversation title.

        Parameters:
        conversationTitle - The title of the conversation.
      • getPortraitUrl

         String getPortraitUrl()

        Get the conversation avatar URL

        Returns:

        The conversation avatar URL

      • setPortraitUrl

         void setPortraitUrl(String portraitUrl)

        Sets the conversation avatar URL

        Parameters:
        portraitUrl - The URL of the conversation avatar
      • getUnreadMessageCount

         int getUnreadMessageCount()

        Get the count of unread messages.

        Returns:

        The count of unread messages.

      • setUnreadMessageCount

         void setUnreadMessageCount(int unreadMessageCount)

        Sets the unread message count.

        Parameters:
        unreadMessageCount - The count of unread messages.
      • isTop

         boolean isTop()

        Retrieves the pinned status.

        Returns:

        The pinned status.

      • setTop

         void setTop(boolean isTop)

        Sets the pinned status.

        Parameters:
        isTop - The pinned status.
      • isTopForTag

         boolean isTopForTag()

        Retrieves the pinned status of the current conversation under this tag.

        This field is only valid when retrieving conversations by tag using {#getConversationsFromTagByPage}.

        Returns:

        The pinned status.

        Since:

        5.6.4

      • setTopForTag

         void setTopForTag(boolean isTopForTag)

        Sets the pinned status of the current conversation under this tag.

        Parameters:
        isTopForTag - The pinned status.
        Since:

        5.6.4

      • getOperationTime

         long getOperationTime()

        Gets the operation timestamp (Unix timestamp in milliseconds) for this conversation, used as the timestamp parameter when paginating through the conversation list.

        The initial value is the same as sentTime. Operations such as pinning will update this timestamp.

        Returns:

        The operation timestamp

        Since:

        5.6.8

      • setOperationTime

         void setOperationTime(long operationTime)

        Sets the operation time for this conversation (Unix timestamp in milliseconds).

        Parameters:
        operationTime - The operation time
        Since:

        5.6.8

      • getSenderUserName

         String getSenderUserName()

        Retrieves the name of the user who sent the message.

        Returns:

        The name of the user who sent the message.

      • setSenderUserName

         void setSenderUserName(String senderUserName)

        Sets the username of the message sender.

        Parameters:
        senderUserName - The username of the message sender.
      • getDraft

         String getDraft()

        Retrieves the draft present in the conversation.

        Returns:

        The draft present in the conversation.

      • setDraft

         void setDraft(String draft)

        Sets the draft in the conversation.

        Parameters:
        draft - The draft in the conversation.
      • getMentionedCount

        @Deprecated() int getMentionedCount()

        Retrieves the count of unread messages in this conversation where you were mentioned.

        Returns:

        The count of unread mentions

      • setMentionedCount

         void setMentionedCount(int count)

        Sets the count of unread @ messages in this conversation.

        Parameters:
        count - The number of unread @ messages.
      • getPushNotificationLevel

         int getPushNotificationLevel()

        Get the Do Not Disturb notification level

        Returns:

        The Do Not Disturb notification level

      • setPushNotificationLevel

         void setPushNotificationLevel(int pushNotificationLevel)

        Sets the Do Not Disturb notification level

        Parameters:
        pushNotificationLevel - The Do Not Disturb notification level
      • getFirstUnreadMsgSendTime

         long getFirstUnreadMsgSendTime()

        Gets the timestamp of the first unread message in the conversation (Unix timestamp in milliseconds).

        Returns:

        The timestamp of the first unread message.

        Since:

        5.2.5

      • setFirstUnreadMsgSendTime

         void setFirstUnreadMsgSendTime(long firstUnreadMsgSendTime)

        Sets the timestamp of the first unread message in the conversation (Unix timestamp, in milliseconds).

        Parameters:
        firstUnreadMsgSendTime - The timestamp of the first unread message
        Since:

        5.2.5

      • obtain

         static Conversation obtain(Conversation.ConversationType type, String id, String title)

        Constructor.

        Parameters:
        type - Specifies the conversation type.
        id - Represents the conversation ID.
        title - Indicates the conversation title.
      • getReceivedStatus

         ReceivedStatus getReceivedStatus()

        Retrieves the receipt status of the last message in the conversation.

        Returns:

        The receipt status of the last message in the conversation.

      • setReceivedStatus

         void setReceivedStatus(ReceivedStatus receivedStatus)

        Sets the received status of the last message in the conversation.

        Parameters:
        receivedStatus - Indicates the received status of the last message in the conversation.
      • getSentStatus

         SentStatus getSentStatus()

        Retrieves the send status of the last message in the conversation.

        Returns:

        The send status of the last message in the conversation.

      • setSentStatus

         void setSentStatus(SentStatus sentStatus)

        Sets the sending status of the last message in the conversation.

        Parameters:
        sentStatus - The sending status of the last message in the conversation.
      • getReceivedTime

         long getReceivedTime()

        Retrieves the receive time of the last message in the conversation (Unix timestamp in milliseconds).

        The receive time is the local time of the client when the message arrives at the receiving client.

        Returns:

        The receive time of the last message in the conversation (Unix timestamp in milliseconds).

      • setReceivedTime

         void setReceivedTime(long receivedTime)

        Sets the received time of the last message in the conversation (Unix timestamp in milliseconds).

        Parameters:
        receivedTime - The received time of the last message in the conversation (Unix timestamp in milliseconds).
      • getSentTime

         long getSentTime()

        Get the sending time of the last message in the conversation (Unix timestamp, milliseconds)

        The sending time is the server time when the message arrives at the server from the sending client.

        Returns:

        The sending time of the last message in the conversation (Unix timestamp, milliseconds)

      • setSentTime

         void setSentTime(long sentTime)

        Sets the sent time of the last message in the conversation (Unix timestamp in milliseconds).

        The sent time is the server time when the message arrives at the server from the sending client.

        Parameters:
        sentTime - The sent time of the last message in the conversation (Unix timestamp in milliseconds)
      • getObjectName

         String getObjectName()

        Gets the name of the message object.

        The name of the message object is the value specified in the annotation.

        Returns:

        The name of the message object.

      • setObjectName

         void setObjectName(String objectName)

        Sets the name of the message object.

        The name of the message object corresponds to the value in the annotation.

        Parameters:
        objectName - The name of the message object.
      • getSenderUserId

         String getSenderUserId()

        Retrieves the user ID of the message sender.

        Returns:

        The user ID of the message sender.

      • setSenderUserId

         void setSenderUserId(String senderUserId)

        Sets the user ID of the message sender.

        Parameters:
        senderUserId - The user ID of the message sender.
      • getLatestMessageId

         int getLatestMessageId()

        Retrieves the ID of the last message in this conversation. (Unique database index value)

        Returns:

        The ID of the last message in this conversation.

      • setLatestMessageId

         void setLatestMessageId(int latestMessageId)

        Sets the ID of the last message in this conversation. (Unique value for database indexing)

        Parameters:
        latestMessageId - The ID of the last message in this conversation.
      • getLatestMessage

         MessageContent getLatestMessage()

        Retrieves the content of the last message in the conversation.

        Returns:

        The content of the last message in the conversation.

      • setLatestMessage

         void setLatestMessage(MessageContent latestMessageContent)

        Sets the content of the last message in the conversation.

        Parameters:
        latestMessageContent - The content of the last message in the conversation.
      • getUnreadMentionedCount

         int getUnreadMentionedCount()

        Get the count of unread @ mentions in this conversation.

        /**

        Returns:

        The number of unread @ mentions

      • getUnreadMentionedMeCount

         int getUnreadMentionedMeCount()

        Retrieves the count of unread messages in this conversation where only you are mentioned.

        Returns:

        The number of unread mentions

      • getLatestMessageDirection

         MessageDirection getLatestMessageDirection()

        Retrieves the message direction.

        Returns:

        The message direction.

      • setLatestMessageDirection

         void setLatestMessageDirection(MessageDirection latestMessageDirection)

        Sets the message direction.

        Parameters:
        latestMessageDirection - Specifies the message direction.
      • getLatestMessageExtra

         String getLatestMessageExtra()

        Retrieve the additional information of the message.

        Returns:

        Specifies the additional information of the message.

      • setLatestMessageExtra

         void setLatestMessageExtra(String latestMessageExtra)

        Sets the additional information for the message.

        Parameters:
        latestMessageExtra - The additional information for the message.
      • getLatestMessageUId

         String getLatestMessageUId()

        Retrieves the unique message ID from the server (globally unique within the same AppKey).

        Returns:

        uid The unique message ID from the server (globally unique within the same AppKey)

      • setLatestMessageUId

         void setLatestMessageUId(String latestMessageUId)

        Sets the server message unique ID (globally unique within the same AppKey).

        Parameters:
        latestMessageUId - The server message unique ID (globally unique within the same AppKey)
      • getLatestMessageReadReceiptInfo

         ReadReceiptInfo getLatestMessageReadReceiptInfo()

        Retrieves the read receipt status of the last message.

        Returns:

        The read receipt status.

      • setLatestMessageReadReceiptInfo

         void setLatestMessageReadReceiptInfo(ReadReceiptInfo latestMessageReadReceiptInfo)

        Sets the read receipt status of the last message

        Parameters:
        latestMessageReadReceiptInfo - The read receipt status
      • getLatestMessageConfig

         MessageConfig getLatestMessageConfig()

        Retrieves the message configuration.

        Returns:

        MessageConfig The message configuration.

      • setLatestMessageConfig

         void setLatestMessageConfig(MessageConfig latestMessageConfig)

        Set message configuration

        Parameters:
        latestMessageConfig - Message configuration
      • isLatestCanIncludeExpansion

         boolean isLatestCanIncludeExpansion()

        Indicates whether the message can contain extended information.

        This property is determined when the message is sent and cannot be modified afterwards. Extended information is only supported in one-to-one chat and group chat. Other conversation types cannot set extended information.

        Returns:

        Indicates whether the message can contain extended information.

      • setLatestCanIncludeExpansion

         void setLatestCanIncludeExpansion(boolean latestCanIncludeExpansion)

        Sets whether the message can include extended information

        Parameters:
        latestCanIncludeExpansion - Indicates whether the message can include extended information
      • getLatestExpansion

         Map<String, String> getLatestExpansion()

        Retrieves the list of expansion information for the last message.

        Returns:

        List of message expansion information

      • setLatestExpansion

         void setLatestExpansion(Map<String, String> latestExpansion)

        Sets the latest message expansion information list.

        Parameters:
        latestExpansion - The list of message expansion information.
      • getMessage

         Message getMessage()

        Retrieves the latest message of the conversation

        Since:

        5.8.0

      • setMessage

         void setMessage(Message latestMessage)

        The LatestMessage of the conversation

        Since:

        5.8.0

      • setMentionedMeCount

         void setMentionedMeCount(int count)

        Sets the count of unread @ messages in this conversation that are only for the current user.

        Parameters:
        count - The count of unread messages.