Skip to content

Commit

Permalink
refactor(abtesting): consistent naming (generated)
Browse files Browse the repository at this point in the history
Co-authored-by: Fernando Beck <fe.beck25@gmail.com>
  • Loading branch information
algolia-bot and febeck committed Aug 20, 2024
1 parent 8afcc23 commit 67383d0
Show file tree
Hide file tree
Showing 54 changed files with 3,746 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,30 @@ public interface IAbtestingClient
/// <returns>ListABTestsResponse</returns>
ListABTestsResponse ListABTests(int? offset = default, int? limit = default, string indexPrefix = default, string indexSuffix = default, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// Schedule an A/B test to be started at a later time.
/// </summary>
/// <param name="scheduleABTestsRequest"></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 ScheduleABTestResponse</returns>
Task<ScheduleABTestResponse> ScheduleABTestAsync(ScheduleABTestsRequest scheduleABTestsRequest, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// Schedule an A/B test to be started at a later time. (Synchronous version)
/// </summary>
/// <param name="scheduleABTestsRequest"></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>ScheduleABTestResponse</returns>
ScheduleABTestResponse ScheduleABTest(ScheduleABTestsRequest scheduleABTestsRequest, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// Stops an A/B test by its ID. You can't restart stopped A/B tests.
/// </summary>
Expand Down Expand Up @@ -664,6 +688,50 @@ public ListABTestsResponse ListABTests(int? offset = default, int? limit = defau
AsyncHelper.RunSync(() => ListABTestsAsync(offset, limit, indexPrefix, indexSuffix, options, cancellationToken));


/// <summary>
/// Schedule an A/B test to be started at a later time.
/// </summary>
///
/// Required API Key ACLs:
/// - editSettings
/// <param name="scheduleABTestsRequest"></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 ScheduleABTestResponse</returns>
public async Task<ScheduleABTestResponse> ScheduleABTestAsync(ScheduleABTestsRequest scheduleABTestsRequest, RequestOptions options = null, CancellationToken cancellationToken = default)
{

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

var requestOptions = new InternalRequestOptions(options);


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


/// <summary>
/// Schedule an A/B test to be started at a later time. (Synchronous version)
/// </summary>
///
/// Required API Key ACLs:
/// - editSettings
/// <param name="scheduleABTestsRequest"></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>ScheduleABTestResponse</returns>
public ScheduleABTestResponse ScheduleABTest(ScheduleABTestsRequest scheduleABTestsRequest, RequestOptions options = null, CancellationToken cancellationToken = default) =>
AsyncHelper.RunSync(() => ScheduleABTestAsync(scheduleABTestsRequest, options, cancellationToken));


/// <summary>
/// Stops an A/B test by its ID. You can't restart stopped A/B tests.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
//
// 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>
/// ScheduleABTestResponse
/// </summary>
public partial class ScheduleABTestResponse
{
/// <summary>
/// Initializes a new instance of the ScheduleABTestResponse class.
/// </summary>
[JsonConstructor]
public ScheduleABTestResponse() { }
/// <summary>
/// Initializes a new instance of the ScheduleABTestResponse class.
/// </summary>
/// <param name="abTestScheduleID">Unique scheduled A/B test identifier. (required).</param>
public ScheduleABTestResponse(int abTestScheduleID)
{
AbTestScheduleID = abTestScheduleID;
}

/// <summary>
/// Unique scheduled A/B test identifier.
/// </summary>
/// <value>Unique scheduled A/B test identifier.</value>
[JsonPropertyName("abTestScheduleID")]
public int AbTestScheduleID { 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 ScheduleABTestResponse {\n");
sb.Append(" AbTestScheduleID: ").Append(AbTestScheduleID).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 ScheduleABTestResponse input)
{
return false;
}

return
(AbTestScheduleID == input.AbTestScheduleID || AbTestScheduleID.Equals(input.AbTestScheduleID));
}

/// <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) + AbTestScheduleID.GetHashCode();
return hashCode;
}
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
//
// 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>
/// ScheduleABTestsRequest
/// </summary>
public partial class ScheduleABTestsRequest
{
/// <summary>
/// Initializes a new instance of the ScheduleABTestsRequest class.
/// </summary>
[JsonConstructor]
public ScheduleABTestsRequest() { }
/// <summary>
/// Initializes a new instance of the ScheduleABTestsRequest class.
/// </summary>
/// <param name="name">A/B test name. (required).</param>
/// <param name="variants">A/B test variants. (required).</param>
/// <param name="scheduledAt">Date and time when the A/B test is scheduled to start, in RFC 3339 format. (required).</param>
/// <param name="endAt">End date and time of the A/B test, in RFC 3339 format. (required).</param>
public ScheduleABTestsRequest(string name, List<AddABTestsVariant> variants, string scheduledAt, string endAt)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Variants = variants ?? throw new ArgumentNullException(nameof(variants));
ScheduledAt = scheduledAt ?? throw new ArgumentNullException(nameof(scheduledAt));
EndAt = endAt ?? throw new ArgumentNullException(nameof(endAt));
}

/// <summary>
/// A/B test name.
/// </summary>
/// <value>A/B test name.</value>
[JsonPropertyName("name")]
public string Name { get; set; }

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

/// <summary>
/// Date and time when the A/B test is scheduled to start, in RFC 3339 format.
/// </summary>
/// <value>Date and time when the A/B test is scheduled to start, in RFC 3339 format.</value>
[JsonPropertyName("scheduledAt")]
public string ScheduledAt { get; set; }

/// <summary>
/// End date and time of the A/B test, in RFC 3339 format.
/// </summary>
/// <value>End date and time of the A/B test, in RFC 3339 format.</value>
[JsonPropertyName("endAt")]
public string EndAt { 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 ScheduleABTestsRequest {\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Variants: ").Append(Variants).Append("\n");
sb.Append(" ScheduledAt: ").Append(ScheduledAt).Append("\n");
sb.Append(" EndAt: ").Append(EndAt).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 ScheduleABTestsRequest input)
{
return false;
}

return
(Name == input.Name || (Name != null && Name.Equals(input.Name))) &&
(Variants == input.Variants || Variants != null && input.Variants != null && Variants.SequenceEqual(input.Variants)) &&
(ScheduledAt == input.ScheduledAt || (ScheduledAt != null && ScheduledAt.Equals(input.ScheduledAt))) &&
(EndAt == input.EndAt || (EndAt != null && EndAt.Equals(input.EndAt)));
}

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

}

Loading

0 comments on commit 67383d0

Please sign in to comment.