Skip to content

Commit 5e32cdd

Browse files
algolia-botleonardogavaudanshortcuts
committed
feat(clients): add new abtesting-v3 package to clients + stabilize alpha js package (generated)
algolia/api-clients-automation#5157 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Leonardo Gavaudan <leonardogavaudan@gmail.com> Co-authored-by: shortcuts <vannicattec@gmail.com>
1 parent 76e6b3c commit 5e32cdd

34 files changed

+4767
-0
lines changed

algoliasearch/Clients/AbtestingV3Client.cs

Lines changed: 1008 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* A/B Testing API
3+
*
4+
* The Algolia A/B Testing API lets you manage your Algolia A/B tests to optimize your search experience. ## Base URLs The base URLs for requests to the A/B testing API are: - `https://analytics.us.algolia.com` - `https://analytics.de.algolia.com` - `https://analytics.algolia.com` (routes requests to the closest of the above servers, based on your geographical location) Use the URL that matches your [analytics region](https://dashboard.algolia.com/account/infrastructure/analytics). **All requests must use HTTPS.** ## Availability and authentication Access to the A/B testing API is available as part of the [Premium or Elevate plans](https://www.algolia.com/pricing). To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia application ID. - `x-algolia-api-key`. An API key with the necessary permissions to make the request. The required access control list (ACL) to make a request is listed in each endpoint's reference. You can find your application ID and API key in the [Algolia dashboard](https://dashboard.algolia.com/account). ## Rate limits You can make up to **100 requests per minute per app** to the A/B testing API. The response includes headers with information about the limits. ## Parameters Query parameters must be [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). Non-ASCII characters must be UTF-8 encoded. Plus characters (`+`) are interpreted as spaces. ## Response status and errors The A/B testing API returns JSON responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current version of the A/B Testing API is version 3, as indicated by the `/3/` in each endpoint's URL.
5+
*
6+
* The version of the OpenAPI document: 3.0.0
7+
* Generated by: https://github.com/openapitools/openapi-generator.git
8+
*/
9+
10+
using System;
11+
using System.Collections.Generic;
12+
using Algolia.Search.Models.Common;
13+
using Algolia.Search.Transport;
14+
using Algolia.Search.Utils;
15+
16+
namespace Algolia.Search.Clients;
17+
18+
/// <summary>
19+
/// AbtestingV3 client configuration
20+
/// </summary>
21+
public sealed class AbtestingV3Config : AlgoliaConfig
22+
{
23+
/// <summary>
24+
/// The configuration of the AbtestingV3 client
25+
/// A client should have it's own configuration ie on configuration per client instance
26+
/// </summary>
27+
/// <param name="appId">Your application ID</param>
28+
/// <param name="apiKey">Your API Key</param>
29+
/// <param name="region">Targeted region (optional)</param>
30+
public AbtestingV3Config(string appId, string apiKey, string region = null)
31+
: base(appId, apiKey, "AbtestingV3", "7.23.1")
32+
{
33+
DefaultHosts = GetDefaultHosts(region);
34+
Compression = CompressionType.None;
35+
ReadTimeout = TimeSpan.FromMilliseconds(5000);
36+
WriteTimeout = TimeSpan.FromMilliseconds(30000);
37+
ConnectTimeout = TimeSpan.FromMilliseconds(2000);
38+
}
39+
40+
private static List<StatefulHost> GetDefaultHosts(string region)
41+
{
42+
var regions = new List<string> { "de", "us" };
43+
if (region != null && !regions.Contains(region))
44+
{
45+
throw new ArgumentException(
46+
$"`region` must be one of the following: {string.Join(", ", regions)}"
47+
);
48+
}
49+
50+
var selectedRegion =
51+
region == null
52+
? "analytics.algolia.com"
53+
: "analytics.{region}.algolia.com".Replace("{region}", region);
54+
55+
var hosts = new List<StatefulHost>
56+
{
57+
new() { Url = selectedRegion, Accept = CallType.Read | CallType.Write },
58+
};
59+
return hosts;
60+
}
61+
}
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
//
2+
// 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.
3+
//
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Text.Json;
9+
using System.Text.Json.Serialization;
10+
using Algolia.Search.Serializer;
11+
12+
namespace Algolia.Search.Models.AbtestingV3;
13+
14+
/// <summary>
15+
/// ABTest
16+
/// </summary>
17+
public partial class ABTest
18+
{
19+
/// <summary>
20+
/// Gets or Sets Status
21+
/// </summary>
22+
[JsonPropertyName("status")]
23+
public Status? Status { get; set; }
24+
25+
/// <summary>
26+
/// Initializes a new instance of the ABTest class.
27+
/// </summary>
28+
[JsonConstructor]
29+
public ABTest() { }
30+
31+
/// <summary>
32+
/// Initializes a new instance of the ABTest class.
33+
/// </summary>
34+
/// <param name="abTestID">Unique A/B test identifier. (required).</param>
35+
/// <param name="updatedAt">Date and time when the A/B test was last updated, in RFC 3339 format. (required).</param>
36+
/// <param name="createdAt">Date and time when the A/B test was created, in RFC 3339 format. (required).</param>
37+
/// <param name="endAt">End date and time of the A/B test, in RFC 3339 format. (required).</param>
38+
/// <param name="name">A/B test name. (required).</param>
39+
/// <param name="status">status (required).</param>
40+
/// <param name="variants">A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control. (required).</param>
41+
public ABTest(
42+
int abTestID,
43+
string updatedAt,
44+
string createdAt,
45+
string endAt,
46+
string name,
47+
Status? status,
48+
List<Variant> variants
49+
)
50+
{
51+
AbTestID = abTestID;
52+
UpdatedAt = updatedAt ?? throw new ArgumentNullException(nameof(updatedAt));
53+
CreatedAt = createdAt ?? throw new ArgumentNullException(nameof(createdAt));
54+
EndAt = endAt ?? throw new ArgumentNullException(nameof(endAt));
55+
Name = name ?? throw new ArgumentNullException(nameof(name));
56+
Status = status;
57+
Variants = variants ?? throw new ArgumentNullException(nameof(variants));
58+
}
59+
60+
/// <summary>
61+
/// Unique A/B test identifier.
62+
/// </summary>
63+
/// <value>Unique A/B test identifier.</value>
64+
[JsonPropertyName("abTestID")]
65+
public int AbTestID { get; set; }
66+
67+
/// <summary>
68+
/// Date and time when the A/B test was last updated, in RFC 3339 format.
69+
/// </summary>
70+
/// <value>Date and time when the A/B test was last updated, in RFC 3339 format.</value>
71+
[JsonPropertyName("updatedAt")]
72+
public string UpdatedAt { get; set; }
73+
74+
/// <summary>
75+
/// Date and time when the A/B test was created, in RFC 3339 format.
76+
/// </summary>
77+
/// <value>Date and time when the A/B test was created, in RFC 3339 format.</value>
78+
[JsonPropertyName("createdAt")]
79+
public string CreatedAt { get; set; }
80+
81+
/// <summary>
82+
/// End date and time of the A/B test, in RFC 3339 format.
83+
/// </summary>
84+
/// <value>End date and time of the A/B test, in RFC 3339 format.</value>
85+
[JsonPropertyName("endAt")]
86+
public string EndAt { get; set; }
87+
88+
/// <summary>
89+
/// A/B test name.
90+
/// </summary>
91+
/// <value>A/B test name.</value>
92+
[JsonPropertyName("name")]
93+
public string Name { get; set; }
94+
95+
/// <summary>
96+
/// A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
97+
/// </summary>
98+
/// <value>A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control. </value>
99+
[JsonPropertyName("variants")]
100+
public List<Variant> Variants { get; set; }
101+
102+
/// <summary>
103+
/// Gets or Sets Configuration
104+
/// </summary>
105+
[JsonPropertyName("configuration")]
106+
public ABTestConfiguration Configuration { get; set; }
107+
108+
/// <summary>
109+
/// Unique migrated A/B test identifier.
110+
/// </summary>
111+
/// <value>Unique migrated A/B test identifier.</value>
112+
[JsonPropertyName("migratedAbTestID")]
113+
public int? MigratedAbTestID { get; set; }
114+
115+
/// <summary>
116+
/// Returns the string presentation of the object
117+
/// </summary>
118+
/// <returns>String presentation of the object</returns>
119+
public override string ToString()
120+
{
121+
StringBuilder sb = new StringBuilder();
122+
sb.Append("class ABTest {\n");
123+
sb.Append(" AbTestID: ").Append(AbTestID).Append("\n");
124+
sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n");
125+
sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n");
126+
sb.Append(" EndAt: ").Append(EndAt).Append("\n");
127+
sb.Append(" Name: ").Append(Name).Append("\n");
128+
sb.Append(" Status: ").Append(Status).Append("\n");
129+
sb.Append(" Variants: ").Append(Variants).Append("\n");
130+
sb.Append(" Configuration: ").Append(Configuration).Append("\n");
131+
sb.Append(" MigratedAbTestID: ").Append(MigratedAbTestID).Append("\n");
132+
sb.Append("}\n");
133+
return sb.ToString();
134+
}
135+
136+
/// <summary>
137+
/// Returns the JSON string presentation of the object
138+
/// </summary>
139+
/// <returns>JSON string presentation of the object</returns>
140+
public virtual string ToJson()
141+
{
142+
return JsonSerializer.Serialize(this, JsonConfig.Options);
143+
}
144+
145+
/// <summary>
146+
/// Returns true if objects are equal
147+
/// </summary>
148+
/// <param name="obj">Object to be compared</param>
149+
/// <returns>Boolean</returns>
150+
public override bool Equals(object obj)
151+
{
152+
if (obj is not ABTest input)
153+
{
154+
return false;
155+
}
156+
157+
return (AbTestID == input.AbTestID || AbTestID.Equals(input.AbTestID))
158+
&& (UpdatedAt == input.UpdatedAt || (UpdatedAt != null && UpdatedAt.Equals(input.UpdatedAt)))
159+
&& (CreatedAt == input.CreatedAt || (CreatedAt != null && CreatedAt.Equals(input.CreatedAt)))
160+
&& (EndAt == input.EndAt || (EndAt != null && EndAt.Equals(input.EndAt)))
161+
&& (Name == input.Name || (Name != null && Name.Equals(input.Name)))
162+
&& (Status == input.Status || Status.Equals(input.Status))
163+
&& (
164+
Variants == input.Variants
165+
|| Variants != null && input.Variants != null && Variants.SequenceEqual(input.Variants)
166+
)
167+
&& (
168+
Configuration == input.Configuration
169+
|| (Configuration != null && Configuration.Equals(input.Configuration))
170+
)
171+
&& (
172+
MigratedAbTestID == input.MigratedAbTestID
173+
|| MigratedAbTestID.Equals(input.MigratedAbTestID)
174+
);
175+
}
176+
177+
/// <summary>
178+
/// Gets the hash code
179+
/// </summary>
180+
/// <returns>Hash code</returns>
181+
public override int GetHashCode()
182+
{
183+
unchecked // Overflow is fine, just wrap
184+
{
185+
int hashCode = 41;
186+
hashCode = (hashCode * 59) + AbTestID.GetHashCode();
187+
if (UpdatedAt != null)
188+
{
189+
hashCode = (hashCode * 59) + UpdatedAt.GetHashCode();
190+
}
191+
if (CreatedAt != null)
192+
{
193+
hashCode = (hashCode * 59) + CreatedAt.GetHashCode();
194+
}
195+
if (EndAt != null)
196+
{
197+
hashCode = (hashCode * 59) + EndAt.GetHashCode();
198+
}
199+
if (Name != null)
200+
{
201+
hashCode = (hashCode * 59) + Name.GetHashCode();
202+
}
203+
hashCode = (hashCode * 59) + Status.GetHashCode();
204+
if (Variants != null)
205+
{
206+
hashCode = (hashCode * 59) + Variants.GetHashCode();
207+
}
208+
if (Configuration != null)
209+
{
210+
hashCode = (hashCode * 59) + Configuration.GetHashCode();
211+
}
212+
hashCode = (hashCode * 59) + MigratedAbTestID.GetHashCode();
213+
return hashCode;
214+
}
215+
}
216+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
//
2+
// 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.
3+
//
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Text.Json;
9+
using System.Text.Json.Serialization;
10+
using Algolia.Search.Serializer;
11+
12+
namespace Algolia.Search.Models.AbtestingV3;
13+
14+
/// <summary>
15+
/// A/B test configuration.
16+
/// </summary>
17+
public partial class ABTestConfiguration
18+
{
19+
/// <summary>
20+
/// Gets or Sets ErrorCorrection
21+
/// </summary>
22+
[JsonPropertyName("errorCorrection")]
23+
public ErrorCorrectionType? ErrorCorrection { get; set; }
24+
25+
/// <summary>
26+
/// Initializes a new instance of the ABTestConfiguration class.
27+
/// </summary>
28+
public ABTestConfiguration() { }
29+
30+
/// <summary>
31+
/// Gets or Sets MinimumDetectableEffect
32+
/// </summary>
33+
[JsonPropertyName("minimumDetectableEffect")]
34+
public MinimumDetectableEffect MinimumDetectableEffect { get; set; }
35+
36+
/// <summary>
37+
/// List of metric filters applied to the test population.
38+
/// </summary>
39+
/// <value>List of metric filters applied to the test population.</value>
40+
[JsonPropertyName("filters")]
41+
public List<MetricsFilter> Filters { get; set; }
42+
43+
/// <summary>
44+
/// Returns the string presentation of the object
45+
/// </summary>
46+
/// <returns>String presentation of the object</returns>
47+
public override string ToString()
48+
{
49+
StringBuilder sb = new StringBuilder();
50+
sb.Append("class ABTestConfiguration {\n");
51+
sb.Append(" MinimumDetectableEffect: ").Append(MinimumDetectableEffect).Append("\n");
52+
sb.Append(" Filters: ").Append(Filters).Append("\n");
53+
sb.Append(" ErrorCorrection: ").Append(ErrorCorrection).Append("\n");
54+
sb.Append("}\n");
55+
return sb.ToString();
56+
}
57+
58+
/// <summary>
59+
/// Returns the JSON string presentation of the object
60+
/// </summary>
61+
/// <returns>JSON string presentation of the object</returns>
62+
public virtual string ToJson()
63+
{
64+
return JsonSerializer.Serialize(this, JsonConfig.Options);
65+
}
66+
67+
/// <summary>
68+
/// Returns true if objects are equal
69+
/// </summary>
70+
/// <param name="obj">Object to be compared</param>
71+
/// <returns>Boolean</returns>
72+
public override bool Equals(object obj)
73+
{
74+
if (obj is not ABTestConfiguration input)
75+
{
76+
return false;
77+
}
78+
79+
return (
80+
MinimumDetectableEffect == input.MinimumDetectableEffect
81+
|| (
82+
MinimumDetectableEffect != null
83+
&& MinimumDetectableEffect.Equals(input.MinimumDetectableEffect)
84+
)
85+
)
86+
&& (
87+
Filters == input.Filters
88+
|| Filters != null && input.Filters != null && Filters.SequenceEqual(input.Filters)
89+
)
90+
&& (
91+
ErrorCorrection == input.ErrorCorrection || ErrorCorrection.Equals(input.ErrorCorrection)
92+
);
93+
}
94+
95+
/// <summary>
96+
/// Gets the hash code
97+
/// </summary>
98+
/// <returns>Hash code</returns>
99+
public override int GetHashCode()
100+
{
101+
unchecked // Overflow is fine, just wrap
102+
{
103+
int hashCode = 41;
104+
if (MinimumDetectableEffect != null)
105+
{
106+
hashCode = (hashCode * 59) + MinimumDetectableEffect.GetHashCode();
107+
}
108+
if (Filters != null)
109+
{
110+
hashCode = (hashCode * 59) + Filters.GetHashCode();
111+
}
112+
hashCode = (hashCode * 59) + ErrorCorrection.GetHashCode();
113+
return hashCode;
114+
}
115+
}
116+
}

0 commit comments

Comments
 (0)