updateMedicalVocabulary method
- required LanguageCode languageCode,
- required String vocabularyName,
- String? vocabularyFileUri,
Updates a vocabulary with new values that you provide in a different text
file from the one you used to create the vocabulary. The
UpdateMedicalVocabulary
operation overwrites all of the
existing information with the values that you provide in the request.
May throw BadRequestException. May throw LimitExceededException. May throw InternalFailureException. May throw NotFoundException. May throw ConflictException.
Parameter languageCode
:
The language code of the language used for the entries in the updated
vocabulary. US English (en-US) is the only valid language code in Amazon
Transcribe Medical.
Parameter vocabularyName
:
The name of the vocabulary to update. The name is case sensitive. If you
try to update a vocabulary with the same name as a vocabulary you've
already made, you get a ConflictException
error.
Parameter vocabularyFileUri
:
The location in Amazon S3 of the text file that contains the you use for
your custom vocabulary. The URI must be in the same AWS Region as the
resource that you are calling. The following is the format for a URI:
https://s3.<aws-region>.amazonaws.com/<bucket-name>/<keyprefix>/<objectkey>
For example:
https://s3.us-east-1.amazonaws.com/AWSDOC-EXAMPLE-BUCKET/vocab.txt
For more information about Amazon S3 object names, see Object Keys in the Amazon S3 Developer Guide.
For more information about custom vocabularies in Amazon Transcribe Medical, see Medical Custom Vocabularies.
Implementation
Future<UpdateMedicalVocabularyResponse> updateMedicalVocabulary({
required LanguageCode languageCode,
required String vocabularyName,
String? vocabularyFileUri,
}) async {
ArgumentError.checkNotNull(languageCode, 'languageCode');
ArgumentError.checkNotNull(vocabularyName, 'vocabularyName');
_s.validateStringLength(
'vocabularyName',
vocabularyName,
1,
200,
isRequired: true,
);
_s.validateStringLength(
'vocabularyFileUri',
vocabularyFileUri,
1,
2000,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Transcribe.UpdateMedicalVocabulary'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'LanguageCode': languageCode.toValue(),
'VocabularyName': vocabularyName,
if (vocabularyFileUri != null) 'VocabularyFileUri': vocabularyFileUri,
},
);
return UpdateMedicalVocabularyResponse.fromJson(jsonResponse.body);
}