Skip to content

Commit 99aac2a

Browse files
algolia-botfebeckmillotp
committed
feat(specs): add /schedule endpoint (#3350) (generated) [skip ci]
Co-authored-by: Fernando Beck <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent d53060d commit 99aac2a

File tree

54 files changed

+3746
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3746
-0
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Clients/AbtestingClient.cs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,30 @@ public interface IAbtestingClient
231231
/// <returns>ListABTestsResponse</returns>
232232
ListABTestsResponse ListABTests(int? offset = default, int? limit = default, string indexPrefix = default, string indexSuffix = default, RequestOptions options = null, CancellationToken cancellationToken = default);
233233

234+
/// <summary>
235+
/// Schedule an A/B test to be started at a later time.
236+
/// </summary>
237+
/// <param name="scheduleABTestsRequest"></param>
238+
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
239+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
240+
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
241+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
242+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
243+
/// <returns>Task of ScheduleABTestResponse</returns>
244+
Task<ScheduleABTestResponse> ScheduleABTestAsync(ScheduleABTestsRequest scheduleABTestsRequest, RequestOptions options = null, CancellationToken cancellationToken = default);
245+
246+
/// <summary>
247+
/// Schedule an A/B test to be started at a later time. (Synchronous version)
248+
/// </summary>
249+
/// <param name="scheduleABTestsRequest"></param>
250+
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
251+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
252+
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
253+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
254+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
255+
/// <returns>ScheduleABTestResponse</returns>
256+
ScheduleABTestResponse ScheduleABTest(ScheduleABTestsRequest scheduleABTestsRequest, RequestOptions options = null, CancellationToken cancellationToken = default);
257+
234258
/// <summary>
235259
/// Stops an A/B test by its ID. You can't restart stopped A/B tests.
236260
/// </summary>
@@ -664,6 +688,50 @@ public ListABTestsResponse ListABTests(int? offset = default, int? limit = defau
664688
AsyncHelper.RunSync(() => ListABTestsAsync(offset, limit, indexPrefix, indexSuffix, options, cancellationToken));
665689

666690

691+
/// <summary>
692+
/// Schedule an A/B test to be started at a later time.
693+
/// </summary>
694+
///
695+
/// Required API Key ACLs:
696+
/// - editSettings
697+
/// <param name="scheduleABTestsRequest"></param>
698+
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
699+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
700+
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
701+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
702+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
703+
/// <returns>Task of ScheduleABTestResponse</returns>
704+
public async Task<ScheduleABTestResponse> ScheduleABTestAsync(ScheduleABTestsRequest scheduleABTestsRequest, RequestOptions options = null, CancellationToken cancellationToken = default)
705+
{
706+
707+
if (scheduleABTestsRequest == null)
708+
throw new ArgumentException("Parameter `scheduleABTestsRequest` is required when calling `ScheduleABTest`.");
709+
710+
var requestOptions = new InternalRequestOptions(options);
711+
712+
713+
requestOptions.Data = scheduleABTestsRequest;
714+
return await _transport.ExecuteRequestAsync<ScheduleABTestResponse>(new HttpMethod("POST"), "/2/abtests/schedule", requestOptions, cancellationToken).ConfigureAwait(false);
715+
}
716+
717+
718+
/// <summary>
719+
/// Schedule an A/B test to be started at a later time. (Synchronous version)
720+
/// </summary>
721+
///
722+
/// Required API Key ACLs:
723+
/// - editSettings
724+
/// <param name="scheduleABTestsRequest"></param>
725+
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
726+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
727+
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
728+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
729+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
730+
/// <returns>ScheduleABTestResponse</returns>
731+
public ScheduleABTestResponse ScheduleABTest(ScheduleABTestsRequest scheduleABTestsRequest, RequestOptions options = null, CancellationToken cancellationToken = default) =>
732+
AsyncHelper.RunSync(() => ScheduleABTestAsync(scheduleABTestsRequest, options, cancellationToken));
733+
734+
667735
/// <summary>
668736
/// Stops an A/B test by its ID. You can't restart stopped A/B tests.
669737
/// </summary>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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.Text;
6+
using System.Linq;
7+
using System.Text.Json.Serialization;
8+
using System.Collections.Generic;
9+
using Algolia.Search.Serializer;
10+
using System.Text.Json;
11+
12+
namespace Algolia.Search.Models.Abtesting;
13+
14+
/// <summary>
15+
/// ScheduleABTestResponse
16+
/// </summary>
17+
public partial class ScheduleABTestResponse
18+
{
19+
/// <summary>
20+
/// Initializes a new instance of the ScheduleABTestResponse class.
21+
/// </summary>
22+
[JsonConstructor]
23+
public ScheduleABTestResponse() { }
24+
/// <summary>
25+
/// Initializes a new instance of the ScheduleABTestResponse class.
26+
/// </summary>
27+
/// <param name="abTestScheduleID">Unique scheduled A/B test identifier. (required).</param>
28+
public ScheduleABTestResponse(int abTestScheduleID)
29+
{
30+
AbTestScheduleID = abTestScheduleID;
31+
}
32+
33+
/// <summary>
34+
/// Unique scheduled A/B test identifier.
35+
/// </summary>
36+
/// <value>Unique scheduled A/B test identifier.</value>
37+
[JsonPropertyName("abTestScheduleID")]
38+
public int AbTestScheduleID { get; set; }
39+
40+
/// <summary>
41+
/// Returns the string presentation of the object
42+
/// </summary>
43+
/// <returns>String presentation of the object</returns>
44+
public override string ToString()
45+
{
46+
StringBuilder sb = new StringBuilder();
47+
sb.Append("class ScheduleABTestResponse {\n");
48+
sb.Append(" AbTestScheduleID: ").Append(AbTestScheduleID).Append("\n");
49+
sb.Append("}\n");
50+
return sb.ToString();
51+
}
52+
53+
/// <summary>
54+
/// Returns the JSON string presentation of the object
55+
/// </summary>
56+
/// <returns>JSON string presentation of the object</returns>
57+
public virtual string ToJson()
58+
{
59+
return JsonSerializer.Serialize(this, JsonConfig.Options);
60+
}
61+
62+
/// <summary>
63+
/// Returns true if objects are equal
64+
/// </summary>
65+
/// <param name="obj">Object to be compared</param>
66+
/// <returns>Boolean</returns>
67+
public override bool Equals(object obj)
68+
{
69+
if (obj is not ScheduleABTestResponse input)
70+
{
71+
return false;
72+
}
73+
74+
return
75+
(AbTestScheduleID == input.AbTestScheduleID || AbTestScheduleID.Equals(input.AbTestScheduleID));
76+
}
77+
78+
/// <summary>
79+
/// Gets the hash code
80+
/// </summary>
81+
/// <returns>Hash code</returns>
82+
public override int GetHashCode()
83+
{
84+
unchecked // Overflow is fine, just wrap
85+
{
86+
int hashCode = 41;
87+
hashCode = (hashCode * 59) + AbTestScheduleID.GetHashCode();
88+
return hashCode;
89+
}
90+
}
91+
92+
}
93+
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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.Text;
6+
using System.Linq;
7+
using System.Text.Json.Serialization;
8+
using System.Collections.Generic;
9+
using Algolia.Search.Serializer;
10+
using System.Text.Json;
11+
12+
namespace Algolia.Search.Models.Abtesting;
13+
14+
/// <summary>
15+
/// ScheduleABTestsRequest
16+
/// </summary>
17+
public partial class ScheduleABTestsRequest
18+
{
19+
/// <summary>
20+
/// Initializes a new instance of the ScheduleABTestsRequest class.
21+
/// </summary>
22+
[JsonConstructor]
23+
public ScheduleABTestsRequest() { }
24+
/// <summary>
25+
/// Initializes a new instance of the ScheduleABTestsRequest class.
26+
/// </summary>
27+
/// <param name="name">A/B test name. (required).</param>
28+
/// <param name="variants">A/B test variants. (required).</param>
29+
/// <param name="scheduledAt">Date and time when the A/B test is scheduled to start, in RFC 3339 format. (required).</param>
30+
/// <param name="endAt">End date and time of the A/B test, in RFC 3339 format. (required).</param>
31+
public ScheduleABTestsRequest(string name, List<AddABTestsVariant> variants, string scheduledAt, string endAt)
32+
{
33+
Name = name ?? throw new ArgumentNullException(nameof(name));
34+
Variants = variants ?? throw new ArgumentNullException(nameof(variants));
35+
ScheduledAt = scheduledAt ?? throw new ArgumentNullException(nameof(scheduledAt));
36+
EndAt = endAt ?? throw new ArgumentNullException(nameof(endAt));
37+
}
38+
39+
/// <summary>
40+
/// A/B test name.
41+
/// </summary>
42+
/// <value>A/B test name.</value>
43+
[JsonPropertyName("name")]
44+
public string Name { get; set; }
45+
46+
/// <summary>
47+
/// A/B test variants.
48+
/// </summary>
49+
/// <value>A/B test variants.</value>
50+
[JsonPropertyName("variants")]
51+
public List<AddABTestsVariant> Variants { get; set; }
52+
53+
/// <summary>
54+
/// Date and time when the A/B test is scheduled to start, in RFC 3339 format.
55+
/// </summary>
56+
/// <value>Date and time when the A/B test is scheduled to start, in RFC 3339 format.</value>
57+
[JsonPropertyName("scheduledAt")]
58+
public string ScheduledAt { get; set; }
59+
60+
/// <summary>
61+
/// End date and time of the A/B test, in RFC 3339 format.
62+
/// </summary>
63+
/// <value>End date and time of the A/B test, in RFC 3339 format.</value>
64+
[JsonPropertyName("endAt")]
65+
public string EndAt { get; set; }
66+
67+
/// <summary>
68+
/// Returns the string presentation of the object
69+
/// </summary>
70+
/// <returns>String presentation of the object</returns>
71+
public override string ToString()
72+
{
73+
StringBuilder sb = new StringBuilder();
74+
sb.Append("class ScheduleABTestsRequest {\n");
75+
sb.Append(" Name: ").Append(Name).Append("\n");
76+
sb.Append(" Variants: ").Append(Variants).Append("\n");
77+
sb.Append(" ScheduledAt: ").Append(ScheduledAt).Append("\n");
78+
sb.Append(" EndAt: ").Append(EndAt).Append("\n");
79+
sb.Append("}\n");
80+
return sb.ToString();
81+
}
82+
83+
/// <summary>
84+
/// Returns the JSON string presentation of the object
85+
/// </summary>
86+
/// <returns>JSON string presentation of the object</returns>
87+
public virtual string ToJson()
88+
{
89+
return JsonSerializer.Serialize(this, JsonConfig.Options);
90+
}
91+
92+
/// <summary>
93+
/// Returns true if objects are equal
94+
/// </summary>
95+
/// <param name="obj">Object to be compared</param>
96+
/// <returns>Boolean</returns>
97+
public override bool Equals(object obj)
98+
{
99+
if (obj is not ScheduleABTestsRequest input)
100+
{
101+
return false;
102+
}
103+
104+
return
105+
(Name == input.Name || (Name != null && Name.Equals(input.Name))) &&
106+
(Variants == input.Variants || Variants != null && input.Variants != null && Variants.SequenceEqual(input.Variants)) &&
107+
(ScheduledAt == input.ScheduledAt || (ScheduledAt != null && ScheduledAt.Equals(input.ScheduledAt))) &&
108+
(EndAt == input.EndAt || (EndAt != null && EndAt.Equals(input.EndAt)));
109+
}
110+
111+
/// <summary>
112+
/// Gets the hash code
113+
/// </summary>
114+
/// <returns>Hash code</returns>
115+
public override int GetHashCode()
116+
{
117+
unchecked // Overflow is fine, just wrap
118+
{
119+
int hashCode = 41;
120+
if (Name != null)
121+
{
122+
hashCode = (hashCode * 59) + Name.GetHashCode();
123+
}
124+
if (Variants != null)
125+
{
126+
hashCode = (hashCode * 59) + Variants.GetHashCode();
127+
}
128+
if (ScheduledAt != null)
129+
{
130+
hashCode = (hashCode * 59) + ScheduledAt.GetHashCode();
131+
}
132+
if (EndAt != null)
133+
{
134+
hashCode = (hashCode * 59) + EndAt.GetHashCode();
135+
}
136+
return hashCode;
137+
}
138+
}
139+
140+
}
141+

0 commit comments

Comments
 (0)