ThreadListController
class ThreadListController(query: QueryThreadsRequest, chatClient: ChatClient = ChatClient.instance(), scope: CoroutineScope = CoroutineScope(DispatcherProvider.IO.limitedParallelism(1)), queryThreadsAsState: (CoroutineScope) -> StateFlow<QueryThreadsState?> = { stateScope ->
chatClient.queryThreadsAsState(
request = query,
coroutineScope = stateScope,
)
}) : AutoCloseable
Controller responsible for managing the Threads list state. It serves as a central place for the state management and business logic related to the Threads list.
Parameters
query
The QueryThreadsRequest object containing the parameters for querying threads.
chatClient
The ChatClient instance for retrieving the Threads related data.
scope
The CoroutineScope the controller's work runs under, in a child scope that close cancels; the given scope itself is never cancelled. The default one outlives user sessions, so the list can follow the next user, and runs one task at a time.
queryThreadsAsState
Function that returns a StateFlow of QueryThreadsState, built in the given scope.
Constructors
Link copied to clipboard
constructor(query: QueryThreadsRequest, chatClient: ChatClient = ChatClient.instance(), scope: CoroutineScope = CoroutineScope(DispatcherProvider.IO.limitedParallelism(1)), queryThreadsAsState: (CoroutineScope) -> StateFlow<QueryThreadsState?> = { stateScope ->
chatClient.queryThreadsAsState(
request = query,
coroutineScope = stateScope,
)
})