createPrompt method

Future<CreatePromptResponse> createPrompt({
  1. required String instanceId,
  2. required String name,
  3. required String s3Uri,
  4. String? description,
  5. Map<String, String>? tags,
})

Creates a prompt. For more information about prompts, such as supported file types and maximum length, see Create prompts in the Connect Customer Administrator Guide.

May throw DuplicateResourceException. May throw InternalServiceException. May throw InvalidParameterException. May throw InvalidRequestException. May throw LimitExceededException. May throw ThrottlingException.

Parameter instanceId : The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

Parameter name : The name of the prompt.

Parameter s3Uri : The URI for the S3 bucket where the prompt is stored. You can provide S3 pre-signed URLs returned by the GetPromptFile API instead of providing S3 URIs.

Parameter description : The description of the prompt.

Parameter tags : The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.

Implementation

Future<CreatePromptResponse> createPrompt({
  required String instanceId,
  required String name,
  required String s3Uri,
  String? description,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'Name': name,
    'S3Uri': s3Uri,
    if (description != null) 'Description': description,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/prompts/${Uri.encodeComponent(instanceId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreatePromptResponse.fromJson(response);
}