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.ObjectA chat log is a record of an event that happened in the chat between participants.ChatLogis a base class for all logs that contains basic fields common to them all. Every other log either descends fromChatLogor can be fully represented by this base class.All possible chat logs:
Description ChatLog#getType() Subclass Member Join ChatLog.Type.MEMBER_JOINN/A Member Leave ChatLog.Type.MEMBER_LEAVEN/A Message from participant ChatLog.Type.MESSAGEChatLog.MessageAttachment message from participant ChatLog.Type.ATTACHMENT_MESSAGEChatLog.AttachmentMessageRating request from an agent ChatLog.Type.RATING_REQUESTN/A Chat rating from the visitor ChatLog.Type.RATINGChatLog.RatingChat comment from the visitor ChatLog.Type.COMMENTChatLog.CommentExample code to access all
ChatLog.Type.MEMBER_LEAVElogs: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 classChatLog.AttachmentMessageChat log with an additional attachment field.static classChatLog.CommentChat log with an additional fields for the previous and new chat comment.static classChatLog.MessageChat log with an additional message field.static classChatLog.RatingChat log with an additional fields for the previous and new chat rating.static classChatLog.TypeAll possible types of chat logs.
-
Field Summary
Fields Modifier and Type Field and Description static java.util.Comparator<ChatLog>TIMESTAMP_COMPARATORComparator to sortChatLogs based on their timestamps.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object o)ChatParticipantgetChatParticipant()Gets the participant from whom this log originated from.DeliveryStatusgetDeliveryStatus()Gets the delivery status of this chat log.java.lang.StringgetDisplayName()Gets the display name of the participant from who this log originated from.java.lang.StringgetId()Gets an unique identifier of this chat log.longgetLastModifiedTimestamp()Gets epoch timestamp at which this chat log was last modified.java.lang.StringgetNick()Gets an unique identifier of the participant from whom this log originated from.ChatLog.TypegetType()Gets the type of this chat log.inthashCode()
-
-
-
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 correspondingAgentobject 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
nullgiven 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.MessageorChatLog.AttachmentMessagewas 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-