@@ -10,45 +10,39 @@ public struct EstimateABTestResponse: Codable, JSONEncodable {
10
10
/// Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This
11
11
/// value is based on historical traffic.
12
12
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 ] ?
17
16
18
- public init ( durationDays: Int64 ? = nil , controlSampleSize : Int64 ? = nil , experimentSampleSize : Int64 ? = nil ) {
17
+ public init ( durationDays: Int64 ? = nil , sampleSizes : [ Int64 ] ? = nil ) {
19
18
self . durationDays = durationDays
20
- self . controlSampleSize = controlSampleSize
21
- self . experimentSampleSize = experimentSampleSize
19
+ self . sampleSizes = sampleSizes
22
20
}
23
21
24
22
public enum CodingKeys : String , CodingKey , CaseIterable {
25
23
case durationDays
26
- case controlSampleSize
27
- case experimentSampleSize
24
+ case sampleSizes
28
25
}
29
26
30
27
// Encodable protocol methods
31
28
32
29
public func encode( to encoder: Encoder ) throws {
33
30
var container = encoder. container ( keyedBy: CodingKeys . self)
34
31
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)
37
33
}
38
34
}
39
35
40
36
extension EstimateABTestResponse : Equatable {
41
37
public static func == ( lhs: EstimateABTestResponse , rhs: EstimateABTestResponse ) -> Bool {
42
38
lhs. durationDays == rhs. durationDays &&
43
- lhs. controlSampleSize == rhs. controlSampleSize &&
44
- lhs. experimentSampleSize == rhs. experimentSampleSize
39
+ lhs. sampleSizes == rhs. sampleSizes
45
40
}
46
41
}
47
42
48
43
extension EstimateABTestResponse : Hashable {
49
44
public func hash( into hasher: inout Hasher ) {
50
45
hasher. combine ( self . durationDays? . hashValue)
51
- hasher. combine ( self . controlSampleSize? . hashValue)
52
- hasher. combine ( self . experimentSampleSize? . hashValue)
46
+ hasher. combine ( self . sampleSizes? . hashValue)
53
47
}
54
48
}
0 commit comments