-
- All Implemented Interfaces:
-
com.amazon.connect.chat.sdk.ChatSession
@Singleton() public final class ChatSessionImpl implements ChatSession
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ChatSessionImpl(ChatService chatService)
-
Method Summary
Modifier and Type Method Description Function0<Unit>getOnConnectionEstablished()UnitsetOnConnectionEstablished(Function0<Unit> onConnectionEstablished)Function0<Unit>getOnConnectionReEstablished()UnitsetOnConnectionReEstablished(Function0<Unit> onConnectionReEstablished)Function0<Unit>getOnConnectionBroken()UnitsetOnConnectionBroken(Function0<Unit> onConnectionBroken)Function0<Unit>getOnDeepHeartBeatFailure()UnitsetOnDeepHeartBeatFailure(Function0<Unit> onDeepHeartBeatFailure)Function1<TranscriptItem, Unit>getOnMessageReceived()UnitsetOnMessageReceived(Function1<TranscriptItem, Unit> onMessageReceived)Function1<TranscriptData, Unit>getOnTranscriptUpdated()UnitsetOnTranscriptUpdated(Function1<TranscriptData, Unit> onTranscriptUpdated)Function1<Event, Unit>getOnTyping()UnitsetOnTyping(Function1<Event, Unit> onTyping)Function1<Event, Unit>getOnMessageDelivered()UnitsetOnMessageDelivered(Function1<Event, Unit> onMessageDelivered)Function1<Event, Unit>getOnMessageRead()UnitsetOnMessageRead(Function1<Event, Unit> onMessageRead)Function1<Event, Unit>getOnParticipantIdle()UnitsetOnParticipantIdle(Function1<Event, Unit> onParticipantIdle)Function1<Event, Unit>getOnParticipantReturned()UnitsetOnParticipantReturned(Function1<Event, Unit> onParticipantReturned)Function1<Event, Unit>getOnParticipantInvited()UnitsetOnParticipantInvited(Function1<Event, Unit> onParticipantInvited)Function1<Event, Unit>getOnAutoDisconnection()UnitsetOnAutoDisconnection(Function1<Event, Unit> onAutoDisconnection)Function1<Event, Unit>getOnChatRehydrated()UnitsetOnChatRehydrated(Function1<Event, Unit> onChatRehydrated)Function1<Event, Unit>getOnParticipantJoined()UnitsetOnParticipantJoined(Function1<Event, Unit> onParticipantJoined)Function1<Event, Unit>getOnParticipantLeft()UnitsetOnParticipantLeft(Function1<Event, Unit> onParticipantLeft)Function1<Event, Unit>getOnTransferSucceeded()UnitsetOnTransferSucceeded(Function1<Event, Unit> onTransferSucceeded)Function1<Event, Unit>getOnTransferFailed()UnitsetOnTransferFailed(Function1<Event, Unit> onTransferFailed)Function1<Event, Unit>getOnChatEnded()UnitsetOnChatEnded(Function1<Event, Unit> onChatEnded)Function1<Boolean, Unit>getOnChatSessionStateChanged()Checks if a chat session is currently active. UnitsetOnChatSessionStateChanged(Function1<Boolean, Unit> onChatSessionStateChanged)Checks if a chat session is currently active. BooleangetIsChatSessionActive()UnitsetIsChatSessionActive(Boolean isChatSessionActive)Unitconfigure(GlobalConfig config)ConnectionDetailsProvidergetConnectionDetailsProvider()Returns ConnectionDetailsProvider object Result<Boolean>connect(ChatDetails chatDetails)Connects to a chat session with the specified chat details. Result<Boolean>disconnect()Disconnects the current chat session. Result<Boolean>suspendWebSocketConnection()Disconnects the websocket and suspends reconnection attempts. Result<Boolean>resumeWebSocketConnection()Resumes a suspended websocket and attempts to reconnect. Result<Boolean>reset()Resets the current state which will disconnect the webSocket and remove all session related data without disconnecting the participant from the chat contact. Result<Boolean>sendMessage(ContentType contentType, String message)Sends a message. Result<Boolean>resendFailedMessage(String messageId)Retry a message that failed to be sent. Result<Boolean>sendEvent(ContentType contentType, String content)Sends an event. Result<Boolean>sendAttachment(Uri fileUri)Sends an attachment. Result<URL>downloadAttachment(String attachmentId, String filename)Downloads an attachment. Result<URL>getAttachmentDownloadUrl(String attachmentId)Returns the S3 download URL for an attachment. Result<TranscriptResponse>getTranscript(ScanDirection scanDirection, SortKey sortKey, Integer maxResults, String nextToken, String startPosition)Gets the transcript. Result<Boolean>sendMessageReceipt(TranscriptItem transcriptItem, MessageReceiptType receiptType)Sends a message receipt. Result<View>describeView(String viewToken)Retrieves the view for the specified view token. -
-
Constructor Detail
-
ChatSessionImpl
ChatSessionImpl(ChatService chatService)
-
-
Method Detail
-
getOnConnectionEstablished
Function0<Unit> getOnConnectionEstablished()
-
setOnConnectionEstablished
Unit setOnConnectionEstablished(Function0<Unit> onConnectionEstablished)
-
getOnConnectionReEstablished
Function0<Unit> getOnConnectionReEstablished()
-
setOnConnectionReEstablished
Unit setOnConnectionReEstablished(Function0<Unit> onConnectionReEstablished)
-
getOnConnectionBroken
Function0<Unit> getOnConnectionBroken()
-
setOnConnectionBroken
Unit setOnConnectionBroken(Function0<Unit> onConnectionBroken)
-
getOnDeepHeartBeatFailure
Function0<Unit> getOnDeepHeartBeatFailure()
-
setOnDeepHeartBeatFailure
Unit setOnDeepHeartBeatFailure(Function0<Unit> onDeepHeartBeatFailure)
-
getOnMessageReceived
Function1<TranscriptItem, Unit> getOnMessageReceived()
-
setOnMessageReceived
Unit setOnMessageReceived(Function1<TranscriptItem, Unit> onMessageReceived)
-
getOnTranscriptUpdated
Function1<TranscriptData, Unit> getOnTranscriptUpdated()
-
setOnTranscriptUpdated
Unit setOnTranscriptUpdated(Function1<TranscriptData, Unit> onTranscriptUpdated)
-
getOnTyping
Function1<Event, Unit> getOnTyping()
-
setOnTyping
Unit setOnTyping(Function1<Event, Unit> onTyping)
-
getOnMessageDelivered
Function1<Event, Unit> getOnMessageDelivered()
-
setOnMessageDelivered
Unit setOnMessageDelivered(Function1<Event, Unit> onMessageDelivered)
-
getOnMessageRead
Function1<Event, Unit> getOnMessageRead()
-
setOnMessageRead
Unit setOnMessageRead(Function1<Event, Unit> onMessageRead)
-
getOnParticipantIdle
Function1<Event, Unit> getOnParticipantIdle()
-
setOnParticipantIdle
Unit setOnParticipantIdle(Function1<Event, Unit> onParticipantIdle)
-
getOnParticipantReturned
Function1<Event, Unit> getOnParticipantReturned()
-
setOnParticipantReturned
Unit setOnParticipantReturned(Function1<Event, Unit> onParticipantReturned)
-
getOnParticipantInvited
Function1<Event, Unit> getOnParticipantInvited()
-
setOnParticipantInvited
Unit setOnParticipantInvited(Function1<Event, Unit> onParticipantInvited)
-
getOnAutoDisconnection
Function1<Event, Unit> getOnAutoDisconnection()
-
setOnAutoDisconnection
Unit setOnAutoDisconnection(Function1<Event, Unit> onAutoDisconnection)
-
getOnChatRehydrated
Function1<Event, Unit> getOnChatRehydrated()
-
setOnChatRehydrated
Unit setOnChatRehydrated(Function1<Event, Unit> onChatRehydrated)
-
getOnParticipantJoined
Function1<Event, Unit> getOnParticipantJoined()
-
setOnParticipantJoined
Unit setOnParticipantJoined(Function1<Event, Unit> onParticipantJoined)
-
getOnParticipantLeft
Function1<Event, Unit> getOnParticipantLeft()
-
setOnParticipantLeft
Unit setOnParticipantLeft(Function1<Event, Unit> onParticipantLeft)
-
getOnTransferSucceeded
Function1<Event, Unit> getOnTransferSucceeded()
-
setOnTransferSucceeded
Unit setOnTransferSucceeded(Function1<Event, Unit> onTransferSucceeded)
-
getOnTransferFailed
Function1<Event, Unit> getOnTransferFailed()
-
setOnTransferFailed
Unit setOnTransferFailed(Function1<Event, Unit> onTransferFailed)
-
getOnChatEnded
Function1<Event, Unit> getOnChatEnded()
-
setOnChatEnded
Unit setOnChatEnded(Function1<Event, Unit> onChatEnded)
-
getOnChatSessionStateChanged
Function1<Boolean, Unit> getOnChatSessionStateChanged()
Checks if a chat session is currently active.
-
setOnChatSessionStateChanged
Unit setOnChatSessionStateChanged(Function1<Boolean, Unit> onChatSessionStateChanged)
Checks if a chat session is currently active.
-
getIsChatSessionActive
Boolean getIsChatSessionActive()
-
setIsChatSessionActive
Unit setIsChatSessionActive(Boolean isChatSessionActive)
-
configure
Unit configure(GlobalConfig config)
-
getConnectionDetailsProvider
ConnectionDetailsProvider getConnectionDetailsProvider()
Returns ConnectionDetailsProvider object
-
connect
Result<Boolean> connect(ChatDetails chatDetails)
Connects to a chat session with the specified chat details.
- Parameters:
chatDetails- The details of the chat.
-
disconnect
Result<Boolean> disconnect()
Disconnects the current chat session.
-
suspendWebSocketConnection
Result<Boolean> suspendWebSocketConnection()
Disconnects the websocket and suspends reconnection attempts.
-
resumeWebSocketConnection
Result<Boolean> resumeWebSocketConnection()
Resumes a suspended websocket and attempts to reconnect.
-
reset
Result<Boolean> reset()
Resets the current state which will disconnect the webSocket and remove all session related data without disconnecting the participant from the chat contact.
-
sendMessage
Result<Boolean> sendMessage(ContentType contentType, String message)
Sends a message.
- Parameters:
contentType- The content type of the message.message- The message content.
-
resendFailedMessage
Result<Boolean> resendFailedMessage(String messageId)
Retry a message that failed to be sent.
- Parameters:
messageId- The Id of the message that failed to be sent.
-
sendEvent
Result<Boolean> sendEvent(ContentType contentType, String content)
Sends an event.
- Parameters:
contentType- The content type of the event.content- The event content.
-
sendAttachment
Result<Boolean> sendAttachment(Uri fileUri)
Sends an attachment.
-
downloadAttachment
Result<URL> downloadAttachment(String attachmentId, String filename)
Downloads an attachment.
- Parameters:
attachmentId- The ID of the attachment to download.filename- The name of the file to save the attachment as.
-
getAttachmentDownloadUrl
Result<URL> getAttachmentDownloadUrl(String attachmentId)
Returns the S3 download URL for an attachment.
- Parameters:
attachmentId- The ID of the attachment.
-
getTranscript
Result<TranscriptResponse> getTranscript(ScanDirection scanDirection, SortKey sortKey, Integer maxResults, String nextToken, String startPosition)
Gets the transcript.
- Parameters:
scanDirection- The direction of the scan.sortKey- The sort key.maxResults- The maximum number of results.nextToken- The next token.startPosition- The start position.
-
sendMessageReceipt
Result<Boolean> sendMessageReceipt(TranscriptItem transcriptItem, MessageReceiptType receiptType)
Sends a message receipt.
- Parameters:
transcriptItem- The transcript item.receiptType- The type of the receipt.
-
describeView
Result<View> describeView(String viewToken)
Retrieves the view for the specified view token.
- Parameters:
viewToken- An encrypted token originating from the interactive message of a ShowView block operation.
-
-
-
-