Skip to content

Commit dfb7090

Browse files
feat(specs): add put task endpoint to ingestion api (generated)
algolia/api-clients-automation#5281 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
1 parent 8c670c9 commit dfb7090

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

src/main/scala/algoliasearch/api/IngestionClient.scala

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import algoliasearch.ingestion.Task
5858
import algoliasearch.ingestion.TaskCreate
5959
import algoliasearch.ingestion.TaskCreateResponse
6060
import algoliasearch.ingestion.TaskCreateV1
61+
import algoliasearch.ingestion.TaskReplace
6162
import algoliasearch.ingestion.TaskSearch
6263
import algoliasearch.ingestion.TaskSortKeys._
6364
import algoliasearch.ingestion.TaskUpdate
@@ -1302,6 +1303,26 @@ class IngestionClient(
13021303
)
13031304
}
13041305

1306+
/** Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
1307+
*
1308+
* @param taskID
1309+
* Unique identifier of a task.
1310+
*/
1311+
def replaceTask(taskID: String, taskReplace: TaskReplace, requestOptions: Option[RequestOptions] = None)(implicit
1312+
ec: ExecutionContext
1313+
): Future[TaskUpdateResponse] = Future {
1314+
requireNotNull(taskID, "Parameter `taskID` is required when calling `replaceTask`.")
1315+
requireNotNull(taskReplace, "Parameter `taskReplace` is required when calling `replaceTask`.")
1316+
1317+
val request = HttpRequest
1318+
.builder()
1319+
.withMethod("PUT")
1320+
.withPath(s"/2/tasks/${escape(taskID)}")
1321+
.withBody(taskReplace)
1322+
.build()
1323+
execute[TaskUpdateResponse](request, requestOptions)
1324+
}
1325+
13051326
/** Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools sources. Creates one
13061327
* run per task.
13071328
*
@@ -1690,7 +1711,7 @@ class IngestionClient(
16901711
execute[SourceUpdateResponse](request, requestOptions)
16911712
}
16921713

1693-
/** Updates a task by its ID.
1714+
/** Partially updates a task by its ID.
16941715
*
16951716
* @param taskID
16961717
* Unique identifier of a task.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/** Ingestion API The Ingestion API lets you connect third-party services and platforms with Algolia and schedule tasks
2+
* to ingest your data. The Ingestion API powers the no-code [data
3+
* connectors](https://dashboard.algolia.com/connectors). ## Base URLs The base URLs for requests to the Ingestion API
4+
* are: - `https://data.us.algolia.com` - `https://data.eu.algolia.com` Use the URL that matches your [analytics
5+
* region](https://dashboard.algolia.com/account/infrastructure/analytics). **All requests must use HTTPS.** ##
6+
* Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
7+
* application ID. - `x-algolia-api-key`. An API key with the necessary permissions to make the request. The required
8+
* access control list (ACL) to make a request is listed in each endpoint's reference. You can find your application ID
9+
* and API key in the [Algolia dashboard](https://dashboard.algolia.com/account). ## Request format Request bodies must
10+
* be JSON objects. ## Response status and errors Response bodies are JSON objects. Successful responses return a `2xx`
11+
* status. Client errors return a `4xx` status. Server errors are indicated by a `5xx` status. Error responses have a
12+
* `message` property with more information. ## Version The current version of the Ingestion API is version 1, as
13+
* indicated by the `/1/` in each endpoint's URL.
14+
*
15+
* The version of the OpenAPI document: 1.0.0
16+
*
17+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
18+
* https://openapi-generator.tech Do not edit the class manually.
19+
*/
20+
package algoliasearch.ingestion
21+
22+
import algoliasearch.ingestion.ActionType._
23+
24+
/** API request body for updating a task.
25+
*
26+
* @param destinationID
27+
* Universally unique identifier (UUID) of a destination resource.
28+
* @param cron
29+
* Cron expression for the task's schedule.
30+
* @param enabled
31+
* Whether the task is enabled.
32+
* @param failureThreshold
33+
* Maximum accepted percentage of failures for a task run to finish successfully.
34+
* @param cursor
35+
* Date of the last cursor in RFC 3339 format.
36+
*/
37+
case class TaskReplace(
38+
destinationID: String,
39+
action: ActionType,
40+
subscriptionAction: Option[ActionType] = scala.None,
41+
cron: Option[String] = scala.None,
42+
enabled: Option[Boolean] = scala.None,
43+
failureThreshold: Option[Int] = scala.None,
44+
input: Option[TaskInput] = scala.None,
45+
cursor: Option[String] = scala.None,
46+
notifications: Option[Notifications] = scala.None,
47+
policies: Option[Policies] = scala.None
48+
)

src/main/scala/algoliasearch/ingestion/TaskUpdate.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package algoliasearch.ingestion
2121

2222
import algoliasearch.ingestion.ActionType._
2323

24-
/** API request body for updating a task.
24+
/** API request body for partially updating a task.
2525
*
2626
* @param destinationID
2727
* Universally unique identifier (UUID) of a destination resource.

0 commit comments

Comments
 (0)