Package ai.nexconn.chat.channel.query
Class MessagesQuery
-
- All Implemented Interfaces:
-
ai.nexconn.chat.internal.query.PageableQuery
public final class MessagesQuery implements PageableQuery<PageData<Message>>
History message pagination query object.
Implements PageableQuery Interface, Provides Pagination load history message's capability, will automatically From Remote fill gap message, ensure message continuity. Via loadNextPage Load data page by page, Via hasMore Check if there is more data.
Via BaseChannel.createMessagesQuery Create instance, Not cannot be constructed directly.
Usage Example:
val params = MessagesQueryParams(channelIdentifier).apply { pageSize = 20 messageType = MessageType.TEXT isAscending = false } val query = BaseChannel.createMessagesQuery(params) // Load first page query.loadNextPage { messages, error -> if (error == null && messages != null) { // Handle Data } // Continue loading when there is more data if (query.hasMore) { query.loadNextPage { ... } } }
-
-
Method Summary
Modifier and Type Method Description final BooleangetHasMore()BooleanisLoading()UnitloadNextPage(OperationHandler<PageData<Message>> handler)-
-
Method Detail
-
getHasMore
final Boolean getHasMore()
-
isLoading
Boolean isLoading()
-
loadNextPage
Unit loadNextPage(OperationHandler<PageData<Message>> handler)
-
-
-
-