public class PreviousMessageListQuery
extends java.lang.Object
Currently, 1 kind of message list can be queried.
The query can be get by calling BaseChannel.createPreviousMessageListQuery()
or
BaseChannel.createPreviousMessageListQuery()
.
Modifier and Type | Class and Description |
---|---|
static interface |
PreviousMessageListQuery.MessageListQueryResult
MessageListQueryResult handler.
|
Modifier and Type | Method and Description |
---|---|
static PreviousMessageListQuery |
create(BaseChannel.ChannelType channelType,
java.lang.String channelUrl)
Creates a query instance to get message list of a channel.
|
BaseChannel |
getChannel()
Current channel.
|
BaseChannel.ChannelType |
getChannelType()
Returns the current channel type.
|
java.lang.String |
getChannelUrl()
Returns the current channel url.
|
java.lang.String |
getCustomTypeFilter()
Returns the custom type filter of message.
|
int |
getLimit()
Returns the maximum number of messages per page.
|
MessagePayloadFilter |
getMessagePayloadFilter()
Returns the
MessagePayloadFilter set in this param. |
long |
getMessageTimestamp()
Returns the time of a request.
|
BaseChannel.MessageTypeFilter |
getMessageTypeFilter()
Returns the
BaseChannel.MessageTypeFilter . |
ReplyTypeFilter |
getReplyTypeFilter()
Returns the reply type filter.
|
java.util.List<java.lang.String> |
getSenderUserIdsFilter()
Returns the sender user ids filter.
|
boolean |
hasMore()
Checks if there are more previous messages.
|
boolean |
isIncludeThreadInfo()
Returns whether to include the thread information of the returned messages in the results when the results contain parent messages.
|
boolean |
isLoading()
Checks if the current query is in communication progress with server.
|
void |
load(int limit,
boolean reverse,
PreviousMessageListQuery.MessageListQueryResult handler)
Requests query result for the previous messages.
|
void |
load(PreviousMessageListQuery.MessageListQueryResult handler)
Requests query result for the previous messages.
|
void |
setCustomTypeFilter(java.lang.String customType)
Sets custom type filter.
|
void |
setCustomTypesFilter(java.util.Collection<java.lang.String> customTypes)
Sets custom type filter.
|
void |
setIncludeMetaArray(boolean includeMetaArray)
Sets message meta array.
|
void |
setIncludeParentMessageText(boolean includeParentMessageText)
Deprecated.
As of 3.0.173, replaced
MessagePayloadFilter.setIncludeParentMessageInfo(boolean) from getMessagePayloadFilter() . |
void |
setIncludeReactions(boolean includeReactions)
Sets message reactions.
|
void |
setIncludeReplies(boolean includeReplies)
Deprecated.
As of 3.0.173, replaced by
setReplyTypeFilter(ReplyTypeFilter) . |
void |
setIncludeThreadInfo(boolean includeThreadInfo)
Determines whether to include the thread information of the returned messages in the results when the results contain parent messages.
|
void |
setLimit(int limit)
Sets the maximum number of messages per queried page.
|
void |
setMessagePayloadFilter(MessagePayloadFilter messagePayloadFilter)
Sets the
MessagePayloadFilter to be used in retrieving message lists. |
void |
setMessageTypeFilter(BaseChannel.MessageTypeFilter messageType)
Sets message type filter.
|
void |
setReplyTypeFilter(ReplyTypeFilter replyTypeFilter)
Determines the reply types to include in the results.
|
void |
setReverse(boolean reverse)
Sets reverse.
|
void |
setSenderUserIdsFilter(java.util.List<java.lang.String> senderUserIds)
Sets sender user ids filter.
|
void |
setShowSubchannelMessagesOnly(boolean showSubchannelMessagesOnly)
If set to true, only messages that belong to current user's subchannel is fetched.
|
boolean |
shouldIncludeMetaArray()
Returns whether the meta array should be included in the results.
|
boolean |
shouldIncludeParentMessageText()
Deprecated.
As of 3.0.173, replaced
MessagePayloadFilter.shouldIncludeParentMessageInfo() from getMessagePayloadFilter() . |
boolean |
shouldIncludeReactions()
Returns whether the reaction data should be included in the results.
|
boolean |
shouldIncludeReplies()
Deprecated.
As of 3.0.173, replaced by
getReplyTypeFilter() . |
boolean |
shouldReverse()
Returns whether the results should be reversed.
|
boolean |
shouldShowSubchannelMessagesOnly()
If set to true, only messages that belong to current user's subchannel is fetched.
|
public static PreviousMessageListQuery create(BaseChannel.ChannelType channelType, java.lang.String channelUrl)
channelType
- a type of channel.channelUrl
- an url of channel.BaseChannel.ChannelType
public boolean hasMore()
true
if there are more previous messages.public boolean isLoading()
true
if the current query is not finished.public void setLimit(int limit)
limit
- The maximum number of messages per page.public void setReverse(boolean reverse)
reverse
- If true
the queried result will be returned by creation time descending order.public void setMessageTypeFilter(BaseChannel.MessageTypeFilter messageType)
messageType
- Message type. Refer to BaseChannel.MessageTypeFilter
.public void setCustomTypeFilter(java.lang.String customType)
customType
- Custom type.public void setCustomTypesFilter(java.util.Collection<java.lang.String> customTypes)
customTypes
- Custom types.public void setSenderUserIdsFilter(java.util.List<java.lang.String> senderUserIds)
senderUserIds
- Sender user IDs.public void setIncludeMetaArray(boolean includeMetaArray)
MessagePayloadFilter.setIncludeMetaArray(boolean)
.includeMetaArray
- If true
the queried result will be returned with message meta array.setMessagePayloadFilter(MessagePayloadFilter).
public void setIncludeReactions(boolean includeReactions)
MessagePayloadFilter.setIncludeReactions(boolean)
.includeReactions
- If true
the queried result will be returned with message reactions.setMessagePayloadFilter(MessagePayloadFilter).
public void setIncludeThreadInfo(boolean includeThreadInfo)
MessagePayloadFilter.setIncludeThreadInfo(boolean)
.includeThreadInfo
- If true
the queried result will be returned with thread information.setMessagePayloadFilter(MessagePayloadFilter).
@Deprecated public void setIncludeReplies(boolean includeReplies)
setReplyTypeFilter(ReplyTypeFilter)
.includeReplies
- If true
the queried result will be returned with reply messages as well.public void setReplyTypeFilter(ReplyTypeFilter replyTypeFilter)
replyTypeFilter
- ReplyTypeFilter
.@Deprecated public void setIncludeParentMessageText(boolean includeParentMessageText)
MessagePayloadFilter.setIncludeParentMessageInfo(boolean)
from getMessagePayloadFilter()
.BaseMessage.getMessage()
of the parent message.
If it is FileMessage, the value is the name of the uploaded file.
Internally, this will be set on MessagePayloadFilter.setIncludeParentMessageInfo(boolean)
.includeParentMessageText
- If true
the queried result will be returned with parent message's text for reply messages. setReplyTypeFilter(ReplyTypeFilter)
must be set to ReplyTypeFilter.ALL
.setMessagePayloadFilter(MessagePayloadFilter).
public void setShowSubchannelMessagesOnly(boolean showSubchannelMessagesOnly)
showSubchannelMessagesOnly
- If false, all messages will be returned. If true,
only messages in the subchannel will be returned.public void setMessagePayloadFilter(MessagePayloadFilter messagePayloadFilter)
MessagePayloadFilter
to be used in retrieving message lists.
This is more preferred way of setting other include flags.messagePayloadFilter
- MessagePayloadFilter
with preferred filters set.public void load(PreviousMessageListQuery.MessageListQueryResult handler)
handler
as list
.handler
- Callback handler.public void load(int limit, boolean reverse, PreviousMessageListQuery.MessageListQueryResult handler)
handler
as list
.limit
- Maximum number of previous messages to load.reverse
- If true
the queried result will be returned by creation time descending order.handler
- Callback handler.public BaseChannel getChannel()
PreviousMessageListQuery
instance was created from BaseChannel.createPreviousMessageListQuery()
,
this will be NonNull
.
If this instance was created from create(BaseChannel.ChannelType, String)
and have not yet called either load(MessageListQueryResult)
or load(int, boolean, MessageListQueryResult)
,
this will be null
.public BaseChannel.ChannelType getChannelType()
public java.lang.String getChannelUrl()
public long getMessageTimestamp()
public int getLimit()
public boolean shouldReverse()
public BaseChannel.MessageTypeFilter getMessageTypeFilter()
BaseChannel.MessageTypeFilter
.BaseChannel.MessageTypeFilter
.public java.lang.String getCustomTypeFilter()
public java.util.List<java.lang.String> getSenderUserIdsFilter()
public boolean shouldIncludeMetaArray()
getMessagePayloadFilter()
.public boolean shouldIncludeReactions()
getMessagePayloadFilter()
.public boolean isIncludeThreadInfo()
getMessagePayloadFilter()
.@Deprecated public boolean shouldIncludeReplies()
getReplyTypeFilter()
.public ReplyTypeFilter getReplyTypeFilter()
ReplyTypeFilter
.@Deprecated public boolean shouldIncludeParentMessageText()
MessagePayloadFilter.shouldIncludeParentMessageInfo()
from getMessagePayloadFilter()
.getMessagePayloadFilter()
.public boolean shouldShowSubchannelMessagesOnly()
public MessagePayloadFilter getMessagePayloadFilter()
MessagePayloadFilter
set in this param.MessagePayloadFilter
. Copyright © 2021, Sendbird or its affiliates. All rights reserved.
Report a bug or request a feature
For further developer documentation, see Chat SDK Documentation. That documentation contains more detailed descriptions, conceptual overviews, definitions of terms, and code examples.