Skip to content

Commit

Permalink
feat(specs): update estimate response type [skip-bc] (#4101) (generat…
Browse files Browse the repository at this point in the history
…ed) [skip ci]

Co-authored-by: Christopher Hawke <[email protected]>
  • Loading branch information
2 people authored and millotp committed Nov 18, 2024
1 parent 666b870 commit b4be179
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 246 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,11 @@ public EstimateABTestResponse()
public long? DurationDays { get; set; }

/// <summary>
/// Number of tracked searches needed to be able to detect the configured effect for the control variant.
/// Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
/// </summary>
/// <value>Number of tracked searches needed to be able to detect the configured effect for the control variant.</value>
[JsonPropertyName("controlSampleSize")]
public long? ControlSampleSize { get; set; }

/// <summary>
/// Number of tracked searches needed to be able to detect the configured effect for the experiment variant.
/// </summary>
/// <value>Number of tracked searches needed to be able to detect the configured effect for the experiment variant.</value>
[JsonPropertyName("experimentSampleSize")]
public long? ExperimentSampleSize { get; set; }
/// <value>Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance. </value>
[JsonPropertyName("sampleSizes")]
public List<long> SampleSizes { get; set; }

/// <summary>
/// Returns the string presentation of the object
Expand All @@ -53,8 +46,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EstimateABTestResponse {\n");
sb.Append(" DurationDays: ").Append(DurationDays).Append("\n");
sb.Append(" ControlSampleSize: ").Append(ControlSampleSize).Append("\n");
sb.Append(" ExperimentSampleSize: ").Append(ExperimentSampleSize).Append("\n");
sb.Append(" SampleSizes: ").Append(SampleSizes).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
Expand Down Expand Up @@ -82,8 +74,7 @@ public override bool Equals(object obj)

return
(DurationDays == input.DurationDays || DurationDays.Equals(input.DurationDays)) &&
(ControlSampleSize == input.ControlSampleSize || ControlSampleSize.Equals(input.ControlSampleSize)) &&
(ExperimentSampleSize == input.ExperimentSampleSize || ExperimentSampleSize.Equals(input.ExperimentSampleSize));
(SampleSizes == input.SampleSizes || SampleSizes != null && input.SampleSizes != null && SampleSizes.SequenceEqual(input.SampleSizes));
}

/// <summary>
Expand All @@ -96,8 +87,10 @@ public override int GetHashCode()
{
int hashCode = 41;
hashCode = (hashCode * 59) + DurationDays.GetHashCode();
hashCode = (hashCode * 59) + ControlSampleSize.GetHashCode();
hashCode = (hashCode * 59) + ExperimentSampleSize.GetHashCode();
if (SampleSizes != null)
{
hashCode = (hashCode * 59) + SampleSizes.GetHashCode();
}
return hashCode;
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/** EstimateABTestResponse */
Expand All @@ -13,11 +15,8 @@ public class EstimateABTestResponse {
@JsonProperty("durationDays")
private Long durationDays;

@JsonProperty("controlSampleSize")
private Long controlSampleSize;

@JsonProperty("experimentSampleSize")
private Long experimentSampleSize;
@JsonProperty("sampleSizes")
private List<Long> sampleSizes;

public EstimateABTestResponse setDurationDays(Long durationDays) {
this.durationDays = durationDays;
Expand All @@ -33,32 +32,26 @@ public Long getDurationDays() {
return durationDays;
}

public EstimateABTestResponse setControlSampleSize(Long controlSampleSize) {
this.controlSampleSize = controlSampleSize;
public EstimateABTestResponse setSampleSizes(List<Long> sampleSizes) {
this.sampleSizes = sampleSizes;
return this;
}

/**
* Number of tracked searches needed to be able to detect the configured effect for the control
* variant.
*/
@javax.annotation.Nullable
public Long getControlSampleSize() {
return controlSampleSize;
}

public EstimateABTestResponse setExperimentSampleSize(Long experimentSampleSize) {
this.experimentSampleSize = experimentSampleSize;
public EstimateABTestResponse addSampleSizes(Long sampleSizesItem) {
if (this.sampleSizes == null) {
this.sampleSizes = new ArrayList<>();
}
this.sampleSizes.add(sampleSizesItem);
return this;
}

/**
* Number of tracked searches needed to be able to detect the configured effect for the experiment
* variant.
* Sample size estimates for each variant. The first element is the control variant. Each element
* is the estimated number of searches required to achieve the desired statistical significance.
*/
@javax.annotation.Nullable
public Long getExperimentSampleSize() {
return experimentSampleSize;
public List<Long> getSampleSizes() {
return sampleSizes;
}

@Override
Expand All @@ -72,23 +65,21 @@ public boolean equals(Object o) {
EstimateABTestResponse estimateABTestResponse = (EstimateABTestResponse) o;
return (
Objects.equals(this.durationDays, estimateABTestResponse.durationDays) &&
Objects.equals(this.controlSampleSize, estimateABTestResponse.controlSampleSize) &&
Objects.equals(this.experimentSampleSize, estimateABTestResponse.experimentSampleSize)
Objects.equals(this.sampleSizes, estimateABTestResponse.sampleSizes)
);
}

@Override
public int hashCode() {
return Objects.hash(durationDays, controlSampleSize, experimentSampleSize);
return Objects.hash(durationDays, sampleSizes);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EstimateABTestResponse {\n");
sb.append(" durationDays: ").append(toIndentedString(durationDays)).append("\n");
sb.append(" controlSampleSize: ").append(toIndentedString(controlSampleSize)).append("\n");
sb.append(" experimentSampleSize: ").append(toIndentedString(experimentSampleSize)).append("\n");
sb.append(" sampleSizes: ").append(toIndentedString(sampleSizes)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ export type EstimateABTestResponse = {
durationDays?: number;

/**
* Number of tracked searches needed to be able to detect the configured effect for the control variant.
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
controlSampleSize?: number;

/**
* Number of tracked searches needed to be able to detect the configured effect for the experiment variant.
*/
experimentSampleSize?: number;
sampleSizes?: Array<number>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ import kotlinx.serialization.json.*
* EstimateABTestResponse
*
* @param durationDays Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
* @param controlSampleSize Number of tracked searches needed to be able to detect the configured effect for the control variant.
* @param experimentSampleSize Number of tracked searches needed to be able to detect the configured effect for the experiment variant.
* @param sampleSizes Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
@Serializable
public data class EstimateABTestResponse(

/** Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic. */
@SerialName(value = "durationDays") val durationDays: Long? = null,

/** Number of tracked searches needed to be able to detect the configured effect for the control variant. */
@SerialName(value = "controlSampleSize") val controlSampleSize: Long? = null,

/** Number of tracked searches needed to be able to detect the configured effect for the experiment variant. */
@SerialName(value = "experimentSampleSize") val experimentSampleSize: Long? = null,
/** Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance. */
@SerialName(value = "sampleSizes") val sampleSizes: List<Long>? = null,
)
Loading

0 comments on commit b4be179

Please sign in to comment.