@@ -10,45 +10,39 @@ public struct EstimateABTestResponse: Codable, JSONEncodable {
1010 /// Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This
1111 /// value is based on historical traffic.
1212 public var durationDays : Int64 ?
13- /// Number of tracked searches needed to be able to detect the configured effect for the control variant.
14- public var controlSampleSize : Int64 ?
15- /// Number of tracked searches needed to be able to detect the configured effect for the experiment variant.
16- public var experimentSampleSize : Int64 ?
13+ /// Sample size estimates for each variant. The first element is the control variant. Each element is the estimated
14+ /// number of searches required to achieve the desired statistical significance.
15+ public var sampleSizes : [ Int64 ] ?
1716
18- public init ( durationDays: Int64 ? = nil , controlSampleSize : Int64 ? = nil , experimentSampleSize : Int64 ? = nil ) {
17+ public init ( durationDays: Int64 ? = nil , sampleSizes : [ Int64 ] ? = nil ) {
1918 self . durationDays = durationDays
20- self . controlSampleSize = controlSampleSize
21- self . experimentSampleSize = experimentSampleSize
19+ self . sampleSizes = sampleSizes
2220 }
2321
2422 public enum CodingKeys : String , CodingKey , CaseIterable {
2523 case durationDays
26- case controlSampleSize
27- case experimentSampleSize
24+ case sampleSizes
2825 }
2926
3027 // Encodable protocol methods
3128
3229 public func encode( to encoder: Encoder ) throws {
3330 var container = encoder. container ( keyedBy: CodingKeys . self)
3431 try container. encodeIfPresent ( self . durationDays, forKey: . durationDays)
35- try container. encodeIfPresent ( self . controlSampleSize, forKey: . controlSampleSize)
36- try container. encodeIfPresent ( self . experimentSampleSize, forKey: . experimentSampleSize)
32+ try container. encodeIfPresent ( self . sampleSizes, forKey: . sampleSizes)
3733 }
3834}
3935
4036extension EstimateABTestResponse : Equatable {
4137 public static func == ( lhs: EstimateABTestResponse , rhs: EstimateABTestResponse ) -> Bool {
4238 lhs. durationDays == rhs. durationDays &&
43- lhs. controlSampleSize == rhs. controlSampleSize &&
44- lhs. experimentSampleSize == rhs. experimentSampleSize
39+ lhs. sampleSizes == rhs. sampleSizes
4540 }
4641}
4742
4843extension EstimateABTestResponse : Hashable {
4944 public func hash( into hasher: inout Hasher ) {
5045 hasher. combine ( self . durationDays? . hashValue)
51- hasher. combine ( self . controlSampleSize? . hashValue)
52- hasher. combine ( self . experimentSampleSize? . hashValue)
46+ hasher. combine ( self . sampleSizes? . hashValue)
5347 }
5448}
0 commit comments