# ChatRx

class ChatRx(type: ChatType, jid: XmppJid, participants: MutableSet<ChatContact>, chatService: ChatService, agenda: Agenda, xmppChat: XMPPChat)

Reactive API of Chat.

This class replicates some of the methods included in Chat but using Rx types as return values instead of callbacks.

## Constructors

ChatRx
Link copied to clipboard
constructor(type: ChatType, jid: XmppJid, participants: MutableSet<ChatContact>, chatService: ChatService, agenda: Agenda, xmppChat: XMPPChat)

## Properties

chatState
Link copied to clipboard
val chatState: Observable<ChatState>
currentParticipants
Link copied to clipboard
val currentParticipants: Observable<List<ChatContact>>
currentStatus
Link copied to clipboard
var currentStatus: ChatState?
newMessage
Link copied to clipboard
val newMessage: Observable<XMPPMessage>
unreadMessages
Link copied to clipboard
val unreadMessages: Observable<Int>

## Functions

archive
Link copied to clipboard
fun archive(): Completable

Archives a one to one chat.

delete
Link copied to clipboard
fun delete(): Completable

Removes a MUC chat.

fetchLastMessages
Link copied to clipboard
fun fetchLastMessages(): Single<List<XMPPMessage>>

Retrieves the last messages available to the current chat. The maximum number of messages to be obtained from the server if available is 15.

fetchMessagesBy
Link copied to clipboard
fun fetchMessagesBy(query: MessageQuery): Single<List<XMPPMessage>>

Retrieves the messages available to the current chat within the specified query.

invite
Link copied to clipboard
fun invite(userId: String): Completable

Adds a new participant to the current chat.

fun invite(userIds: List<String>): Completable

Adds a list of participants to the current chat.

join
Link copied to clipboard
fun join(): Completable

Sends a special message asking the recipient to join the room associated to the current chat. This method has no effect for individual chats.

kick
Link copied to clipboard
fun kick(userId: String): Completable

Removes a participant from the current chat.

markAsDisplayed
Link copied to clipboard
fun markAsDisplayed(): Completable

Marks all messages as viewed since the last message received.

sendFile
Link copied to clipboard
fun sendFile(file: File): Completable

Uploads the file and sends its URI as a message to this chat.

sendFileProgress
Link copied to clipboard
fun sendFileProgress(file: File): Observable<FileUploadState>

Uploads the file and sends its URI as a message to this chat.

sendMessage
Link copied to clipboard
fun sendMessage(message: String): Completable

Sends a text message to this chat.

setState
Link copied to clipboard
fun setState(query: XMPPChatStateQuery): Completable

Sets the current state of current chat instance. This method will send an empty Message with the state attached.