disassociateFaces method

Future<DisassociateFacesResponse> disassociateFaces({
  1. required String collectionId,
  2. required List<String> faceIds,
  3. required String userId,
  4. String? clientRequestToken,
})

Removes the association between a Face supplied in an array of FaceIds and the User. If the User is not present already, then a ResourceNotFound exception is thrown. If successful, an array of faces that are disassociated from the User is returned. If a given face is already disassociated from the given UserID, it will be ignored and not be returned in the response. If a given face is already associated with a different User or not found in the collection it will be returned as part of UnsuccessfulDisassociations. You can remove 1 - 100 face IDs from a user at one time.

May throw AccessDeniedException. May throw ConflictException. May throw IdempotentParameterMismatchException. May throw InternalServerError. May throw InvalidParameterException. May throw ProvisionedThroughputExceededException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter collectionId : The ID of an existing collection containing the UserID.

Parameter faceIds : An array of face IDs to disassociate from the UserID.

Parameter userId : ID for the existing UserID.

Parameter clientRequestToken : Idempotent token used to identify the request to DisassociateFaces. If you use the same token with multiple DisassociateFaces requests, the same response is returned. Use ClientRequestToken to prevent the same request from being processed more than once.

Implementation

Future<DisassociateFacesResponse> disassociateFaces({
  required String collectionId,
  required List<String> faceIds,
  required String userId,
  String? clientRequestToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RekognitionService.DisassociateFaces'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CollectionId': collectionId,
      'FaceIds': faceIds,
      'UserId': userId,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
    },
  );

  return DisassociateFacesResponse.fromJson(jsonResponse.body);
}