Package 

Class ChatClient


  • 
    public final class ChatClient
    
                        

    The ChatClient is the main entry point for all low-level operations on chat

    • Method Detail

      • inheritScope

         final CoroutineScope inheritScope(Function1<Job, CoroutineContext> block)

        Inherits the UserScope and provides its Job as an anchor for children.

      • awaitInitializationState

        @StreamHandsOff(reason = This method is used to avoid race-condition between plugin initialization and dependency resolution.) final InitializationState awaitInitializationState(Long timeoutMilliseconds)
      • appSettings

        @CheckResult() final Call<AppSettings> appSettings()

        Get the current settings of the app. Check AppSettings.

      • connectUser

        @CheckResult()@JvmOverloads() final Call<ConnectionData> connectUser(User user, TokenProvider tokenProvider, Long timeoutMilliseconds)

        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.

        Check out docs for more info about tokens. Also visit this site to find more about Json Web Token standard. You can generate the JWT token on using one of the available libraries or use our manual tool for token generation.

        Parameters:
        user - The user to set.
        tokenProvider - A TokenProvider implementation.
        timeoutMilliseconds - The timeout in milliseconds to be waiting until the connection is established.
      • connectUser

        @CheckResult()@JvmOverloads() 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.

        Check out docs for more info about tokens. Also visit this site to find more about Json Web Token standard. You can generate the JWT token on using one of the available libraries or use our manual tool for token generation.

        Parameters:
        user - The user to set.
        tokenProvider - A TokenProvider implementation.
      • switchUser

        @CheckResult()@JvmOverloads() final Call<ConnectionData> switchUser(User user, TokenProvider tokenProvider, Long timeoutMilliseconds, Function0<Unit> onDisconnectionComplete)

        Changes the user. Disconnects the current user and connects to a new one. 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 disconnects from the SDK and right after connects to it with the new User.

        Parameters:
        user - The user to set.
        tokenProvider - A TokenProvider implementation.
        timeoutMilliseconds - The timeout in milliseconds to be waiting until the connection is established.
      • switchUser

        @CheckResult()@JvmOverloads() final Call<ConnectionData> switchUser(User user, TokenProvider tokenProvider, Long timeoutMilliseconds)

        Changes the user. Disconnects the current user and connects to a new one. 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 disconnects from the SDK and right after connects to it with the new User.

        Parameters:
        user - The user to set.
        tokenProvider - A TokenProvider implementation.
        timeoutMilliseconds - The timeout in milliseconds to be waiting until the connection is established.
      • switchUser

        @CheckResult()@JvmOverloads() final Call<ConnectionData> switchUser(User user, TokenProvider tokenProvider)

        Changes the user. Disconnects the current user and connects to a new one. 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 disconnects from the SDK and right after connects to it with the new User.

        Parameters:
        user - The user to set.
        tokenProvider - A TokenProvider implementation.
      • switchUser

        @CheckResult()@JvmOverloads() final Call<ConnectionData> switchUser(User user, String token, Long timeoutMilliseconds, Function0<Unit> onDisconnectionComplete)

        Changes the user. Disconnects the current user and connects to a new one. 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 disconnects from the SDK and right after connects to it with the new User.

        Parameters:
        user - The user to set.
        token - Instance of JWT token.
        timeoutMilliseconds - The timeout in milliseconds to be waiting until the connection is established.
      • switchUser

        @CheckResult()@JvmOverloads() final Call<ConnectionData> switchUser(User user, String token, Long timeoutMilliseconds)

        Changes the user. Disconnects the current user and connects to a new one. 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 disconnects from the SDK and right after connects to it with the new User.

        Parameters:
        user - The user to set.
        token - Instance of JWT token.
        timeoutMilliseconds - The timeout in milliseconds to be waiting until the connection is established.
      • switchUser

        @CheckResult()@JvmOverloads() final Call<ConnectionData> switchUser(User user, String token)

        Changes the user. Disconnects the current user and connects to a new one. 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 disconnects from the SDK and right after connects to it with the new User.

        Parameters:
        user - The user to set.
        token - Instance of JWT token.
      • queryMembers

        @CheckResult() final Call<List<Member>> queryMembers(String channelType, String channelId, Integer offset, Integer limit, FilterObject filter, QuerySorter<Member> sort, List<Member> members)

        Query members and apply side effects if there are any.

        Parameters:
        channelType - The type of channel.
        channelId - The id of the channel.
        offset - Offset limit.
        limit - Number of members to fetch.
        filter - FilterObject to filter members of certain type.
        sort - Sort the list of members.
        members - List of members to search in distinct channels.
      • sendFile

        @CheckResult()@JvmOverloads() final Call<UploadedFile> 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 100 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<UploadedFile> 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 100 MB

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        file - The file that needs to be uploaded.
      • sendFile

        @CheckResult() final Call<UploadedFile> sendFile(String channelType, String channelId, File file, String messageId, ProgressCallback callback, Boolean transform)

        Uploads a file that belongs to the message with messageId, so the id can be propagated to the FileUploader as part of the upload context.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        file - The file that needs to be uploaded.
        messageId - The id of the message the file belongs to, or null when the upload is not part of sending a message.
        callback - The callback to track progress.
        transform - Whether to run file through the FileTransformer first.
      • sendImage

        @CheckResult()@JvmOverloads() final Call<UploadedFile> 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 100 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<UploadedFile> 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 100 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.
      • sendImage

        @CheckResult() final Call<UploadedFile> sendImage(String channelType, String channelId, File file, String messageId, ProgressCallback callback, Boolean transform)

        Uploads an image that belongs to the message with messageId, so the id can be propagated to the FileUploader as part of the upload context.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        file - The image file that needs to be uploaded.
        messageId - The id of the message the image belongs to, or null when the upload is not part of sending a message.
        callback - The callback to track progress.
        transform - Whether to run file through the FileTransformer first.
      • 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.
      • deleteFile

        @CheckResult() final Call<Unit> deleteFile(String url)

        Deletes a file not related to any channel.

        Parameters:
        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.
      • deleteImage

        @CheckResult() final Call<Unit> deleteImage(String url)

        Deletes an image not related to any channel.

        Parameters:
        url - The URL of the image to be deleted.
      • uploadFile

        @CheckResult()@JvmOverloads() final Call<UploadedFile> uploadFile(File file, ProgressCallback progressCallback)

        Uploads a file not related to any channel. Progress can be accessed via progressCallback.

        Parameters:
        file - The file to be uploaded.
        progressCallback - The callback to be invoked periodically to report upload progress.
      • uploadImage

        @CheckResult()@JvmOverloads() final Call<UploadedFile> uploadImage(File file, ProgressCallback progressCallback)

        Uploads an image not related to any channel. Progress can be accessed via progressCallback.

        Parameters:
        file - The image to be uploaded.
        progressCallback - The callback to be invoked periodically to report upload progress.
      • getReactions

        @CheckResult() final Call<List<Reaction>> getReactions(String messageId, Integer offset, Integer limit)

        Retrieves the reactions on a given message.

        Parameters:
        messageId - The ID of the message to which the reactions belong.
        offset - The offset of the first reaction to retrieve.
        limit - The maximum number of reactions to retrieve.
      • queryReactions

        @CheckResult() final Call<QueryReactionsResult> queryReactions(String messageId, FilterObject filter, Integer limit, String next, QuerySorter<Reaction> sort)

        Queries reactions for a given message.

        Parameters:
        messageId - The ID of the message to which the reactions belong.
        filter - The filter to apply to the reactions.
        limit - The maximum number of reactions to retrieve.
        next - The pagination token for fetching the next set of results.
        sort - The sorting criteria for the reactions.
      • deleteReaction

        @CheckResult() final Call<Message> deleteReaction(String messageId, String reactionType, String cid)

        Deletes the reaction associated with the message with the given message id. cid parameter is being used in side effect functions executed by plugins. You can skip it if plugins are not being used.

        The call will be retried accordingly to retryPolicy.

        Parameters:
        messageId - The id of the message to which reaction belongs.
        reactionType - The type of reaction.
        cid - The full channel id, i.e.
      • sendReaction

        @CheckResult()@JvmOverloads() final Call<Reaction> sendReaction(Reaction reaction, Boolean enforceUnique, String cid, Boolean skipPush)

        Sends the reaction. Use enforceUnique parameter to specify whether the reaction should replace other reactions added by the current user. cid parameter is being used in side effect functions executed by plugins. You can skip it if plugins are not being used.

        The call will be retried accordingly to retryPolicy.

        Parameters:
        reaction - The Reaction to send.
        enforceUnique - Flag to determine whether the reaction should replace other ones added by the current user.
        cid - The full channel id, i.e.
        skipPush - If set to "true", skips sending push notification when reacting to a message.
      • sendReaction

        @CheckResult()@JvmOverloads() final Call<Reaction> sendReaction(Reaction reaction, Boolean enforceUnique, String cid)

        Sends the reaction. Use enforceUnique parameter to specify whether the reaction should replace other reactions added by the current user. cid parameter is being used in side effect functions executed by plugins. You can skip it if plugins are not being used.

        The call will be retried accordingly to retryPolicy.

        Parameters:
        reaction - The Reaction to send.
        enforceUnique - Flag to determine whether the reaction should replace other ones added by the current user.
        cid - The full channel id, i.e.
      • sendReaction

        @CheckResult()@JvmOverloads() final Call<Reaction> sendReaction(Reaction reaction, Boolean enforceUnique)

        Sends the reaction. Use enforceUnique parameter to specify whether the reaction should replace other reactions added by the current user. cid parameter is being used in side effect functions executed by plugins. You can skip it if plugins are not being used.

        The call will be retried accordingly to retryPolicy.

        Parameters:
        reaction - The Reaction to send.
        enforceUnique - Flag to determine whether the reaction should replace other ones added by the current user.
      • fetchCurrentUser

         final Call<User> fetchCurrentUser()

        Fetches the current user. Works only if the user was previously set and the WS connections is closed.

      • reconnectSocket

        @CheckResult() final Call<Unit> reconnectSocket()

        Reconnects the socket. Works only if the user was previously set and the WS connections is closed.

      • clearPersistence

        @CheckResult() final Call<Unit> clearPersistence()

        Clear local data stored on the device from the current user.

        This method can be called even if the user is not connected, on that case the stored credentials will be used.

        If there is already a connection alive for the current user, it will be disconnected.

      • clearCacheAndTemporaryFiles

        @CheckResult() final Call<Unit> clearCacheAndTemporaryFiles(Context context)

        Clears all cache and temporary files created by the Stream Chat SDK.

        This method removes:

        • All cached files from the default cache directory

        • All cached images from the image cache directory

        • All cached files during the upload/download process

        • All temporary files stored in external storage by the SDK (Photos and videos captured using the SDK)

        Note: This method does NOT clear database persistence. Use clearPersistence to clear database data, or call both methods if you need to clear all SDK data.

        Note: This method does NOT clear downloads made by the SDK to the file system. Those files are stored outside of the SDK's control and cannot be removed automatically.

        Parameters:
        context - The Android Context for accessing cache and external storage directories
      • disconnect

        @CheckResult()@JvmOverloads() final Call<Unit> disconnect(Boolean flushPersistence, Boolean deleteDevice)

        Disconnect the current user, stop all observers and clear user data. This method should only be used whenever the user logouts from the main app. You shouldn't call this method, if the user will continue using the Chat in the future.

        Parameters:
        flushPersistence - if true will clear user data, also when no user is connected.
        deleteDevice - If set to true, will attempt to delete the registered device from Stream backend.
      • disconnect

        @CheckResult()@JvmOverloads() final Call<Unit> disconnect(Boolean flushPersistence)

        Disconnect the current user, stop all observers and clear user data. This method should only be used whenever the user logouts from the main app. You shouldn't call this method, if the user will continue using the Chat in the future.

        Parameters:
        flushPersistence - if true will clear user data, also when no user is connected.
      • setUserPushPreference

        @CheckResult() final Call<PushPreference> setUserPushPreference(PushPreferenceLevel level)

        Sets the push notification preference level for the current user. This controls which messages will trigger push notifications for the user across all channels.

        Parameters:
        level - The notification level to set.
      • snoozeUserPushNotifications

        @CheckResult() final Call<PushPreference> snoozeUserPushNotifications(Date until)

        Temporarily disables push notifications for the current user until the specified date. This is useful for implementing "Do Not Disturb" functionality where users can snooze notifications for a specific period of time.

        Once the specified date is reached, notifications will resume according to the user's previously configured notification level.

        Parameters:
        until - The Date until which push notifications should be disabled.
      • setChannelPushPreference

        @CheckResult() final Call<PushPreference> setChannelPushPreference(String cid, PushPreferenceLevel level)

        Sets the push notification preference level for a specific channel.

        Parameters:
        cid - The full channel identifier (e.g., "messaging:123") for which to set the preference.
        level - The notification level to set for this channel.
      • snoozeChannelPushNotifications

        @CheckResult() final Call<PushPreference> snoozeChannelPushNotifications(String cid, Date until)

        Temporarily disables push notifications for a specific channel until the specified date.

        Parameters:
        cid - The full channel identifier (e.g., "messaging:123") for which to snooze notifications.
        until - The Date until which push notifications should be disabled for this channel.
      • createUserGroup

        @CheckResult() final Call<UserGroup> createUserGroup(String name, String id, String description, String teamId, List<String> memberIds)

        Creates a user group.

        Parameters:
        name - Display name (1–255 chars), unique within app/team.
        id - Group ID (max 255 chars).
        description - Optional description (max 1024 chars).
        teamId - Team to scope the group to.
        memberIds - Initial member user IDs (max 100).
      • queryUserGroups

        @CheckResult() final Call<List<UserGroup>> queryUserGroups(Integer limit, String idGt, String createdAtGt, String teamId)

        Lists user groups, ordered for cursor pagination.

        Parameters:
        limit - Max groups to return (1–100).
        idGt - Cursor: groups whose ID sorts after this value.
        createdAtGt - Cursor: groups created after this RFC3339 timestamp.
        teamId - Restrict to a specific team.
      • searchUserGroups

        @CheckResult() final Call<List<UserGroup>> searchUserGroups(String query, Integer limit, String teamId, String nameGt, String idGt)

        Searches user groups by name prefix.

        Parameters:
        query - Search term (1–255 chars).
        limit - Maximum number of groups to return (1–25).
        teamId - Restrict the search to a specific team.
        nameGt - Cursor: groups whose name sorts after this value.
        idGt - Cursor: groups whose ID sorts after this value.
      • getUserGroup

        @CheckResult() final Call<UserGroup> getUserGroup(String id, String teamId)

        Fetches a user group by ID.

        Parameters:
        teamId - Required when multi-tenancy is enabled.
      • addUserGroupMembers

        @CheckResult() final Call<UserGroup> addUserGroupMembers(String id, List<String> memberIds, Boolean asAdmin, String teamId)

        Adds members to a user group.

        Parameters:
        memberIds - User IDs to add (1–100).
        asAdmin - Whether to add the members as group admins.
        teamId - Required when multi-tenancy is enabled.
      • removeUserGroupMembers

        @CheckResult() final Call<UserGroup> removeUserGroupMembers(String id, List<String> memberIds, String teamId)

        Removes members from a user group.

        Parameters:
        memberIds - User IDs to remove (1–100).
        teamId - Required when multi-tenancy is enabled.
      • searchRoles

        @CheckResult() final Call<List<Role>> searchRoles(String query, Integer limit, RoleType roleType, Boolean includeGlobalRoles, String nameGt)

        Searches roles by name prefix.

        Parameters:
        query - Case-insensitive name prefix (1-255 chars).
        limit - Max number of roles to return (1-25).
        roleType - Optional filter by what the role can be assigned to.
        includeGlobalRoles - When true, include cross-team operator roles whose name starts with global_.
        nameGt - Cursor: roles whose name sorts after this value.
      • dismissChannelNotifications

         final Unit dismissChannelNotifications(String channelType, String channelId)

        Dismiss notifications from a given channelType and channelId. Be sure to initialize ChatClient before calling this method!

        Parameters:
        channelType - String that represent the channel type of the channel you want to dismiss notifications.
        channelId - String that represent the channel id of the channel you want to dismiss notifications.
      • searchMessages

        @CheckResult() final Call<SearchMessagesResult> searchMessages(FilterObject channelFilter, FilterObject messageFilter, Integer offset, Integer limit, String next, QuerySorter<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, QuerySorter<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.
      • sendStaticLocation

        @CheckResult() final Call<Location> sendStaticLocation(String cid, Double latitude, Double longitude, String deviceId)

        Sends a static location message to the given channel.

        Parameters:
        cid - The full channel id, i.e.
        latitude - The latitude of the location.
        longitude - The longitude of the location.
        deviceId - The device ID from which the location is sent.
      • startLiveLocationSharing

        @CheckResult() final Call<Location> startLiveLocationSharing(String cid, Double latitude, Double longitude, String deviceId, Date endAt)

        Starts live location sharing for the given channel.

        Parameters:
        cid - The full channel id, i.e.
        latitude - The latitude of the location.
        longitude - The longitude of the location.
        deviceId - The device ID from which the location is shared.
        endAt - The date when the live location sharing will end.
      • updateLiveLocation

        @CheckResult() final Call<Location> updateLiveLocation(String messageId, Double latitude, Double longitude, String deviceId)

        Updates the live location info of a message.

        Parameters:
        messageId - The ID of the message to update.
        latitude - The latitude of the new location.
        longitude - The longitude of the new location.
        deviceId - DEPRECATED: has no effect, since this endpoint does not accept a device id.
      • stopLiveLocationSharing

        @CheckResult() final Call<Location> stopLiveLocationSharing(String messageId, String deviceId)

        Stops the live location sharing for a message.

        Parameters:
        messageId - The ID of the message to stop sharing live location.
        deviceId - DEPRECATED: has no effect, since this endpoint does not accept a device id.
      • sendPoll

        @CheckResult() final Call<Message> sendPoll(String channelType, String channelId, CreatePollParams createPollParams)

        Send a message with a poll to the given channel.

        IMPORTANT: Polls cannot be sent inside a thread!

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        createPollParams - The poll configuration.
      • updatePoll

        @CheckResult() final Call<Poll> updatePoll(UpdatePollRequest poll)

        Update a poll.

        IMPORTANT: All the poll properties that are omitted in the update request will either be removed or set to their default values.

        Parameters:
        poll - The poll to update.
      • closePoll

        @CheckResult() final Call<Poll> closePoll(String pollId)

        Close a poll in a message.

        Parameters:
        pollId - The poll id.
      • createPollOption

        @CheckResult() final Call<PollOption> createPollOption(String pollId, PollOption option)

        Create a new option for a poll.

        Parameters:
        pollId - The poll id.
        option - The option to create.
      • updatePollOption

        @CheckResult() final Call<PollOption> updatePollOption(String pollId, PollOption option)

        Update an existing option in a poll.

        Parameters:
        pollId - The poll id.
        option - The option to update.
      • queryPollVotes

        @CheckResult() final Call<QueryPollVotesResult> queryPollVotes(String pollId, FilterObject filter, Integer limit, String next, QuerySorter<Vote> sort)

        Query votes for a specific poll with optional filtering, pagination, and sorting.

        Parameters:
        pollId - The poll id.
        filter - The filter conditions to filter the votes.
        limit - The maximum number of votes to return.
        next - The pagination token for fetching the next set of results.
        sort - The sort object for the query: Supported fields:
        • created_at Vote creation timestamp

      • queryPolls

        @CheckResult() final Call<QueryPollsResult> queryPolls(FilterObject filter, Integer limit, String next, QuerySorter<Poll> sort)

        Query polls with optional filtering, pagination, and sorting.

        Parameters:
        filter - The filter conditions to filter the polls.
        limit - The maximum number of polls to return.
        next - The pagination token for fetching the next set of results.
        sort - The sort object for the query: Supported fields:
        • id Unique identifier of the poll

        • name Name of the poll

        • created_at Poll creation timestamp

        • updated_at Poll last update timestamp

        • is_closed Whether the poll is closed or not

      • castPollVote

        @CheckResult() final Call<Vote> castPollVote(String messageId, String pollId, String optionId)

        Cast a vote for a poll in a message.

        Note: This function does not validate that the vote can be cast (e.g. that the poll is open or that the user is still within the Poll.maxVotesAllowed limit). Callers are responsible for these checks.

        Parameters:
        messageId - The message id where the poll is.
        pollId - The poll id.
        optionId - The id of the option to vote for.
      • castPollAnswer

        @CheckResult() final Call<Vote> castPollAnswer(String messageId, String pollId, String answer)

        Cast an answer in a poll.

        Parameters:
        messageId - The message id where the poll is.
        pollId - The poll id.
        answer - The answer to cast.
      • removePollVote

        @CheckResult() final Call<Vote> removePollVote(String messageId, String pollId, String voteId)

        Remove a vote for a poll in a message.

        Parameters:
        messageId - The message id where the poll is.
        pollId - The poll id.
        voteId - The id of the vote to remove.
      • getFileAttachments

        @CheckResult() final Call<List<Attachment>> getFileAttachments(String channelType, String channelId, Integer offset, Integer limit)

        Retrieves the file attachments from the given channel.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        offset - The attachments offset.
        limit - Max limit attachments to be fetched.
      • getImageAttachments

        @CheckResult() final Call<List<Attachment>> getImageAttachments(String channelType, String channelId, Integer offset, Integer limit)

        Retrieves the image attachments from the given channel.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        offset - The attachments offset.
        limit - Max limit attachments to be fetched.
      • 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.
      • getNewerReplies

        @CheckResult() final Call<List<Message>> getNewerReplies(String parentId, Integer limit, String lastId)

        Fetch replies to the specified message with id parentId that are newer than the message with lastId. If lastId is null, the oldest replies are returned.

        Parameters:
        parentId - The id of the parent message.
        limit - The number of replies to fetch.
        lastId - The id of the last message to fetch from exclusively.
      • getRepliesAround

        @CheckResult() final Call<List<Message>> getRepliesAround(String parentId, String aroundId, Integer limit)

        Fetch replies to the specified message with id parentId around the reply with id aroundId.

        Parameters:
        parentId - The id of the parent message.
        aroundId - The id of the reply to fetch the surrounding page for.
        limit - The number of replies to fetch.
      • sendGiphy

        @CheckResult() final Call<Message> sendGiphy(Message message)

        Sends selected giphy message to the channel specified by Message.cid. The call will be retried accordingly to retryPolicy.

        Parameters:
        message - The message to send.
      • shuffleGiphy

        @CheckResult() final Call<Message> shuffleGiphy(Message message)

        Performs Giphy shuffle operation in the channel specified by Message.cid. Returns new "ephemeral" message with new giphy url. The call will be retried accordingly to retryPolicy.

        Parameters:
        message - The message to send.
      • deleteMessageForMe

        @CheckResult() final Call<Message> deleteMessageForMe(String messageId)

        Deletes a message for the current user only, making it invisible for them while keeping it visible for others.

        Parameters:
        messageId - The ID of the message to be deleted.
      • getMessage

        @CheckResult() final Call<Message> getMessage(String messageId)

        Fetches a single message from the backend.

        Parameters:
        messageId - The ID of the message we are fetching from the backend.
      • getPendingMessage

        @CheckResult() final Call<PendingMessage> getPendingMessage(String messageId)

        Fetches a single pending message from the backend.

        Parameters:
        messageId - The ID of the pending message we are fetching from the backend.
      • sendMessage

        @CheckResult() final Call<Message> sendMessage(String channelType, String channelId, Message message, Boolean isRetrying)

        Sends the message to the given channel. If isRetrying is set to true, the message may not be prepared again.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        message - Message object
        isRetrying - True if this message is being retried.
      • createDraftMessage

        @CheckResult() final Call<DraftMessage> createDraftMessage(String channelType, String channelId, DraftMessage message)

        Create a new draft message. The call will be retried accordingly to retryPolicy.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        message - The draft message to create.
      • deleteDraftMessages

        @CheckResult() final Call<Unit> deleteDraftMessages(String channelType, String channelId, DraftMessage message)

        Delete a draft message. The call will be retried accordingly to retryPolicy.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        message - The draft message to delete.
      • queryDrafts

        @CheckResult() final Call<QueryDraftsResult> queryDrafts(FilterObject filter, Integer limit, String next, QuerySorter<DraftsSort> sort)

        Query draft messages for the current user.

        Parameters:
        filter - The filter to apply to the query.
        limit - The number of draft messages to return.
        next - The pagination token for the next page of results.
        sort - The sorting criteria for the results.
      • 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.
      • editMessage

        @CheckResult() final Call<Message> editMessage(String channelType, String channelId, Message message)

        Edits an existing message, uploading any new attachments through the standard AttachmentsSender / UploadAttachmentsAndroidWorker pipeline before updating the message on the server.

        When the message contains new attachments (i.e. attachments with a local Attachment.upload file), the method will:

        • Prepare attachments (mark new ones as Attachment.UploadState.Idle).

        • Optimistically upsert the prepared message into channel state so the UI shows upload progress.

        • Delegate upload to AttachmentsSender (which enqueues WorkManager work).

        • On success, call updateMessage which fires the standard edit plugin hooks.

        • On failure, revert the channel state to the original message.

        If the message has no new attachments, the call delegates directly to updateMessage.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        message - The edited Message with resolved attachment files.
      • 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.
      • pinChannel

         final Call<Member> pinChannel(String channelType, String channelId)

        Pin the channel for the current user.

        Parameters:
        channelType - The channel type.
        channelId - The channel ID.
      • unpinChannel

         final Call<Member> unpinChannel(String channelType, String channelId)

        Unpin the channel for the current user.

        Parameters:
        channelType - The channel type.
        channelId - The channel ID.
      • archiveChannel

         final Call<Member> archiveChannel(String channelType, String channelId)

        Archive the channel for the current user.

        Parameters:
        channelType - The channel type.
        channelId - The channel ID.
      • unarchiveChannel

         final Call<Member> unarchiveChannel(String channelType, String channelId)

        Unarchive the channel for the current user.

        Parameters:
        channelType - The channel type.
        channelId - The channel ID.
      • 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.
      • getChannel

         final Call<Channel> getChannel(String cid, Integer messageLimit, Integer memberLimit, Boolean state)

        Gets the channel from the server based on cid.

        Parameters:
        cid - The full channel id.
        messageLimit - The number of messages to retrieve for the channel.
        memberLimit - The number of members to retrieve for the channel.
        state - if true returns the Channel state.
      • getChannel

         final Call<Channel> getChannel(String channelType, String channelId, Integer messageLimit, Integer memberLimit, Boolean state)

        Gets the channel from the server based on channelType and channelId.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        messageLimit - The number of messages to retrieve for the channel.
        memberLimit - The number of members to retrieve for the channel.
        state - if true returns the Channel state.
      • queryGroupedChannels

        @CheckResult() final Call<GroupedChannels> queryGroupedChannels(List<String> groups, Integer limit, Boolean watch, Boolean presence)

        Queries channels grouped into the specified groups and returns the first page of each.

        IMPORTANT: This is an enterprise feature and is disabled by default. For more info, reach out to our Contact & Support.

        Parameters:
        groups - The group names to fetch.
        limit - Default max channels per group.
        watch - Whether to start watching the returned channels for real-time events.
        presence - Whether to receive presence events for the members of the returned channels.
      • queryGroupedChannels

        @CheckResult() final Call<GroupedChannels> queryGroupedChannels(Map<String, GroupedChannelsGroupQuery> groups, QuerySorter<Channel> sort, Integer limit, Boolean watch, Boolean presence)

        Queries channels grouped into the specified groups, with per-group options, and returns the first page of each.

        IMPORTANT: This is an enterprise feature and is disabled by default. For more info, reach out to our Contact & Support.

        Parameters:
        groups - The per-group options keyed by group name.
        sort - The order of the channels in every group.
        limit - Default max channels per group.
        watch - Whether to start watching the returned channels for real-time events.
        presence - Whether to receive presence events for the members of the returned channels.
      • queryGroupedChannelsInternal

        @CheckResult() final Call<GroupedChannels> queryGroupedChannelsInternal(Integer limit, Map<String, GroupedChannelsGroupQuery> groups, Boolean watch, Boolean presence, QuerySorter<Channel> sort)

        Internal variant of queryGroupedChannels that accepts a per-group configuration map.

        Supports per-group request options (limit, next/prev cursors) and returns per-group pagination cursors. Pagination (next or prev on any group) is only allowed when exactly one group is requested.

        IMPORTANT: This is an enterprise feature and is disabled by default. For more info, reach out to our Contact & Support.

        Parameters:
        limit - Default max channels per group when a group does not specify its own limit.
        groups - Optional per-group configuration keyed by group name.
        watch - Whether to start watching the returned channels for real-time events.
        presence - Whether to receive presence events for the members of the returned channels.
        sort - The order of the channels in every group, or null for the server default.
      • markMessageAsDelivered

        @CheckResult() final Call<Boolean> markMessageAsDelivered(String messageId)

        Request to mark the message with the given id as delivered if:

        • Delivery receipts are enabled for the current user.

        • Delivery events are enabled in the channel config.

        and if all of the following conditions are met for the message:

        • Not sent by the current user.

        • Not shadow banned.

        • Not sent by a muted user.

        • Not yet marked as read by the current user.

        • Not yet marked as delivered by the current user.

        IMPORTANT: For this feature to function correctly and efficiently, the offline plugin must be enabled to avoid extra API calls to retrieve message and channel data.

        Parameters:
        messageId - The ID of the message to mark as delivered.
      • markMessageRead

        @CheckResult() final Call<Unit> markMessageRead(String channelType, String channelId, String messageId)

        Marks the given message as read.

        Parameters:
        channelType - The type of the channel in which the thread resides.
        channelId - The ID of the channel in which the thread resides.
        messageId - The ID of the message to mark as read.
      • markThreadRead

        @CheckResult() final Call<Unit> markThreadRead(String channelType, String channelId, String threadId)

        Marks a given thread as read.

        Parameters:
        channelType - The type of the channel in which the thread resides.
        channelId - The ID of the channel in which the thread resides.
        threadId - The ID of the thread to mark as read.
      • showChannel

        @CheckResult() final Call<Unit> showChannel(String channelType, String channelId)

        Shows the specified channel (if previously hidden).

        Parameters:
        channelType - The type of the channel.
        channelId - Id of the channel.
      • 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)

        Stops watching the channel which means you won't receive more events for the channel. The call requires active socket connection and will be automatically postponed and retried until the connection is established.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
      • 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.
      • partialUpdateMember

        @CheckResult() final Call<Member> partialUpdateMember(String channelType, String channelId, String userId, Map<String, Object> set, List<String> unset)

        Updates specific fields of member data, retaining the custom data fields which were set previously.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        userId - The ID of the member to be updated.
        set - The key-value data to be updated in the member data.
        unset - The list of keys to be removed from the member data.
      • 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-MAX_COOLDOWN_TIME_SECONDS.

        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.
      • acceptInvite

        @CheckResult() final Call<Channel> acceptInvite(String channelType, String channelId, String message)

        Accepts the invitation to join a channel.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        message - The message to send with the accept invitation.
      • rejectInvite

        @CheckResult() final Call<Channel> rejectInvite(String channelType, String channelId)

        Rejects the invitation to join the channel.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
      • 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.
      • getUnreadCounts

         final Call<UnreadCounts> getUnreadCounts()

        Gets the unread counts for the current user.

      • 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.
      • markUnread

        @CheckResult() final Call<Unit> markUnread(String channelType, String channelId, String messageId)

        Marks the specified channel as unread.

        Parameters:
        channelType - Type of the channel.
        channelId - Id of the channel.
        messageId - Id of the message.
      • markUnread

        @CheckResult() final Call<Unit> markUnread(String channelType, String channelId, Date timestamp)

        Marks all messages in the channel as unread that were created after the specified timestamp.

        Parameters:
        channelType - Type of the channel.
        channelId - Id of the channel.
        timestamp - The timestamp used to find the first message to mark as unread.
      • markThreadUnread

        @CheckResult() final Call<Unit> markThreadUnread(String channelType, String channelId, String threadId)

        Marks a thread as unread.

        Parameters:
        channelType - Type of the channel.
        channelId - Id of the channel.
        threadId - Id of the thread to mark as unread.
      • updateUsers

        @CheckResult() final Call<List<User>> updateUsers(List<User> users)

        Updates multiple users in a single request.

        Parameters:
        users - The list of users to be updated.
      • updateUser

        @CheckResult() final Call<User> updateUser(User user)

        Updates a single user.

        Parameters:
        user - The user to be updated.
      • blockUser

        @CheckResult() final Call<UserBlock> blockUser(String userId)

        Block a user by ID.

        Parameters:
        userId - the ID of the user that will be blocked.
      • unblockUser

        @CheckResult() final Call<Unit> unblockUser(String userId)

        Unblock a user by ID.

        Parameters:
        userId - the user ID of the user that will be unblocked.
      • 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.
      • addMembers

        @CheckResult() final Call<Channel> addMembers(String channelType, String channelId, List<String> memberIds, Message systemMessage, Boolean hideHistory, Date hideHistoryBefore, Boolean skipPush)

        Adds members to a given channel.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        memberIds - The list of the member ids to be added.
        systemMessage - The system message that will be shown in the channel.
        hideHistory - Hides the history of the channel to the added member.
        hideHistoryBefore - Hides the channel history before the provided date from the added members.
        skipPush - If true, skips sending push notifications.
      • removeMembers

        @CheckResult() final Call<Channel> removeMembers(String channelType, String channelId, List<String> memberIds, Message systemMessage, Boolean skipPush)

        Removes members from a given channel.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        memberIds - The list of the member ids to be removed.
        systemMessage - The system message that will be shown in the channel.
        skipPush - If true, skips sending push notifications.
      • inviteMembers

        @CheckResult() final Call<Channel> inviteMembers(String channelType, String channelId, List<String> memberIds, Message systemMessage, Boolean skipPush)

        Invites members to a given channel.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        memberIds - The list of the member ids to be invited.
        systemMessage - The system message that will be shown in the channel.
        skipPush - If true, skips sending push notifications.
      • 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_updated event.

        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_updated event.

        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_updated event.

        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_updated event.

        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_updated event.

        Parameters:
        userId - The user id to mute.
      • unmuteUser

        @CheckResult() final Call<Unit> unmuteUser(String userId)

        Unmutes a previously muted user. Triggers notification.mutes_updated event.

        Parameters:
        userId - The user id to unmute.
      • flagUser

        @CheckResult() final Call<Flag> flagUser(String userId, String reason, Map<String, String> customData)

        Flags a user.

        Parameters:
        userId - The ID of the user to flag.
        reason - The (optional) reason for flagging the user.
        customData - Custom data to be attached to the flag.
      • unflagUser

        @Deprecated(message = The backend no longer supports un-flagging. This call does nothing and will be removed in the next major version., level = DeprecationLevel.WARNING)@CheckResult() final Call<Flag> unflagUser(String userId)

        Un-flags a previously flagged user.

        Parameters:
        userId - The ID of the user to un-flag.
      • flagMessage

        @CheckResult() final Call<Flag> flagMessage(String messageId, String reason, Map<String, String> customData)

        Flags a message.

        Parameters:
        messageId - The ID of the message to flag.
        reason - The (optional) reason for flagging the message.
        customData - Custom data to be attached to the flag.
      • unflagMessage

        @Deprecated(message = The backend no longer supports un-flagging. This call does nothing and will be removed in the next major version., level = DeprecationLevel.WARNING)@CheckResult() final Call<Flag> unflagMessage(String messageId)

        Un-flags a previously flagged message.

        Parameters:
        messageId - The ID of the message to un-flag.
      • translate

        @CheckResult() final Call<Message> translate(String messageId, String language)

        Translate a message.

        Parameters:
        messageId - The ID of the message to translate.
        language - The language to translate the message to.
      • banUser

        @CheckResult() final Call<Unit> banUser(String targetId, String channelType, String channelId, String reason, Integer timeout)

        Bans a user from a given channel.

        Parameters:
        targetId - The ID of the user to ban.
        channelType - The type of the channel.
        channelId - The ID of the channel.
        reason - The (optional) reason for banning the user.
        timeout - The (optional) duration of the ban in minutes.
      • unbanUser

        @CheckResult() final Call<Unit> unbanUser(String targetId, String channelType, String channelId)

        Unbans a user from a given channel.

        Parameters:
        targetId - The ID of the user to unban.
        channelType - The type of the channel.
        channelId - The ID of the channel.
      • shadowBanUser

        @CheckResult() final Call<Unit> shadowBanUser(String targetId, String channelType, String channelId, String reason, Integer timeout)

        Shadow bans a user from a given channel.

        Parameters:
        targetId - The ID of the user to shadow ban.
        channelType - The type of the channel.
        channelId - The ID of the channel.
        reason - The (optional) reason for shadow banning the user.
        timeout - The (optional) duration of the shadow ban in minutes.
      • removeShadowBan

        @CheckResult() final Call<Unit> removeShadowBan(String targetId, String channelType, String channelId)

        Removes a shadow ban from a user in a given channel.

        Parameters:
        targetId - The ID of the user to un-shadow ban.
        channelType - The type of the channel.
        channelId - The ID of the channel.
      • queryBannedUsers

        @CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySorter<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual, Date createdAtBefore, Date createdAtBeforeOrEqual)

        Queries the banned users matching the provided filters.

        Parameters:
        filter - The filter object to apply to the query.
        sort - The sorter object to apply to the query.
        offset - The offset to start from.
        limit - The maximum number of banned users to return.
        createdAtAfter - The date after which the ban was created.
        createdAtAfterOrEqual - The date after (or at) which the ban was created.
        createdAtBefore - The date before which the ban was created.
        createdAtBeforeOrEqual - The date before (or at) which the ban was created.
      • queryBannedUsers

        @CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySorter<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual, Date createdAtBefore)

        Queries the banned users matching the provided filters.

        Parameters:
        filter - The filter object to apply to the query.
        sort - The sorter object to apply to the query.
        offset - The offset to start from.
        limit - The maximum number of banned users to return.
        createdAtAfter - The date after which the ban was created.
        createdAtAfterOrEqual - The date after (or at) which the ban was created.
        createdAtBefore - The date before which the ban was created.
      • queryBannedUsers

        @CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySorter<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter, Date createdAtAfterOrEqual)

        Queries the banned users matching the provided filters.

        Parameters:
        filter - The filter object to apply to the query.
        sort - The sorter object to apply to the query.
        offset - The offset to start from.
        limit - The maximum number of banned users to return.
        createdAtAfter - The date after which the ban was created.
        createdAtAfterOrEqual - The date after (or at) which the ban was created.
      • queryBannedUsers

        @CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySorter<BannedUsersSort> sort, Integer offset, Integer limit, Date createdAtAfter)

        Queries the banned users matching the provided filters.

        Parameters:
        filter - The filter object to apply to the query.
        sort - The sorter object to apply to the query.
        offset - The offset to start from.
        limit - The maximum number of banned users to return.
        createdAtAfter - The date after which the ban was created.
      • queryBannedUsers

        @CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySorter<BannedUsersSort> sort, Integer offset, Integer limit)

        Queries the banned users matching the provided filters.

        Parameters:
        filter - The filter object to apply to the query.
        sort - The sorter object to apply to the query.
        offset - The offset to start from.
        limit - The maximum number of banned users to return.
      • queryBannedUsers

        @CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySorter<BannedUsersSort> sort, Integer offset)

        Queries the banned users matching the provided filters.

        Parameters:
        filter - The filter object to apply to the query.
        sort - The sorter object to apply to the query.
        offset - The offset to start from.
      • queryBannedUsers

        @CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter, QuerySorter<BannedUsersSort> sort)

        Queries the banned users matching the provided filters.

        Parameters:
        filter - The filter object to apply to the query.
        sort - The sorter object to apply to the query.
      • queryBannedUsers

        @CheckResult()@JvmOverloads() final Call<List<BannedUser>> queryBannedUsers(FilterObject filter)

        Queries the banned users matching the provided filters.

        Parameters:
        filter - The filter object to apply to the query.
      • getCurrentToken

         final String getCurrentToken()

        Retrieves the current user token (or null if it doesn't exist).

      • getAppSettings

         final AppSettings getAppSettings()

        Returns application settings from the server or the default ones as a fallback.

      • createChannel

        @CheckResult() final Call<Channel> createChannel(String channelType, String channelId, List<String> memberIds, Map<String, Object> extraData)

        Creates the channel. You can either create an id-based channel by passing not blank channelId or member-based (distinct) channel by leaving channelId empty. Use memberIds list to create a channel together with members. Make sure the list is not empty in case of creating member-based channel! Extra channel's information, for example name, can be passed in the extraData map.

        The call will be retried accordingly to retryPolicy.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        memberIds - The list of members' ids.
        extraData - Map of key-value pairs that let you store extra data.
      • createChannel

        @CheckResult() final Call<Channel> createChannel(String channelType, String channelId, CreateChannelParams params)

        Creates the channel. You can either create an id-based channel by passing not blank channelId or member-based (distinct) channel by leaving channelId empty. Use CreateChannelParams.members list to create a channel together with members. Make sure the list is not empty in case of creating member-based channel! Extra channel's information, for example name, can be passed in the CreateChannelParams.extraData map.

        The call will be retried accordingly to retryPolicy.

        Parameters:
        channelType - The channel type.
        channelId - The channel id.
        params - The CreateChannelParams holding the data required for creating a channel.
      • 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 CIDs.
        lastSyncAt - The last time the user was online and in sync.
      • getSyncHistory

        @CheckResult() final Call<List<ChatEvent>> getSyncHistory(List<String> channelsIds, String lastSyncAt)

        Returns all events that happened for a list of channels since last sync (while the user was not connected to the web socket). lastSyncAt is in yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z' format. Use this version of getSyncHistory when high precision is necessary.

        Parameters:
        channelsIds - The list of channel CIDs.
        lastSyncAt - The last time the user was online and in sync.
      • keystroke

        @CheckResult() final Call<ChatEvent> keystroke(String channelType, String channelId, String parentId)

        Sends a EventType.TYPING_START event to the backend.

        Parameters:
        channelType - The type of this channel i.e.
        channelId - The id of this channel.
        parentId - Set this field to message.id to indicate that typing event is happening in a thread.
      • stopTyping

        @CheckResult() final Call<ChatEvent> stopTyping(String channelType, String channelId, String parentId)

        Sends a EventType.TYPING_STOP event to the backend.

        Parameters:
        channelType - The type of this channel i.e.
        channelId - The id of this channel.
        parentId - Set this field to message.id to indicate that typing event is happening in a thread.
      • downloadFile

        @CheckResult() final Call<ResponseBody> downloadFile(String fileUrl)

        Downloads the given file which can be fetched through the response body.

        Parameters:
        fileUrl - The URL of the file that we are downloading.
      • partialUpdateThread

        @CheckResult() final Call<ThreadInfo> partialUpdateThread(String messageId, Map<String, Object> set, List<String> unset)

        Partially updates specific Thread 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.
      • createReminder

        @CheckResult() final Call<MessageReminder> createReminder(String messageId, Date remindAt)

        Creates a reminder for a message.

        Parameters:
        messageId - The message id.
        remindAt - The date when the reminder should be triggered.
      • updateReminder

        @CheckResult() final Call<MessageReminder> updateReminder(String messageId, Date remindAt)

        Updates an existing reminder for a message.

        Parameters:
        messageId - The message id.
        remindAt - The date when the reminder should be triggered.
      • deleteReminder

        @CheckResult() final Call<Unit> deleteReminder(String messageId)

        Deletes a reminder for a message.

        Parameters:
        messageId - The message id whose reminder should be deleted.
      • queryReminders

        @CheckResult() final Call<QueryRemindersResult> queryReminders(FilterObject filter, Integer limit, String next, QuerySorter<MessageReminder> sort)

        Queries the message reminders for the current user matching the provided filters.

        Parameters:
        filter - The FilterObject to filter the reminders.
        limit - The maximum number of reminders to return.
        next - The pagination token for the next page of results.
        sort - The sorter object to apply to the query.
      • devToken

         final String devToken(String userId)

        Generate a developer token that can be used to connect users while the app is using a development environment.

        Parameters:
        userId - the desired id of the user to be connected.