ChannelListViewModel

constructor(filter: FilterObject? = null, sort: QuerySorter<Channel> = DEFAULT_SORT, limit: Int = DEFAULT_CHANNEL_LIMIT, messageLimit: Int? = null, memberLimit: Int? = null, isDraftMessagesEnabled: Boolean, chatEventHandlerFactory: ChatEventHandlerFactory = ChatEventHandlerFactory(), chatClient: ChatClient = ChatClient.instance(), globalState: Flow<GlobalState> = chatClient.globalStateFlow)

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

Parameters

filter

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

sort

Defines the ordering of the channels.


constructor(predefinedFilterName: String, filterValues: Map<String, Any>? = null, sortValues: Map<String, Any>? = null, limit: Int = DEFAULT_CHANNEL_LIMIT, messageLimit: Int? = null, memberLimit: Int? = null, isDraftMessagesEnabled: Boolean, chatEventHandlerFactory: ChatEventHandlerFactory = ChatEventHandlerFactory(), chatClient: ChatClient = ChatClient.instance(), 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 does not affect a view model created this way.

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.