Search group channels
Prerequisites
The managed hosting service is enabled by default.
Query group information
Call GroupChannel.getGroupsInfo() to query group information. A single call supports up to 20 groups.
Dart
await GroupChannel.getGroupsInfo(
['groupId1', 'groupId2', 'groupId3'],
(groups, error) {
if (error == null) {
print('Group info: $groups');
}
},
);
Get joined groups by IDs
Dart
await GroupChannel.getJoinedGroups(
['groupId1', 'groupId2'],
(groups, error) {
if (error == null) {
print('Joined groups: $groups');
}
},
);
Get joined groups by role (paginated)
Use GroupChannel.createJoinedGroupsByRoleQuery() to get joined groups filtered by the current user's role, with pagination.
| Enum | Role |
|---|---|
undef | All roles |
normal | Channel member |
manager | Channel admin |
owner | Channel owner |
Dart
final query = GroupChannel.createJoinedGroupsByRoleQuery(
JoinedGroupsByRoleQueryParams(
role: GroupMemberRole.undef,
pageSize: 20,
),
);
await query.loadNextPage((result, error) {
if (error == null) {
print('Joined groups: ${result?.data}');
print('Total matched: ${result?.totalCount}');
}
});
Search joined groups by name
Dart
await GroupChannel.searchJoinedGroups(
SearchJoinedGroupsParams(groupName: 'myGroup', option: PagingQueryOption(pageSize: 20)),
(PagingQueryResult<GroupInfo>? result, NCError? error) {
if (error == null) {
print('Found groups: ${result?.data}');
}
},
);