-
public final class ChatClientExtensions
-
-
Field Summary
Fields Modifier and Type Field Description private final static StateRegistrystateprivate final static GlobalStateglobalState
-
Method Summary
Modifier and Type Method Description final StateRegistrygetState()final GlobalStategetGlobalState()final static StateFlow<QueryChannelsState>queryChannelsAsState(ChatClient $self, QueryChannelsRequest request, CoroutineScope coroutineScope)Performs ChatClient.queryChannels under the hood and returns QueryChannelsState associated with the query. final static StateFlow<QueryChannelsState>queryChannelsAsState(ChatClient $self, QueryChannelsRequest request)Performs ChatClient.queryChannels under the hood and returns QueryChannelsState associated with the query. final static StateFlow<ChannelState>watchChannelAsState(ChatClient $self, String cid, Integer messageLimit, CoroutineScope coroutineScope)Performs ChatClient.queryChannel with watch = true under the hood and returns ChannelState associated with the query. final static StateFlow<ChannelState>watchChannelAsState(ChatClient $self, String cid, Integer messageLimit)Performs ChatClient.queryChannel with watch = true under the hood and returns ChannelState associated with the query. final static ThreadStategetRepliesAsState(ChatClient $self, String messageId, Integer messageLimit, CoroutineScope coroutineScope)Same class of ChatClient. final static ThreadStategetRepliesAsState(ChatClient $self, String messageId, Integer messageLimit)Same class of ChatClient. final static Call<Unit>setMessageForReply(ChatClient $self, String cid, Message message)Set the reply state for the channel. final static Call<Unit>downloadAttachment(ChatClient $self, Context context, Attachment attachment)Downloads the selected attachment to the "Download" folder in the public external storage directory. final static Call<Channel>loadOlderMessages(ChatClient $self, String cid, Integer messageLimit)Loads older messages for the channel. final static Call<Boolean>cancelEphemeralMessage(ChatClient $self, Message message)Cancels the message of "ephemeral" type. final static Call<Message>loadMessageById(ChatClient $self, String cid, String messageId, Integer olderMessagesOffset, Integer newerMessagesOffset)Loads message for a given message id and channel id. -
-
Method Detail
-
getState
final StateRegistry getState()
-
getGlobalState
final GlobalState getGlobalState()
-
queryChannelsAsState
final static StateFlow<QueryChannelsState> queryChannelsAsState(ChatClient $self, QueryChannelsRequest request, CoroutineScope coroutineScope)
Performs ChatClient.queryChannels under the hood and returns QueryChannelsState associated with the query. The QueryChannelsState cannot be created before connecting the user therefore, the method returns a StateFlow that emits a null when the user has not been connected yet and the new value every time the user changes.
- Parameters:
request- The request's parameters combined into QueryChannelsRequest class.coroutineScope- The CoroutineScope used for executing the request.
-
queryChannelsAsState
final static StateFlow<QueryChannelsState> queryChannelsAsState(ChatClient $self, QueryChannelsRequest request)
Performs ChatClient.queryChannels under the hood and returns QueryChannelsState associated with the query. The QueryChannelsState cannot be created before connecting the user therefore, the method returns a StateFlow that emits a null when the user has not been connected yet and the new value every time the user changes.
- Parameters:
request- The request's parameters combined into QueryChannelsRequest class.
-
watchChannelAsState
final static StateFlow<ChannelState> watchChannelAsState(ChatClient $self, String cid, Integer messageLimit, CoroutineScope coroutineScope)
Performs ChatClient.queryChannel with watch = true under the hood and returns ChannelState associated with the query. The ChannelState cannot be created before connecting the user therefore, the method returns a StateFlow that emits a null when the user has not been connected yet and the new value every time the user changes.
- Parameters:
cid- The full channel id, i.e.messageLimit- The number of messages that will be initially loaded.coroutineScope- The CoroutineScope used for executing the request.
-
watchChannelAsState
final static StateFlow<ChannelState> watchChannelAsState(ChatClient $self, String cid, Integer messageLimit)
Performs ChatClient.queryChannel with watch = true under the hood and returns ChannelState associated with the query. The ChannelState cannot be created before connecting the user therefore, the method returns a StateFlow that emits a null when the user has not been connected yet and the new value every time the user changes.
- Parameters:
cid- The full channel id, i.e.messageLimit- The number of messages that will be initially loaded.
-
getRepliesAsState
final static ThreadState getRepliesAsState(ChatClient $self, String messageId, Integer messageLimit, CoroutineScope coroutineScope)
Same class of ChatClient.getReplies, but provides the result as ThreadState
- Parameters:
messageId- The ID of the original message the replies were made to.messageLimit- The number of messages that will be initially loaded.coroutineScope- The CoroutineScope used for executing the request.
-
getRepliesAsState
final static ThreadState getRepliesAsState(ChatClient $self, String messageId, Integer messageLimit)
Same class of ChatClient.getReplies, but provides the result as ThreadState
- Parameters:
messageId- The ID of the original message the replies were made to.messageLimit- The number of messages that will be initially loaded.
-
setMessageForReply
final static Call<Unit> setMessageForReply(ChatClient $self, String cid, Message message)
Set the reply state for the channel.
- Parameters:
cid- CID of the channel where reply state is being set.message- The message we want reply to.
-
downloadAttachment
final static Call<Unit> downloadAttachment(ChatClient $self, Context context, Attachment attachment)
Downloads the selected attachment to the "Download" folder in the public external storage directory.
- Parameters:
attachment- The attachment to download.
-
loadOlderMessages
final static Call<Channel> loadOlderMessages(ChatClient $self, String cid, Integer messageLimit)
Loads older messages for the channel.
- Parameters:
cid- The full channel id i.e.messageLimit- How many new messages to load.
-
cancelEphemeralMessage
final static Call<Boolean> cancelEphemeralMessage(ChatClient $self, Message message)
Cancels the message of "ephemeral" type. Removes the message from local storage and state.
- Parameters:
message- Theephemeralmessage to cancel.
-
loadMessageById
final static Call<Message> loadMessageById(ChatClient $self, String cid, String messageId, Integer olderMessagesOffset, Integer newerMessagesOffset)
Loads message for a given message id and channel id.
- Parameters:
cid- The full channel id i.messageId- The id of the message.olderMessagesOffset- How many new messages to load before the requested message.newerMessagesOffset- How many new messages to load after the requested message.
-
-
-
-