createChatResponseConfiguration method

Future<CreateChatResponseConfigurationResponse> createChatResponseConfiguration({
  1. required String applicationId,
  2. required String displayName,
  3. required Map<ResponseConfigurationType, ResponseConfiguration> responseConfigurations,
  4. String? clientToken,
  5. List<Tag>? tags,
})

Creates a new chat response configuration for an Amazon Q Business application. This operation establishes a set of parameters that define how the system generates and formats responses to user queries in chat interactions.

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

Parameter applicationId : The unique identifier of the Amazon Q Business application for which to create the new chat response configuration.

Parameter displayName : A human-readable name for the new chat response configuration, making it easier to identify and manage among multiple configurations.

Parameter responseConfigurations : A collection of response configuration settings that define how Amazon Q Business will generate and format responses to user queries in chat interactions.

Parameter clientToken : A unique, case-sensitive identifier to ensure idempotency of the request. This helps prevent the same configuration from being created multiple times if retries occur.

Parameter tags : A list of key-value pairs to apply as tags to the new chat response configuration, enabling categorization and management of resources across Amazon Web Services services.

Implementation

Future<CreateChatResponseConfigurationResponse>
    createChatResponseConfiguration({
  required String applicationId,
  required String displayName,
  required Map<ResponseConfigurationType, ResponseConfiguration>
      responseConfigurations,
  String? clientToken,
  List<Tag>? tags,
}) async {
  final $payload = <String, dynamic>{
    'displayName': displayName,
    'responseConfigurations':
        responseConfigurations.map((k, e) => MapEntry(k.value, e)),
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/applications/${Uri.encodeComponent(applicationId)}/chatresponseconfigurations',
    exceptionFnMap: _exceptionFns,
  );
  return CreateChatResponseConfigurationResponse.fromJson(response);
}