Gappein Chat SDK - gappein/gappein-chat-sdk GitHub Wiki

Gappein Chat SDK

How to use the Chat SDK on its own?

This page will explain the different methods provided in the Gappein Chat SDK and its functionality

Method of Gappein.kt

Initialize

   fun initialize()

This method will return the instance of Gappein Chat SDK.

Methods of ChatClient.kt

Set User

   fun setUser(user: User, token: String, onSuccess: (User) -> Unit, onError: (Exception) -> Unit)

This is used to return instance of the current User detail

Send Message

   fun sendMessage(
        messageText: String,
        receiver: String,
        onSuccess: () -> Unit,
        onError: (Exception) -> Unit
    )

This is used to send text message.

Send a File URI

   fun sendMessage(
        fileUri: Uri,
        receiver: String,
        onSuccess: () -> Unit,
        onProgress: (Int) -> Unit,
        onError: (Exception) -> Unit
    )

This is used to send a file URI.

Get the User token

   fun getUserByToken(token: String, onSuccess: (User) -> Unit, onError: (Exception) -> Unit)

This is used to get the User for the respective token.

Open/Create a new channel

    fun openOrCreateChannel(participantUserToken: String, onComplete: (channelId: String) -> Unit)

This is used to open/create a channel with given User.

Get all channels

    fun getUserChannels(onSuccess: (List<Channel>) -> Unit)

This is used to get all channels of the current User.

Get Messages per channel

    fun getMessages(channelId: String, onSuccess: (List<Message>) -> Unit)

This is used to get Messages for given channel.

Get Users per channel

    fun getChannelUsers(channelId: String, onSuccess: (List<User>) -> Unit)

This is used to get Users for given channel.

Get Recipient User of a channel

    fun getChannelRecipientUser(channelId: String, onSuccess: (User) -> Unit)

This is used to get the recipient User of a channel.

Get Last Message of a channel

    fun getLastMessageFromChannel(channelId: String, onSuccess: (Message, User) -> Unit)

This is used to get last message in a channel.

Check if User is online

    fun isUserOnline(token: String, onSuccess: (Boolean, String) -> Unit)

This is used to check whether a particular User is online.

Set User online

    fun setUserOnline(token: String)

This is used to set the User online.

⚠️ **GitHub.com Fallback** ⚠️