Skip to content

Commit bf1b39b

Browse files
algolia-botcdhawkemillotp
committed
feat(specs): add estimate path and responses [skip-bc] (generated)
algolia/api-clients-automation#4057 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Christopher Hawke <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 7d88c5c commit bf1b39b

File tree

6 files changed

+91
-4
lines changed

6 files changed

+91
-4
lines changed

client/src/commonMain/kotlin/com/algolia/client/api/AbtestingClient.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,26 @@ public class AbtestingClient(
155155
)
156156
}
157157

158+
/**
159+
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
160+
*
161+
* Required API Key ACLs:
162+
* - analytics
163+
* @param estimateABTestRequest
164+
* @param requestOptions additional request configuration.
165+
*/
166+
public suspend fun estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions: RequestOptions? = null): EstimateABTestResponse {
167+
val requestConfig = RequestConfig(
168+
method = RequestMethod.POST,
169+
path = listOf("2", "abtests", "estimate"),
170+
body = estimateABTestRequest,
171+
)
172+
return requester.execute(
173+
requestConfig = requestConfig,
174+
requestOptions = requestOptions,
175+
)
176+
}
177+
158178
/**
159179
* Retrieves the details for an A/B test by its ID.
160180
*

client/src/commonMain/kotlin/com/algolia/client/model/abtesting/Effect.kt renamed to client/src/commonMain/kotlin/com/algolia/client/model/abtesting/EffectMetric.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import kotlinx.serialization.*
77
* Metric for which you want to detect the smallest relative difference.
88
*/
99
@Serializable
10-
public enum class Effect(public val value: kotlin.String) {
10+
public enum class EffectMetric(public val value: kotlin.String) {
1111

1212
@SerialName(value = "addToCartRate")
1313
AddToCartRate("addToCartRate"),
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.abtesting
3+
4+
import kotlinx.serialization.*
5+
import kotlinx.serialization.json.*
6+
7+
/**
8+
* EstimateABTestRequest
9+
*
10+
* @param configuration
11+
* @param variants A/B test variants.
12+
*/
13+
@Serializable
14+
public data class EstimateABTestRequest(
15+
16+
@SerialName(value = "configuration") val configuration: EstimateConfiguration,
17+
18+
/** A/B test variants. */
19+
@SerialName(value = "variants") val variants: List<AddABTestsVariant>,
20+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.abtesting
3+
4+
import kotlinx.serialization.*
5+
import kotlinx.serialization.json.*
6+
7+
/**
8+
* EstimateABTestResponse
9+
*
10+
* @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.
11+
* @param controlSampleSize Number of tracked searches needed to be able to detect the configured effect for the control variant.
12+
* @param experimentSampleSize Number of tracked searches needed to be able to detect the configured effect for the experiment variant.
13+
*/
14+
@Serializable
15+
public data class EstimateABTestResponse(
16+
17+
/** Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic. */
18+
@SerialName(value = "durationDays") val durationDays: Long? = null,
19+
20+
/** Number of tracked searches needed to be able to detect the configured effect for the control variant. */
21+
@SerialName(value = "controlSampleSize") val controlSampleSize: Long? = null,
22+
23+
/** Number of tracked searches needed to be able to detect the configured effect for the experiment variant. */
24+
@SerialName(value = "experimentSampleSize") val experimentSampleSize: Long? = null,
25+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.abtesting
3+
4+
import kotlinx.serialization.*
5+
import kotlinx.serialization.json.*
6+
7+
/**
8+
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
9+
*
10+
* @param minimumDetectableEffect
11+
* @param outliers
12+
* @param emptySearch
13+
*/
14+
@Serializable
15+
public data class EstimateConfiguration(
16+
17+
@SerialName(value = "minimumDetectableEffect") val minimumDetectableEffect: MinimumDetectableEffect,
18+
19+
@SerialName(value = "outliers") val outliers: Outliers? = null,
20+
21+
@SerialName(value = "emptySearch") val emptySearch: EmptySearch? = null,
22+
)

client/src/commonMain/kotlin/com/algolia/client/model/abtesting/MinimumDetectableEffect.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import kotlinx.serialization.json.*
88
* Configuration for the smallest difference between test variants you want to detect.
99
*
1010
* @param size Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
11-
* @param effect
11+
* @param metric
1212
*/
1313
@Serializable
1414
public data class MinimumDetectableEffect(
1515

1616
/** Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1. */
17-
@SerialName(value = "size") val size: Double? = null,
17+
@SerialName(value = "size") val size: Double,
1818

19-
@SerialName(value = "effect") val effect: Effect? = null,
19+
@SerialName(value = "metric") val metric: EffectMetric,
2020
)

0 commit comments

Comments
 (0)