-
public final class ChatClientThe ChatClient is the main entry point for all low-level operations on chat
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classChatClient.BuilderBuilder to initialize the singleton ChatClient instance and configure its parameters.
public abstract classChatClient.ChatClientBuilderpublic classChatClient.Companion
-
Field Summary
Fields Modifier and Type Field Description private final List<Function1<User, Unit>>disconnectListenersprivate final List<Function1<User, Unit>>preSetUserListenersprivate final ChatClientConfigconfigprivate final ChatNotificationsnotificationsprivate final Collection<Plugin>plugins
-
Method Summary
Modifier and Type Method Description final List<Function1<User, Unit>>getDisconnectListeners()final List<Function1<User, Unit>>getPreSetUserListeners()final ChatClientConfiggetConfig()final ChatNotificationsgetNotifications()final Collection<Plugin>getPlugins()final Call<ConnectionData>connectUser(User user, String token)Initializes ChatClient for a specific user using the given user token. final Call<ConnectionData>connectUser(User user, TokenProvider tokenProvider)Initializes ChatClient for a specific user. final Call<AppSettings>appSettings()Get the current settings of the app. final UnitsetUserWithoutConnectingIfNeeded()Initializes ChatClient with stored user data. final BooleancontainsStoredCredentials()final Call<ConnectionData>connectAnonymousUser()final Call<ConnectionData>connectGuestUser(String userId, String username)final Call<GuestUser>getGuestToken(String userId, String userName)final Call<List<Member>>queryMembers(String channelType, String channelId, Integer offset, Integer limit, FilterObject filter, QuerySort<Member> sort, List<Member> members)final Call<String>sendFile(String channelType, String channelId, File file, ProgressCallback callback)Uploads a file for the given channel. final Call<String>sendFile(String channelType, String channelId, File file)Uploads a file for the given channel. final Call<String>sendImage(String channelType, String channelId, File file, ProgressCallback callback)Uploads an image for the given channel. final Call<String>sendImage(String channelType, String channelId, File file)Uploads an image for the given channel. final Call<Unit>deleteFile(String channelType, String channelId, String url)Deletes the file represented by url from the given channel. final Call<Unit>deleteImage(String channelType, String channelId, String url)Deletes the image represented by url from the given channel. final Call<List<Reaction>>getReactions(String messageId, Integer offset, Integer limit)final Call<Reaction>sendReaction(String messageId, String reactionType, Boolean enforceUnique)final Call<Reaction>sendReaction(String messageId, String reactionType)final Call<Reaction>sendReaction(Reaction reaction, Boolean enforceUnique)final Call<Reaction>sendReaction(Reaction reaction)final Call<Message>deleteReaction(String messageId, String reactionType)final UnitdisconnectSocket()final UnitreconnectSocket()final UnitaddSocketListener(SocketListener listener)final UnitremoveSocketListener(SocketListener listener)final Disposablesubscribe(ChatEventListener<ChatEvent> listener)final DisposablesubscribeFor(String eventTypes, ChatEventListener<ChatEvent> listener)Subscribes to the specific eventTypes of the client. final DisposablesubscribeFor(LifecycleOwner lifecycleOwner, String eventTypes, ChatEventListener<ChatEvent> listener)Subscribes to the specific eventTypes of the client, in the lifecycle of lifecycleOwner. final DisposablesubscribeFor(Class<out ChatEvent> eventTypes, ChatEventListener<ChatEvent> listener)Subscribes to the specific eventTypes of the client. final DisposablesubscribeFor(LifecycleOwner lifecycleOwner, Class<out ChatEvent> eventTypes, ChatEventListener<ChatEvent> listener)Subscribes to the specific eventTypes of the client, in the lifecycle of lifecycleOwner. final DisposablesubscribeForSingle(String eventType, ChatEventListener<ChatEvent> listener)Subscribes for the next event with the given eventType. final <T extends ChatEvent> DisposablesubscribeForSingle(Class<T> eventType, ChatEventListener<T> listener)Subscribes for the next event with the given eventType. final Unitdisconnect()final Call<List<Device>>getDevices()final Call<Unit>deleteDevice(Device device)final Call<Unit>addDevice(Device device)final Call<SearchMessagesResult>searchMessages(FilterObject channelFilter, FilterObject messageFilter, Integer offset, Integer limit, String next, QuerySort<Message> sort)Search messages across channels. final Call<List<Message>>getPinnedMessages(String channelType, String channelId, Integer limit, QuerySort<Message> sort, PinnedMessagesPagination pagination)Returns a list of messages pinned in the channel. final Call<List<Attachment>>getFileAttachments(String channelType, String channelId, Integer offset, Integer limit)final Call<List<Attachment>>getImageAttachments(String channelType, String channelId, Integer offset, Integer limit)final Call<List<Message>>getMessagesWithAttachments(String channelType, String channelId, Integer offset, Integer limit, List<String> types)Returns a Call with messages that contain at least one desired type attachment but not necessarily all of them will have a specified type. final Call<List<Message>>getRepliesInternal(String messageId, Integer limit)final Call<List<Message>>getRepliesMoreInternal(String messageId, String firstId, Integer limit)final Call<List<Message>>getReplies(String messageId, Integer limit)final Call<List<Message>>getRepliesMore(String messageId, String firstId, Integer limit)final Call<Message>sendAction(SendActionRequest request)final Call<Message>deleteMessage(String messageId, Boolean hard)final Call<Message>deleteMessage(String messageId)final Call<Message>getMessage(String messageId)final Call<Message>sendMessage(String channelType, String channelId, Message message)Sends the message to the given channel. final Call<Message>updateMessage(Message message)Updates the message in the API and calls the plugins that handle this request. final Call<Message>updateMessageInternal(Message message)Updates the message in the API without causing any side effect in the local data of the SDK. final Call<Message>partialUpdateMessage(String messageId, Map<String, Object> set, List<String> unset)Partially updates specific Message fields retaining the fields which were set previously. final Call<Message>pinMessage(Message message, Date expirationDate)Pins the message. final Call<Message>pinMessage(Message message, Integer timeout)Pins the message. final Call<Message>unpinMessage(Message message)Unpins the message that was previously pinned final Call<List<Channel>>queryChannelsInternal(QueryChannelsRequest request)final Call<Channel>queryChannelInternal(String channelType, String channelId, QueryChannelRequest request)final Call<Channel>queryChannel(String channelType, String channelId, QueryChannelRequest request)final Call<List<Channel>>queryChannels(QueryChannelsRequest request)final Call<Channel>deleteChannel(String channelType, String channelId)final Call<Unit>markMessageRead(String channelType, String channelId, String messageId)final Call<Unit>showChannel(String channelType, String channelId)final Call<Unit>hideChannel(String channelType, String channelId, Boolean clearHistory)Hides the specified channel with side effects. final Call<Channel>truncateChannel(String channelType, String channelId, Message systemMessage)Removes all of the messages of the channel but doesn't affect the channel data or members. final Call<Unit>stopWatching(String channelType, String channelId)final Call<Channel>updateChannel(String channelType, String channelId, Message updateMessage, Map<String, Object> channelExtraData)Updates all of the channel data. final Call<Channel>updateChannelPartial(String channelType, String channelId, Map<String, Object> set, List<String> unset)Updates specific fields of channel data retaining the custom data fields which were set previously. final Call<Channel>enableSlowMode(String channelType, String channelId, Integer cooldownTimeInSeconds)Enables slow mode for the channel. final Call<Channel>disableSlowMode(String channelType, String channelId)Disables slow mode for the channel. final Call<Channel>rejectInvite(String channelType, String channelId)final Call<ChatEvent>sendEvent(String eventType, String channelType, String channelId, Map<Object, Object> extraData)Sends an event to all users watching the channel. final StringgetVersion()final Call<Channel>acceptInvite(String channelType, String channelId, String message)final Call<Unit>markAllReadInternal()Marks all the channel as read. final Call<Unit>markAllRead()Marks all the channel as read. final Call<Unit>markRead(String channelType, String channelId)Marks the specified channel as read. final Call<Unit>markReadInternal(String channelType, String channelId)Marks the specified channel as read without running a precondition. final Call<List<User>>updateUsers(List<User> users)final Call<User>updateUser(User user)final Call<User>partialUpdateUser(String id, Map<String, Object> set, List<String> unset)Updates specific user fields retaining the custom data fields which were set previously. final Call<List<User>>queryUsers(QueryUsersRequest query)final Call<Channel>addMembers(String channelType, String channelId, List<String> members)final Call<Channel>removeMembers(String channelType, String channelId, List<String> members)Method to remove members of a given channel. final Call<Unit>muteChannel(String channelType, String channelId, Integer expiration)Mutes a channel for the current user. final Call<Unit>muteChannel(String channelType, String channelId)Mutes a channel for the current user. final Call<Unit>unmuteChannel(String channelType, String channelId)Unmutes a channel for the current user. final Call<Mute>muteUser(String userId, Integer timeout)Mutes a user. final Call<Mute>muteUser(String userId)Mutes a user. final Call<Unit>unmuteUser(String userId)Unmutes a previously muted user. final Call<Unit>unmuteCurrentUser()final Call<Mute>muteCurrentUser()final Call<Flag>flagUser(String userId)final Call<Flag>unflagUser(String userId)final Call<Flag>flagMessage(String messageId)final Call<Flag>unflagMessage(String messageId)final Call<Message>translate(String messageId, String language)final Call<Unit>banUser(String targetId, String channelType, String channelId, String reason, Integer timeout)final Call<Unit>unbanUser(String targetId, String channelType, String channelId)final Call<Unit>shadowBanUser(String targetId, String channelType, String channelId, String reason, Integer timeout)final Call<Unit>removeShadowBan(String targetId, String channelType, String channelId)final Call<List<BannedUser>>queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual, Date createdAtBefore, Date createdAtBeforeOrEqual)final Call<List<BannedUser>>queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual, Date createdAtBefore)final Call<List<BannedUser>>queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual)final Call<List<BannedUser>>queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter)final Call<List<BannedUser>>queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit)final Call<List<BannedUser>>queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset)final Call<List<BannedUser>>queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort)final Call<List<BannedUser>>queryBannedUsers(FilterObject filter)final UnitsetPushNotificationReceivedListener(PushNotificationReceivedListener pushNotificationReceivedListener)final StringgetConnectionId()final UsergetCurrentUser()final StringgetCurrentToken()final BooleanisSocketConnected()final ChannelClientchannel(String channelType, String channelId)Returns a ChannelClient for given type and id. final ChannelClientchannel(String cid)Returns a ChannelClient for given cid. final Call<Channel>createChannel(String channelType, String channelId, Map<String, Object> extraData)final Call<Channel>createChannel(String channelType, String channelId, List<String> members)final Call<Channel>createChannel(String channelType, List<String> members)final Call<Channel>createChannel(String channelType, List<String> members, Map<String, Object> extraData)final Call<Channel>createChannel(String channelType, String channelId, List<String> members, Map<String, Object> extraData)final Call<List<ChatEvent>>getSyncHistory(List<String> channelsIds, Date lastSyncAt)Returns all events that happened for a list of channels since last sync (while the user was not connected to the web-socket). final StringdevToken(String userId)-
-
Method Detail
-
getDisconnectListeners
final List<Function1<User, Unit>> getDisconnectListeners()
-
getPreSetUserListeners
final List<Function1<User, Unit>> getPreSetUserListeners()
-
getConfig
final ChatClientConfig getConfig()
-
getNotifications
final ChatNotifications getNotifications()
-
getPlugins
final Collection<Plugin> getPlugins()
-
connectUser
@CheckResult() final Call<ConnectionData> connectUser(User user, String token)
Initializes ChatClient for a specific user using the given user token.
- Parameters:
user- Instance of User type.token- Instance of JWT token.
-
connectUser
@CheckResult() final Call<ConnectionData> connectUser(User user, TokenProvider tokenProvider)
Initializes ChatClient for a specific user. The tokenProvider implementation is used for the initial token, and it's also invoked whenever the user's token has expired, to fetch a new token.
This method performs required operations before connecting with the Stream API. Moreover, it warms up the connection, sets up notifications, and connects to the socket. You can use listener to get updates about socket connection.
- Parameters:
user- The user to set.tokenProvider- A TokenProvider implementation.
-
appSettings
final Call<AppSettings> appSettings()
Get the current settings of the app. Check AppSettings.
-
setUserWithoutConnectingIfNeeded
final Unit setUserWithoutConnectingIfNeeded()
Initializes ChatClient with stored user data. Caution: This method doesn't establish connection to the web socket, you should use connectUser instead.
This method initializes ChatClient to allow the use of Stream REST API client. Moreover, it warms up the connection, and sets up notifications.
-
containsStoredCredentials
final Boolean containsStoredCredentials()
-
connectAnonymousUser
@CheckResult() final Call<ConnectionData> connectAnonymousUser()
-
connectGuestUser
@CheckResult() final Call<ConnectionData> connectGuestUser(String userId, String username)
-
getGuestToken
@CheckResult() final Call<GuestUser> getGuestToken(String userId, String userName)
-
queryMembers
@CheckResult() final Call<List<Member>> queryMembers(String channelType, String channelId, Integer offset, Integer limit, FilterObject filter, QuerySort<Member> sort, List<Member> members)
-
sendFile
@CheckResult()@JvmOverloads() final Call<String> sendFile(String channelType, String channelId, File file, ProgressCallback callback)
Uploads a file for the given channel. Progress can be accessed via callback.
The Stream CDN imposes the following restrictions on file uploads:
The maximum file size is 20 MB
- Parameters:
channelType- The channel type.channelId- The channel id.file- The file that needs to be uploaded.callback- The callback to track progress.
-
sendFile
@CheckResult()@JvmOverloads() final Call<String> sendFile(String channelType, String channelId, File file)
Uploads a file for the given channel. Progress can be accessed via callback.
The Stream CDN imposes the following restrictions on file uploads:
The maximum file size is 20 MB
- Parameters:
channelType- The channel type.channelId- The channel id.file- The file that needs to be uploaded.
-
sendImage
@CheckResult()@JvmOverloads() final Call<String> sendImage(String channelType, String channelId, File file, ProgressCallback callback)
Uploads an image for the given channel. Progress can be accessed via callback.
The Stream CDN imposes the following restrictions on image uploads:
The maximum image size is 20 MB
Supported MIME types are listed in StreamCdnImageMimeTypes.SUPPORTED_IMAGE_MIME_TYPES
- Parameters:
channelType- The channel type.channelId- Еhe channel id.file- The image file that needs to be uploaded.callback- The callback to track progress.
-
sendImage
@CheckResult()@JvmOverloads() final Call<String> sendImage(String channelType, String channelId, File file)
Uploads an image for the given channel. Progress can be accessed via callback.
The Stream CDN imposes the following restrictions on image uploads:
The maximum image size is 20 MB
Supported MIME types are listed in StreamCdnImageMimeTypes.SUPPORTED_IMAGE_MIME_TYPES
- Parameters:
channelType- The channel type.channelId- Еhe channel id.file- The image file that needs to be uploaded.
-
deleteFile
@CheckResult() final Call<Unit> deleteFile(String channelType, String channelId, String url)
Deletes the file represented by url from the given channel.
- Parameters:
channelType- The channel type.channelId- The channel id.url- The URL of the file to be deleted.
-
deleteImage
@CheckResult() final Call<Unit> deleteImage(String channelType, String channelId, String url)
Deletes the image represented by url from the given channel.
- Parameters:
channelType- The channel type.channelId- The channel id.url- The URL of the image to be deleted.
-
getReactions
@CheckResult() final Call<List<Reaction>> getReactions(String messageId, Integer offset, Integer limit)
-
sendReaction
@CheckResult()@JvmOverloads() final Call<Reaction> sendReaction(String messageId, String reactionType, Boolean enforceUnique)
-
sendReaction
@CheckResult()@JvmOverloads() final Call<Reaction> sendReaction(String messageId, String reactionType)
-
sendReaction
@CheckResult()@JvmOverloads() final Call<Reaction> sendReaction(Reaction reaction, Boolean enforceUnique)
-
sendReaction
@CheckResult()@JvmOverloads() final Call<Reaction> sendReaction(Reaction reaction)
-
deleteReaction
@CheckResult() final Call<Message> deleteReaction(String messageId, String reactionType)
-
disconnectSocket
final Unit disconnectSocket()
-
reconnectSocket
final Unit reconnectSocket()
-
addSocketListener
final Unit addSocketListener(SocketListener listener)
-
removeSocketListener
final Unit removeSocketListener(SocketListener listener)
-
subscribe
final Disposable subscribe(ChatEventListener<ChatEvent> listener)
-
subscribeFor
final Disposable subscribeFor(String eventTypes, ChatEventListener<ChatEvent> listener)
Subscribes to the specific eventTypes of the client.
-
subscribeFor
final Disposable subscribeFor(LifecycleOwner lifecycleOwner, String eventTypes, ChatEventListener<ChatEvent> listener)
Subscribes to the specific eventTypes of the client, in the lifecycle of lifecycleOwner.
Only receives events when the lifecycle is in a STARTED state, otherwise events are dropped.
-
subscribeFor
final Disposable subscribeFor(Class<out ChatEvent> eventTypes, ChatEventListener<ChatEvent> listener)
Subscribes to the specific eventTypes of the client.
-
subscribeFor
final Disposable subscribeFor(LifecycleOwner lifecycleOwner, Class<out ChatEvent> eventTypes, ChatEventListener<ChatEvent> listener)
Subscribes to the specific eventTypes of the client, in the lifecycle of lifecycleOwner.
Only receives events when the lifecycle is in a STARTED state, otherwise events are dropped.
-
subscribeForSingle
final Disposable subscribeForSingle(String eventType, ChatEventListener<ChatEvent> listener)
Subscribes for the next event with the given eventType.
-
subscribeForSingle
final <T extends ChatEvent> Disposable subscribeForSingle(Class<T> eventType, ChatEventListener<T> listener)
Subscribes for the next event with the given eventType.
-
disconnect
final Unit disconnect()
-
getDevices
@CheckResult() final Call<List<Device>> getDevices()
-
deleteDevice
@CheckResult() final Call<Unit> deleteDevice(Device device)
-
addDevice
@CheckResult() final Call<Unit> addDevice(Device device)
-
searchMessages
@CheckResult() final Call<SearchMessagesResult> searchMessages(FilterObject channelFilter, FilterObject messageFilter, Integer offset, Integer limit, String next, QuerySort<Message> sort)
Search messages across channels. There are two ways to paginate through search results:
Limit and offset will allow you to access up to 1000 results matching your query. You will not be able to sort using limit and offset. The results will instead be sorted by relevance and message ID.
Next pagination will allow you to access all search results that match your query, and you will be able to sort using any filter-able fields and custom fields. Pages of sort results will be returned with next and previous strings which can be supplied as a next parameter when making a query to get a new page of results.
- Parameters:
channelFilter- Channel filter conditions.messageFilter- Message filter conditions.offset- Pagination offset, cannot be used with sort or next.limit- The number of messages to return.next- Pagination parameter, cannot be used with non-zero offset.sort- The sort criteria applied to the result, cannot be used with non-zero offset.
-
getPinnedMessages
@CheckResult() final Call<List<Message>> getPinnedMessages(String channelType, String channelId, Integer limit, QuerySort<Message> sort, PinnedMessagesPagination pagination)
Returns a list of messages pinned in the channel. You can sort the list by specifying sort parameter. Keep in mind that for now we only support sorting by Message.pinnedAt. The list can be paginated in a few different ways using limit and pagination.
- Parameters:
channelType- The channel type.channelId- The id of the channel we're querying.limit- Max limit of messages to be fetched.sort- Parameter by which we sort the messages.pagination- Provides different options for pagination.
-
getFileAttachments
@CheckResult() final Call<List<Attachment>> getFileAttachments(String channelType, String channelId, Integer offset, Integer limit)
-
getImageAttachments
@CheckResult() final Call<List<Attachment>> getImageAttachments(String channelType, String channelId, Integer offset, Integer limit)
-
getMessagesWithAttachments
@CheckResult() final Call<List<Message>> getMessagesWithAttachments(String channelType, String channelId, Integer offset, Integer limit, List<String> types)
Returns a Call with messages that contain at least one desired type attachment but not necessarily all of them will have a specified type.
- Parameters:
channelType- The channel type.channelId- The channel id.offset- The messages offset.limit- Max limit messages to be fetched.types- Desired attachment's types list.
-
getRepliesInternal
@CheckResult() final Call<List<Message>> getRepliesInternal(String messageId, Integer limit)
-
getRepliesMoreInternal
@CheckResult() final Call<List<Message>> getRepliesMoreInternal(String messageId, String firstId, Integer limit)
-
getReplies
@CheckResult() final Call<List<Message>> getReplies(String messageId, Integer limit)
-
getRepliesMore
@CheckResult() final Call<List<Message>> getRepliesMore(String messageId, String firstId, Integer limit)
-
sendAction
@CheckResult() final Call<Message> sendAction(SendActionRequest request)
-
deleteMessage
@CheckResult()@JvmOverloads() final Call<Message> deleteMessage(String messageId, Boolean hard)
-
deleteMessage
@CheckResult()@JvmOverloads() final Call<Message> deleteMessage(String messageId)
-
getMessage
@CheckResult() final Call<Message> getMessage(String messageId)
-
sendMessage
@CheckResult() final Call<Message> sendMessage(String channelType, String channelId, Message message)
Sends the message to the given channel.
- Parameters:
channelType- The channel type.channelId- The channel id.message- Message object
-
updateMessage
@CheckResult() final Call<Message> updateMessage(Message message)
Updates the message in the API and calls the plugins that handle this request. OfflinePlugin can be used here to store the updated message locally.
- Parameters:
message- Message The message to be updated.
-
updateMessageInternal
final Call<Message> updateMessageInternal(Message message)
Updates the message in the API without causing any side effect in the local data of the SDK.
- Parameters:
message- Message The message to be updated in the API
-
partialUpdateMessage
@CheckResult() final Call<Message> partialUpdateMessage(String messageId, Map<String, Object> set, List<String> unset)
Partially updates specific Message fields retaining the fields which were set previously.
- Parameters:
messageId- The message ID.set- The key-value data which will be added to the existing message object.unset- The list of fields which will be removed from the existing message object.
-
pinMessage
@CheckResult() final Call<Message> pinMessage(Message message, Date expirationDate)
Pins the message.
- Parameters:
message- The message object containing the ID of the message to be pinned.expirationDate- The exact expiration date.
-
pinMessage
@CheckResult() final Call<Message> pinMessage(Message message, Integer timeout)
Pins the message.
- Parameters:
message- The message object containing the ID of the message to be pinned.timeout- The expiration timeout in seconds.
-
unpinMessage
@CheckResult() final Call<Message> unpinMessage(Message message)
Unpins the message that was previously pinned
- Parameters:
message- The message object containing the ID of the message to be unpinned.
-
queryChannelsInternal
@CheckResult() final Call<List<Channel>> queryChannelsInternal(QueryChannelsRequest request)
-
queryChannelInternal
@CheckResult() final Call<Channel> queryChannelInternal(String channelType, String channelId, QueryChannelRequest request)
-
queryChannel
@CheckResult() final Call<Channel> queryChannel(String channelType, String channelId, QueryChannelRequest request)
-
queryChannels
@CheckResult() final Call<List<Channel>> queryChannels(QueryChannelsRequest request)
-
deleteChannel
@CheckResult() final Call<Channel> deleteChannel(String channelType, String channelId)
-
markMessageRead
@CheckResult() final Call<Unit> markMessageRead(String channelType, String channelId, String messageId)
-
showChannel
@CheckResult() final Call<Unit> showChannel(String channelType, String channelId)
-
hideChannel
@CheckResult() final Call<Unit> hideChannel(String channelType, String channelId, Boolean clearHistory)
Hides the specified channel with side effects.
- Parameters:
channelType- The type of the channel.channelId- Id of the channel.clearHistory- Boolean, if you want to clear the history of this channel or not.
-
truncateChannel
@CheckResult() final Call<Channel> truncateChannel(String channelType, String channelId, Message systemMessage)
Removes all of the messages of the channel but doesn't affect the channel data or members.
- Parameters:
channelType- The channel type.channelId- The channel id.systemMessage- The system message that will be shown in the channel.
-
stopWatching
@CheckResult() final Call<Unit> stopWatching(String channelType, String channelId)
-
updateChannel
@CheckResult() final Call<Channel> updateChannel(String channelType, String channelId, Message updateMessage, Map<String, Object> channelExtraData)
Updates all of the channel data. Any data that is present on the channel and not included in a full update will be deleted.
- Parameters:
channelType- The channel type.channelId- The channel id.updateMessage- The message object allowing you to show a system message in the channel.channelExtraData- The updated channel extra data.
-
updateChannelPartial
@CheckResult() final Call<Channel> updateChannelPartial(String channelType, String channelId, Map<String, Object> set, List<String> unset)
Updates specific fields of channel data retaining the custom data fields which were set previously.
- Parameters:
channelType- The channel type.channelId- The channel id.set- The key-value data which will be added to the existing channel data object.unset- The list of fields which will be removed from the existing channel data object.
-
enableSlowMode
@CheckResult() final Call<Channel> enableSlowMode(String channelType, String channelId, Integer cooldownTimeInSeconds)
Enables slow mode for the channel. When slow mode is enabled, users can only send a message every cooldownTimeInSeconds time interval. The cooldownTimeInSeconds is specified in seconds, and should be between 1-120.
- Parameters:
channelType- The channel type.channelId- The channel id.cooldownTimeInSeconds- The duration of the time interval users have to wait between messages.
-
disableSlowMode
@CheckResult() final Call<Channel> disableSlowMode(String channelType, String channelId)
Disables slow mode for the channel.
- Parameters:
channelType- The channel type.channelId- The channel id.
-
rejectInvite
@CheckResult() final Call<Channel> rejectInvite(String channelType, String channelId)
-
sendEvent
@CheckResult() final Call<ChatEvent> sendEvent(String eventType, String channelType, String channelId, Map<Object, Object> extraData)
Sends an event to all users watching the channel.
- Parameters:
eventType- The event name.channelType- The channel type.channelId- The channel id.extraData- The event payload.
-
getVersion
final String getVersion()
-
acceptInvite
@CheckResult() final Call<Channel> acceptInvite(String channelType, String channelId, String message)
-
markAllReadInternal
final Call<Unit> markAllReadInternal()
Marks all the channel as read.
-
markAllRead
@CheckResult() final Call<Unit> markAllRead()
Marks all the channel as read.
-
markRead
@CheckResult() final Call<Unit> markRead(String channelType, String channelId)
Marks the specified channel as read.
- Parameters:
channelType- Type of the channel.channelId- Id of the channel.
-
markReadInternal
@CheckResult() final Call<Unit> markReadInternal(String channelType, String channelId)
Marks the specified channel as read without running a precondition.
- Parameters:
channelType- Type of the channel.channelId- Id of the channel.
-
updateUsers
@CheckResult() final Call<List<User>> updateUsers(List<User> users)
-
updateUser
@CheckResult() final Call<User> updateUser(User user)
-
partialUpdateUser
@CheckResult() final Call<User> partialUpdateUser(String id, Map<String, Object> set, List<String> unset)
Updates specific user fields retaining the custom data fields which were set previously.
- Parameters:
id- User ids.set- The key-value data which will be added to the existing user object.unset- The list of fields which will be removed from the existing user object.
-
queryUsers
@CheckResult() final Call<List<User>> queryUsers(QueryUsersRequest query)
-
addMembers
@CheckResult() final Call<Channel> addMembers(String channelType, String channelId, List<String> members)
-
removeMembers
@CheckResult() final Call<Channel> removeMembers(String channelType, String channelId, List<String> members)
Method to remove members of a given channel.
- Parameters:
channelType- The channel type.channelId- The channel id.members- The list of the members to be removed.
-
muteChannel
@JvmOverloads()@CheckResult() final Call<Unit> muteChannel(String channelType, String channelId, Integer expiration)
Mutes a channel for the current user. Messages added to the channel will not trigger push notifications, and will not change the unread count for the users that muted it. By default, mutes stay in place indefinitely until the user removes it. However, you can optionally set an expiration time. Triggers
notification.channel_mutes_updatedevent.- Parameters:
channelType- The channel type.channelId- The channel id.expiration- The duration of mute in millis.
-
muteChannel
@JvmOverloads()@CheckResult() final Call<Unit> muteChannel(String channelType, String channelId)
Mutes a channel for the current user. Messages added to the channel will not trigger push notifications, and will not change the unread count for the users that muted it. By default, mutes stay in place indefinitely until the user removes it. However, you can optionally set an expiration time. Triggers
notification.channel_mutes_updatedevent.- Parameters:
channelType- The channel type.channelId- The channel id.
-
unmuteChannel
@CheckResult() final Call<Unit> unmuteChannel(String channelType, String channelId)
Unmutes a channel for the current user. Triggers
notification.channel_mutes_updatedevent.- Parameters:
channelType- The channel type.channelId- The channel id.
-
muteUser
@JvmOverloads()@CheckResult() final Call<Mute> muteUser(String userId, Integer timeout)
Mutes a user. Messages from muted users will not trigger push notifications. By default, mutes stay in place indefinitely until the user removes it. However, you can optionally set a mute timeout. Triggers
notification.mutes_updatedevent.- Parameters:
userId- The user id to mute.timeout- The timeout in minutes until the mute is expired.
-
muteUser
@JvmOverloads()@CheckResult() final Call<Mute> muteUser(String userId)
Mutes a user. Messages from muted users will not trigger push notifications. By default, mutes stay in place indefinitely until the user removes it. However, you can optionally set a mute timeout. Triggers
notification.mutes_updatedevent.- Parameters:
userId- The user id to mute.
-
unmuteUser
@CheckResult() final Call<Unit> unmuteUser(String userId)
Unmutes a previously muted user. Triggers
notification.mutes_updatedevent.- Parameters:
userId- The user id to unmute.
-
unmuteCurrentUser
@CheckResult() final Call<Unit> unmuteCurrentUser()
-
muteCurrentUser
@CheckResult() final Call<Mute> muteCurrentUser()
-
flagUser
@CheckResult() final Call<Flag> flagUser(String userId)
-
unflagUser
@CheckResult() final Call<Flag> unflagUser(String userId)
-
flagMessage
@CheckResult() final Call<Flag> flagMessage(String messageId)
-
unflagMessage
@CheckResult() final Call<Flag> unflagMessage(String messageId)
-
translate
@CheckResult() final Call<Message> translate(String messageId, String language)
-
banUser
@CheckResult() final Call<Unit> banUser(String targetId, String channelType, String channelId, String reason, Integer timeout)
-
unbanUser
@CheckResult() final Call<Unit> unbanUser(String targetId, String channelType, String channelId)
-
shadowBanUser
@CheckResult() final Call<Unit> shadowBanUser(String targetId, String channelType, String channelId, String reason, Integer timeout)
-
removeShadowBan
@CheckResult() final Call<Unit> removeShadowBan(String targetId, String channelType, String channelId)
-
queryBannedUsers
@CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual, Date createdAtBefore, Date createdAtBeforeOrEqual)
-
queryBannedUsers
@CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual, Date createdAtBefore)
-
queryBannedUsers
@CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual)
-
queryBannedUsers
@CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter)
-
queryBannedUsers
@CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit)
-
queryBannedUsers
@CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset)
-
queryBannedUsers
@CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort)
-
queryBannedUsers
@CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter)
-
setPushNotificationReceivedListener
final Unit setPushNotificationReceivedListener(PushNotificationReceivedListener pushNotificationReceivedListener)
-
getConnectionId
final String getConnectionId()
-
getCurrentUser
final User getCurrentUser()
-
getCurrentToken
final String getCurrentToken()
-
isSocketConnected
final Boolean isSocketConnected()
-
channel
final ChannelClient channel(String channelType, String channelId)
Returns a ChannelClient for given type and id.
- Parameters:
channelType- The channel type.channelId- The channel id.
-
channel
final ChannelClient channel(String cid)
Returns a ChannelClient for given cid.
- Parameters:
cid- The full channel id.
-
createChannel
@CheckResult() final Call<Channel> createChannel(String channelType, String channelId, Map<String, Object> extraData)
-
createChannel
@CheckResult() final Call<Channel> createChannel(String channelType, String channelId, List<String> members)
-
createChannel
@CheckResult() final Call<Channel> createChannel(String channelType, List<String> members)
-
createChannel
@CheckResult() final Call<Channel> createChannel(String channelType, List<String> members, Map<String, Object> extraData)
-
createChannel
@CheckResult() final Call<Channel> createChannel(String channelType, String channelId, List<String> members, Map<String, Object> extraData)
-
getSyncHistory
@CheckResult() final Call<List<ChatEvent>> getSyncHistory(List<String> channelsIds, Date lastSyncAt)
Returns all events that happened for a list of channels since last sync (while the user was not connected to the web-socket).
- Parameters:
channelsIds- The list of channel CIDslastSyncAt- The last time the user was online and in sync
-
-
-
-