Class MessageService
- All Implemented Interfaces:
ZulipService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddEmojiReaction(long messageId, String emojiName) Adds a emoji reaction to a message.createMessageReminder(long messageId, Instant scheduledDeliveryTimestamp) Creates a message reminder.deleteEmojiReaction(long messageId, String emojiName) Removes a emoji reaction.deleteMessage(long messageId) Permanently deletes a message.deleteMessageReminder(int messageReminderId) Deletes and cancels a previously scheduled message reminder.deleteScheduledMessage(long scheduledMessageId) Deletes and cancels the sending of a previously scheduled message.editMessage(long messageId) Edits the content or topic of a message.editScheduledMessage(long scheduledMessageId) Edits an existing scheduled message.fileUpload(File file) Uploads a file to the Zulip server.getMessage(long messageId) Gets a single message.getMessageHistory(long messageId) Gets a message edit history.getMessageReadReceipts(long messageId) Gets a list containing of IDs for all users who have marked the given message as read.Gets all message reminders for the current user.getMessages(int numBefore, int numAfter, long anchor) Fetch message history from a Zulip server using the specified before message id, after message id and anchor message ID.getMessages(int numBefore, int numAfter, Anchor anchor) Fetch message history from a Zulip server using the specified before message id, after message id and anchor value.getMessages(List<Long> messageIds) Gets a messages matching the given message IDs.Fetch all scheduled messages for the current user.Deprecated.markStreamAsRead(long streamId) Marks a stream as read.markTopicAsRead(long streamId, String topicName) Marks a topic as read.Searches for and matches messages with a narrow.renderMessage(String content) Renders a message to HTML.reportMessage(long messageId, MessageReportReason reportReason) Reports a message for moderation.sendChannelMessage(String content, long channelId, String topic) Sends a channel message to the given channel id and topic.sendChannelMessage(String content, String channelName, String topic) Sends a channel message to the given channel name and topic.sendDirectMessage(String content, long... userIds) Sends a direct message to the users matching the given email user ids.sendDirectMessage(String content, String... userEmails) Sends a direct message to the users matching the given email addresses.sendScheduledMessage(MessageType type, String content, Instant deliveryTimestamp, long... to) Schedules the sending of a message to a specified stream or users.sendStreamMessage(String content, long streamId, String topic) Sends a stream message to the given stream id and topic.sendStreamMessage(String content, String streamName, String topic) Sends a stream message to the given stream name and topic.updateMessageFlags(MessageFlag flag, Operation operation, long... messageIds) Add or remove personal message flags on a collection of message idsupdateMessageFlagsForNarrow(int anchor, int numBefore, int numAfter, Operation operation, MessageFlag flag, Narrow... narrows) Add or remove personal message flags with a narrowupdateMessageFlagsForNarrow(Anchor anchor, int numBefore, int numAfter, Operation operation, MessageFlag flag, Narrow... narrows) Add or remove personal message flags with a narrow
-
Constructor Details
-
MessageService
Constructs aMessageService.- Parameters:
client- The Zulip HTTP client
-
-
Method Details
-
addEmojiReaction
Adds a emoji reaction to a message.- Parameters:
messageId- The id of the message to add an emoji reaction toemojiName- The name of the emoji to add- Returns:
- The
AddEmojiReactionApiRequestbuilder object - See Also:
-
createMessageReminder
public CreateMessageReminderApiRequest createMessageReminder(long messageId, Instant scheduledDeliveryTimestamp) Creates a message reminder.- Parameters:
messageId- The id of the previously sent message to reference in the message reminderscheduledDeliveryTimestamp- The timestamp for when the message reminder will be sent- Returns:
- The
CreateMessageReminderApiRequestbuilder object - See Also:
-
deleteEmojiReaction
Removes a emoji reaction.- Parameters:
messageId- The id of the message to remove the reaction fromemojiName- The name of the emoji to remove- Returns:
- The
DeleteEmojiReactionApiRequestbuilder object - See Also:
-
deleteMessage
Permanently deletes a message.- Parameters:
messageId- The id of the message to delete- Returns:
- The
DeleteMessageApiRequestbuilder object - See Also:
-
deleteMessageReminder
Deletes and cancels a previously scheduled message reminder.- Parameters:
messageReminderId- The id of the message reminder to delete- Returns:
- The
DeleteMessageReminderApiRequestbuilder object - See Also:
-
deleteScheduledMessage
Deletes and cancels the sending of a previously scheduled message.- Parameters:
scheduledMessageId- The id of the scheduled message to delete- Returns:
- The
DeleteMessageApiRequestbuilder object - See Also:
-
editMessage
Edits the content or topic of a message.- Parameters:
messageId- The id of the message to edit- Returns:
- The
EditMessageApiRequestbuilder object - See Also:
-
editScheduledMessage
Edits an existing scheduled message.- Parameters:
scheduledMessageId- The id of the scheduled message to edit- Returns:
- The
EditMessageApiRequestbuilder object - See Also:
-
fileUpload
Uploads a file to the Zulip server.- Parameters:
file- The file to upload- Returns:
- The
FileUploadApiRequestbuilder object - See Also:
-
getMessageHistory
Gets a message edit history.- Parameters:
messageId- The id of the message to get edit history- Returns:
- The
GetMessageHistoryApiRequestbuilder object - See Also:
-
getMessage
Gets a single message.- Parameters:
messageId- The id of the message to get- Returns:
- The
GetMessageApiRequestbuilder object - See Also:
-
getMessages
Gets a messages matching the given message IDs.- Parameters:
messageIds- The IDs of the messages to fetch- Returns:
- The
GetMessagesApiRequestbuilder object
-
getMessages
Fetch message history from a Zulip server using the specified before message id, after message id and anchor value.
To refine the list of messages returned, use the returned
GetMessagesApiRequestbuilder object to set an anchor and narrow expression.Note that a maximum of 5000 messages can be obtained per request. Therefore Zulip recommends using a numBefore value of <= 1000 and a numAfter value <= 1000.
- Parameters:
numBefore- The number of messages with IDs less than the anchor to retrievenumAfter- The number of messages with IDs greater than the anchor to retrieveanchor- The value for the server to compute the anchor from- Returns:
- The
GetMessagesApiRequestbuilder object - See Also:
-
getMessages
Fetch message history from a Zulip server using the specified before message id, after message id and anchor message ID.
To refine the list of messages returned, use the returned
GetMessagesApiRequestbuilder object to set an anchor and narrow expression.Note that a maximum of 5000 messages can be obtained per request. Therefore Zulip recommends using a numBefore value of <= 1000 and a numAfter vlaue <= 1000.
- Parameters:
numBefore- The number of messages with IDs less than the (optional) anchor to retrievenumAfter- The number of messages with IDs greater than the (optional) anchor to retrieveanchor- The message ID to anchor fetching of new message- Returns:
- The
GetMessagesApiRequestbuilder object - See Also:
-
getMessageReadReceipts
Gets a list containing of IDs for all users who have marked the given message as read.- Parameters:
messageId- The id of the message to get read recipients for- Returns:
- The
GetMessageReadReceiptsApiRequestbuilder object - See Also:
-
getMessageReminders
Gets all message reminders for the current user.- Returns:
- The
GetMessageReadReceiptsApiRequestbuilder object - See Also:
-
getScheduledMessages
Fetch all scheduled messages for the current user.- Returns:
- The
GetScheduledMessagesApiRequestbuilder object - See Also:
-
markAllAsRead
Deprecated.useupdateMessageFlagsForNarrowinstead.Marks all of the current user unread messages as read.- Returns:
- The
MarkAllAsReadApiRequestbuilder object - See Also:
-
markStreamAsRead
Marks a stream as read.- Parameters:
streamId- The id of the stream to mark as read- Returns:
- The
MarkStreamAsReadApiRequestbuilder object - See Also:
-
markTopicAsRead
Marks a topic as read.- Parameters:
streamId- The id of the stream wher the topic residestopicName- The name of the topic to mark as read- Returns:
- The
MarkTopicAsReadApiRequestbuilder object - See Also:
-
matchMessages
Searches for and matches messages with a narrow.- Returns:
- The
MatchesNarrowApiRequestbuilder object - See Also:
-
renderMessage
Renders a message to HTML.- Parameters:
content- The content to render as HTML- Returns:
- The
RenderMessageApiRequestbuilder object - See Also:
-
reportMessage
Reports a message for moderation.- Parameters:
messageId- The id of the message to reportreportReason- The reason for the message report- Returns:
- The
ReportMessageApiRequestbuilder object - See Also:
-
sendChannelMessage
Sends a channel message to the given channel name and topic.- Parameters:
content- The content of the messagechannelName- The name of the channel to send the message totopic- The name of the message topic- Returns:
- The
SendMessageApiRequestbuilder object - See Also:
-
sendChannelMessage
Sends a channel message to the given channel id and topic.- Parameters:
content- The content of the messagechannelId- The id of the stream to send the message totopic- The name of the message topic- Returns:
- The
SendMessageApiRequestbuilder object - See Also:
-
sendDirectMessage
Sends a direct message to the users matching the given email addresses.- Parameters:
content- The content of the messageuserEmails- The email addresses of the users to send the message to- Returns:
- The
SendMessageApiRequestbuilder object - See Also:
-
sendDirectMessage
Sends a direct message to the users matching the given email user ids.- Parameters:
content- The content of the messageuserIds- The ids of the users to send the message to- Returns:
- The
SendMessageApiRequestbuilder object - See Also:
-
sendScheduledMessage
public SendScheduledMessageApiRequest sendScheduledMessage(MessageType type, String content, Instant deliveryTimestamp, long... to) Schedules the sending of a message to a specified stream or users.- Parameters:
type- The type of scheduled message to be sentcontent- The content of the messagedeliveryTimestamp-Instantset to the UNIX epoch timestamp for when the message will be sentto- If the type is 'stream' then this is the id of the stream. Else one or more user ids may be specified- Returns:
- The
SendScheduledMessageApiRequest
-
sendStreamMessage
Sends a stream message to the given stream name and topic.- Parameters:
content- The content of the messagestreamName- The name of the stream to send the message totopic- The name of the message topic- Returns:
- The
SendMessageApiRequestbuilder object - See Also:
-
sendStreamMessage
Sends a stream message to the given stream id and topic.- Parameters:
content- The content of the messagestreamId- The id of the stream to send the message totopic- The name of the message topic- Returns:
- The
SendMessageApiRequestbuilder object - See Also:
-
updateMessageFlags
public UpdateMessageFlagsApiRequest updateMessageFlags(MessageFlag flag, Operation operation, long... messageIds) Add or remove personal message flags on a collection of message ids- Parameters:
flag- TheMessageFlagto add or removeoperation- TheOperationto applymessageIds- The message ids to update flags on- Returns:
- The
UpdateMessageFlagsApiRequestbuilder object - See Also:
-
updateMessageFlagsForNarrow
public UpdateMessageFlagsForNarrowApiRequest updateMessageFlagsForNarrow(Anchor anchor, int numBefore, int numAfter, Operation operation, MessageFlag flag, Narrow... narrows) Add or remove personal message flags with a narrow- Parameters:
anchor- TheAnchorto usenumBefore- The number of messages preceding the anchor in the update rangenumAfter- The number of messages following the anchor in the update rangeoperation- TheOperationto apply for theMessageFlagflag- TheMessageFlagto add or remove to the messagesnarrows- TheNarrowexpressions to use- Returns:
- The
UpdateMessageFlagsApiRequestbuilder object - See Also:
-
updateMessageFlagsForNarrow
public UpdateMessageFlagsForNarrowApiRequest updateMessageFlagsForNarrow(int anchor, int numBefore, int numAfter, Operation operation, MessageFlag flag, Narrow... narrows) Add or remove personal message flags with a narrow- Parameters:
anchor- The message id anchor to filter and restrict messagesnumBefore- The number of messages preceding the anchor in the update rangenumAfter- The number of messages following the anchor in the update rangeoperation- TheOperationto apply for theMessageFlagflag- TheMessageFlagto add or remove to the messagesnarrows- TheNarrowexpressions to use- Returns:
- The
UpdateMessageFlagsApiRequestbuilder object - See Also:
-
updateMessageFlagsForNarrowinstead.