getUserGroups method
Returns the groups to which a user belongs.
Permissions required: Browse users and groups global permission.
Implementation
Future<List<GroupName>> getUserGroups(
{required String accountId, String? username, String? key}) async {
return (await _client.send(
'get',
'rest/api/3/user/groups',
queryParameters: {
'accountId': accountId,
if (username != null) 'username': username,
if (key != null) 'key': key,
},
) as List<Object?>)
.map((i) => GroupName.fromJson(i as Map<String, Object?>? ?? const {}))
.toList();
}