-
public class PreviousMessageListQuery
A class representing query to retrieve previous message list for channels.
Currently, 1 kind of message list can be queried.
- The list of previous messages for a channel.
The query can be get by calling createPreviousMessageListQuery or createPreviousMessageListQuery.
- The list of previous messages for a channel.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
PreviousMessageListQuery.MessageListQueryResult
MessageListQueryResult handler. This provides callback for load.
-
Field Summary
Fields Modifier and Type Field Description private final BaseChannel.ChannelType
channelType
private final String
channelUrl
private boolean
showSubchannelMessagesOnly
private ReplyTypeFilter
replyTypeFilter
private MessagePayloadFilter
messagePayloadFilter
-
Method Summary
Modifier and Type Method Description BaseChannel.ChannelType
getChannelType()
Returns the current channel type. String
getChannelUrl()
Returns the current channel url. void
setShowSubchannelMessagesOnly(boolean showSubchannelMessagesOnly)
If set to true, only messages that belong to current user's subchannel is fetched.If set to false, all messages will be fetched. ReplyTypeFilter
getReplyTypeFilter()
Returns the reply type filter. void
setReplyTypeFilter(@NonNull() ReplyTypeFilter replyTypeFilter)
Determines the reply types to include in the results. MessagePayloadFilter
getMessagePayloadFilter()
Returns the MessagePayloadFilter set in this param. void
setMessagePayloadFilter(@NonNull() MessagePayloadFilter messagePayloadFilter)
Sets the MessagePayloadFilter to be used in retrieving message lists.This is more preferred way of setting other include flags. static PreviousMessageListQuery
create(@NonNull() BaseChannel.ChannelType channelType, @NonNull() String channelUrl)
Creates a query instance to get message list of a channel. boolean
hasMore()
Checks if there are more previous messages. synchronized boolean
isLoading()
Checks if the current query is in communication progress with server. void
setLimit(int limit)
Sets the maximum number of messages per queried page. void
setReverse(boolean reverse)
Sets reverse. void
setMessageTypeFilter(BaseChannel.MessageTypeFilter messageType)
Sets message type filter. void
setCustomTypeFilter(String customType)
Sets custom type filter. void
setCustomTypesFilter(Collection<String> customTypes)
Sets custom type filter. void
setSenderUserIdsFilter(List<String> senderUserIds)
Sets sender user ids filter. void
setIncludeMetaArray(boolean includeMetaArray)
Sets message meta array. void
setIncludeReactions(boolean includeReactions)
Sets message reactions. 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
setIncludeReplies(boolean includeReplies)
Determines whether replies are included in the results. void
setIncludeParentMessageText(boolean includeParentMessageText)
Determines whether to include the parent message text in the results when the updated messages are replies in a thread. void
setIncludePollDetails(boolean includePollDetails)
Determines whether to include the poll of the returned messages in the results. synchronized void
load(PreviousMessageListQuery.MessageListQueryResult handler)
Requests query result for the previous messages. synchronized void
load(int limit, boolean reverse, PreviousMessageListQuery.MessageListQueryResult handler)
Requests query result for the previous messages. BaseChannel
getChannel()
Current channel. long
getMessageTimestamp()
Returns the time of a request. int
getLimit()
Returns the maximum number of messages per page. boolean
shouldReverse()
Returns whether the results should be reversed. BaseChannel.MessageTypeFilter
getMessageTypeFilter()
Returns the BaseChannel.MessageTypeFilter. String
getCustomTypeFilter()
Returns the custom type filter of message. List<String>
getSenderUserIdsFilter()
Returns the sender user ids filter. boolean
shouldIncludeMetaArray()
Returns whether the meta array should be included in the results. boolean
shouldIncludeReactions()
Returns whether the reaction data should be included in the results. boolean
isIncludeThreadInfo()
Returns whether to include the thread information of the returned messages in the results when the results contain parent messages. boolean
shouldIncludeReplies()
Returns whether the replies should be included in the results. boolean
shouldIncludeParentMessageText()
Returns whether the text of a parent message should be included in the reply messages included in the results. boolean
shouldShowSubchannelMessagesOnly()
If set to true, only messages that belong to current user's subchannel is fetched.If set to false, all messages will be fetched. boolean
shouldIncludePollDetails()
Returns whether to include the poll of the returned messages in the results. -
-
Method Detail
-
getChannelType
@NonNull() BaseChannel.ChannelType getChannelType()
Returns the current channel type.
-
getChannelUrl
@NonNull() String getChannelUrl()
Returns the current channel url.
-
setShowSubchannelMessagesOnly
void setShowSubchannelMessagesOnly(boolean showSubchannelMessagesOnly)
If set to true, only messages that belong to current user's subchannel is fetched.If set to false, all messages will be fetched. Default is false.Takes effect only when the requested channel is a dynamically partitioned open channel.
- Parameters:
showSubchannelMessagesOnly
- If false, all messages will be returned.
-
getReplyTypeFilter
@NonNull() ReplyTypeFilter getReplyTypeFilter()
Returns the reply type filter.
-
setReplyTypeFilter
void setReplyTypeFilter(@NonNull() ReplyTypeFilter replyTypeFilter)
Determines the reply types to include in the results.
- Parameters:
replyTypeFilter
- ReplyTypeFilter.
-
getMessagePayloadFilter
@NonNull() MessagePayloadFilter getMessagePayloadFilter()
Returns the MessagePayloadFilter set in this param.
-
setMessagePayloadFilter
void setMessagePayloadFilter(@NonNull() MessagePayloadFilter messagePayloadFilter)
Sets the MessagePayloadFilter to be used in retrieving message lists.This is more preferred way of setting other include flags.
- Parameters:
messagePayloadFilter
- MessagePayloadFilter with preferred filters set.
-
create
@NonNull() static PreviousMessageListQuery create(@NonNull() BaseChannel.ChannelType channelType, @NonNull() String channelUrl)
Creates a query instance to get message list of a channel.
- Parameters:
channelType
- a type of channel.channelUrl
- an url of channel.
-
hasMore
boolean hasMore()
Checks if there are more previous messages.
-
isLoading
synchronized boolean isLoading()
Checks if the current query is in communication progress with server.
-
setLimit
void setLimit(int limit)
Sets the maximum number of messages per queried page.
- Parameters:
limit
- The maximum number of messages per page.
-
setReverse
void setReverse(boolean reverse)
Sets reverse.
- Parameters:
reverse
- Iftrue
the queried result will be returned by creation time descending order.
-
setMessageTypeFilter
void setMessageTypeFilter(BaseChannel.MessageTypeFilter messageType)
Sets message type filter.
- Parameters:
messageType
- Message type.
-
setCustomTypeFilter
void setCustomTypeFilter(String customType)
Sets custom type filter.
- Parameters:
customType
- Custom type.
-
setCustomTypesFilter
void setCustomTypesFilter(Collection<String> customTypes)
Sets custom type filter. when set, only messages with customType that equals to one ofcustomTypes will be returned. When a customType is an empty string (""), all messageswithout a custom type will be returned.
- Parameters:
customTypes
- Custom types.
-
setSenderUserIdsFilter
void setSenderUserIdsFilter(List<String> senderUserIds)
Sets sender user ids filter.
- Parameters:
senderUserIds
- Sender user IDs.
-
setIncludeMetaArray
void setIncludeMetaArray(boolean includeMetaArray)
Sets message meta array.Internally, this will be set on setIncludeMetaArray.
- Parameters:
includeMetaArray
- Iftrue
the queried result will be returned with message meta array.
-
setIncludeReactions
void setIncludeReactions(boolean includeReactions)
Sets message reactions.Internally, this will be set on setIncludeReactions.
- Parameters:
includeReactions
- Iftrue
the queried result will be returned with message reactions.
-
setIncludeThreadInfo
void setIncludeThreadInfo(boolean includeThreadInfo)
Determines whether to include the thread information of the returned messages in the results when the results contain parent messages.Internally, this will be set on setIncludeThreadInfo.
- Parameters:
includeThreadInfo
- Iftrue
the queried result will be returned with thread information.
-
setIncludeReplies
@Deprecated() void setIncludeReplies(boolean includeReplies)
Determines whether replies are included in the results.
- Parameters:
includeReplies
- Iftrue
the queried result will be returned with reply messages as well.
-
setIncludeParentMessageText
@Deprecated() void setIncludeParentMessageText(boolean includeParentMessageText)
Determines whether to include the parent message text in the results when the updated messages are replies in a thread.If the type of the parent message is UserMessage, the value is a getMessage of the parent message.If it is FileMessage, the value is the name of the uploaded file.Internally, this will be set on setIncludeParentMessageInfo.
- Parameters:
includeParentMessageText
- Iftrue
the queried result will be returned with parent message's text for reply messages.
-
setIncludePollDetails
void setIncludePollDetails(boolean includePollDetails)
Determines whether to include the poll of the returned messages in the results.Internally, this will be set on setIncludePollDetails.
- Parameters:
includePollDetails
- Iftrue
the queried result will be returned with poll.
-
load
synchronized void load(PreviousMessageListQuery.MessageListQueryResult handler)
Requests query result for the previous messages. The queried result is passed to
handler
aslist
.- Parameters:
handler
- Callback handler.
-
load
synchronized void load(int limit, boolean reverse, PreviousMessageListQuery.MessageListQueryResult handler)
Requests query result for the previous messages. The queried result is passed to
handler
aslist
.- Parameters:
limit
- Maximum number of previous messages to load.reverse
- Iftrue
the queried result will be returned by creation time descending order.handler
- Callback handler.
-
getChannel
@Nullable() BaseChannel getChannel()
Current channel.If this PreviousMessageListQuery instance was created from createPreviousMessageListQuery,this will be
NonNull
.If this instance was created from create and have not yet called either load or load,this will benull
.
-
getMessageTimestamp
long getMessageTimestamp()
Returns the time of a request.
-
getLimit
int getLimit()
Returns the maximum number of messages per page.
-
shouldReverse
boolean shouldReverse()
Returns whether the results should be reversed.
-
getMessageTypeFilter
BaseChannel.MessageTypeFilter getMessageTypeFilter()
Returns the BaseChannel.MessageTypeFilter.
-
getCustomTypeFilter
String getCustomTypeFilter()
Returns the custom type filter of message.
-
getSenderUserIdsFilter
List<String> getSenderUserIdsFilter()
Returns the sender user ids filter.
-
shouldIncludeMetaArray
boolean shouldIncludeMetaArray()
Returns whether the meta array should be included in the results.Can also be checked by getMessagePayloadFilter.
-
shouldIncludeReactions
boolean shouldIncludeReactions()
Returns whether the reaction data should be included in the results.Can also be checked by getMessagePayloadFilter.
-
isIncludeThreadInfo
boolean isIncludeThreadInfo()
Returns whether to include the thread information of the returned messages in the results when the results contain parent messages.Can also be checked by getMessagePayloadFilter.
-
shouldIncludeReplies
@Deprecated() boolean shouldIncludeReplies()
Returns whether the replies should be included in the results.
-
shouldIncludeParentMessageText
@Deprecated() boolean shouldIncludeParentMessageText()
Returns whether the text of a parent message should be included in the reply messages included in the results.Can also be checked by getMessagePayloadFilter.
-
shouldShowSubchannelMessagesOnly
boolean shouldShowSubchannelMessagesOnly()
If set to true, only messages that belong to current user's subchannel is fetched.If set to false, all messages will be fetched. Default is false.Takes effect only when the requested channel is a dynamically partitioned open channel.
-
shouldIncludePollDetails
boolean shouldIncludePollDetails()
Returns whether to include the poll of the returned messages in the results.Can also be checked by getMessagePayloadFilter.
-
-
-
-