3535public interface AsyncProjectService {
3636
3737 /**
38- * Submits a project update request and returns a reactive {@link Mono< ProjectUpdateResponse >}
38+ * Submits a project update request and returns a reactive {@link Mono<ProjectUpdateResponse>}
3939 * object immediately.
4040 * <p>
4141 * The method implementation must be non-blocking.
@@ -65,7 +65,7 @@ public interface AsyncProjectService {
6565
6666 /**
6767 * Submits an experiment update request and returns a reactive
68- * {@link Mono< ExperimentUpdateResponse >} object immediately.
68+ * {@link Mono<ExperimentUpdateResponse>} object immediately.
6969 * <p>
7070 * The method is non-blocking.
7171 * <p>
@@ -92,7 +92,7 @@ public interface AsyncProjectService {
9292 Mono <ExperimentUpdateResponse > update (ExperimentUpdateRequest request );
9393
9494 /**
95- * Submits a project creation request and returns a {@link Mono< ProjectCreationResponse >}
95+ * Submits a project creation request and returns a {@link Mono<ProjectCreationResponse>}
9696 * immediately.
9797 * <p>
9898 * This implementation must be non-blocking.
@@ -244,8 +244,9 @@ sealed interface ProjectUpdateResponseBody permits FundingInformation, ProjectCo
244244
245245 }
246246
247- sealed interface ExperimentUpdateRequestBody permits ConfoundingVariables , ExperimentDescription ,
248- ExperimentalGroups , ExperimentalVariables {
247+ sealed interface ExperimentUpdateRequestBody permits ConfoundingVariableAdditions ,
248+ ConfoundingVariableDeletions , ConfoundingVariableUpdates , ExperimentDescription ,
249+ ExperimentalGroups , ExperimentalVariableAdditions , ExperimentalVariableDeletions {
249250
250251 }
251252
@@ -331,11 +332,54 @@ record FundingInformation(String grant, String grantId) implements ProjectUpdate
331332 * @param unit the unit of the experimental variable. Can be null if no unit is set
332333 * @since 1.9.0
333334 */
334- record ExperimentalVariable (String name , Set <String > levels , @ Nullable String unit ) {
335+ record ExperimentalVariable (Long id , String name , Set <String > levels , @ Nullable String unit ) {
335336
336337 public ExperimentalVariable {
337338 levels = Set .copyOf (levels );
338339 }
340+
341+ @ Override
342+ public Set <String > levels () {
343+ return Set .copyOf (levels );
344+ }
345+ }
346+
347+ /**
348+ * Information about variables that should be created
349+ *
350+ * @param experimentalVariables
351+ * @since 1.9.2
352+ */
353+ record ExperimentalVariableAdditions (List <ExperimentalVariable > experimentalVariables ) implements
354+ ExperimentUpdateRequestBody {
355+
356+ public ExperimentalVariableAdditions {
357+ experimentalVariables = List .copyOf (experimentalVariables );
358+ }
359+
360+ @ Override
361+ public List <ExperimentalVariable > experimentalVariables () {
362+ return List .copyOf (experimentalVariables );
363+ }
364+ }
365+
366+
367+ /**
368+ * Information about variables that should be deleted
369+ *
370+ * @param experimentalVariables
371+ */
372+ record ExperimentalVariableDeletions (List <ExperimentalVariable > experimentalVariables ) implements
373+ ExperimentUpdateRequestBody {
374+
375+ public ExperimentalVariableDeletions {
376+ experimentalVariables = List .copyOf (experimentalVariables );
377+ }
378+
379+ @ Override
380+ public List <ExperimentalVariable > experimentalVariables () {
381+ return List .copyOf (experimentalVariables );
382+ }
339383 }
340384
341385 /**
@@ -345,22 +389,29 @@ record ExperimentalVariable(String name, Set<String> levels, @Nullable String un
345389 * @since 1.9.0
346390 */
347391 record ExperimentalVariables (List <ExperimentalVariable > experimentalVariables ) implements
348- ExperimentUpdateRequestBody , ExperimentUpdateResponseBody {
392+ ExperimentUpdateResponseBody {
393+
349394
350395 public ExperimentalVariables {
351396 experimentalVariables = List .copyOf (experimentalVariables );
352397 }
398+
399+ @ Override
400+ public List <ExperimentalVariable > experimentalVariables () {
401+ return List .copyOf (experimentalVariables );
402+ }
353403 }
354404
355405 /**
356406 * A level of an experimental variable
357407 *
408+ * @param variableId the identifier of the variable
358409 * @param variableName the name of the variable
359410 * @param levelValue the value of the level
360411 * @param unit the unit for the value of the level. Can be null if no unit is set
361412 * @since 1.9.0
362413 */
363- record VariableLevel (String variableName , String levelValue , @ Nullable String unit ) {
414+ record VariableLevel (Long variableId , String variableName , String levelValue , @ Nullable String unit ) {
364415
365416 }
366417
@@ -421,17 +472,81 @@ record ExperimentDescription(String experimentName, Set<String> species, Set<Str
421472 }
422473
423474 /**
424- * A list of confounding variable information. Can be used in
475+ * A list of confounding variable information for variable addition. Can be used in
476+ * {@link #update(ExperimentUpdateRequest)}
477+ *
478+ * @param confoundingVariables the variable information
479+ */
480+ record ConfoundingVariableAdditions (
481+ List <ConfoundingVariableInformation > confoundingVariables ) implements
482+ ExperimentUpdateRequestBody {
483+
484+ public ConfoundingVariableAdditions {
485+ confoundingVariables = List .copyOf (confoundingVariables );
486+ }
487+
488+ @ Override
489+ public List <ConfoundingVariableInformation > confoundingVariables () {
490+ return List .copyOf (confoundingVariables );
491+ }
492+ }
493+
494+ /**
495+ * A list of confounding variable information for variable update. Can be used in
496+ * {@link #update(ExperimentUpdateRequest)}
497+ *
498+ * @param confoundingVariables the variable information
499+ */
500+ record ConfoundingVariableDeletions (
501+ List <ConfoundingVariableInformation > confoundingVariables ) implements
502+ ExperimentUpdateRequestBody {
503+
504+ public ConfoundingVariableDeletions {
505+ confoundingVariables = List .copyOf (confoundingVariables );
506+ }
507+
508+ @ Override
509+ public List <ConfoundingVariableInformation > confoundingVariables () {
510+ return List .copyOf (confoundingVariables );
511+ }
512+ }
513+
514+ /**
515+ * A list of confounding variable information for variable deletion. Can be used in
425516 * {@link #update(ExperimentUpdateRequest)}
426517 *
427518 * @param confoundingVariables the variable information
428519 */
520+ record ConfoundingVariableUpdates (
521+ List <ConfoundingVariableInformation > confoundingVariables ) implements
522+ ExperimentUpdateRequestBody {
523+
524+ public ConfoundingVariableUpdates {
525+ confoundingVariables = List .copyOf (confoundingVariables );
526+ }
527+
528+ @ Override
529+ public List <ConfoundingVariableInformation > confoundingVariables () {
530+ return List .copyOf (confoundingVariables );
531+ }
532+ }
533+
534+ /**
535+ * A list of confounding variable information.
536+ *
537+ * @param confoundingVariables the variable information
538+ */
429539 record ConfoundingVariables (List <ConfoundingVariableInformation > confoundingVariables ) implements
430- ExperimentUpdateRequestBody , ExperimentUpdateResponseBody {
540+ ExperimentUpdateResponseBody {
431541
432542 public ConfoundingVariables {
433543 confoundingVariables = List .copyOf (confoundingVariables );
434544 }
545+
546+ @ Override
547+ public List <ConfoundingVariableInformation > confoundingVariables () {
548+ return List .copyOf (confoundingVariables );
549+ }
435550 }
436551
437552
0 commit comments