Retrieve List of Groups
In other words, as a logged-in user, how do I retrieve the list of groups I’ve joined and groups that are available? In order to fetch the list of groups, you can use theGroupsRequest class. To use this class i.e to create an object of the GroupsRequest class, you need to use the GroupsRequestBuilder class. The GroupsRequestBuilder class allows you to set the parameters based on which the groups are to be fetched.
Fetching using this builder will return Group objects
Use GroupsRequestBuilder to fetch groups with filtering, searching, and pagination.
Set Limit
Sets the number of groups to fetch per request.- TypeScript
- JavaScript
Set Search Keyword
Filters groups by a search string.- TypeScript
- JavaScript
Joined Only
Whentrue, returns only groups the logged-in user has joined.
- TypeScript
- JavaScript
Set Tags
Filters groups by specified tags.- TypeScript
- JavaScript
With Tags
Whentrue, includes tag data in the returned group objects.
- TypeScript
- JavaScript
| Field | Getter | Return Type | Description |
|---|---|---|---|
| tags | getTags() | string[] | Tags associated with the group |
GroupsRequest class.
Once you have the object of the GroupsRequest class, you need to call the fetchNext() method. Calling this method will return a list of Group objects containing n number of groups where n is the limit set in the builder class.
The list of groups fetched will only have the public and password type groups. The private groups will only be available if the user is a member of the group.
- TypeScript
- JavaScript
build() to get the GroupsRequest object, then call fetchNext() to retrieve groups.
The list only includes public and password-protected groups. Private groups
appear only if the user is a member.
- TypeScript
- JavaScript
fetchNext() method returns an array of Group objects.
Retrieve Particular Group Details
UsegetGroup() to fetch a specific group’s details by GUID.
- TypeScript
- JavaScript
| Parameter | Description |
|---|---|
GUID | The GUID of the group to fetch |
Group object.
Get Online Group Member Count
UsegetOnlineGroupMemberCount() to get the number of online members in specified groups.
- TypeScript
- JavaScript
getOnlineGroupMemberCount() resolves with a { guid: count } object where each key is a group GUID and its value is the number of currently online members in that group.
Next Steps
Create Group
Create public, private, or password-protected groups
Retrieve Group Members
Fetch and filter members of a specific group