listFaces method

Future<ListFacesResponse> listFaces({
  1. required String collectionId,
  2. List<String>? faceIds,
  3. int? maxResults,
  4. String? nextToken,
  5. String? userId,
})

Returns metadata for faces in the specified collection. This metadata includes information such as the bounding box coordinates, the confidence (that the bounding box contains a face), and face ID. For an example, see Listing Faces in a Collection in the Amazon Rekognition Developer Guide.

This operation requires permissions to perform the rekognition:ListFaces action.

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

Parameter collectionId : ID of the collection from which to list the faces.

Parameter faceIds : An array of face IDs to filter results with when listing faces in a collection.

Parameter maxResults : Maximum number of faces to return.

Parameter nextToken : If the previous response was incomplete (because there is more data to retrieve), Amazon Rekognition returns a pagination token in the response. You can use this pagination token to retrieve the next set of faces.

Parameter userId : An array of user IDs to filter results with when listing faces in a collection.

Implementation

Future<ListFacesResponse> listFaces({
  required String collectionId,
  List<String>? faceIds,
  int? maxResults,
  String? nextToken,
  String? userId,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    4096,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RekognitionService.ListFaces'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CollectionId': collectionId,
      if (faceIds != null) 'FaceIds': faceIds,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (userId != null) 'UserId': userId,
    },
  );

  return ListFacesResponse.fromJson(jsonResponse.body);
}