updateTaskTemplate method

Future<UpdateTaskTemplateResponse> updateTaskTemplate({
  1. required String instanceId,
  2. required String taskTemplateId,
  3. TaskTemplateConstraints? constraints,
  4. String? contactFlowId,
  5. TaskTemplateDefaults? defaults,
  6. String? description,
  7. List<TaskTemplateField>? fields,
  8. String? name,
  9. String? selfAssignFlowId,
  10. TaskTemplateStatus? status,
})

Updates details about a specific task template in the specified Connect Customer instance. This operation does not support partial updates. Instead it does a full update of template content.

May throw InternalServiceException. May throw InvalidParameterException. May throw PropertyValidationException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. 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 taskTemplateId : A unique identifier for the task template.

Parameter constraints : Constraints that are applicable to the fields listed. Although this parameter is marked as optional in the API model, the service requires it when calling CreateTaskTemplate or UpdateTaskTemplate. The RequiredFields array must contain at least one element, and the field of type NAME must be included in RequiredFields.

Parameter contactFlowId : The identifier of the flow that runs by default when a task is created by referencing this template.

Although this parameter is marked as optional, the request must contain either a ContactFlowId or a field of type QUICK_CONNECT.

Parameter defaults : The default values for fields when a task is created by referencing this template.

Parameter description : The description of the task template.

Parameter fields : Fields that are part of the template.

The request must contain exactly one field of type NAME. This field must also be listed in the RequiredFields array within the Constraints parameter.

Parameter name : The name of the task template.

Parameter selfAssignFlowId : The ContactFlowId for the flow that will be run if this template is used to create a self-assigned task.

Parameter status : Marks a template as ACTIVE or INACTIVE for a task to refer to it. Tasks can only be created from ACTIVE templates. If a template is marked as INACTIVE, then a task that refers to this template cannot be created.

Although this parameter is marked as optional, the service requires it when calling UpdateTaskTemplate.

Implementation

Future<UpdateTaskTemplateResponse> updateTaskTemplate({
  required String instanceId,
  required String taskTemplateId,
  TaskTemplateConstraints? constraints,
  String? contactFlowId,
  TaskTemplateDefaults? defaults,
  String? description,
  List<TaskTemplateField>? fields,
  String? name,
  String? selfAssignFlowId,
  TaskTemplateStatus? status,
}) async {
  final $payload = <String, dynamic>{
    if (constraints != null) 'Constraints': constraints,
    if (contactFlowId != null) 'ContactFlowId': contactFlowId,
    if (defaults != null) 'Defaults': defaults,
    if (description != null) 'Description': description,
    if (fields != null) 'Fields': fields,
    if (name != null) 'Name': name,
    if (selfAssignFlowId != null) 'SelfAssignFlowId': selfAssignFlowId,
    if (status != null) 'Status': status.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/instance/${Uri.encodeComponent(instanceId)}/task/template/${Uri.encodeComponent(taskTemplateId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateTaskTemplateResponse.fromJson(response);
}