Retrieve a list of channels
You can retrieve a list of OpenChannel
objects using the next()
method of an OpenChannelListQuery
instance.
On the other hand, a list of GroupChannel
objects can be retrieved through GroupChannelCollection
and its loadMore()
method. First, create a GroupChannelListQuery
instance. The GroupChannelListQuery
instance returns both public and private group channels that the current user has joined. To retrieve a list of certain group channels such as public group channels or Supergroup channels, use the the list query's filters as described at the bottom of this page.
Note: You can also search for specific open channels and group channels with keywords and filters.
Open channels
Create an OpenChannelListQuery
instance to retrieve a list of open channels matching the specifications set by OpenChannelListQueryParams
. After a list of open channels is successfully retrieved, you can access the data of each open channel from the result list through the channels
parameter of the callback handler.
Group channels
A group channel list view can be drawn with a GroupChannelCollection
instance. First, create a GroupChannelListQuery
instance through the createMyGroupChannelListQuery()
method and its query setters. This determines which channel to include in the channel list and how to list channels in order.
To retrieve group channels in the collection, call hasMore
first to check whether there are more channels to load for the collection. If so, call loadMore()
.
To learn more about how the collection works, see Group channel collection under Local caching.
Filter group channels using GroupChannelListQuery
When creating a GroupChannelCollection
instance, you need to set params within GroupChannelListQuery
first. The params in GroupChannelListQuery
works much like other search options, retrieving a list of group channels matching the specifications set by GroupChannelListQueryParams
. For example, use myMemberStateFilter
when searching for only the group channels that the current user belongs to, and publicChannelFilter
when searching for all public group channels regardless of the current user's membership status. To retrieve a list of Supergroup channels, you can set the superChannelFilter
property to SuperChannelFilter.SUPER_CHANNEL_ONLY
.
Once the params is set, you can use the query instance for GroupChannelCollectionCreateParams
in createGroupChannelCollection()
.