ChannelListViewModel

constructor(chatClient: ChatClient, initialSort: QuerySorter<Channel> = QuerySortByField.descByName("last_updated"), initialFilters: FilterObject? = null, channelLimit: Int = DEFAULT_CHANNEL_LIMIT, memberLimit: Int? = null, messageLimit: Int? = null, chatEventHandlerFactory: ChatEventHandlerFactory = ChatEventHandlerFactory(chatClient.clientState), searchDebounceMs: Long = SEARCH_DEBOUNCE_MS, draftMessagesEnabled: Boolean = true, messageSearchSort: QuerySorter<Message>? = null, globalState: Flow<GlobalState> = chatClient.globalStateFlow)

Creates a view model that queries channels by an explicit filter and sort.

Parameters

initialSort

The initial sort used for Channels. Can be changed at runtime via setQuerySort.

initialFilters

The data filter. Can be changed at runtime via setFilters. When null, a default filter scoped to messaging channels the current user is a member of is used.


constructor(chatClient: ChatClient, predefinedFilterName: String, filterValues: Map<String, Any>? = null, sortValues: Map<String, Any>? = null, channelLimit: Int = DEFAULT_CHANNEL_LIMIT, memberLimit: Int? = null, messageLimit: Int? = null, chatEventHandlerFactory: ChatEventHandlerFactory = ChatEventHandlerFactory(chatClient.clientState), searchDebounceMs: Long = SEARCH_DEBOUNCE_MS, draftMessagesEnabled: Boolean = true, messageSearchSort: QuerySorter<Message>? = null, globalState: Flow<GlobalState> = chatClient.globalStateFlow)

Creates a view model that queries channels using a predefined filter resolved by the server.

The filter and sort are identified by predefinedFilterName and resolved server-side; filterValues and sortValues interpolate into the predefined template. setFilters and setQuerySort do not affect a view model created this way. Channel search still narrows the displayed list to the search predicate.

Parameters

predefinedFilterName

The name of the predefined filter registered on the backend.

filterValues

Optional values interpolated into the predefined filter template.

sortValues

Optional values interpolated into the predefined sort template.