authsomeListUserRoles method

Future<UserRoleListResponse> authsomeListUserRoles({
  1. required String userId,
  2. required String token,
  3. String? appId,
})

List user roles GET /v1/users/{userId}/roles

Implementation

Future<UserRoleListResponse> authsomeListUserRoles({required String userId, required String token, String? appId}) async {
  final path = '/v1/users/$userId/roles';
  final queryParams = <String, String>{};
  if (appId != null) queryParams['app_id'] = appId.toString();
  final queryString = queryParams.isNotEmpty
      ? '?${queryParams.entries.map((e) => '${e.key}=${Uri.encodeComponent(e.value)}').join('&')}'
      : '';
  final res = await _request(
'GET',
    '$path$queryString',
    token: token,
  );
  return UserRoleListResponse.fromJson(Map<String, dynamic>.from(res as Map));
}