Class GetMessagesApiRequest
java.lang.Object
com.github.jamesnetherton.zulip.client.api.core.ZulipApiRequest
com.github.jamesnetherton.zulip.client.api.message.request.GetMessagesApiRequest
- All Implemented Interfaces:
ExecutableApiRequest<List<Message>>
,NarrowableApiRequest<GetMessagesApiRequest>
public class GetMessagesApiRequest
extends ZulipApiRequest
implements NarrowableApiRequest<GetMessagesApiRequest>, ExecutableApiRequest<List<Message>>
Zulip API request builder for searching and getting messages.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGetMessagesApiRequest
(ZulipHttpClient client) Constructs aGetMessagesApiRequest
. -
Method Summary
Modifier and TypeMethodDescriptionexecute()
Executes the Zulip API request for searching and getting messages.withAllowEmptyTopicName
(boolean allowEmptyTopicName) Sets whether to allow empty topic names to be returned.withAnchor
(long messageId) Sets the optional message id anchor to filter and restrict messages.withAnchor
(Anchor anchor) Sets the optionalAnchor
to filter and restrict messages.withGravatar
(boolean clientGravatar) Sets the optional choice of whether to return the users gravatar URL int the response.withIncludeAnchor
(boolean includeAnchor) Whether a message with the specified ID matching the narrow should be included.withMarkdown
(boolean applyMarkdown) Sets the optional choice of message content should be returned in the rendered HTML format.withMessageIds
(List<Long> messageIds) Sets the list of message IDs to fetch.withNarrows
(Narrow... narrows) Sets the optional narrow to fetch messages from.withNumAfter
(int numAfter) Sets the mandatory number of messages with ids greater than the anchor to retrieve.withNumBefore
(int numBefore) Sets the mandatory number of messages with ids less than the anchor to retrieve.Methods inherited from class com.github.jamesnetherton.zulip.client.api.core.ZulipApiRequest
client, getParam, getParams, putParam, putParamAsJsonString, putParamAsWrappedObject
-
Field Details
-
ALLOW_EMPTY_TOPIC_NAME
- See Also:
-
ANCHOR
- See Also:
-
GRAVATAR
- See Also:
-
INCLUDE_ANCHOR
- See Also:
-
MARKDOWN
- See Also:
-
MESSAGE_IDS
- See Also:
-
NARROW
- See Also:
-
NUM_AFTER
- See Also:
-
NUM_BEFORE
- See Also:
-
-
Constructor Details
-
GetMessagesApiRequest
Constructs aGetMessagesApiRequest
.- Parameters:
client
- The Zulip HTTP client
-
-
Method Details
-
withAllowEmptyTopicName
Sets whether to allow empty topic names to be returned.- Parameters:
allowEmptyTopicName
-true
to allow empty topic names.false
to disallow empty topic names- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
withAnchor
Sets the optionalAnchor
to filter and restrict messages.- Parameters:
anchor
- The anchor value- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
withAnchor
Sets the optional message id anchor to filter and restrict messages.- Parameters:
messageId
- The message id anchor value- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
withIncludeAnchor
Whether a message with the specified ID matching the narrow should be included.- Parameters:
includeAnchor
-true
if a message with the specified ID matching the narrow should be included.False
if a message with the specified ID matching the narrow should not be included- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
withMessageIds
Sets the list of message IDs to fetch.- Parameters:
messageIds
- The message IDs to fetch and match against- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
withNumBefore
Sets the mandatory number of messages with ids less than the anchor to retrieve.- Parameters:
numBefore
- The number of messages with ids less than the anchor to retrieve- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
withNumAfter
Sets the mandatory number of messages with ids greater than the anchor to retrieve.- Parameters:
numAfter
- The number of messages with ids greater than the anchor to retrieve- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
withNarrows
Sets the optional narrow to fetch messages from.- Specified by:
withNarrows
in interfaceNarrowableApiRequest<GetMessagesApiRequest>
- Parameters:
narrows
- One or moreNarrow
expressions- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
withGravatar
Sets the optional choice of whether to return the users gravatar URL int the response.- Parameters:
clientGravatar
-true
if the gravatar should be included in the response.False
if the gravatar should not be included- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
withMarkdown
Sets the optional choice of message content should be returned in the rendered HTML format.- Parameters:
applyMarkdown
-true
if to return rendered HTML.false
if markdown should be returned- Returns:
- This
GetMessagesApiRequest
instance - See Also:
-
execute
Executes the Zulip API request for searching and getting messages.- Specified by:
execute
in interfaceExecutableApiRequest<List<Message>>
- Returns:
- List of
Message
objects that matched the search criteria - Throws:
ZulipClientException
- if the request was not successful
-