batchCreateCustomVocabularyItem method

Future<BatchCreateCustomVocabularyItemResponse> batchCreateCustomVocabularyItem({
  1. required String botId,
  2. required String botVersion,
  3. required List<NewCustomVocabularyItem> customVocabularyItemList,
  4. required String localeId,
})

Create a batch of custom vocabulary items for a given bot locale's custom vocabulary.

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

Parameter botId : The identifier of the bot associated with this custom vocabulary.

Parameter botVersion : The identifier of the version of the bot associated with this custom vocabulary.

Parameter customVocabularyItemList : A list of new custom vocabulary items. Each entry must contain a phrase and can optionally contain a displayAs and/or a weight.

Parameter localeId : The identifier of the language and locale where this custom vocabulary is used. The string must match one of the supported locales. For more information, see Supported Languages .

Implementation

Future<BatchCreateCustomVocabularyItemResponse>
    batchCreateCustomVocabularyItem({
  required String botId,
  required String botVersion,
  required List<NewCustomVocabularyItem> customVocabularyItemList,
  required String localeId,
}) async {
  final $payload = <String, dynamic>{
    'customVocabularyItemList': customVocabularyItemList,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/bots/${Uri.encodeComponent(botId)}/botversions/${Uri.encodeComponent(botVersion)}/botlocales/${Uri.encodeComponent(localeId)}/customvocabulary/DEFAULT/batchcreate',
    exceptionFnMap: _exceptionFns,
  );
  return BatchCreateCustomVocabularyItemResponse.fromJson(response);
}