updateExperimentDefinition method

Future<ExperimentDefinition> updateExperimentDefinition({
  1. required String applicationIdentifier,
  2. required String experimentDefinitionIdentifier,
  3. String? audienceDescription,
  4. String? audienceRule,
  5. TreatmentInput? control,
  6. String? hypothesis,
  7. String? launchCriteria,
  8. List<TreatmentInput>? treatments,
})

Updates an experiment definition. You can update treatments, the control, audience rules, and other properties. You cannot update an experiment definition while an experiment run is active.

May throw BadRequestException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException.

Parameter applicationIdentifier : The application ID or name.

Parameter experimentDefinitionIdentifier : The experiment definition ID or name.

Parameter audienceDescription : An updated audience description.

Parameter audienceRule : An updated audience rule.

Parameter control : An updated control treatment.

Parameter hypothesis : An updated hypothesis.

Parameter launchCriteria : Updated launch criteria.

Parameter treatments : The updated list of treatments to evaluate during the experiment. Each treatment defines a distinct variation compared to the control.

Implementation

Future<ExperimentDefinition> updateExperimentDefinition({
  required String applicationIdentifier,
  required String experimentDefinitionIdentifier,
  String? audienceDescription,
  String? audienceRule,
  TreatmentInput? control,
  String? hypothesis,
  String? launchCriteria,
  List<TreatmentInput>? treatments,
}) async {
  final $payload = <String, dynamic>{
    if (audienceDescription != null)
      'AudienceDescription': audienceDescription,
    if (audienceRule != null) 'AudienceRule': audienceRule,
    if (control != null) 'Control': control,
    if (hypothesis != null) 'Hypothesis': hypothesis,
    if (launchCriteria != null) 'LaunchCriteria': launchCriteria,
    if (treatments != null) 'Treatments': treatments,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/applications/${Uri.encodeComponent(applicationIdentifier)}/experimentdefinitions/${Uri.encodeComponent(experimentDefinitionIdentifier)}',
    exceptionFnMap: _exceptionFns,
  );
  return ExperimentDefinition.fromJson(response);
}