Suggestions

close search

Conversation class

Represents a conversation.


Properties


id: string

It's the unique identifier of the conversation on Stringee system.

name: string

It's name of the conversation.

isGroup: boolean

Whether the conversation is a group chat:

creator: string

It's the unique identifier of the participant create the conversation.

unreadCount: number

It's number of unread messages in the conversation.

updatedAt: number

It's last time when update the conversation.

created: number

It's time when create the conversation.

lastMessage: Message

It's last message of the conversation.

pinMsgId: string

It's pined message's identifier.

participants: Array<User>

It's list of participants.


Methods


deleteConversation(): Promise<void>

Delete the conversation.

addParticipants(userIds: Array<string>): Promise<Array<User&gt>;

Add participants to conversation. If successful return a list of added User.

removeParticipants(userIds: Array<string>): Promise<Array<User&gt>;

Remove participants from conversation. If successful return a list of removed User.

updateConversation(conversationInfo: ConversationInfo): Promise<void>

Update conversation's information by ConversationInfo.

markConversationAsRead(): Promise<void>

Mark the conversation as read.

sendBeginTyping(): Promise<void>

Send begin typing event to other client.

sendEndTyping(): Promise<void>

Send end typing event to other client.

sendMessage(message: NewMessageInfo): Promise<void>

Send a message by NewMessageInfo.

deleteMessage(messageId: string): Promise<void>

Delete message by message's identifier.

revokeMessage(messageId: string): Promise<void>

Revoke message by message's identifier.

getLocalMessages(count: number, isAscending: boolean): Promise<Array<Message&gt>;

Get list of local messages of conversation were saved in local database. If successful return a list of Message.

getLastMessages(count: number, isAscending: boolean, loadDeletedMessage: boolean, loadDeletedMessageContent: boolean): Promise<Array<Message&gt>;

Get list of latest messages of conversation from Stringee server. If successful return a list of Message.

getAllLastMessages(count: number, isAscending: boolean, loadDeletedMessage: boolean, loadDeletedMessageContent: boolean): Promise<Array<Message&gt>;

Get list of latest messages include deleted message of conversation from Stringee server. If successful return a list of Message.

getMessagesAfter(sequence: number, count: number, isAscending: boolean, loadDeletedMessage: boolean, loadDeletedMessageContent: boolean): Promise<Array<Message&gt>;

Get list of messages which have sequence smaller than sequence from Stringee server. If successful return a list of Message.

getAllMessagesAfter(sequence: number, count: number, isAscending: boolean, loadDeletedMessage: boolean, loadDeletedMessageContent: boolean): Promise<Array<Message&gt>;

Get list of messages include deleted message which have sequence smaller than sequence from Stringee server. If successful return a list of Message.

getMessagesBefore(sequence: number, count: number, isAscending: boolean, loadDeletedMessage: boolean, loadDeletedMessageContent: boolean): Promise<Array<Message&gt>;

Get list of messages which have sequence greater than sequence from Stringee server. If successful return a list of Message.

getAllMessagesBefore(sequence: number, count: number, isAscending: boolean, loadDeletedMessage: boolean, loadDeletedMessageContent: boolean): Promise<Array<Message&gt>;

Get list of messages include deleted message which have sequence greater than sequence from Stringee server. If successful return a list of Message.

getMessageById(messageId: string): Promise<Message>

Get message of conversation by message's identifier from Stringee server. If successful return a Message.

endChat(): Promise<void>

End the support conversation.

sendChatTranscript(String email, String domain): Promise<void>

Send chat's content to an email at any time.