Interface ConversationService
- All Known Implementing Classes:
ConversationServiceImpl
public interface ConversationService
Service contract for managing conversations (direct and group).
Each method is documented to improve generated JavaDoc and maintainability.
-
Method Summary
Modifier and TypeMethodDescriptiongetConversation(UUID userId, UUID conversationId) Get conversation details by ID.org.springframework.data.domain.Page<OutputChatMessageDto> getConversationMessages(UUID userId, UUID conversationId, org.springframework.data.domain.Pageable pageable) Get recent messages for conversation.getConversationParticipants(UUID conversationId) Get all participants for a conversation.Get aggregated counts for direct and group conversations.Get conversations along with unread message information for a user.org.springframework.data.domain.Page<OutputConversationDto> getRecentConversationsForUser(UUID userId, org.springframework.data.domain.Pageable pageable) Get recently active conversations for a user.booleanisUserParticipant(UUID conversationId, UUID userId) Check if a user is a participant in the conversation.voidleaveConversation(UUID conversationId, UUID userId) Leave the conversation as a user.voidmarkBulkMessagesAsRead(UUID userId, UUID conversationId, InputBulkMessagesDto request) Mark all messages in the conversation as read for a user for the bulk messages request.voidmarkConversationAsRead(UUID userId, UUID conversationId) Mark all messages in the conversation as read for a user.voidmarkConversationUptoMessageAsRead(UUID userId, UUID conversationId, UUID messageId) Mark all messages in the conversation as read for a user upto the message id provided.voidmuteConversation(UUID conversationId, UUID userId, boolean muted) Mute or unmute a conversation for a user.searchConversations(UUID userId, String searchTerm, org.springframework.data.domain.Pageable pageable) Search conversations by a free-text term (e.g., by name/description for non-direct chats).
-
Method Details
-
getConversation
Get conversation details by ID.- Parameters:
userId- the user idconversationId- the conversation ID- Returns:
- Output conversation if found
-
getRecentConversationsForUser
org.springframework.data.domain.Page<OutputConversationDto> getRecentConversationsForUser(UUID userId, org.springframework.data.domain.Pageable pageable) Get recently active conversations for a user.- Parameters:
userId- the user IDpageable- the pageable containing requested paging and sorting information- Returns:
- page of conversations ordered by recent activity
-
getConversationMessages
org.springframework.data.domain.Page<OutputChatMessageDto> getConversationMessages(UUID userId, UUID conversationId, org.springframework.data.domain.Pageable pageable) Get recent messages for conversation.- Parameters:
userId- the user IDconversationId- the conversation IDpageable- the pageable containing requested paging and sorting information- Returns:
- page of conversations ordered by recent activity
-
getConversationParticipants
Get all participants for a conversation.- Parameters:
conversationId- the conversation ID- Returns:
- list of participants
-
isUserParticipant
Check if a user is a participant in the conversation.- Parameters:
conversationId- the conversation IDuserId- the user ID- Returns:
- true if the user is an active participant
-
muteConversation
Mute or unmute a conversation for a user.- Parameters:
conversationId- the conversation IDuserId- the user IDmuted- true to mute, false to unmute
-
markConversationAsRead
Mark all messages in the conversation as read for a user.- Parameters:
userId- the user IDconversationId- the conversation ID
-
markConversationUptoMessageAsRead
void markConversationUptoMessageAsRead(@NonNull UUID userId, @NonNull UUID conversationId, @NonNull UUID messageId) Mark all messages in the conversation as read for a user upto the message id provided.- Parameters:
userId- the user IDconversationId- the conversation IDmessageId- the message ID
-
markBulkMessagesAsRead
void markBulkMessagesAsRead(@NonNull UUID userId, @NonNull UUID conversationId, @NonNull InputBulkMessagesDto request) Mark all messages in the conversation as read for a user for the bulk messages request.- Parameters:
userId- the user IDconversationId- the conversation IDrequest- the input bulk messages request
-
getConversationsWithUnreadMessages
Get conversations along with unread message information for a user.- Parameters:
userId- the user ID- Returns:
- list of participant records including unread state
-
leaveConversation
Leave the conversation as a user.- Parameters:
conversationId- the conversation IDuserId- the user ID
-
searchConversations
OutputSearchResultDto searchConversations(UUID userId, String searchTerm, org.springframework.data.domain.Pageable pageable) Search conversations by a free-text term (e.g., by name/description for non-direct chats).- Parameters:
userId- the user IDsearchTerm- free-text termpageable- the pageable containing requested paging and sorting information- Returns:
- list of matching conversations/messages
-
getConversationStats
OutputConversationStatsDto getConversationStats()Get aggregated counts for direct and group conversations.- Returns:
- conversation statistics DTO
-