Skip to content

Commit

Permalink
fix number (generated)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Nov 7, 2024
1 parent c75b847 commit cbe7c0f
Show file tree
Hide file tree
Showing 107 changed files with 5,422 additions and 308 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,36 @@ public interface IAbtestingClient
/// <returns>ABTestResponse</returns>
ABTestResponse DeleteABTest(int id, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// 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.
/// </summary>
///
/// Required API Key ACLs:
/// - analytics
/// <param name="estimateABTestRequest"></param>
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>Task of EstimateABTestResponse</returns>
Task<EstimateABTestResponse> EstimateABTestAsync(EstimateABTestRequest estimateABTestRequest, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// 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. (Synchronous version)
/// </summary>
///
/// Required API Key ACLs:
/// - analytics
/// <param name="estimateABTestRequest"></param>
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>EstimateABTestResponse</returns>
EstimateABTestResponse EstimateABTest(EstimateABTestRequest estimateABTestRequest, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// Retrieves the details for an A/B test by its ID.
/// </summary>
Expand Down Expand Up @@ -513,6 +543,26 @@ public ABTestResponse DeleteABTest(int id, RequestOptions options = null, Cancel
AsyncHelper.RunSync(() => DeleteABTestAsync(id, options, cancellationToken));


/// <inheritdoc />
public async Task<EstimateABTestResponse> EstimateABTestAsync(EstimateABTestRequest estimateABTestRequest, RequestOptions options = null, CancellationToken cancellationToken = default)
{

if (estimateABTestRequest == null)
throw new ArgumentException("Parameter `estimateABTestRequest` is required when calling `EstimateABTest`.");

var requestOptions = new InternalRequestOptions(options);


requestOptions.Data = estimateABTestRequest;
return await _transport.ExecuteRequestAsync<EstimateABTestResponse>(new HttpMethod("POST"), "/2/abtests/estimate", requestOptions, cancellationToken).ConfigureAwait(false);
}


/// <inheritdoc />
public EstimateABTestResponse EstimateABTest(EstimateABTestRequest estimateABTestRequest, RequestOptions options = null, CancellationToken cancellationToken = default) =>
AsyncHelper.RunSync(() => EstimateABTestAsync(estimateABTestRequest, options, cancellationToken));


/// <inheritdoc />
public async Task<ABTest> GetABTestAsync(int id, RequestOptions options = null, CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace Algolia.Search.Models.Abtesting;
/// Metric for which you want to detect the smallest relative difference.
/// </summary>
/// <value>Metric for which you want to detect the smallest relative difference.</value>
[JsonConverter(typeof(Serializer.JsonStringEnumConverter<Effect>))]
public enum Effect
[JsonConverter(typeof(Serializer.JsonStringEnumConverter<EffectMetric>))]
public enum EffectMetric
{
/// <summary>
/// Enum AddToCartRate for value: addToCartRate
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
//
// 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.
//
using System;
using System.Text;
using System.Linq;
using System.Text.Json.Serialization;
using System.Collections.Generic;
using Algolia.Search.Serializer;
using System.Text.Json;

namespace Algolia.Search.Models.Abtesting;

/// <summary>
/// EstimateABTestRequest
/// </summary>
public partial class EstimateABTestRequest
{
/// <summary>
/// Initializes a new instance of the EstimateABTestRequest class.
/// </summary>
[JsonConstructor]
public EstimateABTestRequest() { }
/// <summary>
/// Initializes a new instance of the EstimateABTestRequest class.
/// </summary>
/// <param name="configuration">configuration (required).</param>
/// <param name="variants">A/B test variants. (required).</param>
public EstimateABTestRequest(EstimateConfiguration configuration, List<AddABTestsVariant> variants)
{
Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
Variants = variants ?? throw new ArgumentNullException(nameof(variants));
}

/// <summary>
/// Gets or Sets Configuration
/// </summary>
[JsonPropertyName("configuration")]
public EstimateConfiguration Configuration { get; set; }

/// <summary>
/// A/B test variants.
/// </summary>
/// <value>A/B test variants.</value>
[JsonPropertyName("variants")]
public List<AddABTestsVariant> Variants { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class EstimateABTestRequest {\n");
sb.Append(" Configuration: ").Append(Configuration).Append("\n");
sb.Append(" Variants: ").Append(Variants).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonSerializer.Serialize(this, JsonConfig.Options);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (obj is not EstimateABTestRequest input)
{
return false;
}

return
(Configuration == input.Configuration || (Configuration != null && Configuration.Equals(input.Configuration))) &&
(Variants == input.Variants || Variants != null && input.Variants != null && Variants.SequenceEqual(input.Variants));
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (Configuration != null)
{
hashCode = (hashCode * 59) + Configuration.GetHashCode();
}
if (Variants != null)
{
hashCode = (hashCode * 59) + Variants.GetHashCode();
}
return hashCode;
}
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
//
// 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.
//
using System;
using System.Text;
using System.Linq;
using System.Text.Json.Serialization;
using System.Collections.Generic;
using Algolia.Search.Serializer;
using System.Text.Json;

namespace Algolia.Search.Models.Abtesting;

/// <summary>
/// EstimateABTestResponse
/// </summary>
public partial class EstimateABTestResponse
{
/// <summary>
/// Initializes a new instance of the EstimateABTestResponse class.
/// </summary>
public EstimateABTestResponse()
{
}

/// <summary>
/// Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
/// </summary>
/// <value>Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.</value>
[JsonPropertyName("durationDays")]
public long? DurationDays { get; set; }

/// <summary>
/// Number of tracked searches needed to be able to detect the configured effect for the control variant.
/// </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; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
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("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonSerializer.Serialize(this, JsonConfig.Options);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (obj is not EstimateABTestResponse input)
{
return false;
}

return
(DurationDays == input.DurationDays || DurationDays.Equals(input.DurationDays)) &&
(ControlSampleSize == input.ControlSampleSize || ControlSampleSize.Equals(input.ControlSampleSize)) &&
(ExperimentSampleSize == input.ExperimentSampleSize || ExperimentSampleSize.Equals(input.ExperimentSampleSize));
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
hashCode = (hashCode * 59) + DurationDays.GetHashCode();
hashCode = (hashCode * 59) + ControlSampleSize.GetHashCode();
hashCode = (hashCode * 59) + ExperimentSampleSize.GetHashCode();
return hashCode;
}
}

}

Loading

0 comments on commit cbe7c0f

Please sign in to comment.