Interface Plugin
-
- All Implemented Interfaces:
-
io.getstream.chat.android.client.plugin.listeners.ChannelMarkReadListener,io.getstream.chat.android.client.plugin.listeners.CreateChannelListener,io.getstream.chat.android.client.plugin.listeners.DeleteMessageListener,io.getstream.chat.android.client.plugin.listeners.DeleteReactionListener,io.getstream.chat.android.client.plugin.listeners.EditMessageListener,io.getstream.chat.android.client.plugin.listeners.FetchCurrentUserListener,io.getstream.chat.android.client.plugin.listeners.GetMessageListener,io.getstream.chat.android.client.plugin.listeners.HideChannelListener,io.getstream.chat.android.client.plugin.listeners.MarkAllReadListener,io.getstream.chat.android.client.plugin.listeners.QueryChannelListener,io.getstream.chat.android.client.plugin.listeners.QueryChannelsListener,io.getstream.chat.android.client.plugin.listeners.QueryMembersListener,io.getstream.chat.android.client.plugin.listeners.SendAttachmentListener,io.getstream.chat.android.client.plugin.listeners.SendGiphyListener,io.getstream.chat.android.client.plugin.listeners.SendMessageListener,io.getstream.chat.android.client.plugin.listeners.SendReactionListener,io.getstream.chat.android.client.plugin.listeners.ShuffleGiphyListener,io.getstream.chat.android.client.plugin.listeners.ThreadQueryListener,io.getstream.chat.android.client.plugin.listeners.TypingEventListener
public interface Plugin implements QueryMembersListener, DeleteReactionListener, SendReactionListener, ThreadQueryListener, SendGiphyListener, ShuffleGiphyListener, DeleteMessageListener, SendMessageListener, SendAttachmentListener, EditMessageListener, QueryChannelListener, QueryChannelsListener, TypingEventListener, HideChannelListener, MarkAllReadListener, ChannelMarkReadListener, CreateChannelListener, GetMessageListener, FetchCurrentUserListener
Plugin is an extension for ChatClient.
-
-
Method Summary
Modifier and Type Method Description UnitonQueryMembersResult(Result<List<Member>> result, String channelType, String channelId, Integer offset, Integer limit, FilterObject filter, QuerySorter<Member> sort, List<Member> members)Runs this function on the Result of this request. UnitonDeleteReactionRequest(String cid, String messageId, String reactionType, User currentUser)A method called before making an API call to delete the reaction. UnitonDeleteReactionResult(String cid, String messageId, String reactionType, User currentUser, Result<Message> result)A method called after receiving the response from the delete reaction call. Result<Unit>onDeleteReactionPrecondition(User currentUser)Runs precondition check for ChatClient.deleteReaction. UnitonSendReactionRequest(String cid, Reaction reaction, Boolean enforceUnique, User currentUser)A method called before making an API call to send the reaction. UnitonSendReactionResult(String cid, Reaction reaction, Boolean enforceUnique, User currentUser, Result<Reaction> result)A method called after receiving the response from the send reaction call. Result<Unit>onSendReactionPrecondition(User currentUser, Reaction reaction)Runs precondition check for ChatClient.sendReaction. Result<Unit>onGetRepliesPrecondition(String messageId, Integer limit)Runs precondition check for ChatClient.getReplies. UnitonGetRepliesRequest(String messageId, Integer limit)Runs side effect before the request is launched. UnitonGetRepliesResult(Result<List<Message>> result, String messageId, Integer limit)Runs this function on the result of the ChatClient.getReplies request. Result<Unit>onGetRepliesMorePrecondition(String messageId, String firstId, Integer limit)Runs precondition check for ChatClient.getRepliesMore. UnitonGetRepliesMoreRequest(String messageId, String firstId, Integer limit)Runs side effect before the request is launched. UnitonGetRepliesMoreResult(Result<List<Message>> result, String messageId, String firstId, Integer limit)Runs this function on the result of the ChatClient.getRepliesMore request. UnitonGiphySendResult(String cid, Result<Message> result)A method called after receiving the response from the send Giphy call. UnitonShuffleGiphyResult(String cid, Result<Message> result)A method called after receiving the response from the shuffle Giphy call. Result<Unit>onMessageDeletePrecondition(String messageId)Runs precondition check for ChatClient.deleteMessage. UnitonMessageDeleteRequest(String messageId)Method called when a request to delete a message in the API happens UnitonMessageDeleteResult(String originalMessageId, Result<Message> result)Method called when a request for message deletion return. UnitonMessageSendResult(Result<Message> result, String channelType, String channelId, Message message)Side effect to be invoked when the original request is completed with a response. UnitonMessageEditRequest(Message message)Method called when a request for message edition happens. UnitonMessageEditResult(Message originalMessage, Result<Message> result)Method called when a request for message edition return. Result<Unit>onQueryChannelPrecondition(String channelType, String channelId, QueryChannelRequest request)Run precondition for the request. UnitonQueryChannelRequest(String channelType, String channelId, QueryChannelRequest request)Runs side effect before the request is launched. UnitonQueryChannelResult(Result<Channel> result, String channelType, String channelId, QueryChannelRequest request)Runs this function on the result of the request. Result<Unit>onQueryChannelsPrecondition(QueryChannelsRequest request)Run precondition for the request. UnitonQueryChannelsRequest(QueryChannelsRequest request)Runs side effect before the request is launched. UnitonQueryChannelsResult(Result<List<Channel>> result, QueryChannelsRequest request)Runs this function on the Result of this QueryChannelsRequest. Result<Unit>onTypingEventPrecondition(String eventType, String channelType, String channelId, Map<Object, Object> extraData, Date eventTime)Runs this precondition before ChatClient.keystroke and ChatClient.stopTyping request is invoked. UnitonTypingEventRequest(String eventType, String channelType, String channelId, Map<Object, Object> extraData, Date eventTime)Runs this side effect before ChatClient.keystroke and ChatClient.stopTyping request is invoked. UnitonTypingEventResult(Result<ChatEvent> result, String eventType, String channelType, String channelId, Map<Object, Object> extraData, Date eventTime)Runs this side effect after ChatClient.keystroke and ChatClient.stopTyping request is completed. Result<Unit>onHideChannelPrecondition(String channelType, String channelId, Boolean clearHistory)Run precondition for the request. UnitonHideChannelRequest(String channelType, String channelId, Boolean clearHistory)Runs side effect before the request is launched. UnitonHideChannelResult(Result<Unit> result, String channelType, String channelId, Boolean clearHistory)Runs this function on the result of the request. UnitonMarkAllReadRequest()Register this side effect to run just before actual ChatClient.markAllRead request is launched. Result<Unit>onChannelMarkReadPrecondition(String channelType, String channelId)Run precondition for the request. UnitonCreateChannelRequest(String channelType, String channelId, List<String> memberIds, Map<String, Object> extraData, User currentUser)A method called before making an API call to create a channel. UnitonCreateChannelResult(String channelType, String channelId, List<String> memberIds, Result<Channel> result)A method called after receiving the response from the create channel call. Result<Unit>onCreateChannelPrecondition(User currentUser, String channelId, List<String> memberIds)Runs precondition check for ChatClient.createChannel. UnitonAttachmentSendRequest(String channelType, String channelId, Message message)Updates the SDK before the attachments are sent to backend. abstract UnitonUserSet(User user)abstract UnitonUserDisconnected()UnitonGetMessageResult(String messageId, Result<Message> result)Method called when the API call requesting a single new message has completed. UnitonFetchCurrentUserResult(Result<User> result)Called when the current user is fetched from the backend. abstract ErrorHandlergetErrorHandler()-
-
Method Detail
-
onQueryMembersResult
Unit onQueryMembersResult(Result<List<Member>> result, String channelType, String channelId, Integer offset, Integer limit, FilterObject filter, QuerySorter<Member> sort, List<Member> members)
Runs this function on the Result of this request.
- Parameters:
result- Result of this request.channelType- The type of channel.channelId- The id of the channel.offset- Offset limit.limit- Number of members to fetch.filter- FilterObject to filter members of certain type.sort- Sort the list of members.members- List of members.
-
onDeleteReactionRequest
Unit onDeleteReactionRequest(String cid, String messageId, String reactionType, User currentUser)
A method called before making an API call to delete the reaction.
- Parameters:
cid- The full channel id, i.e.messageId- The id of the message to which reaction belongs.reactionType- The type of reaction.currentUser- The currently logged in user.
-
onDeleteReactionResult
Unit onDeleteReactionResult(String cid, String messageId, String reactionType, User currentUser, Result<Message> result)
A method called after receiving the response from the delete reaction call.
- Parameters:
cid- The full channel id, i.e.messageId- The id of the message to which reaction belongs.reactionType- The type of reaction.currentUser- The currently logged in user.result- The API call result.
-
onDeleteReactionPrecondition
Result<Unit> onDeleteReactionPrecondition(User currentUser)
Runs precondition check for ChatClient.deleteReaction. The request will be run if the method returns Result.Success and won't be made if it returns Result.Failure.
- Parameters:
currentUser- The currently logged in user.
-
onSendReactionRequest
Unit onSendReactionRequest(String cid, Reaction reaction, Boolean enforceUnique, User currentUser)
A method called before making an API call to send the reaction.
- Parameters:
cid- The full channel id, i.e.reaction- The Reaction to send.enforceUnique- Flag to determine whether the reaction should replace other ones added by the current user.currentUser- The currently logged in user.
-
onSendReactionResult
Unit onSendReactionResult(String cid, Reaction reaction, Boolean enforceUnique, User currentUser, Result<Reaction> result)
A method called after receiving the response from the send reaction call.
- Parameters:
cid- The full channel id, i.e.reaction- The Reaction to send.enforceUnique- Flag to determine whether the reaction should replace other ones added by the current user.currentUser- The currently logged in user.result- The API call result.
-
onSendReactionPrecondition
Result<Unit> onSendReactionPrecondition(User currentUser, Reaction reaction)
Runs precondition check for ChatClient.sendReaction. The request will be run if the method returns Result.Success and won't be made if it returns Result.Failure.
- Parameters:
currentUser- The currently logged in user.reaction- The Reaction to send.
-
onGetRepliesPrecondition
Result<Unit> onGetRepliesPrecondition(String messageId, Integer limit)
Runs precondition check for ChatClient.getReplies. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.
-
onGetRepliesRequest
Unit onGetRepliesRequest(String messageId, Integer limit)
Runs side effect before the request is launched.
-
onGetRepliesResult
Unit onGetRepliesResult(Result<List<Message>> result, String messageId, Integer limit)
Runs this function on the result of the ChatClient.getReplies request.
-
onGetRepliesMorePrecondition
Result<Unit> onGetRepliesMorePrecondition(String messageId, String firstId, Integer limit)
Runs precondition check for ChatClient.getRepliesMore. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.
-
onGetRepliesMoreRequest
Unit onGetRepliesMoreRequest(String messageId, String firstId, Integer limit)
Runs side effect before the request is launched.
-
onGetRepliesMoreResult
Unit onGetRepliesMoreResult(Result<List<Message>> result, String messageId, String firstId, Integer limit)
Runs this function on the result of the ChatClient.getRepliesMore request.
-
onGiphySendResult
Unit onGiphySendResult(String cid, Result<Message> result)
A method called after receiving the response from the send Giphy call.
- Parameters:
cid- The full channel id, i.e.result- The API call result.
-
onShuffleGiphyResult
Unit onShuffleGiphyResult(String cid, Result<Message> result)
A method called after receiving the response from the shuffle Giphy call.
- Parameters:
cid- The full channel id, i.e.result- The API call result.
-
onMessageDeletePrecondition
Result<Unit> onMessageDeletePrecondition(String messageId)
Runs precondition check for ChatClient.deleteMessage. The request will be run if the method returns Result.Success and won't be made if it returns Result.Failure.
- Parameters:
messageId- The message id to be deleted.
-
onMessageDeleteRequest
Unit onMessageDeleteRequest(String messageId)
Method called when a request to delete a message in the API happens
-
onMessageDeleteResult
Unit onMessageDeleteResult(String originalMessageId, Result<Message> result)
Method called when a request for message deletion return. Use it to update database, update messages or to present an error to the user.
- Parameters:
result- the result of the API call.
-
onMessageSendResult
Unit onMessageSendResult(Result<Message> result, String channelType, String channelId, Message message)
Side effect to be invoked when the original request is completed with a response.
- Parameters:
result- Result response from the original request.channelType- The type of the channel in which message is sent.channelId- The id of the the channel in which message is sent.message- Message to be sent.
-
onMessageEditRequest
Unit onMessageEditRequest(Message message)
Method called when a request for message edition happens. Use it to update database, update messages in the SDK, update the UI when a message occurs...
- Parameters:
message- Message.
-
onMessageEditResult
Unit onMessageEditResult(Message originalMessage, Result<Message> result)
Method called when a request for message edition return. Use it to update database, update messages or to present an error to the user.
- Parameters:
result- the result of the API call.
-
onQueryChannelPrecondition
Result<Unit> onQueryChannelPrecondition(String channelType, String channelId, QueryChannelRequest request)
Run precondition for the request. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.
-
onQueryChannelRequest
Unit onQueryChannelRequest(String channelType, String channelId, QueryChannelRequest request)
Runs side effect before the request is launched.
- Parameters:
channelType- Type of the requested channel.channelId- Id of the requested channel.request- QueryChannelRequest which is going to be used for the request.
-
onQueryChannelResult
Unit onQueryChannelResult(Result<Channel> result, String channelType, String channelId, QueryChannelRequest request)
Runs this function on the result of the request.
-
onQueryChannelsPrecondition
Result<Unit> onQueryChannelsPrecondition(QueryChannelsRequest request)
Run precondition for the request. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.
- Parameters:
request- QueryChannelRequest which is going to be used for the request.
-
onQueryChannelsRequest
Unit onQueryChannelsRequest(QueryChannelsRequest request)
Runs side effect before the request is launched.
- Parameters:
request- QueryChannelsRequest which is going to be used for the request.
-
onQueryChannelsResult
Unit onQueryChannelsResult(Result<List<Channel>> result, QueryChannelsRequest request)
Runs this function on the Result of this QueryChannelsRequest.
-
onTypingEventPrecondition
Result<Unit> onTypingEventPrecondition(String eventType, String channelType, String channelId, Map<Object, Object> extraData, Date eventTime)
Runs this precondition before ChatClient.keystroke and ChatClient.stopTyping request is invoked.
- Parameters:
eventType- Type of the event that can be one of the EventType.channelType- Type of the channel in which the event is sent.channelId- Id of the channel in which the event is sent.extraData- Any extra data such as parent id.eventTime- Date object as the time of this event.
-
onTypingEventRequest
Unit onTypingEventRequest(String eventType, String channelType, String channelId, Map<Object, Object> extraData, Date eventTime)
Runs this side effect before ChatClient.keystroke and ChatClient.stopTyping request is invoked.
- Parameters:
eventType- Type of the event that can be one of the EventType.channelType- Type of the channel in which the event is sent.channelId- Id of the channel in which the event is sent.extraData- Any extra data such as parent id.eventTime- Date object as the time of this event.
-
onTypingEventResult
Unit onTypingEventResult(Result<ChatEvent> result, String eventType, String channelType, String channelId, Map<Object, Object> extraData, Date eventTime)
Runs this side effect after ChatClient.keystroke and ChatClient.stopTyping request is completed.
- Parameters:
result- Result of the original request.eventType- Type of the event that can be one of the EventType.channelType- Type of the channel in which the event is sent.channelId- Id of the channel in which the event is sent.extraData- Any extra data such as parent id.eventTime- Date object as the time of this event.
-
onHideChannelPrecondition
Result<Unit> onHideChannelPrecondition(String channelType, String channelId, Boolean clearHistory)
Run precondition for the request. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.
- Parameters:
channelType- Type of the requested channel.channelId- Id of the requested channel.clearHistory- Boolean, if you want to clear the history of this channel or not.
-
onHideChannelRequest
Unit onHideChannelRequest(String channelType, String channelId, Boolean clearHistory)
Runs side effect before the request is launched.
- Parameters:
channelType- Type of the requested channel.channelId- Id of the requested channel.clearHistory- Boolean, if you want to clear the history of this channel or not.
-
onHideChannelResult
Unit onHideChannelResult(Result<Unit> result, String channelType, String channelId, Boolean clearHistory)
Runs this function on the result of the request.
- Parameters:
result- Result of this request.channelType- Type of the requested channel.channelId- Id of the requested channel.clearHistory- Boolean, if you want to clear the history of this channel or not.
-
onMarkAllReadRequest
Unit onMarkAllReadRequest()
Register this side effect to run just before actual ChatClient.markAllRead request is launched.
-
onChannelMarkReadPrecondition
Result<Unit> onChannelMarkReadPrecondition(String channelType, String channelId)
Run precondition for the request. If it returns Result.Success then the request is run otherwise it returns Result.Failure and no request is made.
- Parameters:
channelType- Type of the channel to mark as read.channelId- Id of the channel to mark as read.
-
onCreateChannelRequest
Unit onCreateChannelRequest(String channelType, String channelId, List<String> memberIds, Map<String, Object> extraData, User currentUser)
A method called before making an API call to create a channel.
- Parameters:
channelType- The channel type.channelId- The channel id.memberIds- The list of members' ids.extraData- Map of key-value pairs that let you store extra datacurrentUser- The currently logged in user.
-
onCreateChannelResult
Unit onCreateChannelResult(String channelType, String channelId, List<String> memberIds, Result<Channel> result)
A method called after receiving the response from the create channel call.
- Parameters:
channelType- The channel type.channelId- The channel id.memberIds- The list of members' ids.result- The API call result.
-
onCreateChannelPrecondition
Result<Unit> onCreateChannelPrecondition(User currentUser, String channelId, List<String> memberIds)
Runs precondition check for ChatClient.createChannel. The request will be run if the method returns Result.Success and won't be made if it returns Result.Failure.
- Parameters:
currentUser- The currently logged in user.channelId- The channel id.memberIds- The list of members' ids.
-
onAttachmentSendRequest
Unit onAttachmentSendRequest(String channelType, String channelId, Message message)
Updates the SDK before the attachments are sent to backend. It can be used to update the database with the message whose attachments are going to be sent or to change the state of the messages that are presented to the end user.
- Parameters:
channelType- StringchannelId- Stringmessage- Message
-
onUserDisconnected
abstract Unit onUserDisconnected()
-
onGetMessageResult
Unit onGetMessageResult(String messageId, Result<Message> result)
Method called when the API call requesting a single new message has completed.
Use it to update the database accordingly.
- Parameters:
messageId- The ID of the message we are fetching.result- The result of the API call.
-
onFetchCurrentUserResult
Unit onFetchCurrentUserResult(Result<User> result)
Called when the current user is fetched from the backend.
-
getErrorHandler
abstract ErrorHandler getErrorHandler()
-
-
-
-