Package zendesk.chat.client
Class ChatLog
- java.lang.Object
-
- zendesk.chat.client.ChatLog
-
- Direct Known Subclasses:
- ChatLog.AttachmentMessage, ChatLog.Comment, ChatLog.Message, ChatLog.Rating
public class ChatLog extends java.lang.Object
A chat log is a record of an event that happened in the chat between participants.ChatLog
is a base class for all logs that contains basic fields common to them all. Every other log either descends fromChatLog
or can be fully represented by this base class.All possible chat logs:
Description ChatLog#getType() Subclass Member Join ChatLog.Type.MEMBER_JOIN
N/A Member Leave ChatLog.Type.MEMBER_LEAVE
N/A Message from participant ChatLog.Type.MESSAGE
ChatLog.Message
Attachment message from participant ChatLog.Type.ATTACHMENT_MESSAGE
ChatLog.AttachmentMessage
Rating request from an agent ChatLog.Type.RATING_REQUEST
N/A Chat rating from the visitor ChatLog.Type.RATING
ChatLog.Rating
Chat comment from the visitor ChatLog.Type.COMMENT
ChatLog.Comment
Example code to access all
ChatLog.Type.MEMBER_LEAVE
logs:val memberLeaveLogs = chatState.chatLogs.filter {it.type == ChatLog.Type.MEMBER_LEAVE}
- See Also:
All possible types of logs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
ChatLog.AttachmentMessage
Chat log with an additional attachment field.static class
ChatLog.Comment
Chat log with an additional fields for the previous and new chat comment.static class
ChatLog.Message
Chat log with an additional message field.static class
ChatLog.Rating
Chat log with an additional fields for the previous and new chat rating.static class
ChatLog.Type
All possible types of chat logs.
-
Field Summary
Fields Modifier and Type Field and Description static java.util.Comparator<ChatLog>
TIMESTAMP_COMPARATOR
Comparator to sortChatLog
s based on their timestamps.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
equals(java.lang.Object o)
ChatParticipant
getChatParticipant()
Gets the participant from whom this log originated from.DeliveryStatus
getDeliveryStatus()
Gets the delivery status of this chat log.java.lang.String
getDisplayName()
Gets the display name of the participant from who this log originated from.java.lang.String
getId()
Gets an unique identifier of this chat log.long
getLastModifiedTimestamp()
Gets epoch timestamp at which this chat log was last modified.java.lang.String
getNick()
Gets an unique identifier of the participant from whom this log originated from.ChatLog.Type
getType()
Gets the type of this chat log.int
hashCode()
-
-
-
Method Detail
-
getId
public java.lang.String getId()
Gets an unique identifier of this chat log.
-
getLastModifiedTimestamp
public long getLastModifiedTimestamp()
Gets epoch timestamp at which this chat log was last modified.
-
getType
public ChatLog.Type getType()
Gets the type of this chat log.- Returns:
ChatLog.Type
-
getChatParticipant
public ChatParticipant getChatParticipant()
Gets the participant from whom this log originated from.- Returns:
ChatParticipant
-
getNick
public java.lang.String getNick()
Gets an unique identifier of the participant from whom this log originated from.
GivenChatLog.getChatParticipant()
returnsChatParticipant.AGENT
, this nick can be matched againstAgent.getId()
to find a correspondingAgent
object that provides more information about the agent.A sample Kotlin code looks as follows:
if(chatLog.chatParticipant == ChatParticipant.AGENT) { val agent = chatState.agents.filter { it.id == chatLog.nick}.first() }
- Returns:
- A unique identifier of the participant or
null
. - See Also:
ChatState.getAgents()
,Agent.getId()
,ChatParticipant
-
getDisplayName
public java.lang.String getDisplayName()
Gets the display name of the participant from who this log originated from.Note, this could be
null
given a pending or failed visitor message. For all other participants, the display name is guaranteed not to be null.- Returns:
- The display name of
null
-
getDeliveryStatus
public DeliveryStatus getDeliveryStatus()
Gets the delivery status of this chat log.You can use this to determine if visitor
ChatLog.Message
orChatLog.AttachmentMessage
was successfully received by the system.For logs authored by all other participants, delivery status should always be equal to
DeliveryStatus.DELIVERED
.- See Also:
DeliveryStatus
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-