createWatchlist method

Future<CreateWatchlistResponse> createWatchlist({
  1. required String domainId,
  2. required String name,
  3. String? clientToken,
  4. String? description,
})

Creates a watchlist that fraudsters can be a part of.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter domainId : The identifier of the domain that contains the watchlist.

Parameter name : The name of the watchlist.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs.

Parameter description : A brief description of this watchlist.

Implementation

Future<CreateWatchlistResponse> createWatchlist({
  required String domainId,
  required String name,
  String? clientToken,
  String? description,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'VoiceID.CreateWatchlist'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DomainId': domainId,
      'Name': name,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'Description': description,
    },
  );

  return CreateWatchlistResponse.fromJson(jsonResponse.body);
}