listUsers method

Future<ListUsersResponse> listUsers({
  1. required String collectionId,
  2. int? maxResults,
  3. String? nextToken,
})

Returns metadata of the User such as UserID in the specified collection. Anonymous User (to reserve faces without any identity) is not returned as part of this request. The results are sorted by system generated primary key ID. If the response is truncated, NextToken is returned in the response that can be used in the subsequent request to retrieve the next set of identities.

May throw AccessDeniedException. May throw InternalServerError. May throw InvalidPaginationTokenException. May throw InvalidParameterException. May throw ProvisionedThroughputExceededException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter collectionId : The ID of an existing collection.

Parameter maxResults : Maximum number of UsersID to return.

Parameter nextToken : Pagingation token to receive the next set of UsersID.

Implementation

Future<ListUsersResponse> listUsers({
  required String collectionId,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    500,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RekognitionService.ListUsers'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CollectionId': collectionId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListUsersResponse.fromJson(jsonResponse.body);
}