listUsers method

Future<ListUsersResponse> listUsers({
  1. required String accountId,
  2. int? maxResults,
  3. String? nextToken,
  4. String? userEmail,
  5. UserType? userType,
})

Lists the users that belong to the specified Amazon Chime account. You can specify an email address to list only the user that the email address belongs to.

May throw UnauthorizedClientException. May throw NotFoundException. May throw ForbiddenException. May throw BadRequestException. May throw ThrottledClientException. May throw ServiceUnavailableException. May throw ServiceFailureException.

Parameter accountId : The Amazon Chime account ID.

Parameter maxResults : The maximum number of results to return in a single call. Defaults to 100.

Parameter nextToken : The token to use to retrieve the next page of results.

Parameter userEmail : Optional. The user email address used to filter results. Maximum 1.

Parameter userType : The user type.

Implementation

Future<ListUsersResponse> listUsers({
  required String accountId,
  int? maxResults,
  String? nextToken,
  String? userEmail,
  UserType? userType,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    200,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'max-results': [maxResults.toString()],
    if (nextToken != null) 'next-token': [nextToken],
    if (userEmail != null) 'user-email': [userEmail],
    if (userType != null) 'user-type': [userType.toValue()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/accounts/${Uri.encodeComponent(accountId)}/users',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListUsersResponse.fromJson(response);
}