-
public final class ChannelClient
-
-
Method Summary
Modifier and Type Method Description final StringgetCid()final StringgetChannelType()final StringgetChannelId()final Call<Channel>create(List<String> members, Map<String, Object> extraData)final Call<Channel>create(Map<String, Object> extraData)final Disposablesubscribe(ChatEventListener<ChatEvent> listener)final DisposablesubscribeFor(String eventTypes, ChatEventListener<ChatEvent> listener)final DisposablesubscribeFor(LifecycleOwner lifecycleOwner, String eventTypes, ChatEventListener<ChatEvent> listener)final DisposablesubscribeFor(Class<out ChatEvent> eventTypes, ChatEventListener<ChatEvent> listener)final DisposablesubscribeFor(LifecycleOwner lifecycleOwner, Class<out ChatEvent> eventTypes, ChatEventListener<ChatEvent> listener)final DisposablesubscribeForSingle(String eventType, ChatEventListener<ChatEvent> listener)final <T extends ChatEvent> DisposablesubscribeForSingle(Class<T> eventType, ChatEventListener<T> listener)final Call<Channel>query(QueryChannelRequest request)final Call<Channel>watch(WatchChannelRequest request)final Call<Channel>watch(Map<String, Object> data)final Call<Channel>watch()final Call<Unit>stopWatching()final Call<Message>getMessage(String messageId)final Call<Message>updateMessage(Message message)final Call<Message>deleteMessage(String messageId)final Call<Message>sendMessage(Message message)final Call<Unit>banUser(String targetId, String reason, Integer timeout)final Call<Unit>unbanUser(String targetId)final Call<Unit>shadowBanUser(String targetId, String reason, Integer timeout)final Call<Unit>removeShadowBan(String targetId)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 Call<List<BannedUser>>queryBannedUsers()final Call<Unit>markMessageRead(String messageId)final Call<Unit>markRead()final Call<Channel>delete()final Call<Unit>show()final Call<Unit>hide(Boolean clearHistory)final Call<Channel>truncate()Removes all of the messages of the channel but doesn't affect the channel data or members. final Call<String>sendFile(File file, ProgressCallback callback)Uploads a file for the given channel. final Call<String>sendFile(File file)Uploads a file for the given channel. final Call<String>sendImage(File file, ProgressCallback callback)Uploads an image for the given channel. final Call<String>sendImage(File file)Uploads an image for the given channel. final Call<Unit>deleteFile(String url)Deletes the file represented by url from the given channel. final Call<Unit>deleteImage(String url)Deletes the image represented by url from the given channel. final Call<Reaction>sendReaction(Reaction reaction, Boolean enforceUnique)final Call<Message>sendAction(SendActionRequest request)final Call<Message>deleteReaction(String messageId, String reactionType)final Call<List<Reaction>>getReactions(String messageId, Integer offset, Integer limit)final Call<List<Message>>getReactions(String messageId, String firstReactionId, Integer limit)final Call<Channel>update(Message message, Map<String, Object> extraData)Updates all of the channel data. final Call<Channel>updatePartial(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(Integer cooldownTimeInSeconds)Enables slow mode for the channel. final Call<Channel>disableSlowMode()Disables slow mode for the channel. final Call<Channel>addMembers(String userIds)final Call<Channel>removeMembers(String userIds)final Call<Channel>acceptInvite(String message)final Call<Channel>rejectInvite()final Call<Unit>mute(Integer expiration)Mutes a channel for the current user. final Call<Unit>mute()Mutes a channel for the current user. final Call<Unit>unmute()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<Mute>muteCurrentUser()final Call<Unit>unmuteCurrentUser()final Call<ChatEvent>keystroke()final Call<ChatEvent>keystroke(String parentId)final Call<ChatEvent>stopTyping()final Call<ChatEvent>stopTyping(String parentId)final Call<ChatEvent>sendEvent(String eventType, Map<Object, Object> extraData)Sends an event to all users watching the channel. final Call<List<Member>>queryMembers(Integer offset, Integer limit, FilterObject filter, QuerySort<Member> sort, List<Member> members)final Call<List<Attachment>>getFileAttachments(Integer offset, Integer limit)final Call<List<Attachment>>getImageAttachments(Integer offset, Integer limit)final Call<List<Message>>getMessagesWithAttachments(Integer offset, Integer limit, String type)final Call<List<Message>>getMessagesWithAttachments(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<Message>pinMessage(Message message, Date expirationDate)final Call<Message>pinMessage(Message message, Integer timeout)final Call<Message>unpinMessage(Message message)-
-
Method Detail
-
getChannelType
final String getChannelType()
-
getChannelId
final String getChannelId()
-
subscribe
final Disposable subscribe(ChatEventListener<ChatEvent> listener)
-
subscribeFor
final Disposable subscribeFor(String eventTypes, ChatEventListener<ChatEvent> listener)
-
subscribeFor
final Disposable subscribeFor(LifecycleOwner lifecycleOwner, String eventTypes, ChatEventListener<ChatEvent> listener)
-
subscribeFor
final Disposable subscribeFor(Class<out ChatEvent> eventTypes, ChatEventListener<ChatEvent> listener)
-
subscribeFor
final Disposable subscribeFor(LifecycleOwner lifecycleOwner, Class<out ChatEvent> eventTypes, ChatEventListener<ChatEvent> listener)
-
subscribeForSingle
final Disposable subscribeForSingle(String eventType, ChatEventListener<ChatEvent> listener)
-
subscribeForSingle
final <T extends ChatEvent> Disposable subscribeForSingle(Class<T> eventType, ChatEventListener<T> listener)
-
query
final Call<Channel> query(QueryChannelRequest request)
-
watch
final Call<Channel> watch(WatchChannelRequest request)
-
stopWatching
final Call<Unit> stopWatching()
-
getMessage
final Call<Message> getMessage(String messageId)
-
updateMessage
final Call<Message> updateMessage(Message message)
-
deleteMessage
final Call<Message> deleteMessage(String messageId)
-
sendMessage
final Call<Message> sendMessage(Message message)
-
shadowBanUser
final Call<Unit> shadowBanUser(String targetId, String reason, Integer timeout)
-
removeShadowBan
final Call<Unit> removeShadowBan(String targetId)
-
queryBannedUsers
final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual, Date createdAtBefore, Date createdAtBeforeOrEqual)
-
queryBannedUsers
final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual, Date createdAtBefore)
-
queryBannedUsers
final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual)
-
queryBannedUsers
final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter)
-
queryBannedUsers
final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset, Integer limit)
-
queryBannedUsers
final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort, Integer offset)
-
queryBannedUsers
final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySort<BannedUsersSort> sort)
-
queryBannedUsers
final Call<List<BannedUser>> queryBannedUsers(FilterObject filter)
-
queryBannedUsers
final Call<List<BannedUser>> queryBannedUsers()
-
markMessageRead
final Call<Unit> markMessageRead(String messageId)
-
truncate
final Call<Channel> truncate()
Removes all of the messages of the channel but doesn't affect the channel data or members.
-
sendFile
final Call<String> sendFile(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:
file- The file that needs to be uploaded.callback- The callback to track progress.
-
sendFile
final Call<String> sendFile(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:
file- The file that needs to be uploaded.
-
sendImage
final Call<String> sendImage(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:
file- The image file that needs to be uploaded.callback- The callback to track progress.
-
sendImage
final Call<String> sendImage(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:
file- The image file that needs to be uploaded.
-
deleteFile
final Call<Unit> deleteFile(String url)
Deletes the file represented by url from the given channel.
- Parameters:
url- The URL of the file to be deleted.
-
deleteImage
final Call<Unit> deleteImage(String url)
Deletes the image represented by url from the given channel.
- Parameters:
url- The URL of the image to be deleted.
-
sendReaction
final Call<Reaction> sendReaction(Reaction reaction, Boolean enforceUnique)
-
sendAction
final Call<Message> sendAction(SendActionRequest request)
-
deleteReaction
final Call<Message> deleteReaction(String messageId, String reactionType)
-
getReactions
final Call<List<Reaction>> getReactions(String messageId, Integer offset, Integer limit)
-
getReactions
final Call<List<Message>> getReactions(String messageId, String firstReactionId, Integer limit)
-
update
final Call<Channel> update(Message message, Map<String, Object> extraData)
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:
message- The message object allowing you to show a system message in the channel.extraData- The updated channel extra data.
-
updatePartial
final Call<Channel> updatePartial(Map<String, Object> set, List<String> unset)
Updates specific fields of channel data retaining the custom data fields which were set previously.
- Parameters:
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
final Call<Channel> enableSlowMode(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:
cooldownTimeInSeconds- The duration of the time interval users have to wait between messages.
-
disableSlowMode
final Call<Channel> disableSlowMode()
Disables slow mode for the channel.
-
addMembers
final Call<Channel> addMembers(String userIds)
-
removeMembers
final Call<Channel> removeMembers(String userIds)
-
acceptInvite
final Call<Channel> acceptInvite(String message)
-
rejectInvite
final Call<Channel> rejectInvite()
-
mute
final Call<Unit> mute(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:
expiration- The duration of mute in millis.
-
mute
final Call<Unit> mute()
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.
-
unmute
final Call<Unit> unmute()
Unmutes a channel for the current user. Triggers
notification.channel_mutes_updatedevent.
-
muteUser
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
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
final Call<Unit> unmuteUser(String userId)
Unmutes a previously muted user. Triggers
notification.mutes_updatedevent.- Parameters:
userId- The user id to unmute.
-
muteCurrentUser
final Call<Mute> muteCurrentUser()
-
unmuteCurrentUser
final Call<Unit> unmuteCurrentUser()
-
stopTyping
final Call<ChatEvent> stopTyping()
-
stopTyping
final Call<ChatEvent> stopTyping(String parentId)
-
sendEvent
final Call<ChatEvent> sendEvent(String eventType, Map<Object, Object> extraData)
Sends an event to all users watching the channel.
- Parameters:
eventType- The event name.extraData- The event payload.
-
queryMembers
final Call<List<Member>> queryMembers(Integer offset, Integer limit, FilterObject filter, QuerySort<Member> sort, List<Member> members)
-
getFileAttachments
final Call<List<Attachment>> getFileAttachments(Integer offset, Integer limit)
-
getImageAttachments
final Call<List<Attachment>> getImageAttachments(Integer offset, Integer limit)
-
getMessagesWithAttachments
final Call<List<Message>> getMessagesWithAttachments(Integer offset, Integer limit, String type)
-
getMessagesWithAttachments
final Call<List<Message>> getMessagesWithAttachments(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:
offset- The messages offset.limit- Max limit messages to be fetched.types- Desired attachment's types list.
-
pinMessage
final Call<Message> pinMessage(Message message, Date expirationDate)
-
pinMessage
final Call<Message> pinMessage(Message message, Integer timeout)
-
unpinMessage
final Call<Message> unpinMessage(Message message)
-
-
-
-