updateVocabularyFilter method

Future<UpdateVocabularyFilterResponse> updateVocabularyFilter({
  1. required String vocabularyFilterName,
  2. String? vocabularyFilterFileUri,
  3. List<String>? words,
})

Updates a vocabulary filter with a new list of filtered words.

May throw BadRequestException. May throw LimitExceededException. May throw InternalFailureException. May throw NotFoundException.

Parameter vocabularyFilterName : The name of the vocabulary filter to update. If you try to update a vocabulary filter with the same name as another vocabulary filter, you get a ConflictException error.

Parameter vocabularyFilterFileUri : The Amazon S3 location of a text file used as input to create the vocabulary filter. Only use characters from the character set defined for custom vocabularies. For a list of character sets, see Character Sets for Custom Vocabularies.

The specified file must be less than 50 KB of UTF-8 characters.

If you provide the location of a list of words in the VocabularyFilterFileUri parameter, you can't use the Words parameter.

Parameter words : The words to use in the vocabulary filter. Only use characters from the character set defined for custom vocabularies. For a list of character sets, see Character Sets for Custom Vocabularies.

If you provide a list of words in the Words parameter, you can't use the VocabularyFilterFileUri parameter.

Implementation

Future<UpdateVocabularyFilterResponse> updateVocabularyFilter({
  required String vocabularyFilterName,
  String? vocabularyFilterFileUri,
  List<String>? words,
}) async {
  ArgumentError.checkNotNull(vocabularyFilterName, 'vocabularyFilterName');
  _s.validateStringLength(
    'vocabularyFilterName',
    vocabularyFilterName,
    1,
    200,
    isRequired: true,
  );
  _s.validateStringLength(
    'vocabularyFilterFileUri',
    vocabularyFilterFileUri,
    1,
    2000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Transcribe.UpdateVocabularyFilter'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'VocabularyFilterName': vocabularyFilterName,
      if (vocabularyFilterFileUri != null)
        'VocabularyFilterFileUri': vocabularyFilterFileUri,
      if (words != null) 'Words': words,
    },
  );

  return UpdateVocabularyFilterResponse.fromJson(jsonResponse.body);
}