Skip to content

Commit 4c46d69

Browse files
feat(specs): add put task endpoint to ingestion api (generated)
algolia/api-clients-automation#5281 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 915ddd3 commit 4c46d69

File tree

3 files changed

+279
-5
lines changed

3 files changed

+279
-5
lines changed

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

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3528,6 +3528,69 @@ public CompletableFuture<WatchResponse> pushTaskAsync(@Nonnull String taskID, @N
35283528
return this.pushTaskAsync(taskID, pushTaskPayload, null, null);
35293529
}
35303530

3531+
/**
3532+
* Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of
3533+
* fields.
3534+
*
3535+
* @param taskID Unique identifier of a task. (required)
3536+
* @param taskReplace (required)
3537+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
3538+
* the transporter requestOptions.
3539+
* @throws AlgoliaRuntimeException If it fails to process the API call
3540+
*/
3541+
public TaskUpdateResponse replaceTask(@Nonnull String taskID, @Nonnull TaskReplace taskReplace, @Nullable RequestOptions requestOptions)
3542+
throws AlgoliaRuntimeException {
3543+
return LaunderThrowable.await(replaceTaskAsync(taskID, taskReplace, requestOptions));
3544+
}
3545+
3546+
/**
3547+
* Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of
3548+
* fields.
3549+
*
3550+
* @param taskID Unique identifier of a task. (required)
3551+
* @param taskReplace (required)
3552+
* @throws AlgoliaRuntimeException If it fails to process the API call
3553+
*/
3554+
public TaskUpdateResponse replaceTask(@Nonnull String taskID, @Nonnull TaskReplace taskReplace) throws AlgoliaRuntimeException {
3555+
return this.replaceTask(taskID, taskReplace, null);
3556+
}
3557+
3558+
/**
3559+
* (asynchronously) Fully updates a task by its ID, use partialUpdateTask if you only want to
3560+
* update a subset of fields.
3561+
*
3562+
* @param taskID Unique identifier of a task. (required)
3563+
* @param taskReplace (required)
3564+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
3565+
* the transporter requestOptions.
3566+
* @throws AlgoliaRuntimeException If it fails to process the API call
3567+
*/
3568+
public CompletableFuture<TaskUpdateResponse> replaceTaskAsync(
3569+
@Nonnull String taskID,
3570+
@Nonnull TaskReplace taskReplace,
3571+
@Nullable RequestOptions requestOptions
3572+
) throws AlgoliaRuntimeException {
3573+
Parameters.requireNonNull(taskID, "Parameter `taskID` is required when calling `replaceTask`.");
3574+
3575+
Parameters.requireNonNull(taskReplace, "Parameter `taskReplace` is required when calling `replaceTask`.");
3576+
3577+
HttpRequest request = HttpRequest.builder().setPath("/2/tasks/{taskID}", taskID).setMethod("PUT").setBody(taskReplace).build();
3578+
return executeAsync(request, requestOptions, new TypeReference<TaskUpdateResponse>() {});
3579+
}
3580+
3581+
/**
3582+
* (asynchronously) Fully updates a task by its ID, use partialUpdateTask if you only want to
3583+
* update a subset of fields.
3584+
*
3585+
* @param taskID Unique identifier of a task. (required)
3586+
* @param taskReplace (required)
3587+
* @throws AlgoliaRuntimeException If it fails to process the API call
3588+
*/
3589+
public CompletableFuture<TaskUpdateResponse> replaceTaskAsync(@Nonnull String taskID, @Nonnull TaskReplace taskReplace)
3590+
throws AlgoliaRuntimeException {
3591+
return this.replaceTaskAsync(taskID, taskReplace, null);
3592+
}
3593+
35313594
/**
35323595
* Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools
35333596
* sources. Creates one run per task.
@@ -4576,7 +4639,7 @@ public CompletableFuture<SourceUpdateResponse> updateSourceAsync(@Nonnull String
45764639
}
45774640

45784641
/**
4579-
* Updates a task by its ID.
4642+
* Partially updates a task by its ID.
45804643
*
45814644
* @param taskID Unique identifier of a task. (required)
45824645
* @param taskUpdate (required)
@@ -4590,7 +4653,7 @@ public TaskUpdateResponse updateTask(@Nonnull String taskID, @Nonnull TaskUpdate
45904653
}
45914654

45924655
/**
4593-
* Updates a task by its ID.
4656+
* Partially updates a task by its ID.
45944657
*
45954658
* @param taskID Unique identifier of a task. (required)
45964659
* @param taskUpdate (required)
@@ -4601,7 +4664,7 @@ public TaskUpdateResponse updateTask(@Nonnull String taskID, @Nonnull TaskUpdate
46014664
}
46024665

46034666
/**
4604-
* (asynchronously) Updates a task by its ID.
4667+
* (asynchronously) Partially updates a task by its ID.
46054668
*
46064669
* @param taskID Unique identifier of a task. (required)
46074670
* @param taskUpdate (required)
@@ -4623,7 +4686,7 @@ public CompletableFuture<TaskUpdateResponse> updateTaskAsync(
46234686
}
46244687

46254688
/**
4626-
* (asynchronously) Updates a task by its ID.
4689+
* (asynchronously) Partially updates a task by its ID.
46274690
*
46284691
* @param taskID Unique identifier of a task. (required)
46294692
* @param taskUpdate (required)
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
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.ingestion;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
import java.util.Objects;
9+
10+
/** API request body for updating a task. */
11+
public class TaskReplace {
12+
13+
@JsonProperty("destinationID")
14+
private String destinationID;
15+
16+
@JsonProperty("action")
17+
private ActionType action;
18+
19+
@JsonProperty("subscriptionAction")
20+
private ActionType subscriptionAction;
21+
22+
@JsonProperty("cron")
23+
private String cron;
24+
25+
@JsonProperty("enabled")
26+
private Boolean enabled;
27+
28+
@JsonProperty("failureThreshold")
29+
private Integer failureThreshold;
30+
31+
@JsonProperty("input")
32+
private TaskInput input;
33+
34+
@JsonProperty("cursor")
35+
private String cursor;
36+
37+
@JsonProperty("notifications")
38+
private Notifications notifications;
39+
40+
@JsonProperty("policies")
41+
private Policies policies;
42+
43+
public TaskReplace setDestinationID(String destinationID) {
44+
this.destinationID = destinationID;
45+
return this;
46+
}
47+
48+
/** Universally unique identifier (UUID) of a destination resource. */
49+
@javax.annotation.Nonnull
50+
public String getDestinationID() {
51+
return destinationID;
52+
}
53+
54+
public TaskReplace setAction(ActionType action) {
55+
this.action = action;
56+
return this;
57+
}
58+
59+
/** Get action */
60+
@javax.annotation.Nonnull
61+
public ActionType getAction() {
62+
return action;
63+
}
64+
65+
public TaskReplace setSubscriptionAction(ActionType subscriptionAction) {
66+
this.subscriptionAction = subscriptionAction;
67+
return this;
68+
}
69+
70+
/** Get subscriptionAction */
71+
@javax.annotation.Nullable
72+
public ActionType getSubscriptionAction() {
73+
return subscriptionAction;
74+
}
75+
76+
public TaskReplace setCron(String cron) {
77+
this.cron = cron;
78+
return this;
79+
}
80+
81+
/** Cron expression for the task's schedule. */
82+
@javax.annotation.Nullable
83+
public String getCron() {
84+
return cron;
85+
}
86+
87+
public TaskReplace setEnabled(Boolean enabled) {
88+
this.enabled = enabled;
89+
return this;
90+
}
91+
92+
/** Whether the task is enabled. */
93+
@javax.annotation.Nullable
94+
public Boolean getEnabled() {
95+
return enabled;
96+
}
97+
98+
public TaskReplace setFailureThreshold(Integer failureThreshold) {
99+
this.failureThreshold = failureThreshold;
100+
return this;
101+
}
102+
103+
/**
104+
* Maximum accepted percentage of failures for a task run to finish successfully. minimum: 0
105+
* maximum: 100
106+
*/
107+
@javax.annotation.Nullable
108+
public Integer getFailureThreshold() {
109+
return failureThreshold;
110+
}
111+
112+
public TaskReplace setInput(TaskInput input) {
113+
this.input = input;
114+
return this;
115+
}
116+
117+
/** Get input */
118+
@javax.annotation.Nullable
119+
public TaskInput getInput() {
120+
return input;
121+
}
122+
123+
public TaskReplace setCursor(String cursor) {
124+
this.cursor = cursor;
125+
return this;
126+
}
127+
128+
/** Date of the last cursor in RFC 3339 format. */
129+
@javax.annotation.Nullable
130+
public String getCursor() {
131+
return cursor;
132+
}
133+
134+
public TaskReplace setNotifications(Notifications notifications) {
135+
this.notifications = notifications;
136+
return this;
137+
}
138+
139+
/** Get notifications */
140+
@javax.annotation.Nullable
141+
public Notifications getNotifications() {
142+
return notifications;
143+
}
144+
145+
public TaskReplace setPolicies(Policies policies) {
146+
this.policies = policies;
147+
return this;
148+
}
149+
150+
/** Get policies */
151+
@javax.annotation.Nullable
152+
public Policies getPolicies() {
153+
return policies;
154+
}
155+
156+
@Override
157+
public boolean equals(Object o) {
158+
if (this == o) {
159+
return true;
160+
}
161+
if (o == null || getClass() != o.getClass()) {
162+
return false;
163+
}
164+
TaskReplace taskReplace = (TaskReplace) o;
165+
return (
166+
Objects.equals(this.destinationID, taskReplace.destinationID) &&
167+
Objects.equals(this.action, taskReplace.action) &&
168+
Objects.equals(this.subscriptionAction, taskReplace.subscriptionAction) &&
169+
Objects.equals(this.cron, taskReplace.cron) &&
170+
Objects.equals(this.enabled, taskReplace.enabled) &&
171+
Objects.equals(this.failureThreshold, taskReplace.failureThreshold) &&
172+
Objects.equals(this.input, taskReplace.input) &&
173+
Objects.equals(this.cursor, taskReplace.cursor) &&
174+
Objects.equals(this.notifications, taskReplace.notifications) &&
175+
Objects.equals(this.policies, taskReplace.policies)
176+
);
177+
}
178+
179+
@Override
180+
public int hashCode() {
181+
return Objects.hash(destinationID, action, subscriptionAction, cron, enabled, failureThreshold, input, cursor, notifications, policies);
182+
}
183+
184+
@Override
185+
public String toString() {
186+
StringBuilder sb = new StringBuilder();
187+
sb.append("class TaskReplace {\n");
188+
sb.append(" destinationID: ").append(toIndentedString(destinationID)).append("\n");
189+
sb.append(" action: ").append(toIndentedString(action)).append("\n");
190+
sb.append(" subscriptionAction: ").append(toIndentedString(subscriptionAction)).append("\n");
191+
sb.append(" cron: ").append(toIndentedString(cron)).append("\n");
192+
sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n");
193+
sb.append(" failureThreshold: ").append(toIndentedString(failureThreshold)).append("\n");
194+
sb.append(" input: ").append(toIndentedString(input)).append("\n");
195+
sb.append(" cursor: ").append(toIndentedString(cursor)).append("\n");
196+
sb.append(" notifications: ").append(toIndentedString(notifications)).append("\n");
197+
sb.append(" policies: ").append(toIndentedString(policies)).append("\n");
198+
sb.append("}");
199+
return sb.toString();
200+
}
201+
202+
/**
203+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
204+
*/
205+
private String toIndentedString(Object o) {
206+
if (o == null) {
207+
return "null";
208+
}
209+
return o.toString().replace("\n", "\n ");
210+
}
211+
}

algoliasearch/src/main/java/com/algolia/model/ingestion/TaskUpdate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.fasterxml.jackson.databind.annotation.*;
88
import java.util.Objects;
99

10-
/** API request body for updating a task. */
10+
/** API request body for partially updating a task. */
1111
public class TaskUpdate {
1212

1313
@JsonProperty("destinationID")

0 commit comments

Comments
 (0)