docs: add more descriptive documentation to repository methods

This commit is contained in:
Joey Boerwinkel 2025-03-11 16:36:51 +01:00 committed by FlutterJoey
parent c155531b11
commit f7f15ef750
2 changed files with 15 additions and 1 deletions

View file

@ -73,17 +73,27 @@ abstract class ChatRepositoryInterface {
required MessageModel firstMessage, required MessageModel firstMessage,
}); });
/// Function that provides the next message id /// Retrieve the next unused message id given a current chat.
///
/// The resulting string should be at least unique per [chatId]. The userId
/// is provided in case the specific user has influence on the id.
///
/// Imagine returning a UUID, the next integer in a counter or the document
/// id in firebase.
Future<String> getNextMessageId({ Future<String> getNextMessageId({
required String userId, required String userId,
required String chatId, required String chatId,
}); });
/// Send a message with the given parameters. /// Send a message with the given parameters.
///
/// [chatId] is the chat id. /// [chatId] is the chat id.
/// [senderId] is the sender id. /// [senderId] is the sender id.
/// [messageId] is the identifier for this message
/// [text] is the message text. /// [text] is the message text.
/// [imageUrl] is the image url. /// [imageUrl] is the image url.
/// [messageType] is a way to identify a difference in messages
/// [timestamp] is the moment of sending.
Future<void> sendMessage({ Future<void> sendMessage({
required String chatId, required String chatId,
required String senderId, required String senderId,

View file

@ -15,10 +15,14 @@ abstract class PendingMessageRepositoryInterface {
}); });
/// Create a message in the pending messages and return the created message. /// Create a message in the pending messages and return the created message.
///
/// [chatId] is the chat id. /// [chatId] is the chat id.
/// [senderId] is the sender id. /// [senderId] is the sender id.
/// [messageId] is the identifier for this message
/// [text] is the message text. /// [text] is the message text.
/// [imageUrl] is the image url. /// [imageUrl] is the image url.
/// [messageType] is a way to identify a difference in messages
/// [timestamp] is the moment of sending.
Future<MessageModel> createMessage({ Future<MessageModel> createMessage({
required String chatId, required String chatId,
required String senderId, required String senderId,