From dcdaefe76e289c61964930ac6a5a66aafef8d006 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 1 Feb 2021 14:42:34 +0530 Subject: [PATCH] [StreamChat -> ChatPersistenceClient] Add doc comments Signed-off-by: Sahil Kumar --- .../lib/src/db/chat_persistence_client.dart | 55 +++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/packages/dart_client/lib/src/db/chat_persistence_client.dart b/packages/dart_client/lib/src/db/chat_persistence_client.dart index 070bf37f..c4ce6cd2 100644 --- a/packages/dart_client/lib/src/db/chat_persistence_client.dart +++ b/packages/dart_client/lib/src/db/chat_persistence_client.dart @@ -8,7 +8,7 @@ import 'package:stream_chat/src/models/reaction.dart'; import 'package:stream_chat/src/models/read.dart'; import 'package:stream_chat/src/models/user.dart'; -/// +/// A simple client used for persisting chat data locally. abstract class ChatPersistenceClient { /// Creates a new connection to the client Future connect(String userId); @@ -38,22 +38,25 @@ abstract class ChatPersistenceClient { /// Get the channel cids saved in the offline storage Future> getChannelCids(); - /// + /// Get stored [ChannelModel]s by providing channel [cid] Future getChannelByCid(String cid); - /// + /// Get stored channel [Member]s by providing channel [cid] Future> getMembersByCid(String cid); - /// + /// Get stored channel [Read]s by providing channel [cid] Future> getReadsByCid(String cid); + /// Get stored [Message]s by providing channel [cid] /// + /// Optionally, you can [messagePagination] + /// for filtering out messages Future> getMessagesByCid( String cid, { PaginationParams messagePagination, }); - /// Get channel data by cid + /// Get [ChannelState] data by providing channel [cid] Future getChannelStateByCid( String cid, { PaginationParams messagePagination, @@ -73,14 +76,18 @@ abstract class ChatPersistenceClient { ); } - /// Get list of channels by filter, sort and paginationParams + /// Get all the stored [ChannelState]s + /// + /// Optionally, pass [filter], [sort], [paginationParams] + /// for filtering out states. Future> getChannelStates({ Map filter, List sort = const [], PaginationParams paginationParams, }); - /// Update list of channel queries + /// Update list of channel queries. + /// /// If [clearQueryCache] is true before the insert /// the list of matching rows will be deleted Future updateChannelQueries( @@ -89,53 +96,57 @@ abstract class ChatPersistenceClient { bool clearQueryCache, ); - /// Remove a message by message id + /// Remove a message by [messageId] Future deleteMessageById(String messageId) { return deleteMessageByIds([messageId]); } - /// Remove a message by message ids + /// Remove a message by [messageIds] Future deleteMessageByIds(List messageIds); - /// Remove a message by channel cid + /// Remove a message by channel [cid] Future deleteMessageByCid(String cid) { return deleteMessageByCids([cid]); } - /// Remove a message by message cids + /// Remove a message by message [cids] Future deleteMessageByCids(List cids); - /// Remove a channel by cid + /// Remove a channel by [cid] Future deleteChannels(List cids); - /// Update messages data from a list + /// Updates the message data of a particular channel [cid] with + /// the new [messages] data Future updateMessages(String cid, List messages); - /// Get the info about channel threads + /// Returns all the threads by parent message of a particular channel by + /// providing channel [cid] Future>> getChannelThreads(String cid); - /// + /// Updates all the channels using the new [channels] data. Future updateChannels(List channels); - /// + /// Updates all the members of a particular channle [cid] + /// with the new [members] data Future updateMembers(String cid, List members); - /// + /// Updates the read data of a particular channel [cid] with + /// the new [reads] data Future updateReads(String cid, List reads); - /// + /// Updates the users data with the new [users] data Future updateUsers(List users); - /// + /// Updates the reactions data with the new [reactions] data Future updateReactions(List reactions); - /// + /// Deletes all the reactions by [messageIds] Future deleteReactionsByMessageId(List messageIds); - /// + /// Deletes all the members by channel [cids] Future deleteMembersByCids(List cids); - /// + /// Update the channel state data using [channelState] Future updateChannelState(ChannelState channelState) { return updateChannelStates([channelState]); }