Skip to content

Commit b3cf1a0

Browse files
algolia-botfebeckmillotp
committed
feat(specs): add /schedule endpoint (generated)
algolia/api-clients-automation#3350 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Fernando Beck <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 50c69c1 commit b3cf1a0

File tree

3 files changed

+233
-0
lines changed

3 files changed

+233
-0
lines changed

algoliasearch/src/main/java/com/algolia/api/AbtestingClient.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,58 @@ public CompletableFuture<ListABTestsResponse> listABTestsAsync() throws AlgoliaR
748748
return this.listABTestsAsync(null, null, null, null, null);
749749
}
750750

751+
/**
752+
* Schedule an A/B test to be started at a later time.
753+
*
754+
* @param scheduleABTestsRequest (required)
755+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
756+
* the transporter requestOptions.
757+
* @throws AlgoliaRuntimeException If it fails to process the API call
758+
*/
759+
public ScheduleABTestResponse scheduleABTest(@Nonnull ScheduleABTestsRequest scheduleABTestsRequest, RequestOptions requestOptions)
760+
throws AlgoliaRuntimeException {
761+
return LaunderThrowable.await(scheduleABTestAsync(scheduleABTestsRequest, requestOptions));
762+
}
763+
764+
/**
765+
* Schedule an A/B test to be started at a later time.
766+
*
767+
* @param scheduleABTestsRequest (required)
768+
* @throws AlgoliaRuntimeException If it fails to process the API call
769+
*/
770+
public ScheduleABTestResponse scheduleABTest(@Nonnull ScheduleABTestsRequest scheduleABTestsRequest) throws AlgoliaRuntimeException {
771+
return this.scheduleABTest(scheduleABTestsRequest, null);
772+
}
773+
774+
/**
775+
* (asynchronously) Schedule an A/B test to be started at a later time.
776+
*
777+
* @param scheduleABTestsRequest (required)
778+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
779+
* the transporter requestOptions.
780+
* @throws AlgoliaRuntimeException If it fails to process the API call
781+
*/
782+
public CompletableFuture<ScheduleABTestResponse> scheduleABTestAsync(
783+
@Nonnull ScheduleABTestsRequest scheduleABTestsRequest,
784+
RequestOptions requestOptions
785+
) throws AlgoliaRuntimeException {
786+
Parameters.requireNonNull(scheduleABTestsRequest, "Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
787+
788+
HttpRequest request = HttpRequest.builder().setPath("/2/abtests/schedule").setMethod("POST").setBody(scheduleABTestsRequest).build();
789+
return executeAsync(request, requestOptions, new TypeReference<ScheduleABTestResponse>() {});
790+
}
791+
792+
/**
793+
* (asynchronously) Schedule an A/B test to be started at a later time.
794+
*
795+
* @param scheduleABTestsRequest (required)
796+
* @throws AlgoliaRuntimeException If it fails to process the API call
797+
*/
798+
public CompletableFuture<ScheduleABTestResponse> scheduleABTestAsync(@Nonnull ScheduleABTestsRequest scheduleABTestsRequest)
799+
throws AlgoliaRuntimeException {
800+
return this.scheduleABTestAsync(scheduleABTestsRequest, null);
801+
}
802+
751803
/**
752804
* Stops an A/B test by its ID. You can't restart stopped A/B tests.
753805
*
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.abtesting;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
import java.util.Objects;
9+
10+
/** ScheduleABTestResponse */
11+
public class ScheduleABTestResponse {
12+
13+
@JsonProperty("abTestScheduleID")
14+
private Integer abTestScheduleID;
15+
16+
public ScheduleABTestResponse setAbTestScheduleID(Integer abTestScheduleID) {
17+
this.abTestScheduleID = abTestScheduleID;
18+
return this;
19+
}
20+
21+
/** Unique scheduled A/B test identifier. */
22+
@javax.annotation.Nonnull
23+
public Integer getAbTestScheduleID() {
24+
return abTestScheduleID;
25+
}
26+
27+
@Override
28+
public boolean equals(Object o) {
29+
if (this == o) {
30+
return true;
31+
}
32+
if (o == null || getClass() != o.getClass()) {
33+
return false;
34+
}
35+
ScheduleABTestResponse scheduleABTestResponse = (ScheduleABTestResponse) o;
36+
return Objects.equals(this.abTestScheduleID, scheduleABTestResponse.abTestScheduleID);
37+
}
38+
39+
@Override
40+
public int hashCode() {
41+
return Objects.hash(abTestScheduleID);
42+
}
43+
44+
@Override
45+
public String toString() {
46+
StringBuilder sb = new StringBuilder();
47+
sb.append("class ScheduleABTestResponse {\n");
48+
sb.append(" abTestScheduleID: ").append(toIndentedString(abTestScheduleID)).append("\n");
49+
sb.append("}");
50+
return sb.toString();
51+
}
52+
53+
/**
54+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
55+
*/
56+
private String toIndentedString(Object o) {
57+
if (o == null) {
58+
return "null";
59+
}
60+
return o.toString().replace("\n", "\n ");
61+
}
62+
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.abtesting;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
import java.util.Objects;
11+
12+
/** ScheduleABTestsRequest */
13+
public class ScheduleABTestsRequest {
14+
15+
@JsonProperty("name")
16+
private String name;
17+
18+
@JsonProperty("variants")
19+
private List<AddABTestsVariant> variants = new ArrayList<>();
20+
21+
@JsonProperty("scheduledAt")
22+
private String scheduledAt;
23+
24+
@JsonProperty("endAt")
25+
private String endAt;
26+
27+
public ScheduleABTestsRequest setName(String name) {
28+
this.name = name;
29+
return this;
30+
}
31+
32+
/** A/B test name. */
33+
@javax.annotation.Nonnull
34+
public String getName() {
35+
return name;
36+
}
37+
38+
public ScheduleABTestsRequest setVariants(List<AddABTestsVariant> variants) {
39+
this.variants = variants;
40+
return this;
41+
}
42+
43+
public ScheduleABTestsRequest addVariants(AddABTestsVariant variantsItem) {
44+
this.variants.add(variantsItem);
45+
return this;
46+
}
47+
48+
/** A/B test variants. */
49+
@javax.annotation.Nonnull
50+
public List<AddABTestsVariant> getVariants() {
51+
return variants;
52+
}
53+
54+
public ScheduleABTestsRequest setScheduledAt(String scheduledAt) {
55+
this.scheduledAt = scheduledAt;
56+
return this;
57+
}
58+
59+
/** Date and time when the A/B test is scheduled to start, in RFC 3339 format. */
60+
@javax.annotation.Nonnull
61+
public String getScheduledAt() {
62+
return scheduledAt;
63+
}
64+
65+
public ScheduleABTestsRequest setEndAt(String endAt) {
66+
this.endAt = endAt;
67+
return this;
68+
}
69+
70+
/** End date and time of the A/B test, in RFC 3339 format. */
71+
@javax.annotation.Nonnull
72+
public String getEndAt() {
73+
return endAt;
74+
}
75+
76+
@Override
77+
public boolean equals(Object o) {
78+
if (this == o) {
79+
return true;
80+
}
81+
if (o == null || getClass() != o.getClass()) {
82+
return false;
83+
}
84+
ScheduleABTestsRequest scheduleABTestsRequest = (ScheduleABTestsRequest) o;
85+
return (
86+
Objects.equals(this.name, scheduleABTestsRequest.name) &&
87+
Objects.equals(this.variants, scheduleABTestsRequest.variants) &&
88+
Objects.equals(this.scheduledAt, scheduleABTestsRequest.scheduledAt) &&
89+
Objects.equals(this.endAt, scheduleABTestsRequest.endAt)
90+
);
91+
}
92+
93+
@Override
94+
public int hashCode() {
95+
return Objects.hash(name, variants, scheduledAt, endAt);
96+
}
97+
98+
@Override
99+
public String toString() {
100+
StringBuilder sb = new StringBuilder();
101+
sb.append("class ScheduleABTestsRequest {\n");
102+
sb.append(" name: ").append(toIndentedString(name)).append("\n");
103+
sb.append(" variants: ").append(toIndentedString(variants)).append("\n");
104+
sb.append(" scheduledAt: ").append(toIndentedString(scheduledAt)).append("\n");
105+
sb.append(" endAt: ").append(toIndentedString(endAt)).append("\n");
106+
sb.append("}");
107+
return sb.toString();
108+
}
109+
110+
/**
111+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
112+
*/
113+
private String toIndentedString(Object o) {
114+
if (o == null) {
115+
return "null";
116+
}
117+
return o.toString().replace("\n", "\n ");
118+
}
119+
}

0 commit comments

Comments
 (0)