Chat Android SDK  5.1.0
com.twilio.chat.Channels Class Reference

Provides access to channels collection, allows to create new channels. More...

Classes

class  ChannelBuilder
 Helper to create new channel with provided data. More...
 
enum  SortCriterion
 Sorting criterion for channel query operation. More...
 
enum  SortOrder
 Sorting order for channel query operation. More...
 

Public Member Functions

Actions
void createChannel (String friendlyName,@NonNull ChannelType type, CallbackListener< Channel > listener)
 Create a channel with friendly name and type. More...
 
Builders
ChannelBuilder channelBuilder ()
 Get ChannelBuilder to create channel with options. More...
 
Getters
void getChannel (String channelSidOrUniqueName, CallbackListener< Channel > listener)
 Retrieves a channel with the specified SID or unique name. More...
 
void getPublicChannelsList (CallbackListener< Paginator< ChannelDescriptor >> listener)
 Request list of public channels user have not joined. More...
 
void getUserChannelsList (CallbackListener< Paginator< ChannelDescriptor >> listener)
 Request list of channels user have joined. More...
 
native List< ChannelgetSubscribedChannels ()
 Request list of user's joined channels. More...
 
native List< ChannelgetSubscribedChannelsSortedBy (SortCriterion criterion, SortOrder order)
 Request list of user's joined channels sorted in particular order. More...
 
native List< MembergetMembersByIdentity (String identity)
 Get list of all Channel members with a given identity. More...
 

Detailed Description

Provides access to channels collection, allows to create new channels.

Member Function Documentation

ChannelBuilder com.twilio.chat.Channels.channelBuilder ( )

Get ChannelBuilder to create channel with options.

A pattern to build channel with options is:

channels.channelBuilder()
.withFriendlyName("Channel")
.withType(Channel.ChannelType.PRIVATE)
.build(listener);
Returns
A ChannelBuilder used to create channel with options.
void com.twilio.chat.Channels.createChannel ( String  friendlyName,
@NonNull ChannelType  type,
CallbackListener< Channel listener 
)

Create a channel with friendly name and type.

This operation creates a new channel entity on the backend.

Parameters
friendlyNameFriendly name of the new channel.
typeChannel type
listenerListener that receives the status of create channel action.
void com.twilio.chat.Channels.getChannel ( String  channelSidOrUniqueName,
CallbackListener< Channel listener 
)

Retrieves a channel with the specified SID or unique name.

Parameters
channelSidOrUniqueNameIdentifier for the channel.
listenerListener to receive the channel.
native List<Member> com.twilio.chat.Channels.getMembersByIdentity ( String  identity)

Get list of all Channel members with a given identity.

The effect of this function is to find and return all Member instances across multiple channels with the given identity.

Parameters
identityMember identity to look up.
Returns
List of Members across Channels with given identity.
void com.twilio.chat.Channels.getPublicChannelsList ( CallbackListener< Paginator< ChannelDescriptor >>  listener)

Request list of public channels user have not joined.

This command will return a list of ChannelDescriptors. These are the channels that are public and are not joined by current user. To get channels already joined by current user see getUserChannelsList.

Returned list is wrapped in a pagination interface.

Parameters
listenerListener to receive a paginator with first page of results. Use paginator interface to request subsequent pages.
native List<Channel> com.twilio.chat.Channels.getSubscribedChannels ( )

Request list of user's joined channels.

Returns
A list of Channels that are subscribed to.
native List<Channel> com.twilio.chat.Channels.getSubscribedChannelsSortedBy ( SortCriterion  criterion,
SortOrder  order 
)

Request list of user's joined channels sorted in particular order.

Parameters
criterionField to sort on.
orderSorting order.
Returns
A list of Channels that are subscribed to.
void com.twilio.chat.Channels.getUserChannelsList ( CallbackListener< Paginator< ChannelDescriptor >>  listener)

Request list of channels user have joined.

This command will return a list of ChannelDescriptors. These are the channels that are joined by current user, regardless of if they are public or private. To get public channels not yet joined by current user see getPublicChannelsList.

Returned list is wrapped in a pagination interface.

Parameters
listenerListener to receive a paginator with first page of results. Use paginator interface to request subsequent pages.