Skip to content

Commit

Permalink
feat(specs): add estimate path and responses [skip-bc] (generated)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
3 people committed Nov 7, 2024
1 parent 7d88c5c commit bf1b39b
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,26 @@ public class AbtestingClient(
)
}

/**
* 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.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest
* @param requestOptions additional request configuration.
*/
public suspend fun estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions: RequestOptions? = null): EstimateABTestResponse {
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("2", "abtests", "estimate"),
body = estimateABTestRequest,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}

/**
* Retrieves the details for an A/B test by its ID.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import kotlinx.serialization.*
* Metric for which you want to detect the smallest relative difference.
*/
@Serializable
public enum class Effect(public val value: kotlin.String) {
public enum class EffectMetric(public val value: kotlin.String) {

@SerialName(value = "addToCartRate")
AddToCartRate("addToCartRate"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** 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. */
package com.algolia.client.model.abtesting

import kotlinx.serialization.*
import kotlinx.serialization.json.*

/**
* EstimateABTestRequest
*
* @param configuration
* @param variants A/B test variants.
*/
@Serializable
public data class EstimateABTestRequest(

@SerialName(value = "configuration") val configuration: EstimateConfiguration,

/** A/B test variants. */
@SerialName(value = "variants") val variants: List<AddABTestsVariant>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/** 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. */
package com.algolia.client.model.abtesting

import kotlinx.serialization.*
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.
*/
@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,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/** 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. */
package com.algolia.client.model.abtesting

import kotlinx.serialization.*
import kotlinx.serialization.json.*

/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*
* @param minimumDetectableEffect
* @param outliers
* @param emptySearch
*/
@Serializable
public data class EstimateConfiguration(

@SerialName(value = "minimumDetectableEffect") val minimumDetectableEffect: MinimumDetectableEffect,

@SerialName(value = "outliers") val outliers: Outliers? = null,

@SerialName(value = "emptySearch") val emptySearch: EmptySearch? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import kotlinx.serialization.json.*
* Configuration for the smallest difference between test variants you want to detect.
*
* @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.
* @param effect
* @param metric
*/
@Serializable
public data class MinimumDetectableEffect(

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

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

0 comments on commit bf1b39b

Please sign in to comment.