public final class ChatClient
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
addEventHandler(ChatEventType chatEventType,
RealTimeNotificationCallback listener)
Add handler for a chat event for realtime notifications.
|
void |
addPushNotificationHandler(ChatEventType chatEventType,
java9.util.function.Consumer<ChatEvent> listener)
Add handler for a chat event for push notifications.
|
CreateChatThreadResult |
createChatThread(CreateChatThreadOptions options)
Creates a chat thread.
|
com.azure.android.core.rest.Response<CreateChatThreadResult> |
createChatThreadWithResponse(CreateChatThreadOptions options,
com.azure.android.core.util.RequestContext requestContext)
Creates a chat thread.
|
void |
deleteChatThread(java.lang.String chatThreadId)
Deletes a chat thread.
|
com.azure.android.core.rest.Response<java.lang.Void> |
deleteChatThreadWithResponse(java.lang.String chatThreadId,
com.azure.android.core.util.RequestContext requestContext)
Deletes a chat thread.
|
ChatThreadClient |
getChatThreadClient(java.lang.String chatThreadId)
Creates a chat thread client.
|
boolean |
handlePushNotification(ChatPushNotification pushNotification)
Handle incoming push notification.
|
com.azure.android.core.rest.util.paging.PagedIterable<ChatThreadItem> |
listChatThreads()
Gets the list of chat threads of a user.
|
com.azure.android.core.rest.util.paging.PagedIterable<ChatThreadItem> |
listChatThreads(ListChatThreadsOptions listThreadsOptions,
com.azure.android.core.util.RequestContext requestContext)
Gets the list of chat threads of a user.
|
void |
removeEventHandler(ChatEventType chatEventType,
RealTimeNotificationCallback listener)
Remove handler from a chat event for realtime notifications.
|
void |
removePushNotificationHandler(ChatEventType chatEventType,
java9.util.function.Consumer<ChatEvent> listener)
Remove handler from a chat event for push notifications.
|
void |
startPushNotifications(java.lang.String deviceRegistrationToken,
java9.util.function.Consumer<java.lang.Throwable> errorHandler)
Register current device for receiving incoming push notifications via FCM.
|
void |
startRealtimeNotifications(android.content.Context context,
java9.util.function.Consumer<java.lang.Throwable> errorHandler)
Start receiving realtime notifications.
|
void |
startRealtimeNotifications(java.lang.String skypeUserToken,
android.content.Context context)
Deprecated.
Use
startRealtimeNotifications(Context, Consumer) instead. |
void |
stopPushNotifications()
Unregister current device from receiving incoming push notifications.
|
void |
stopRealtimeNotifications()
Stop receiving realtime notifications.
|
public ChatThreadClient getChatThreadClient(java.lang.String chatThreadId)
chatThreadId
- The id of the chat thread.java.lang.NullPointerException
- if chatThreadId is nullpublic CreateChatThreadResult createChatThread(CreateChatThreadOptions options)
options
- Options for creating a chat thread.ChatErrorResponseException
- if the request is rejected by server.java.lang.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.public com.azure.android.core.rest.Response<CreateChatThreadResult> createChatThreadWithResponse(CreateChatThreadOptions options, com.azure.android.core.util.RequestContext requestContext)
options
- Options for creating a chat thread.requestContext
- The context to associate with this operation.ChatErrorResponseException
- if the request is rejected by server.java.lang.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.public void deleteChatThread(java.lang.String chatThreadId)
chatThreadId
- the id of the Chat thread to delete.ChatErrorResponseException
- if the request is rejected by server.java.lang.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.public com.azure.android.core.rest.Response<java.lang.Void> deleteChatThreadWithResponse(java.lang.String chatThreadId, com.azure.android.core.util.RequestContext requestContext)
chatThreadId
- the id of the Chat thread to delete.requestContext
- The context to associate with this operation.ChatErrorResponseException
- if the request is rejected by server.java.lang.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.public com.azure.android.core.rest.util.paging.PagedIterable<ChatThreadItem> listChatThreads()
ChatErrorResponseException
- if the request is rejected by server.java.lang.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.public com.azure.android.core.rest.util.paging.PagedIterable<ChatThreadItem> listChatThreads(ListChatThreadsOptions listThreadsOptions, com.azure.android.core.util.RequestContext requestContext)
listThreadsOptions
- The request options.requestContext
- The context to associate with this operation.ChatErrorResponseException
- if the request is rejected by server.java.lang.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.public void startRealtimeNotifications(android.content.Context context, java9.util.function.Consumer<java.lang.Throwable> errorHandler)
stopRealtimeNotifications()
is called,
realtime notifications will be enabled and the corresponding registration will auto-renew.
If there's an error during registration initialization or renewal,
realtime notifications will be disabled and errorHandler
will be called.context
- the Android app contexterrorHandler
- error handler callback for registration failuresjava.lang.RuntimeException
- if realtime notifications failed to start.@Deprecated public void startRealtimeNotifications(java.lang.String skypeUserToken, android.content.Context context)
startRealtimeNotifications(Context, Consumer)
instead.stopRealtimeNotifications()
is called,
realtime notifications will be enabled and the corresponding registration will auto-renew.
If there's an error during registration initialization or renewal, realtime notifications will be disabled.skypeUserToken
- the skype user tokencontext
- the Android app contextjava.lang.RuntimeException
- if realtime notifications failed to start.public void stopRealtimeNotifications()
public void startPushNotifications(java.lang.String deviceRegistrationToken, java9.util.function.Consumer<java.lang.Throwable> errorHandler)
stopPushNotifications()
is called,
push notifications will be enabled and the corresponding registration will auto-renew.
If there's an error during registration initialization or renewal,
push notifications will be disabled and errorHandler
will be called.deviceRegistrationToken
- Device registration token obtained from the FCM SDK.errorHandler
- error handler callback for registration failuresjava.lang.RuntimeException
- if push notifications failed to start.public void stopPushNotifications()
public boolean handlePushNotification(ChatPushNotification pushNotification)
pushNotification
- Incoming push notification payload from the FCM SDK.java.lang.IllegalStateException
- if the push notification could not be handled.public void addPushNotificationHandler(ChatEventType chatEventType, java9.util.function.Consumer<ChatEvent> listener)
chatEventType
- the chat event typelistener
- the listener callback functionjava.lang.IllegalStateException
- if push notifications has not started yet.public void removePushNotificationHandler(ChatEventType chatEventType, java9.util.function.Consumer<ChatEvent> listener)
chatEventType
- the chat event typelistener
- the listener callback functionpublic void addEventHandler(ChatEventType chatEventType, RealTimeNotificationCallback listener)
chatEventType
- the chat event typelistener
- the listener callback functionjava.lang.IllegalStateException
- if realtime notifications has not started yet.public void removeEventHandler(ChatEventType chatEventType, RealTimeNotificationCallback listener)
chatEventType
- the chat event typelistener
- the listener callback function