Gappein Chat SDK - gappein/gappein-chat-sdk GitHub Wiki
This page will explain the different methods provided in the Gappein Chat SDK and its functionality
fun initialize()
This method will return the instance of Gappein Chat SDK.
fun setUser(user: User, token: String, onSuccess: (User) -> Unit, onError: (Exception) -> Unit)
This is used to return instance of the current User detail
fun sendMessage(
messageText: String,
receiver: String,
onSuccess: () -> Unit,
onError: (Exception) -> Unit
)
This is used to send text message.
fun sendMessage(
fileUri: Uri,
receiver: String,
onSuccess: () -> Unit,
onProgress: (Int) -> Unit,
onError: (Exception) -> Unit
)
This is used to send a file URI.
fun getUserByToken(token: String, onSuccess: (User) -> Unit, onError: (Exception) -> Unit)
This is used to get the User for the respective token.
fun openOrCreateChannel(participantUserToken: String, onComplete: (channelId: String) -> Unit)
This is used to open/create a channel with given User.
fun getUserChannels(onSuccess: (List<Channel>) -> Unit)
This is used to get all channels of the current User.
fun getMessages(channelId: String, onSuccess: (List<Message>) -> Unit)
This is used to get Messages for given channel.
fun getChannelUsers(channelId: String, onSuccess: (List<User>) -> Unit)
This is used to get Users for given channel.
fun getChannelRecipientUser(channelId: String, onSuccess: (User) -> Unit)
This is used to get the recipient User of a channel.
fun getLastMessageFromChannel(channelId: String, onSuccess: (Message, User) -> Unit)
This is used to get last message in a channel.
fun isUserOnline(token: String, onSuccess: (Boolean, String) -> Unit)
This is used to check whether a particular User is online.
fun setUserOnline(token: String)
This is used to set the User online.