Retrieve the List of Group Members
In order to fetch the list of groups members for a group, you can use theGroupMembersRequest class. To use this class i.e to create an object of the GroupMembersRequest class, you need to use the GroupMembersRequestBuilder class. The GroupMembersRequestBuilder class allows you to set the parameters based on which the groups are to be fetched.
The GroupMembersRequestBuilder class allows you to set the below parameters:
The GUID of the group for which the members are to be fetched must be specified in the constructor of the GroupMembersRequestBuilder class.
Set Limit
This method sets the limit i.e. the number of members that should be fetched in a single iteration.- Java
- Kotlin
Set Search Keyword
With offline support on, this filter is answered by the server only; the cached page is empty.
- Java
- Kotlin
Set Scopes
This method allows you to fetch group members based on the specified scopes.- Java
- Kotlin
Set Status
With offline support on, this filter is answered by the server only; the cached page is empty.
UsersRequest.USER_STATUS_ONLINE or UsersRequest.USER_STATUS_OFFLINE; leave it unset to fetch all members.
- Java
- Kotlin
build() method to get the object of the GroupMembersRequest class.
Once you have the object of the GroupMembersRequest class, you need to call the fetchNext() method. Calling this method will return a list of GroupMember objects containing N number of members depending on the limit set.
- Java
- Kotlin
Offline Behaviour
With offline support enabled,GroupMembersRequest.fetchNext() on a GroupMemberFetchListener first delivers onCachedGroupMembers from the device (empty when nothing was recorded), then onServerGroupMembers with the live page to reconcile by uid. Offline, the read ends with onError with code ERROR_INTERNET_UNAVAILABLE after the cached page. A request that uses a server-only filter records nothing, so its cached page is always empty. See Show Cached Data.